JitRegCache: Add PreloadRegisters function
This commit is contained in:
parent
9f683f9bb1
commit
096392f295
|
@ -873,20 +873,8 @@ u8* Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
|
||||||
// output, which needs to be bound in the actual instruction compilation.
|
// output, which needs to be bound in the actual instruction compilation.
|
||||||
// TODO: make this smarter in the case that we're actually register-starved, i.e.
|
// TODO: make this smarter in the case that we're actually register-starved, i.e.
|
||||||
// prioritize the more important registers.
|
// prioritize the more important registers.
|
||||||
for (int reg : op.regsIn)
|
gpr.PreloadRegisters(op.regsIn & op.gprInReg);
|
||||||
{
|
fpr.PreloadRegisters(op.fregsIn & op.fprInXmm);
|
||||||
if (gpr.NumFreeRegisters() < 2)
|
|
||||||
break;
|
|
||||||
if (op.gprInReg[reg] && !gpr.R(reg).IsImm())
|
|
||||||
gpr.BindToRegister(reg, true, false);
|
|
||||||
}
|
|
||||||
for (int reg : op.fregsIn)
|
|
||||||
{
|
|
||||||
if (fpr.NumFreeRegisters() < 2)
|
|
||||||
break;
|
|
||||||
if (op.fprInXmm[reg])
|
|
||||||
fpr.BindToRegister(reg, true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
CompileInstruction(op);
|
CompileInstruction(op);
|
||||||
|
|
||||||
|
|
|
@ -666,6 +666,17 @@ bool RegCache::IsAllUnlocked() const
|
||||||
!IsAnyConstraintActive();
|
!IsAnyConstraintActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RegCache::PreloadRegisters(BitSet32 to_preload)
|
||||||
|
{
|
||||||
|
for (preg_t preg : to_preload)
|
||||||
|
{
|
||||||
|
if (NumFreeRegisters() < 2)
|
||||||
|
return;
|
||||||
|
if (!R(preg).IsImm())
|
||||||
|
BindToRegister(preg, true, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RegCache::NewLock(preg_t preg)
|
void RegCache::NewLock(preg_t preg)
|
||||||
{
|
{
|
||||||
m_regs[preg].Lock();
|
m_regs[preg].Lock();
|
||||||
|
|
|
@ -246,6 +246,8 @@ public:
|
||||||
|
|
||||||
bool IsAllUnlocked() const;
|
bool IsAllUnlocked() const;
|
||||||
|
|
||||||
|
void PreloadRegisters(BitSet32 regs);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class RCOpArg;
|
friend class RCOpArg;
|
||||||
friend class RCX64Reg;
|
friend class RCX64Reg;
|
||||||
|
|
Loading…
Reference in New Issue