mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-24 16:49:50 +00:00
Minor refactor - let's not access a global when we don't need to
This commit is contained in:
parent
a4ca07e683
commit
49a6a2f6cf
@ -185,7 +185,7 @@ void ArmJit::CompileDelaySlot(int flags)
|
||||
|
||||
js.inDelaySlot = true;
|
||||
MIPSOpcode op = GetOffsetInstruction(1);
|
||||
MIPSCompileOp(op);
|
||||
MIPSCompileOp(op, this);
|
||||
js.inDelaySlot = false;
|
||||
|
||||
if (flags & DELAYSLOT_FLUSH)
|
||||
@ -309,7 +309,7 @@ const u8 *ArmJit::DoJit(u32 em_address, JitBlock *b)
|
||||
|
||||
js.downcountAmount += MIPSGetInstructionCycleEstimate(inst);
|
||||
|
||||
MIPSCompileOp(inst);
|
||||
MIPSCompileOp(inst, this);
|
||||
|
||||
js.compilerPC += 4;
|
||||
js.numInstructions++;
|
||||
@ -486,14 +486,14 @@ void ArmJit::Comp_ReplacementFunc(MIPSOpcode op)
|
||||
}
|
||||
|
||||
if (entry->flags & REPFLAG_DISABLED) {
|
||||
MIPSCompileOp(Memory::Read_Instruction(GetCompilerPC(), true));
|
||||
MIPSCompileOp(Memory::Read_Instruction(GetCompilerPC(), true), this);
|
||||
} else if (entry->jitReplaceFunc) {
|
||||
MIPSReplaceFunc repl = entry->jitReplaceFunc;
|
||||
int cycles = (this->*repl)();
|
||||
|
||||
if (entry->flags & (REPFLAG_HOOKENTER | REPFLAG_HOOKEXIT)) {
|
||||
// Compile the original instruction at this address. We ignore cycles for hooks.
|
||||
MIPSCompileOp(Memory::Read_Instruction(GetCompilerPC(), true));
|
||||
MIPSCompileOp(Memory::Read_Instruction(GetCompilerPC(), true), this);
|
||||
} else {
|
||||
FlushAll();
|
||||
// Flushed, so R1 is safe.
|
||||
@ -520,7 +520,7 @@ void ArmJit::Comp_ReplacementFunc(MIPSOpcode op)
|
||||
if (entry->flags & (REPFLAG_HOOKENTER | REPFLAG_HOOKEXIT)) {
|
||||
// Compile the original instruction at this address. We ignore cycles for hooks.
|
||||
ApplyRoundingMode();
|
||||
MIPSCompileOp(Memory::Read_Instruction(GetCompilerPC(), true));
|
||||
MIPSCompileOp(Memory::Read_Instruction(GetCompilerPC(), true), this);
|
||||
} else {
|
||||
ApplyRoundingMode();
|
||||
LDR(R1, CTXREG, MIPS_REG_RA * 4);
|
||||
|
@ -174,7 +174,7 @@ void Arm64Jit::CompileDelaySlot(int flags) {
|
||||
|
||||
js.inDelaySlot = true;
|
||||
MIPSOpcode op = GetOffsetInstruction(1);
|
||||
MIPSCompileOp(op);
|
||||
MIPSCompileOp(op, this);
|
||||
js.inDelaySlot = false;
|
||||
|
||||
if (flags & DELAYSLOT_FLUSH)
|
||||
@ -293,7 +293,7 @@ const u8 *Arm64Jit::DoJit(u32 em_address, JitBlock *b) {
|
||||
|
||||
js.downcountAmount += MIPSGetInstructionCycleEstimate(inst);
|
||||
|
||||
MIPSCompileOp(inst);
|
||||
MIPSCompileOp(inst, this);
|
||||
|
||||
js.compilerPC += 4;
|
||||
js.numInstructions++;
|
||||
@ -467,14 +467,14 @@ void Arm64Jit::Comp_ReplacementFunc(MIPSOpcode op)
|
||||
}
|
||||
|
||||
if (entry->flags & REPFLAG_DISABLED) {
|
||||
MIPSCompileOp(Memory::Read_Instruction(GetCompilerPC(), true));
|
||||
MIPSCompileOp(Memory::Read_Instruction(GetCompilerPC(), true), this);
|
||||
} else if (entry->jitReplaceFunc) {
|
||||
MIPSReplaceFunc repl = entry->jitReplaceFunc;
|
||||
int cycles = (this->*repl)();
|
||||
|
||||
if (entry->flags & (REPFLAG_HOOKENTER | REPFLAG_HOOKEXIT)) {
|
||||
// Compile the original instruction at this address. We ignore cycles for hooks.
|
||||
MIPSCompileOp(Memory::Read_Instruction(GetCompilerPC(), true));
|
||||
MIPSCompileOp(Memory::Read_Instruction(GetCompilerPC(), true), this);
|
||||
} else {
|
||||
FlushAll();
|
||||
// Flushed, so R1 is safe.
|
||||
@ -498,7 +498,7 @@ void Arm64Jit::Comp_ReplacementFunc(MIPSOpcode op)
|
||||
// Compile the original instruction at this address. We ignore cycles for hooks.
|
||||
ApplyRoundingMode();
|
||||
LoadStaticRegisters();
|
||||
MIPSCompileOp(Memory::Read_Instruction(GetCompilerPC(), true));
|
||||
MIPSCompileOp(Memory::Read_Instruction(GetCompilerPC(), true), this);
|
||||
} else {
|
||||
ApplyRoundingMode();
|
||||
LoadStaticRegisters();
|
||||
|
@ -127,7 +127,7 @@ void MipsJit::CompileDelaySlot(int flags)
|
||||
|
||||
js.inDelaySlot = true;
|
||||
MIPSOpcode op = Memory::Read_Opcode_JIT(js.compilerPC + 4);
|
||||
MIPSCompileOp(op);
|
||||
MIPSCompileOp(op, this);
|
||||
js.inDelaySlot = false;
|
||||
|
||||
if (flags & DELAYSLOT_FLUSH)
|
||||
@ -188,7 +188,7 @@ const u8 *MipsJit::DoJit(u32 em_address, JitBlock *b)
|
||||
MIPSOpcode inst = Memory::Read_Opcode_JIT(js.compilerPC);
|
||||
js.downcountAmount += MIPSGetInstructionCycleEstimate(inst);
|
||||
|
||||
MIPSCompileOp(inst);
|
||||
MIPSCompileOp(inst, this);
|
||||
|
||||
js.compilerPC += 4;
|
||||
js.numInstructions++;
|
||||
|
@ -911,20 +911,20 @@ const MIPSInstruction *MIPSGetInstruction(MIPSOpcode op) {
|
||||
return instr;
|
||||
}
|
||||
|
||||
void MIPSCompileOp(MIPSOpcode op) {
|
||||
void MIPSCompileOp(MIPSOpcode op, MIPSComp::JitInterface *jit) {
|
||||
if (op == 0)
|
||||
return;
|
||||
const MIPSInstruction *instr = MIPSGetInstruction(op);
|
||||
const MIPSInfo info = MIPSGetInfo(op);
|
||||
if (instr) {
|
||||
if (instr->compile) {
|
||||
(MIPSComp::jit->*(instr->compile))(op);
|
||||
(jit->*(instr->compile))(op);
|
||||
} else {
|
||||
ERROR_LOG_REPORT(CPU,"MIPSCompileOp %08x failed",op.encoding);
|
||||
}
|
||||
|
||||
if (info & OUT_EAT_PREFIX)
|
||||
MIPSComp::jit->EatPrefix();
|
||||
jit->EatPrefix();
|
||||
} else {
|
||||
ERROR_LOG_REPORT(CPU, "MIPSCompileOp: Invalid instruction %08x", op.encoding);
|
||||
}
|
||||
|
@ -111,7 +111,11 @@ struct MIPSInfo {
|
||||
typedef void (CDECL *MIPSDisFunc)(MIPSOpcode opcode, char *out);
|
||||
typedef void (CDECL *MIPSInterpretFunc)(MIPSOpcode opcode);
|
||||
|
||||
void MIPSCompileOp(MIPSOpcode op);
|
||||
namespace MIPSComp {
|
||||
class JitInterface;
|
||||
}
|
||||
|
||||
void MIPSCompileOp(MIPSOpcode op, MIPSComp::JitInterface *jit);
|
||||
void MIPSDisAsm(MIPSOpcode op, u32 pc, char *out, bool tabsToSpaces = false);
|
||||
MIPSInfo MIPSGetInfo(MIPSOpcode op);
|
||||
void MIPSInterpret(MIPSOpcode op); //only for those rare ones
|
||||
|
@ -261,7 +261,7 @@ void Jit::CompileDelaySlot(int flags, RegCacheState *state)
|
||||
|
||||
js.inDelaySlot = true;
|
||||
MIPSOpcode op = GetOffsetInstruction(1);
|
||||
MIPSCompileOp(op);
|
||||
MIPSCompileOp(op, this);
|
||||
js.inDelaySlot = false;
|
||||
|
||||
if (flags & DELAYSLOT_FLUSH)
|
||||
@ -381,7 +381,7 @@ const u8 *Jit::DoJit(u32 em_address, JitBlock *b)
|
||||
MIPSOpcode inst = Memory::Read_Opcode_JIT(GetCompilerPC());
|
||||
js.downcountAmount += MIPSGetInstructionCycleEstimate(inst);
|
||||
|
||||
MIPSCompileOp(inst);
|
||||
MIPSCompileOp(inst, this);
|
||||
|
||||
if (js.afterOp & JitState::AFTER_CORE_STATE) {
|
||||
// TODO: Save/restore?
|
||||
@ -596,14 +596,14 @@ void Jit::Comp_ReplacementFunc(MIPSOpcode op)
|
||||
}
|
||||
|
||||
if (disabled) {
|
||||
MIPSCompileOp(origInstruction);
|
||||
MIPSCompileOp(origInstruction, this);
|
||||
} else if (entry->jitReplaceFunc) {
|
||||
MIPSReplaceFunc repl = entry->jitReplaceFunc;
|
||||
int cycles = (this->*repl)();
|
||||
|
||||
if (entry->flags & (REPFLAG_HOOKENTER | REPFLAG_HOOKEXIT)) {
|
||||
// Compile the original instruction at this address. We ignore cycles for hooks.
|
||||
MIPSCompileOp(origInstruction);
|
||||
MIPSCompileOp(origInstruction, this);
|
||||
} else {
|
||||
FlushAll();
|
||||
MOV(32, R(ECX), M(&mips_->r[MIPS_REG_RA]));
|
||||
@ -623,7 +623,7 @@ void Jit::Comp_ReplacementFunc(MIPSOpcode op)
|
||||
if (entry->flags & (REPFLAG_HOOKENTER | REPFLAG_HOOKEXIT)) {
|
||||
// Compile the original instruction at this address. We ignore cycles for hooks.
|
||||
ApplyRoundingMode();
|
||||
MIPSCompileOp(Memory::Read_Instruction(GetCompilerPC(), true));
|
||||
MIPSCompileOp(Memory::Read_Instruction(GetCompilerPC(), true), this);
|
||||
} else {
|
||||
MOV(32, R(ECX), M(&mips_->r[MIPS_REG_RA]));
|
||||
SUB(32, M(&mips_->downcount), R(EAX));
|
||||
|
Loading…
Reference in New Issue
Block a user