diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index f1051a2454..0705366aec 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -967,15 +967,8 @@ BitSet8 Jit64::ComputeStaticGQRs(const PPCAnalyst::CodeBlock& cb) const BitSet32 Jit64::CallerSavedRegistersInUse() const { - BitSet32 result; - for (size_t i = 0; i < NUM_XREGS; i++) - { - if (!gpr.IsFreeX(i)) - result[i] = true; - if (!fpr.IsFreeX(i)) - result[16 + i] = true; - } - return result & ABI_ALL_CALLER_SAVED; + BitSet32 in_use = gpr.RegistersInUse() | (fpr.RegistersInUse() << 16); + return in_use & ABI_ALL_CALLER_SAVED; } void Jit64::EnableBlockLink() diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp index 690bb93444..0edf0ac875 100644 --- a/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp +++ b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp @@ -677,6 +677,17 @@ void RegCache::PreloadRegisters(BitSet32 to_preload) } } +BitSet32 RegCache::RegistersInUse() const +{ + BitSet32 result; + for (size_t i = 0; i < m_xregs.size(); i++) + { + if (!m_xregs[i].IsFree()) + result[i] = true; + } + return result; +} + void RegCache::NewLock(preg_t preg) { m_regs[preg].Lock(); diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.h b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.h index dc189aa553..67f010d0d6 100644 --- a/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.h +++ b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.h @@ -247,6 +247,7 @@ public: bool IsAllUnlocked() const; void PreloadRegisters(BitSet32 regs); + BitSet32 RegistersInUse() const; protected: friend class RCOpArg;