RegCache: make state clear optional on flushes
This commit is contained in:
parent
38c3812a60
commit
0cd9eea99e
|
@ -255,7 +255,7 @@ void RegCache::BindToRegister(int i, bool doLoad, bool makeDirty)
|
|||
}
|
||||
}
|
||||
|
||||
void RegCache::StoreFromRegister(int i)
|
||||
void RegCache::StoreFromRegister(int i, bool clearState)
|
||||
{
|
||||
if (regs[i].away)
|
||||
{
|
||||
|
@ -263,10 +263,13 @@ void RegCache::StoreFromRegister(int i)
|
|||
if (regs[i].location.IsSimpleReg())
|
||||
{
|
||||
X64Reg xr = RX(i);
|
||||
xregs[xr].free = true;
|
||||
xregs[xr].ppcReg = -1;
|
||||
doStore = xregs[xr].dirty;
|
||||
xregs[xr].dirty = false;
|
||||
if(clearState)
|
||||
{
|
||||
xregs[xr].free = true;
|
||||
xregs[xr].ppcReg = -1;
|
||||
xregs[xr].dirty = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -276,8 +279,11 @@ void RegCache::StoreFromRegister(int i)
|
|||
OpArg newLoc = GetDefaultLocation(i);
|
||||
if (doStore)
|
||||
StoreRegister(i, newLoc);
|
||||
regs[i].location = newLoc;
|
||||
regs[i].away = false;
|
||||
if(clearState)
|
||||
{
|
||||
regs[i].location = newLoc;
|
||||
regs[i].away = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -305,7 +311,7 @@ void FPURegCache::StoreRegister(int preg, OpArg newLoc)
|
|||
emit->MOVAPD(newLoc, regs[preg].location.GetSimpleReg());
|
||||
}
|
||||
|
||||
void RegCache::Flush()
|
||||
void RegCache::Flush(bool clearState)
|
||||
{
|
||||
for (int i = 0; i < (int)xregs.size(); i++)
|
||||
{
|
||||
|
@ -321,15 +327,9 @@ void RegCache::Flush()
|
|||
}
|
||||
if (regs[i].away)
|
||||
{
|
||||
if (regs[i].location.IsSimpleReg())
|
||||
if (regs[i].location.IsSimpleReg() || regs[i].location.IsImm())
|
||||
{
|
||||
X64Reg xr = RX(i);
|
||||
StoreFromRegister(i);
|
||||
xregs[xr].dirty = false;
|
||||
}
|
||||
else if (regs[i].location.IsImm())
|
||||
{
|
||||
StoreFromRegister(i);
|
||||
StoreFromRegister(i, clearState);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -63,15 +63,15 @@ public:
|
|||
FlushR(reg1); FlushR(reg2);
|
||||
LockX(reg1); LockX(reg2);
|
||||
}
|
||||
virtual void Flush();
|
||||
virtual void Flush(PPCAnalyst::CodeOp *op) {Flush();}
|
||||
void Flush(bool clearState = true);
|
||||
void Flush(PPCAnalyst::CodeOp *op) {Flush();}
|
||||
int SanityCheck() const;
|
||||
void KillImmediate(int preg, bool doLoad, bool makeDirty);
|
||||
|
||||
//TODO - instead of doload, use "read", "write"
|
||||
//read only will not set dirty flag
|
||||
void BindToRegister(int preg, bool doLoad = true, bool makeDirty = true);
|
||||
void StoreFromRegister(int preg);
|
||||
void StoreFromRegister(int preg, bool clearState = true);
|
||||
virtual void StoreRegister(int preg, OpArg newLoc) = 0;
|
||||
virtual void LoadRegister(int preg, X64Reg newLoc) = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue