diff options
| author | Martino Fontana <tinozzo123@gmail.com> | 2026-03-08 10:34:15 +0100 |
|---|---|---|
| committer | Martino Fontana <tinozzo123@gmail.com> | 2026-11-15 22:31:06 +0100 |
| commit | 3e33294292f7f978cdc9dfa7b38a03f8f68acdeb (patch) | |
| tree | af3529e0502c4c829c9107336f7d7ea4c8699c2d /Source/Core | |
| parent | 14d5fe714d5c270fdce4e8541b3903de3d5b2cff (diff) | |
JitRegCache: Don't store `m_default_location`
The register cache is inconsistent in using that or getting it from `GetDefaultLocation(preg_t preg)`.
Considering how simple that function is, let's only use that and remove some state.
Diffstat (limited to 'Source/Core')
4 files changed, 9 insertions, 16 deletions
diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/CachedReg.h b/Source/Core/Core/PowerPC/Jit64/RegCache/CachedReg.h index a80451760a..00940fab36 100644 --- a/Source/Core/Core/PowerPC/Jit64/RegCache/CachedReg.h +++ b/Source/Core/Core/PowerPC/Jit64/RegCache/CachedReg.h @@ -4,11 +4,9 @@ #pragma once #include <cstddef> -#include <optional> #include "Common/Assert.h" -#include "Common/CommonTypes.h" -#include "Common/x64Emitter.h" +#include "Common/x64Reg.h" #include "Core/PowerPC/Jit64/RegCache/RCMode.h" using preg_t = size_t; @@ -18,10 +16,6 @@ class PPCCachedReg public: PPCCachedReg() = default; - explicit PPCCachedReg(Gen::OpArg default_location) : m_default_location(default_location) {} - - Gen::OpArg GetDefaultLocation() const { return m_default_location; } - Gen::X64Reg GetHostRegister() const { ASSERT(m_in_host_register); @@ -77,7 +71,6 @@ public: } private: - Gen::OpArg m_default_location{}; Gen::X64Reg m_host_register{}; bool m_in_default_location = true; bool m_in_host_register = false; @@ -88,6 +81,8 @@ private: class X64CachedReg { public: + X64CachedReg() = default; + preg_t Contents() const { return ppcReg; } void SetBoundTo(preg_t ppcReg_) diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.cpp b/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.cpp index 3e089ffe7d..d9ec584fc1 100644 --- a/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.cpp +++ b/Source/Core/Core/PowerPC/Jit64/RegCache/FPURegCache.cpp @@ -39,7 +39,7 @@ OpArg FPURegCache::R(preg_t preg) const else { ASSERT_MSG(DYNA_REC, m_regs[preg].IsInDefaultLocation(), "FPR {} missing!", preg); - return m_regs[preg].GetDefaultLocation(); + return GetDefaultLocation(preg); } } @@ -60,7 +60,7 @@ 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, m_regs[preg].GetDefaultLocation()); + m_emitter->MOVAPD(new_loc, GetDefaultLocation(preg)); } void FPURegCache::DiscardImm(preg_t preg) diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.cpp b/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.cpp index fdbe13e192..610905c59a 100644 --- a/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.cpp +++ b/Source/Core/Core/PowerPC/Jit64/RegCache/GPRRegCache.cpp @@ -43,7 +43,7 @@ OpArg GPRRegCache::R(preg_t preg) const else { ASSERT_MSG(DYNA_REC, m_regs[preg].IsInDefaultLocation(), "GPR {} missing!", preg); - return m_regs[preg].GetDefaultLocation(); + return GetDefaultLocation(preg); } } @@ -76,7 +76,7 @@ void GPRRegCache::LoadRegister(preg_t preg, X64Reg new_loc) { ASSERT_MSG(DYNA_REC, m_regs[preg].IsInDefaultLocation(), "GPR {} not in default location", preg); - m_emitter->MOV(32, ::Gen::R(new_loc), m_regs[preg].GetDefaultLocation()); + m_emitter->MOV(32, ::Gen::R(new_loc), GetDefaultLocation(preg)); } } diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp index e51620c74b..e35d13eed6 100644 --- a/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp +++ b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp @@ -238,10 +238,8 @@ RegCache::RegCache(Jit64& jit) : m_jit{jit} void RegCache::Start() { m_xregs.fill({}); - for (size_t i = 0; i < m_regs.size(); i++) - { - m_regs[i] = PPCCachedReg{GetDefaultLocation(i)}; - } + m_regs.fill({}); + m_constraints.fill({}); } void RegCache::SetEmitter(XEmitter* emitter) |
