Permalink
Browse files

JitRegCache: Add PreloadRegisters function

  • Loading branch information...
MerryMage committed Oct 15, 2018
1 parent 9f683f9 commit 096392f295efebe54ee99a454f83c95f2ebc9190
@@ -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.
// TODO: make this smarter in the case that we're actually register-starved, i.e.
// prioritize the more important registers.
for (int reg : op.regsIn)
{
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);
}
gpr.PreloadRegisters(op.regsIn & op.gprInReg);
fpr.PreloadRegisters(op.fregsIn & op.fprInXmm);
CompileInstruction(op);
@@ -666,6 +666,17 @@ bool RegCache::IsAllUnlocked() const
!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)
{
m_regs[preg].Lock();
@@ -246,6 +246,8 @@ class RegCache
bool IsAllUnlocked() const;
void PreloadRegisters(BitSet32 regs);
protected:
friend class RCOpArg;
friend class RCX64Reg;

0 comments on commit 096392f

Please sign in to comment.