JitRegCache: Rename CachedReg function names

* BoundTo -> SetBoundTo
* Flushed -> SetFlushed
* Remove argument from MakeDirty
This commit is contained in:
MerryMage 2018-10-07 09:02:39 +01:00
parent 29d301e303
commit d5999bc0df
2 changed files with 16 additions and 14 deletions

View File

@ -38,8 +38,8 @@ void RegCache::DiscardRegContentsIfCached(preg_t preg)
if (m_regs[preg].IsBound()) if (m_regs[preg].IsBound())
{ {
X64Reg xr = m_regs[preg].Location().GetSimpleReg(); X64Reg xr = m_regs[preg].Location().GetSimpleReg();
m_xregs[xr].Flushed(); m_xregs[xr].SetFlushed();
m_regs[preg].Flushed(); m_regs[preg].SetFlushed();
} }
} }
@ -68,7 +68,7 @@ void RegCache::Flush(FlushMode mode, BitSet32 regsToFlush)
// We can have a cached value without a host register through speculative constants. // We can have a cached value without a host register through speculative constants.
// It must be cleared when flushing, otherwise it may be out of sync with PPCSTATE, // It must be cleared when flushing, otherwise it may be out of sync with PPCSTATE,
// if PPCSTATE is modified externally (e.g. fallback to interpreter). // if PPCSTATE is modified externally (e.g. fallback to interpreter).
m_regs[i].Flushed(); m_regs[i].SetFlushed();
break; break;
case PPCCachedReg::LocationType::Bound: case PPCCachedReg::LocationType::Bound:
case PPCCachedReg::LocationType::Immediate: case PPCCachedReg::LocationType::Immediate:
@ -125,7 +125,8 @@ void RegCache::KillImmediate(preg_t preg, bool doLoad, bool makeDirty)
case PPCCachedReg::LocationType::SpeculativeImmediate: case PPCCachedReg::LocationType::SpeculativeImmediate:
break; break;
case PPCCachedReg::LocationType::Bound: case PPCCachedReg::LocationType::Bound:
m_xregs[RX(preg)].MakeDirty(makeDirty); if (makeDirty)
m_xregs[RX(preg)].MakeDirty();
break; break;
case PPCCachedReg::LocationType::Immediate: case PPCCachedReg::LocationType::Immediate:
BindToRegister(preg, doLoad, makeDirty); BindToRegister(preg, doLoad, makeDirty);
@ -142,7 +143,7 @@ void RegCache::BindToRegister(preg_t i, bool doLoad, bool makeDirty)
ASSERT_MSG(DYNA_REC, !m_xregs[xr].IsDirty(), "Xreg %i already dirty", xr); ASSERT_MSG(DYNA_REC, !m_xregs[xr].IsDirty(), "Xreg %i already dirty", xr);
ASSERT_MSG(DYNA_REC, !m_xregs[xr].IsLocked(), "GetFreeXReg returned locked register"); ASSERT_MSG(DYNA_REC, !m_xregs[xr].IsLocked(), "GetFreeXReg returned locked register");
m_xregs[xr].BoundTo(i, makeDirty || m_regs[i].IsAway()); m_xregs[xr].SetBoundTo(i, makeDirty || m_regs[i].IsAway());
if (doLoad) if (doLoad)
{ {
@ -154,13 +155,14 @@ void RegCache::BindToRegister(preg_t i, bool doLoad, bool makeDirty)
[xr](const auto& r) { return r.Location().IsSimpleReg(xr); }), [xr](const auto& r) { return r.Location().IsSimpleReg(xr); }),
"Xreg %i already bound", xr); "Xreg %i already bound", xr);
m_regs[i].BoundTo(xr); m_regs[i].SetBoundTo(xr);
} }
else else
{ {
// reg location must be simplereg; memory locations // reg location must be simplereg; memory locations
// and immediates are taken care of above. // and immediates are taken care of above.
m_xregs[RX(i)].MakeDirty(makeDirty); if (makeDirty)
m_xregs[RX(i)].MakeDirty();
} }
ASSERT_MSG(DYNA_REC, !m_xregs[RX(i)].IsLocked(), "WTF, this reg should have been flushed"); ASSERT_MSG(DYNA_REC, !m_xregs[RX(i)].IsLocked(), "WTF, this reg should have been flushed");
@ -180,7 +182,7 @@ void RegCache::StoreFromRegister(preg_t i, FlushMode mode)
X64Reg xr = RX(i); X64Reg xr = RX(i);
doStore = m_xregs[xr].IsDirty(); doStore = m_xregs[xr].IsDirty();
if (mode == FlushMode::All) if (mode == FlushMode::All)
m_xregs[xr].Flushed(); m_xregs[xr].SetFlushed();
break; break;
} }
case PPCCachedReg::LocationType::Immediate: case PPCCachedReg::LocationType::Immediate:
@ -191,7 +193,7 @@ void RegCache::StoreFromRegister(preg_t i, FlushMode mode)
if (doStore) if (doStore)
StoreRegister(i, GetDefaultLocation(i)); StoreRegister(i, GetDefaultLocation(i));
if (mode == FlushMode::All) if (mode == FlushMode::All)
m_regs[i].Flushed(); m_regs[i].SetFlushed();
} }
const OpArg& RegCache::R(preg_t preg) const const OpArg& RegCache::R(preg_t preg) const

View File

@ -57,13 +57,13 @@ public:
bool IsAway() const { return away; } bool IsAway() const { return away; }
bool IsBound() const { return GetLocationType() == LocationType::Bound; } bool IsBound() const { return GetLocationType() == LocationType::Bound; }
void BoundTo(Gen::X64Reg xreg) void SetBoundTo(Gen::X64Reg xreg)
{ {
away = true; away = true;
location = Gen::R(xreg); location = Gen::R(xreg);
} }
void Flushed() void SetFlushed()
{ {
away = false; away = false;
location = default_location; location = default_location;
@ -91,14 +91,14 @@ class X64CachedReg
public: public:
preg_t Contents() const { return ppcReg; } preg_t Contents() const { return ppcReg; }
void BoundTo(preg_t ppcReg_, bool dirty_) void SetBoundTo(preg_t ppcReg_, bool dirty_)
{ {
free = false; free = false;
ppcReg = ppcReg_; ppcReg = ppcReg_;
dirty = dirty_; dirty = dirty_;
} }
void Flushed() void SetFlushed()
{ {
ppcReg = static_cast<preg_t>(Gen::INVALID_REG); ppcReg = static_cast<preg_t>(Gen::INVALID_REG);
free = true; free = true;
@ -108,7 +108,7 @@ public:
bool IsFree() const { return free && !locked; } bool IsFree() const { return free && !locked; }
bool IsDirty() const { return dirty; } bool IsDirty() const { return dirty; }
void MakeDirty(bool makeDirty = true) { dirty |= makeDirty; } void MakeDirty() { dirty = true; }
bool IsLocked() const { return locked; } bool IsLocked() const { return locked; }
void Lock() { locked = true; } void Lock() { locked = true; }