From 2f6b10035d717fa2878793dda8f8d9bdc2ef2d78 Mon Sep 17 00:00:00 2001 From: Martino Fontana Date: Sun, 12 Apr 2026 19:41:14 +0200 Subject: [PATCH] JitRegCache: Rename "default location" to "PPC State" More intutive name, and more consistent with ARM's RegCache. --- Source/Core/Core/PowerPC/Jit64/RegCache/CachedReg.h | 12 ++++++------ .../Core/Core/PowerPC/Jit64/RegCache/FPURegCache.cpp | 10 +++++----- .../Core/Core/PowerPC/Jit64/RegCache/FPURegCache.h | 2 +- .../Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.cpp | 11 +++++------ .../Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.h | 2 +- .../Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp | 6 +++--- .../Core/Core/PowerPC/Jit64/RegCache/JitRegCache.h | 2 +- 7 files changed, 22 insertions(+), 23 deletions(-) diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/CachedReg.h b/Source/Core/Core/PowerPC/Jit64/RegCache/CachedReg.h index 00940fab36..042a1917a1 100644 --- a/Source/Core/Core/PowerPC/Jit64/RegCache/CachedReg.h +++ b/Source/Core/Core/PowerPC/Jit64/RegCache/CachedReg.h @@ -22,7 +22,7 @@ public: return m_host_register; } - bool IsInDefaultLocation() const { return m_in_default_location; } + bool IsInPPCState() const { return m_in_ppc_state; } bool IsInHostRegister() const { return m_in_host_register; } void SetFlushed(bool maintain_host_register) @@ -30,23 +30,23 @@ public: ASSERT(!m_revertable); if (!maintain_host_register) m_in_host_register = false; - m_in_default_location = true; + m_in_ppc_state = true; } void SetInHostRegister(Gen::X64Reg xreg, bool dirty) { if (dirty) - m_in_default_location = false; + m_in_ppc_state = false; m_in_host_register = true; m_host_register = xreg; } - void SetDirty() { m_in_default_location = false; } + void SetDirty() { m_in_ppc_state = false; } void SetDiscarded() { ASSERT(!m_revertable); - m_in_default_location = false; + m_in_ppc_state = false; m_in_host_register = false; } @@ -72,7 +72,7 @@ public: private: Gen::X64Reg m_host_register{}; - bool m_in_default_location = true; + bool m_in_ppc_state = true; bool m_in_host_register = false; bool m_revertable = false; size_t m_locked = 0; diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.cpp b/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.cpp index d9ec584fc1..703a74bb74 100644 --- a/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.cpp +++ b/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.cpp @@ -38,8 +38,8 @@ OpArg FPURegCache::R(preg_t preg) const } else { - ASSERT_MSG(DYNA_REC, m_regs[preg].IsInDefaultLocation(), "FPR {} missing!", preg); - return GetDefaultLocation(preg); + ASSERT_MSG(DYNA_REC, m_regs[preg].IsInPPCState(), "FPR {} missing!", preg); + return GetPPCStateLocation(preg); } } @@ -59,8 +59,8 @@ void FPURegCache::StoreRegister(preg_t preg, const OpArg& new_loc, void FPURegCache::LoadRegister(preg_t preg, X64Reg new_loc) { - ASSERT_MSG(DYNA_REC, m_regs[preg].IsInDefaultLocation(), "FPR {} not in default location", preg); - m_emitter->MOVAPD(new_loc, GetDefaultLocation(preg)); + ASSERT_MSG(DYNA_REC, m_regs[preg].IsInPPCState(), "FPR {} not in PPCState", preg); + m_emitter->MOVAPD(new_loc, GetPPCStateLocation(preg)); } void FPURegCache::DiscardImm(preg_t preg) @@ -75,7 +75,7 @@ std::span FPURegCache::GetAllocationOrder() const return allocation_order; } -OpArg FPURegCache::GetDefaultLocation(preg_t preg) const +OpArg FPURegCache::GetPPCStateLocation(preg_t preg) const { return PPCSTATE_PS0(preg); } diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.h b/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.h index 76cad940ae..b8f4ba0798 100644 --- a/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.h +++ b/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.h @@ -18,7 +18,7 @@ public: protected: Gen::OpArg R(preg_t preg) const override; - Gen::OpArg GetDefaultLocation(preg_t preg) const override; + Gen::OpArg GetPPCStateLocation(preg_t preg) const override; void StoreRegister(preg_t preg, const Gen::OpArg& newLoc, IgnoreDiscardedRegisters ignore_discarded_registers) override; void LoadRegister(preg_t preg, Gen::X64Reg newLoc) override; diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.cpp b/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.cpp index 610905c59a..8e67a60c9a 100644 --- a/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.cpp +++ b/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.cpp @@ -42,8 +42,8 @@ OpArg GPRRegCache::R(preg_t preg) const } else { - ASSERT_MSG(DYNA_REC, m_regs[preg].IsInDefaultLocation(), "GPR {} missing!", preg); - return GetDefaultLocation(preg); + ASSERT_MSG(DYNA_REC, m_regs[preg].IsInPPCState(), "GPR {} missing!", preg); + return GetPPCStateLocation(preg); } } @@ -74,9 +74,8 @@ void GPRRegCache::LoadRegister(preg_t preg, X64Reg new_loc) } else { - ASSERT_MSG(DYNA_REC, m_regs[preg].IsInDefaultLocation(), "GPR {} not in default location", - preg); - m_emitter->MOV(32, ::Gen::R(new_loc), GetDefaultLocation(preg)); + ASSERT_MSG(DYNA_REC, m_regs[preg].IsInPPCState(), "GPR {} not in PPCState", preg); + m_emitter->MOV(32, ::Gen::R(new_loc), GetPPCStateLocation(preg)); } } @@ -85,7 +84,7 @@ void GPRRegCache::DiscardImm(preg_t preg) m_jit.GetConstantPropagation().ClearGPR(preg); } -OpArg GPRRegCache::GetDefaultLocation(preg_t preg) const +OpArg GPRRegCache::GetPPCStateLocation(preg_t preg) const { return PPCSTATE_GPR(preg); } diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.h b/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.h index 9c0b394bad..d784234b48 100644 --- a/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.h +++ b/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.h @@ -20,7 +20,7 @@ public: protected: Gen::OpArg R(preg_t preg) const override; - Gen::OpArg GetDefaultLocation(preg_t preg) const override; + Gen::OpArg GetPPCStateLocation(preg_t preg) const override; void StoreRegister(preg_t preg, const Gen::OpArg& new_loc, IgnoreDiscardedRegisters ignore_discarded_registers) override; void LoadRegister(preg_t preg, Gen::X64Reg new_loc) override; diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp index e35d13eed6..8d43588061 100644 --- a/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp +++ b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp @@ -471,8 +471,8 @@ void RegCache::StoreFromRegister(preg_t i, FlushMode mode, // When a transaction is in progress, allowing the store would overwrite the old value. ASSERT_MSG(DYNA_REC, !m_regs[i].IsRevertable(), "Register transaction on {} is in progress!", i); - if (!m_regs[i].IsInDefaultLocation()) - StoreRegister(i, GetDefaultLocation(i), ignore_discarded_registers); + if (!m_regs[i].IsInPPCState()) + StoreRegister(i, GetPPCStateLocation(i), ignore_discarded_registers); if (mode == FlushMode::Full && m_regs[i].IsInHostRegister()) m_xregs[m_regs[i].GetHostRegister()].Unbind(); @@ -542,7 +542,7 @@ float RegCache::ScoreRegister(X64Reg xreg) const // bias a bit against dirty registers. Testing shows that a bias of 2 seems roughly // right: 3 causes too many extra clobbers, while 1 saves very few clobbers relative // to the number of extra stores it causes. - if (!m_regs[preg].IsInDefaultLocation()) + if (!m_regs[preg].IsInPPCState()) score += 2; // If the register isn't actually needed in a physical register for a later instruction, diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.h b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.h index 42b424b902..97bf222404 100644 --- a/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.h +++ b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.h @@ -194,7 +194,7 @@ protected: friend class RCX64Reg; friend class RCForkGuard; - virtual Gen::OpArg GetDefaultLocation(preg_t preg) const = 0; + virtual Gen::OpArg GetPPCStateLocation(preg_t preg) const = 0; virtual void StoreRegister(preg_t preg, const Gen::OpArg& new_loc, IgnoreDiscardedRegisters ignore_discarded_registers) = 0; virtual void LoadRegister(preg_t preg, Gen::X64Reg new_loc) = 0;