Merge pull request #9767 from JosJuice/jitarm64-fpr-callee-saved

JitArm64: Improve Arm64FPRCache::GetCallerSavedUsed
This commit is contained in:
Markus Wick 2021-07-23 01:53:44 +02:00 committed by GitHub
commit 8ad7508620
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -742,6 +742,17 @@ bool Arm64FPRCache::IsCalleeSaved(ARM64Reg reg) const
return std::find(callee_regs.begin(), callee_regs.end(), reg) != callee_regs.end();
}
bool Arm64FPRCache::IsTopHalfUsed(ARM64Reg reg) const
{
for (const OpArg& r : m_guest_registers)
{
if (r.GetReg() != ARM64Reg::INVALID_REG && DecodeReg(r.GetReg()) == DecodeReg(reg))
return r.GetType() == RegType::Register;
}
return false;
}
void Arm64FPRCache::FlushRegister(size_t preg, bool maintain_state, ARM64Reg tmp_reg)
{
OpArg& reg = m_guest_registers[preg];
@ -846,7 +857,7 @@ BitSet32 Arm64FPRCache::GetCallerSavedUsed() const
BitSet32 registers(0);
for (const auto& it : m_host_registers)
{
if (it.IsLocked())
if (it.IsLocked() && (!IsCalleeSaved(it.GetReg()) || IsTopHalfUsed(it.GetReg())))
registers[DecodeReg(it.GetReg())] = true;
}
return registers;

View File

@ -351,6 +351,7 @@ protected:
private:
bool IsCalleeSaved(Arm64Gen::ARM64Reg reg) const;
bool IsTopHalfUsed(Arm64Gen::ARM64Reg reg) const;
void FlushRegisters(BitSet32 regs, bool maintain_state, Arm64Gen::ARM64Reg tmp_reg);
};