CPU/Recompiler: Skip updating current_instruction_pc

This commit is contained in:
Connor McLaughlin 2021-07-20 22:41:50 +10:00
parent 21938e14c6
commit d9d41de81b
5 changed files with 5 additions and 20 deletions

View File

@ -450,7 +450,6 @@ void ExecuteRecompiler()
#endif
const u32 pc = g_state.regs.pc;
g_state.current_instruction_pc = pc;
s_single_block_asm_dispatcher(s_fast_map[pc >> 16][pc >> 2]);
}
@ -802,8 +801,10 @@ void FastCompileBlockFunction()
if (block)
{
s_single_block_asm_dispatcher(block->host_code);
return;
}
else if (g_settings.gpu_pgxp_enable)
if (g_settings.gpu_pgxp_enable)
{
if (g_settings.gpu_pgxp_cpu)
InterpretUncachedBlock<PGXPMode::CPU>();

View File

@ -1165,6 +1165,7 @@ bool CodeGenerator::Compile_Fallback(const CodeBlockInstruction& cbi)
m_register_cache.WriteLoadDelayToCPU(true);
}
EmitStoreCPUStructField(offsetof(State, current_instruction_pc), Value::FromConstantU32(cbi.pc));
EmitStoreCPUStructField(offsetof(State, current_instruction.bits), Value::FromConstantU32(cbi.instruction.bits));
// emit the function call
@ -2341,7 +2342,6 @@ bool CodeGenerator::Compile_Branch(const CodeBlockInstruction& cbi)
&return_to_dispatcher);
// we're committed at this point :D
EmitStoreCPUStructField(offsetof(State, current_instruction_pc), branch_target);
EmitEndBlock(true, false);
const void* jump_pointer = GetCurrentCodePointer();
@ -2368,22 +2368,15 @@ bool CodeGenerator::Compile_Branch(const CodeBlockInstruction& cbi)
if (condition != Condition::Always)
{
WriteNewPC(next_pc, true);
EmitStoreCPUStructField(offsetof(State, current_instruction_pc), next_pc);
}
else
{
WriteNewPC(branch_target, true);
EmitStoreCPUStructField(offsetof(State, current_instruction_pc), branch_target);
}
EmitConditionalBranch(Condition::GreaterEqual, false, pending_ticks.GetHostRegister(), downcount,
&return_to_dispatcher);
if (condition != Condition::Always)
EmitStoreCPUStructField(offsetof(State, current_instruction_pc), next_pc);
else
EmitStoreCPUStructField(offsetof(State, current_instruction_pc), branch_target);
EmitEndBlock(true, false);
const void* jump_pointer = GetCurrentCodePointer();

View File

@ -2089,9 +2089,6 @@ CodeCache::DispatcherFunction CodeGenerator::CompileDispatcher()
m_emit->lsr(a32::r1, a32::r0, 16);
m_emit->ldr(a32::r1, a32::MemOperand(a32::r2, a32::r1, a32::LSL, 2));
// current_instruction_pc <- pc (r0)
m_emit->str(a32::r0, a32::MemOperand(GetHostReg32(RCPUPTR), offsetof(State, current_instruction_pc)));
// blr(r1[pc]) (fast_map[pc >> 2])
m_emit->ldr(a32::r0, a32::MemOperand(a32::r1, a32::r0));
m_emit->blx(a32::r0);

View File

@ -2290,13 +2290,10 @@ CodeCache::DispatcherFunction CodeGenerator::CompileDispatcher()
// x9 <- s_fast_map[pc >> 16]
EmitLoadGlobalAddress(10, CodeCache::GetFastMapPointer());
m_emit->lsr(a64::w9, a64::w8, 16);
m_emit->lsr(a64::w8, a64::w8, 2);
m_emit->ldr(a64::x9, a64::MemOperand(a64::x10, a64::x9, a64::LSL, 3));
// current_instruction_pc <- pc (w8)
m_emit->str(a64::w8, a64::MemOperand(GetHostReg64(RCPUPTR), offsetof(State, current_instruction_pc)));
// blr(x9[pc * 2]) (fast_map[pc >> 2])
m_emit->lsr(a64::w8, a64::w8, 2);
m_emit->ldr(a64::x8, a64::MemOperand(a64::x9, a64::x8, a64::LSL, 3));
m_emit->blr(a64::x8);

View File

@ -3073,9 +3073,6 @@ CodeCache::DispatcherFunction CodeGenerator::CompileDispatcher()
// eax <- pc
m_emit->mov(m_emit->eax, m_emit->dword[m_emit->rbp + offsetof(State, regs.pc)]);
// current_instruction_pc <- pc (eax)
m_emit->mov(m_emit->dword[m_emit->rbp + offsetof(State, current_instruction_pc)], m_emit->eax);
// rcx <- s_fast_map[pc >> 16]
EmitLoadGlobalAddress(Xbyak::Operand::RBX, CodeCache::GetFastMapPointer());
m_emit->mov(m_emit->ecx, m_emit->eax);