Core: Delete constant regs when flushing to interpreter

This commit is contained in:
refractionpcsx2 2025-02-28 21:32:04 +00:00
parent 121920c074
commit de26226fa1
3 changed files with 10 additions and 4 deletions

View File

@ -109,7 +109,7 @@ void _freeX86reg(int x86reg);
void _freeX86regWithoutWriteback(int x86reg);
void _freeX86regs();
void _flushX86regs();
void _flushConstRegs();
void _flushConstRegs(bool delete_const);
void _flushConstReg(int reg);
void _validateRegs();
void _writebackX86Reg(int x86reg);

View File

@ -105,7 +105,7 @@ void _flushConstReg(int reg)
}
}
void _flushConstRegs()
void _flushConstRegs(bool delete_const)
{
int zero_reg_count = 0;
int minusone_reg_count = 0;
@ -134,6 +134,8 @@ void _flushConstRegs()
{
xMOV(ptr64[&cpuRegs.GPR.r[i].UD[0]], rax);
g_cpuFlushedConstReg |= 1u << i;
if (delete_const)
g_cpuHasConstReg &= ~(1u << i);
}
}
rax_is_zero = true;
@ -154,6 +156,8 @@ void _flushConstRegs()
{
xMOV(ptr64[&cpuRegs.GPR.r[i].UD[0]], rax);
g_cpuFlushedConstReg |= 1u << i;
if (delete_const)
g_cpuHasConstReg &= ~(1u << i);
}
}
}
@ -166,6 +170,8 @@ void _flushConstRegs()
xWriteImm64ToMem(&cpuRegs.GPR.r[i].UD[0], rax, g_cpuConstRegs[i].UD[0]);
g_cpuFlushedConstReg |= 1u << i;
if (delete_const)
g_cpuHasConstReg &= ~(1u << i);
}
}

View File

@ -227,7 +227,7 @@ void _eeFlushAllDirty()
_flushX86regs();
// flush constants, do them all at once for slightly better codegen
_flushConstRegs();
_flushConstRegs(false);
}
void _eeMoveGPRtoR(const xRegister32& to, int fromgpr, bool allow_preload)
@ -1225,7 +1225,7 @@ void iFlushCall(int flushtype)
_flushXMMregs();
if (flushtype & FLUSH_CONSTANT_REGS)
_flushConstRegs();
_flushConstRegs(true);
if ((flushtype & FLUSH_PC) && !g_cpuFlushedPC)
{