RegCache: merge fpr+gpr StoreFromRegister

This commit is contained in:
degasus 2014-06-02 13:55:50 +02:00
parent fd9bfddde7
commit 9e9b71fa87
2 changed files with 13 additions and 20 deletions

View File

@ -256,7 +256,7 @@ void GPRRegCache::BindToRegister(int i, bool doLoad, bool makeDirty)
}
}
void GPRRegCache::StoreFromRegister(int i)
void RegCache::StoreFromRegister(int i)
{
if (regs[i].away)
{
@ -276,12 +276,17 @@ void GPRRegCache::StoreFromRegister(int i)
}
OpArg newLoc = GetDefaultLocation(i);
if (doStore)
emit->MOV(32, newLoc, regs[i].location);
StoreRegister(i, newLoc);
regs[i].location = newLoc;
regs[i].away = false;
}
}
void GPRRegCache::StoreRegister(int preg, OpArg newLoc)
{
emit->MOV(32, newLoc, regs[preg].location);
}
void FPURegCache::BindToRegister(int i, bool doLoad, bool makeDirty)
{
_assert_msg_(DYNA_REC, !regs[i].location.IsImm(), "WTF - load - imm");
@ -312,22 +317,9 @@ void FPURegCache::BindToRegister(int i, bool doLoad, bool makeDirty)
}
}
void FPURegCache::StoreFromRegister(int i)
void FPURegCache::StoreRegister(int preg, OpArg newLoc)
{
_assert_msg_(DYNA_REC, !regs[i].location.IsImm(), "WTF - store - imm");
if (regs[i].away)
{
X64Reg xr = regs[i].location.GetSimpleReg();
_assert_msg_(DYNA_REC, xr < xregs.size(), "WTF - store - invalid reg");
OpArg newLoc = GetDefaultLocation(i);
if (xregs[xr].dirty)
emit->MOVAPD(newLoc, xr);
xregs[xr].free = true;
xregs[xr].dirty = false;
xregs[xr].ppcReg = -1;
regs[i].location = newLoc;
regs[i].away = false;
}
emit->MOVAPD(newLoc, regs[preg].location.GetSimpleReg());
}
void RegCache::Flush()

View File

@ -71,7 +71,8 @@ public:
//TODO - instead of doload, use "read", "write"
//read only will not set dirty flag
virtual void BindToRegister(int preg, bool doLoad = true, bool makeDirty = true) = 0;
virtual void StoreFromRegister(int preg) = 0;
void StoreFromRegister(int preg);
virtual void StoreRegister(int preg, OpArg newLoc) = 0;
const OpArg &R(int preg) const {return regs[preg].location;}
X64Reg RX(int preg) const
@ -107,7 +108,7 @@ class GPRRegCache : public RegCache
{
public:
void BindToRegister(int preg, bool doLoad = true, bool makeDirty = true) override;
void StoreFromRegister(int preg) override;
void StoreRegister(int preg, OpArg newLoc) override;
OpArg GetDefaultLocation(int reg) const override;
const int *GetAllocationOrder(int &count) override;
void SetImmediate32(int preg, u32 immValue);
@ -118,7 +119,7 @@ class FPURegCache : public RegCache
{
public:
void BindToRegister(int preg, bool doLoad = true, bool makeDirty = true) override;
void StoreFromRegister(int preg) override;
void StoreRegister(int preg, OpArg newLoc) override;
const int *GetAllocationOrder(int &count) override;
OpArg GetDefaultLocation(int reg) const override;
};