Change register cache to using an enum to determine flush mode.

This is easier to identify what the flush is doing rather than a "true" as argument.
This commit is contained in:
Ryan Houdek 2014-06-10 02:42:00 -05:00
parent 541bfd071e
commit 5e1a465d50
3 changed files with 15 additions and 9 deletions

View File

@ -255,7 +255,7 @@ void RegCache::BindToRegister(int i, bool doLoad, bool makeDirty)
}
}
void RegCache::StoreFromRegister(int i, bool clearState)
void RegCache::StoreFromRegister(int i, FlushMode mode)
{
if (regs[i].away)
{
@ -264,7 +264,7 @@ void RegCache::StoreFromRegister(int i, bool clearState)
{
X64Reg xr = RX(i);
doStore = xregs[xr].dirty;
if(clearState)
if(mode == FLUSH_ALL)
{
xregs[xr].free = true;
xregs[xr].ppcReg = -1;
@ -279,7 +279,7 @@ void RegCache::StoreFromRegister(int i, bool clearState)
OpArg newLoc = GetDefaultLocation(i);
if (doStore)
StoreRegister(i, newLoc);
if(clearState)
if(mode == FLUSH_ALL)
{
regs[i].location = newLoc;
regs[i].away = false;
@ -311,7 +311,7 @@ void FPURegCache::StoreRegister(int preg, OpArg newLoc)
emit->MOVAPD(newLoc, regs[preg].location.GetSimpleReg());
}
void RegCache::Flush(bool clearState)
void RegCache::Flush(FlushMode mode)
{
for (int i = 0; i < (int)xregs.size(); i++)
{
@ -329,7 +329,7 @@ void RegCache::Flush(bool clearState)
{
if (regs[i].location.IsSimpleReg() || regs[i].location.IsImm())
{
StoreFromRegister(i, clearState);
StoreFromRegister(i, mode);
}
else
{

View File

@ -10,6 +10,12 @@
using namespace Gen;
enum FlushMode
{
FLUSH_ALL,
FLUSH_MAINTAIN_STATE,
};
struct PPCCachedReg
{
OpArg location;
@ -63,7 +69,7 @@ public:
FlushR(reg1); FlushR(reg2);
LockX(reg1); LockX(reg2);
}
void Flush(bool clearState = true);
void Flush(FlushMode mode = FLUSH_ALL);
void Flush(PPCAnalyst::CodeOp *op) {Flush();}
int SanityCheck() const;
void KillImmediate(int preg, bool doLoad, bool makeDirty);
@ -71,7 +77,7 @@ public:
//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, bool clearState = true);
void StoreFromRegister(int preg, FlushMode mode = FLUSH_ALL);
virtual void StoreRegister(int preg, OpArg newLoc) = 0;
virtual void LoadRegister(int preg, X64Reg newLoc) = 0;

View File

@ -133,8 +133,8 @@ void Jit64::bcx(UGeckoInstruction inst)
else
destination = js.compilerPC + SignExt16(inst.BD << 2);
gpr.Flush(false);
fpr.Flush(false);
gpr.Flush(FLUSH_MAINTAIN_STATE);
fpr.Flush(FLUSH_MAINTAIN_STATE);
WriteExit(destination);
if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0)