diff --git a/Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp b/Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp index d121a9d808..b35a823ee4 100644 --- a/Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp +++ b/Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp @@ -256,7 +256,7 @@ void GPRRegCache::BindToRegister(int i, bool doLoad, bool makeDirty) } } -void GPRRegCache::StoreFromRegister(int i) +void RegCache::StoreFromRegister(int i) { if (regs[i].away) { @@ -276,12 +276,17 @@ void GPRRegCache::StoreFromRegister(int i) } OpArg newLoc = GetDefaultLocation(i); if (doStore) - emit->MOV(32, newLoc, regs[i].location); + StoreRegister(i, newLoc); regs[i].location = newLoc; regs[i].away = false; } } +void GPRRegCache::StoreRegister(int preg, OpArg newLoc) +{ + emit->MOV(32, newLoc, regs[preg].location); +} + void FPURegCache::BindToRegister(int i, bool doLoad, bool makeDirty) { _assert_msg_(DYNA_REC, !regs[i].location.IsImm(), "WTF - load - imm"); @@ -312,22 +317,9 @@ void FPURegCache::BindToRegister(int i, bool doLoad, bool makeDirty) } } -void FPURegCache::StoreFromRegister(int i) +void FPURegCache::StoreRegister(int preg, OpArg newLoc) { - _assert_msg_(DYNA_REC, !regs[i].location.IsImm(), "WTF - store - imm"); - if (regs[i].away) - { - X64Reg xr = regs[i].location.GetSimpleReg(); - _assert_msg_(DYNA_REC, xr < xregs.size(), "WTF - store - invalid reg"); - OpArg newLoc = GetDefaultLocation(i); - if (xregs[xr].dirty) - emit->MOVAPD(newLoc, xr); - xregs[xr].free = true; - xregs[xr].dirty = false; - xregs[xr].ppcReg = -1; - regs[i].location = newLoc; - regs[i].away = false; - } + emit->MOVAPD(newLoc, regs[preg].location.GetSimpleReg()); } void RegCache::Flush() diff --git a/Source/Core/Core/PowerPC/Jit64/JitRegCache.h b/Source/Core/Core/PowerPC/Jit64/JitRegCache.h index 674b72bcd8..48517b27b0 100644 --- a/Source/Core/Core/PowerPC/Jit64/JitRegCache.h +++ b/Source/Core/Core/PowerPC/Jit64/JitRegCache.h @@ -71,7 +71,8 @@ public: //TODO - instead of doload, use "read", "write" //read only will not set dirty flag virtual void BindToRegister(int preg, bool doLoad = true, bool makeDirty = true) = 0; - virtual void StoreFromRegister(int preg) = 0; + void StoreFromRegister(int preg); + virtual void StoreRegister(int preg, OpArg newLoc) = 0; const OpArg &R(int preg) const {return regs[preg].location;} X64Reg RX(int preg) const @@ -107,7 +108,7 @@ class GPRRegCache : public RegCache { public: void BindToRegister(int preg, bool doLoad = true, bool makeDirty = true) override; - void StoreFromRegister(int preg) override; + void StoreRegister(int preg, OpArg newLoc) override; OpArg GetDefaultLocation(int reg) const override; const int *GetAllocationOrder(int &count) override; void SetImmediate32(int preg, u32 immValue); @@ -118,7 +119,7 @@ class FPURegCache : public RegCache { public: void BindToRegister(int preg, bool doLoad = true, bool makeDirty = true) override; - void StoreFromRegister(int preg) override; + void StoreRegister(int preg, OpArg newLoc) override; const int *GetAllocationOrder(int &count) override; OpArg GetDefaultLocation(int reg) const override; };