CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Core/MIPS/IR/IRCompLoadStore.cpp
Views: 1401
// Copyright (c) 2012- PPSSPP Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official git repository and contact information can be found at15// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.1617#include "Core/Config.h"18#include "Core/MemMap.h"19#include "Core/MIPS/MIPS.h"20#include "Core/MIPS/MIPSAnalyst.h"21#include "Core/MIPS/MIPSCodeUtils.h"22#include "Core/MIPS/IR/IRFrontend.h"23#include "Core/MIPS/IR/IRRegCache.h"2425#define _RS MIPS_GET_RS(op)26#define _RT MIPS_GET_RT(op)27#define _RD MIPS_GET_RD(op)28#define _FS MIPS_GET_FS(op)29#define _FT MIPS_GET_FT(op)30#define _FD MIPS_GET_FD(op)31#define _SA MIPS_GET_SA(op)32#define _POS ((op>> 6) & 0x1F)33#define _SIZE ((op>>11) & 0x1F)34#define _IMM16 (signed short)(op & 0xFFFF)35#define _IMM26 (op & 0x03FFFFFF)3637// All functions should have CONDITIONAL_DISABLE, so we can narrow things down to a file quickly.38// Currently known non working ones should have DISABLE.3940// #define CONDITIONAL_DISABLE(flag) { Comp_Generic(op); return; }41#define CONDITIONAL_DISABLE(flag) if (opts.disableFlags & (uint32_t)JitDisable::flag) { Comp_Generic(op); return; }42#define DISABLE { Comp_Generic(op); return; }43#define INVALIDOP { Comp_Generic(op); return; }4445namespace MIPSComp {46void IRFrontend::Comp_ITypeMem(MIPSOpcode op) {47CONDITIONAL_DISABLE(LSU);4849int offset = _IMM16;50MIPSGPReg rt = _RT;51MIPSGPReg rs = _RS;52int o = op >> 26;53if (((op >> 29) & 1) == 0 && rt == MIPS_REG_ZERO) {54// Don't load anything into $zr55return;56}5758CheckMemoryBreakpoint(rs, offset);5960switch (o) {61// Load62case 35:63ir.Write(IROp::Load32, rt, rs, ir.AddConstant(offset));64break;65case 37:66ir.Write(IROp::Load16, rt, rs, ir.AddConstant(offset));67break;68case 33:69ir.Write(IROp::Load16Ext, rt, rs, ir.AddConstant(offset));70break;71case 36:72ir.Write(IROp::Load8, rt, rs, ir.AddConstant(offset));73break;74case 32:75ir.Write(IROp::Load8Ext, rt, rs, ir.AddConstant(offset));76break;77// Store78case 43:79ir.Write(IROp::Store32, rt, rs, ir.AddConstant(offset));80break;81case 41:82ir.Write(IROp::Store16, rt, rs, ir.AddConstant(offset));83break;84case 40:85ir.Write(IROp::Store8, rt, rs, ir.AddConstant(offset));86break;8788case 34: //lwl89ir.Write(IROp::Load32Left, rt, rs, ir.AddConstant(offset));90break;91case 38: //lwr92ir.Write(IROp::Load32Right, rt, rs, ir.AddConstant(offset));93break;94case 42: //swl95ir.Write(IROp::Store32Left, rt, rs, ir.AddConstant(offset));96break;97case 46: //swr98ir.Write(IROp::Store32Right, rt, rs, ir.AddConstant(offset));99break;100101default:102INVALIDOP;103return;104}105}106107void IRFrontend::Comp_StoreSync(MIPSOpcode op) {108CONDITIONAL_DISABLE(LSU);109110int offset = _IMM16;111MIPSGPReg rt = _RT;112MIPSGPReg rs = _RS;113// Note: still does something even if loading to zero.114115CheckMemoryBreakpoint(rs, offset);116117switch (op >> 26) {118case 48: // ll119ir.Write(IROp::Load32Linked, rt, rs, ir.AddConstant(offset));120break;121122case 56: // sc123ir.Write(IROp::Store32Conditional, rt, rs, ir.AddConstant(offset));124break;125126default:127INVALIDOP;128}129}130131void IRFrontend::Comp_Cache(MIPSOpcode op) {132CONDITIONAL_DISABLE(LSU);133134int func = (op >> 16) & 0x1F;135136// See Int_Cache for the definitions.137switch (func) {138case 24: break;139case 25: break;140case 27: break;141case 30: break;142default:143// Fall back to the interpreter.144DISABLE;145}146}147}148149150