Core: Update Map_MemoryStack to pass gp by reference

This commit is contained in:
zilmar 2024-10-24 12:01:14 +10:30
parent 440894992a
commit 885d31f275
2 changed files with 10 additions and 10 deletions

View File

@ -610,7 +610,7 @@ asmjit::x86::Gp CX86RegInfo::Get_MemoryStack() const
return x86Reg_Unknown; return x86Reg_Unknown;
} }
asmjit::x86::Gp CX86RegInfo::Map_MemoryStack(asmjit::x86::Gp Reg, bool bMapRegister, bool LoadValue) asmjit::x86::Gp CX86RegInfo::Map_MemoryStack(const asmjit::x86::Gp & Reg, bool bMapRegister, bool LoadValue)
{ {
asmjit::x86::Gp CurrentMap = Get_MemoryStack(); asmjit::x86::Gp CurrentMap = Get_MemoryStack();
if (!bMapRegister) if (!bMapRegister)
@ -631,19 +631,19 @@ asmjit::x86::Gp CX86RegInfo::Map_MemoryStack(asmjit::x86::Gp Reg, bool bMapRegis
{ {
return CurrentMap; return CurrentMap;
} }
Reg = FreeX86Reg(); asmjit::x86::Gp MemoryStackReg = FreeX86Reg();
if (!Reg.isValid()) if (!MemoryStackReg.isValid())
{ {
g_Notify->DisplayError("Map_MemoryStack\n\nOut of registers"); g_Notify->DisplayError("Map_MemoryStack\n\nOut of registers");
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
SetX86Mapped(GetIndexFromX86Reg(Reg), CX86RegInfo::Stack_Mapped); SetX86Mapped(GetIndexFromX86Reg(MemoryStackReg), CX86RegInfo::Stack_Mapped);
m_CodeBlock.Log(" regcache: allocate %s as Memory Stack", CX86Ops::x86_Name(Reg)); m_CodeBlock.Log(" regcache: allocate %s as Memory Stack", CX86Ops::x86_Name(MemoryStackReg));
if (LoadValue) if (LoadValue)
{ {
m_Assembler.MoveVariableToX86reg(Reg, &g_Recompiler->MemoryStackPos(), "MemoryStack"); m_Assembler.MoveVariableToX86reg(MemoryStackReg, &g_Recompiler->MemoryStackPos(), "MemoryStack");
} }
return Reg; return MemoryStackReg;
} }
// Move to a register/allocate register // Move to a register/allocate register

View File

@ -97,7 +97,7 @@ public:
void Map_GPR_64bit(int32_t MipsReg, int32_t MipsRegToLoad); void Map_GPR_64bit(int32_t MipsReg, int32_t MipsRegToLoad);
asmjit::x86::Gp Map_FPStatusReg(); asmjit::x86::Gp Map_FPStatusReg();
asmjit::x86::Gp Get_MemoryStack() const; asmjit::x86::Gp Get_MemoryStack() const;
asmjit::x86::Gp Map_MemoryStack(asmjit::x86::Gp Reg, bool bMapRegister, bool LoadValue = true); asmjit::x86::Gp Map_MemoryStack(const asmjit::x86::Gp & Reg, bool bMapRegister, bool LoadValue = true);
asmjit::x86::Gp Map_TempReg(asmjit::x86::Gp Reg, int32_t MipsReg, bool LoadHiWord, bool Reg8Bit); asmjit::x86::Gp Map_TempReg(asmjit::x86::Gp Reg, int32_t MipsReg, bool LoadHiWord, bool Reg8Bit);
void ProtectGPR(uint32_t MipsReg); void ProtectGPR(uint32_t MipsReg);
void UnProtectGPR(uint32_t MipsReg); void UnProtectGPR(uint32_t MipsReg);
@ -108,11 +108,11 @@ public:
bool UnMap_X86reg(const asmjit::x86::Gp & Reg); bool UnMap_X86reg(const asmjit::x86::Gp & Reg);
void WriteBackRegisters(); void WriteBackRegisters();
asmjit::x86::Gp GetMipsRegMapLo(int32_t Reg) const const asmjit::x86::Gp & GetMipsRegMapLo(int32_t Reg) const
{ {
return m_RegMapLo[Reg]; return m_RegMapLo[Reg];
} }
asmjit::x86::Gp GetMipsRegMapHi(int32_t Reg) const const asmjit::x86::Gp & GetMipsRegMapHi(int32_t Reg) const
{ {
return m_RegMapHi[Reg]; return m_RegMapHi[Reg];
} }