Permalink
Browse files

Merge pull request #7460 from MerryMage/regcache-old

JitRegCache: Cleanup
  • Loading branch information...
Tilka committed Oct 7, 2018
2 parents 406159f + d448ed3 commit e6302185875ae9c6ec00929a2238e7a19f4f1c43
@@ -14,14 +14,14 @@ FPURegCache::FPURegCache(Jit64& jit) : RegCache{jit}
{
}
void FPURegCache::StoreRegister(size_t preg, const OpArg& new_loc)
void FPURegCache::StoreRegister(preg_t preg, const OpArg& new_loc)
{
m_emitter->MOVAPD(new_loc, m_regs[preg].location.GetSimpleReg());
m_emitter->MOVAPD(new_loc, m_regs[preg].Location().GetSimpleReg());
}
void FPURegCache::LoadRegister(size_t preg, X64Reg new_loc)
void FPURegCache::LoadRegister(preg_t preg, X64Reg new_loc)
{
m_emitter->MOVAPD(new_loc, m_regs[preg].location);
m_emitter->MOVAPD(new_loc, m_regs[preg].Location());
}
const X64Reg* FPURegCache::GetAllocationOrder(size_t* count) const
@@ -32,17 +32,17 @@ const X64Reg* FPURegCache::GetAllocationOrder(size_t* count) const
return allocation_order;
}
OpArg FPURegCache::GetDefaultLocation(size_t reg) const
OpArg FPURegCache::GetDefaultLocation(preg_t preg) const
{
return PPCSTATE(ps[reg][0]);
return PPCSTATE(ps[preg][0]);
}
BitSet32 FPURegCache::GetRegUtilization() const
{
return m_jit.js.op->gprInReg;
}
BitSet32 FPURegCache::CountRegsIn(size_t preg, u32 lookahead) const
BitSet32 FPURegCache::CountRegsIn(preg_t preg, u32 lookahead) const
{
BitSet32 regs_used;
@@ -12,11 +12,12 @@ class FPURegCache final : public RegCache
{
public:
explicit FPURegCache(Jit64& jit);
Gen::OpArg GetDefaultLocation(preg_t preg) const override;
void StoreRegister(size_t preg, const Gen::OpArg& newLoc) override;
void LoadRegister(size_t preg, Gen::X64Reg newLoc) override;
protected:
void StoreRegister(preg_t preg, const Gen::OpArg& newLoc) override;
void LoadRegister(preg_t preg, Gen::X64Reg newLoc) override;
const Gen::X64Reg* GetAllocationOrder(size_t* count) const override;
Gen::OpArg GetDefaultLocation(size_t reg) const override;
BitSet32 GetRegUtilization() const override;
BitSet32 CountRegsIn(size_t preg, u32 lookahead) const override;
BitSet32 CountRegsIn(preg_t preg, u32 lookahead) const override;
};
@@ -14,19 +14,19 @@ GPRRegCache::GPRRegCache(Jit64& jit) : RegCache{jit}
{
}
void GPRRegCache::StoreRegister(size_t preg, const OpArg& new_loc)
void GPRRegCache::StoreRegister(preg_t preg, const OpArg& new_loc)
{
m_emitter->MOV(32, new_loc, m_regs[preg].location);
m_emitter->MOV(32, new_loc, m_regs[preg].Location());
}
void GPRRegCache::LoadRegister(size_t preg, X64Reg new_loc)
void GPRRegCache::LoadRegister(preg_t preg, X64Reg new_loc)
{
m_emitter->MOV(32, ::Gen::R(new_loc), m_regs[preg].location);
m_emitter->MOV(32, ::Gen::R(new_loc), m_regs[preg].Location());
}
OpArg GPRRegCache::GetDefaultLocation(size_t reg) const
OpArg GPRRegCache::GetDefaultLocation(preg_t preg) const
{
return PPCSTATE(gpr[reg]);
return PPCSTATE(gpr[preg]);
}
const X64Reg* GPRRegCache::GetAllocationOrder(size_t* count) const
@@ -46,21 +46,20 @@ const X64Reg* GPRRegCache::GetAllocationOrder(size_t* count) const
return allocation_order;
}
void GPRRegCache::SetImmediate32(size_t preg, u32 imm_value, bool dirty)
void GPRRegCache::SetImmediate32(preg_t preg, u32 imm_value, bool dirty)
{
// "dirty" can be false to avoid redundantly flushing an immediate when
// processing speculative constants.
DiscardRegContentsIfCached(preg);
m_regs[preg].away |= dirty;
m_regs[preg].location = Imm32(imm_value);
m_regs[preg].SetToImm32(imm_value, dirty);
}
BitSet32 GPRRegCache::GetRegUtilization() const
{
return m_jit.js.op->gprInReg;
}
BitSet32 GPRRegCache::CountRegsIn(size_t preg, u32 lookahead) const
BitSet32 GPRRegCache::CountRegsIn(preg_t preg, u32 lookahead) const
{
BitSet32 regs_used;
@@ -12,12 +12,13 @@ class GPRRegCache final : public RegCache
{
public:
explicit GPRRegCache(Jit64& jit);
Gen::OpArg GetDefaultLocation(preg_t preg) const override;
void SetImmediate32(preg_t preg, u32 imm_value, bool dirty = true);
void StoreRegister(size_t preg, const Gen::OpArg& new_loc) override;
void LoadRegister(size_t preg, Gen::X64Reg new_loc) override;
Gen::OpArg GetDefaultLocation(size_t reg) const override;
protected:
void StoreRegister(preg_t preg, const Gen::OpArg& new_loc) override;
void LoadRegister(preg_t preg, Gen::X64Reg new_loc) override;
const Gen::X64Reg* GetAllocationOrder(size_t* count) const override;
void SetImmediate32(size_t preg, u32 imm_value, bool dirty = true);
BitSet32 GetRegUtilization() const override;
BitSet32 CountRegsIn(size_t preg, u32 lookahead) const override;
BitSet32 CountRegsIn(preg_t preg, u32 lookahead) const override;
};
@@ -935,10 +935,10 @@ u8* Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
}
#if defined(_DEBUG) || defined(DEBUGFAST)
if (gpr.SanityCheck() || fpr.SanityCheck())
if (!gpr.SanityCheck() || !fpr.SanityCheck())
{
std::string ppc_inst = Common::GekkoDisassembler::Disassemble(op.inst.hex, em_address);
// NOTICE_LOG(DYNA_REC, "Unflushed register: %s", ppc_inst.c_str());
NOTICE_LOG(DYNA_REC, "Unflushed register: %s", ppc_inst.c_str());
}
#endif
i += js.skipInstructions;
Oops, something went wrong.

0 comments on commit e630218

Please sign in to comment.