mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-15 16:59:18 +01:00
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:
parent
541bfd071e
commit
5e1a465d50
@ -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)
|
if (regs[i].away)
|
||||||
{
|
{
|
||||||
@ -264,7 +264,7 @@ void RegCache::StoreFromRegister(int i, bool clearState)
|
|||||||
{
|
{
|
||||||
X64Reg xr = RX(i);
|
X64Reg xr = RX(i);
|
||||||
doStore = xregs[xr].dirty;
|
doStore = xregs[xr].dirty;
|
||||||
if(clearState)
|
if(mode == FLUSH_ALL)
|
||||||
{
|
{
|
||||||
xregs[xr].free = true;
|
xregs[xr].free = true;
|
||||||
xregs[xr].ppcReg = -1;
|
xregs[xr].ppcReg = -1;
|
||||||
@ -279,7 +279,7 @@ void RegCache::StoreFromRegister(int i, bool clearState)
|
|||||||
OpArg newLoc = GetDefaultLocation(i);
|
OpArg newLoc = GetDefaultLocation(i);
|
||||||
if (doStore)
|
if (doStore)
|
||||||
StoreRegister(i, newLoc);
|
StoreRegister(i, newLoc);
|
||||||
if(clearState)
|
if(mode == FLUSH_ALL)
|
||||||
{
|
{
|
||||||
regs[i].location = newLoc;
|
regs[i].location = newLoc;
|
||||||
regs[i].away = false;
|
regs[i].away = false;
|
||||||
@ -311,7 +311,7 @@ void FPURegCache::StoreRegister(int preg, OpArg newLoc)
|
|||||||
emit->MOVAPD(newLoc, regs[preg].location.GetSimpleReg());
|
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++)
|
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())
|
if (regs[i].location.IsSimpleReg() || regs[i].location.IsImm())
|
||||||
{
|
{
|
||||||
StoreFromRegister(i, clearState);
|
StoreFromRegister(i, mode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,12 @@
|
|||||||
|
|
||||||
using namespace Gen;
|
using namespace Gen;
|
||||||
|
|
||||||
|
enum FlushMode
|
||||||
|
{
|
||||||
|
FLUSH_ALL,
|
||||||
|
FLUSH_MAINTAIN_STATE,
|
||||||
|
};
|
||||||
|
|
||||||
struct PPCCachedReg
|
struct PPCCachedReg
|
||||||
{
|
{
|
||||||
OpArg location;
|
OpArg location;
|
||||||
@ -63,7 +69,7 @@ public:
|
|||||||
FlushR(reg1); FlushR(reg2);
|
FlushR(reg1); FlushR(reg2);
|
||||||
LockX(reg1); LockX(reg2);
|
LockX(reg1); LockX(reg2);
|
||||||
}
|
}
|
||||||
void Flush(bool clearState = true);
|
void Flush(FlushMode mode = FLUSH_ALL);
|
||||||
void Flush(PPCAnalyst::CodeOp *op) {Flush();}
|
void Flush(PPCAnalyst::CodeOp *op) {Flush();}
|
||||||
int SanityCheck() const;
|
int SanityCheck() const;
|
||||||
void KillImmediate(int preg, bool doLoad, bool makeDirty);
|
void KillImmediate(int preg, bool doLoad, bool makeDirty);
|
||||||
@ -71,7 +77,7 @@ public:
|
|||||||
//TODO - instead of doload, use "read", "write"
|
//TODO - instead of doload, use "read", "write"
|
||||||
//read only will not set dirty flag
|
//read only will not set dirty flag
|
||||||
void BindToRegister(int preg, bool doLoad = true, bool makeDirty = true);
|
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 StoreRegister(int preg, OpArg newLoc) = 0;
|
||||||
virtual void LoadRegister(int preg, X64Reg newLoc) = 0;
|
virtual void LoadRegister(int preg, X64Reg newLoc) = 0;
|
||||||
|
|
||||||
|
@ -133,8 +133,8 @@ void Jit64::bcx(UGeckoInstruction inst)
|
|||||||
else
|
else
|
||||||
destination = js.compilerPC + SignExt16(inst.BD << 2);
|
destination = js.compilerPC + SignExt16(inst.BD << 2);
|
||||||
|
|
||||||
gpr.Flush(false);
|
gpr.Flush(FLUSH_MAINTAIN_STATE);
|
||||||
fpr.Flush(false);
|
fpr.Flush(FLUSH_MAINTAIN_STATE);
|
||||||
WriteExit(destination);
|
WriteExit(destination);
|
||||||
|
|
||||||
if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0)
|
if ((inst.BO & BO_DONT_CHECK_CONDITION) == 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user