JitRegCache: Rename "default location" to "PPC State"

More intutive name, and more consistent with ARM's RegCache.
This commit is contained in:
Martino Fontana
2026-04-12 19:41:14 +02:00
parent 3e33294292
commit 2f6b10035d
7 changed files with 22 additions and 23 deletions

View File

@@ -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;

View File

@@ -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<const X64Reg> FPURegCache::GetAllocationOrder() const
return allocation_order;
}
OpArg FPURegCache::GetDefaultLocation(preg_t preg) const
OpArg FPURegCache::GetPPCStateLocation(preg_t preg) const
{
return PPCSTATE_PS0(preg);
}

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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,

View File

@@ -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;