diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.cpp index 16217e6fa..7bb7e664d 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.cpp @@ -610,7 +610,7 @@ asmjit::x86::Gp CX86RegInfo::Get_MemoryStack() const 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(); if (!bMapRegister) @@ -631,19 +631,19 @@ asmjit::x86::Gp CX86RegInfo::Map_MemoryStack(asmjit::x86::Gp Reg, bool bMapRegis { return CurrentMap; } - Reg = FreeX86Reg(); - if (!Reg.isValid()) + asmjit::x86::Gp MemoryStackReg = FreeX86Reg(); + if (!MemoryStackReg.isValid()) { g_Notify->DisplayError("Map_MemoryStack\n\nOut of registers"); g_Notify->BreakPoint(__FILE__, __LINE__); } - SetX86Mapped(GetIndexFromX86Reg(Reg), CX86RegInfo::Stack_Mapped); - m_CodeBlock.Log(" regcache: allocate %s as Memory Stack", CX86Ops::x86_Name(Reg)); + SetX86Mapped(GetIndexFromX86Reg(MemoryStackReg), CX86RegInfo::Stack_Mapped); + m_CodeBlock.Log(" regcache: allocate %s as Memory Stack", CX86Ops::x86_Name(MemoryStackReg)); 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 diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.h b/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.h index cdcc8bc66..a3353d0d2 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.h +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.h @@ -97,7 +97,7 @@ public: void Map_GPR_64bit(int32_t MipsReg, int32_t MipsRegToLoad); asmjit::x86::Gp Map_FPStatusReg(); 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); void ProtectGPR(uint32_t MipsReg); void UnProtectGPR(uint32_t MipsReg); @@ -108,11 +108,11 @@ public: bool UnMap_X86reg(const asmjit::x86::Gp & Reg); void WriteBackRegisters(); - asmjit::x86::Gp GetMipsRegMapLo(int32_t Reg) const + const asmjit::x86::Gp & GetMipsRegMapLo(int32_t Reg) const { 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]; }