diff --git a/Source/Core/Core/PowerPC/Jit64Common/ConstantPool.cpp b/Source/Core/Core/PowerPC/Jit64Common/ConstantPool.cpp index cd8da238a0..24db1f12c4 100644 --- a/Source/Core/Core/PowerPC/Jit64Common/ConstantPool.cpp +++ b/Source/Core/Core/PowerPC/Jit64Common/ConstantPool.cpp @@ -7,7 +7,6 @@ #include #include "Common/Assert.h" -#include "Common/x64Emitter.h" #include "Core/PowerPC/Jit64Common/ConstantPool.h" ConstantPool::ConstantPool() = default; @@ -37,8 +36,8 @@ void ConstantPool::Shutdown() m_const_info.clear(); } -Gen::OpArg ConstantPool::GetConstantOpArg(const void* value, size_t element_size, - size_t num_elements, size_t index) +const void* ConstantPool::GetConstant(const void* value, size_t element_size, size_t num_elements, + size_t index) { const size_t value_size = element_size * num_elements; auto iter = m_const_info.find(value); @@ -59,5 +58,5 @@ Gen::OpArg ConstantPool::GetConstantOpArg(const void* value, size_t element_size _assert_msg_(DYNA_REC, info.m_size == value_size, "Constant has incorrect size in constant pool."); u8* location = static_cast(info.m_location); - return Gen::M(location + element_size * index); + return location + element_size * index; } diff --git a/Source/Core/Core/PowerPC/Jit64Common/ConstantPool.h b/Source/Core/Core/PowerPC/Jit64Common/ConstantPool.h index 732a41af9d..51e6e84d7d 100644 --- a/Source/Core/Core/PowerPC/Jit64Common/ConstantPool.h +++ b/Source/Core/Core/PowerPC/Jit64Common/ConstantPool.h @@ -7,12 +7,6 @@ #include #include -namespace Gen -{ -struct OpArg; -class X64CodeBlock; -} - // Constants are copied into this pool so that they live at a memory location // that is close to the code that references it. This ensures that the 32-bit // limitation on RIP addressing is not an issue. @@ -32,8 +26,8 @@ public: // Copies the value into the pool if it doesn't exist. Returns a pointer // to existing values if they were already copied. Pointer equality is // used to determine if two constants are the same. - Gen::OpArg GetConstantOpArg(const void* value, size_t element_size, size_t num_elements, - size_t index); + const void* GetConstant(const void* value, size_t element_size, size_t num_elements, + size_t index); private: struct ConstantInfo diff --git a/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.h b/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.h index 244494a31e..20e44d0bc0 100644 --- a/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.h +++ b/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.h @@ -29,16 +29,22 @@ public: void SwitchToFarCode(); void SwitchToNearCode(); + template + const void* GetConstantFromPool(const T& value) + { + return m_const_pool.GetConstant(&value, sizeof(T), 1, 0); + } + template Gen::OpArg MConst(const T& value) { - return m_const_pool.GetConstantOpArg(&value, sizeof(T), 1, 0); + return Gen::M(GetConstantFromPool(value)); } template Gen::OpArg MConst(const T (&value)[N], size_t index = 0) { - return m_const_pool.GetConstantOpArg(&value, sizeof(T), N, index); + return Gen::M(m_const_pool.GetConstant(&value, sizeof(T), N, index)); } Gen::FixupBranch CheckIfSafeAddress(const Gen::OpArg& reg_value, Gen::X64Reg reg_addr,