core: overload _freeX86reg with xRegister32

This commit is contained in:
Gregory Hainaut 2015-11-26 21:10:24 +01:00
parent 6291910b02
commit 743e615224
6 changed files with 16 additions and 8 deletions

View File

@ -268,6 +268,7 @@ template< typename T > void xWrite( T val );
// Diagnostics -- returns a string representation of this register. Return string
// is a valid non-null string for any Id, valid or invalid. No assertions are generated.
const char* GetName();
int GetId() const { return Id; }
};
class xRegisterInt : public xRegisterBase

View File

@ -126,6 +126,7 @@ void _deleteX86reg(int type, int reg, int flush);
int _checkX86reg(int type, int reg, int mode);
void _addNeededX86reg(int type, int reg);
void _clearNeededX86regs();
void _freeX86reg(const x86Emitter::xRegister32& x86reg);
void _freeX86reg(int x86reg);
void _freeX86regs();
void _flushCachedRegs();

View File

@ -574,9 +574,9 @@ void _psxMoveGPRtoRm(x86IntRegType to, int fromgpr)
void _psxFlushCall(int flushtype)
{
// x86-32 ABI : These registers are not preserved across calls:
_freeX86reg( EAX );
_freeX86reg( ECX );
_freeX86reg( EDX );
_freeX86reg( eax );
_freeX86reg( ecx );
_freeX86reg( edx );
if( flushtype & FLUSH_CACHED_REGS )
_psxFlushConstRegs();

View File

@ -442,6 +442,12 @@ void _deleteX86reg(int type, int reg, int flush)
}
}
// Temporary solution to support eax/ebx... type
void _freeX86reg(const x86Emitter::xRegister32& x86reg)
{
_freeX86reg(x86reg.GetId());
}
void _freeX86reg(int x86reg)
{
pxAssert( x86reg >= 0 && x86reg < (int)iREGCNT_GPR );

View File

@ -1039,9 +1039,9 @@ void LoadBranchState()
void iFlushCall(int flushtype)
{
// Free registers that are not saved across function calls (x86-32 ABI):
_freeX86reg(EAX);
_freeX86reg(ECX);
_freeX86reg(EDX);
_freeX86reg(eax);
_freeX86reg(ecx);
_freeX86reg(edx);
if ((flushtype & FLUSH_PC) && !g_cpuFlushedPC) {
xMOV(ptr32[&cpuRegs.pc], pc);

View File

@ -345,7 +345,7 @@ void VU_ADD_SUB(u32 regd, u32 regt, int is_sub, int info)
if (temp2 == ECX)
{
temp2 = ALLOCTEMPX86(0);
_freeX86reg(ECX);
_freeX86reg(ecx);
}
xMOVAPS(ptr[&VU_addsub_reg[0][0]], xRegisterSSE(regd));
@ -440,7 +440,7 @@ void VU_ADD_SUB_SS(u32 regd, u32 regt, int is_sub, int is_mem, int info)
if (temp2 == ECX)
{
temp2 = ALLOCTEMPX86(0);
_freeX86reg(ECX);
_freeX86reg(ecx);
}
xMOVAPS(ptr[&VU_addsub_reg[0][0]], xRegisterSSE(regd));