diff --git a/Android/jni/Project64-core/CMakeLists.txt b/Android/jni/Project64-core/CMakeLists.txt index b30e2ed3d..4d0ba912a 100644 --- a/Android/jni/Project64-core/CMakeLists.txt +++ b/Android/jni/Project64-core/CMakeLists.txt @@ -53,6 +53,7 @@ add_library(Project64-core STATIC N64System/Recompiler/JumpInfo.cpp N64System/Recompiler/LoopAnalysis.cpp N64System/Recompiler/Recompiler.cpp + N64System/Recompiler/RecompilerOps.cpp N64System/Recompiler/RecompilerMemory.cpp N64System/Recompiler/RegBase.cpp N64System/Recompiler/Aarch64/Aarch64ops.cpp diff --git a/Source/Project64-core/N64System/Interpreter/InterpreterOps.h b/Source/Project64-core/N64System/Interpreter/InterpreterOps.h index ed6de6c57..7f3498c84 100644 --- a/Source/Project64-core/N64System/Interpreter/InterpreterOps.h +++ b/Source/Project64-core/N64System/Interpreter/InterpreterOps.h @@ -246,7 +246,6 @@ protected: static Func Jump_CoP1_L[64]; static void GenerateAddressErrorException(uint64_t VAddr, bool FromRead); - static void GenerateFloatingPointException(void); static void GenerateOverflowException(void); static void GenerateTLBReadException(uint64_t VAddr, const char * function); static void GenerateTLBWriteException(uint64_t VAddr, const char * function); diff --git a/Source/Project64-core/N64System/N64System.cpp b/Source/Project64-core/N64System/N64System.cpp index c82fa1a9e..29c726726 100644 --- a/Source/Project64-core/N64System/N64System.cpp +++ b/Source/Project64-core/N64System/N64System.cpp @@ -1482,29 +1482,25 @@ void CN64System::SyncCPU(CN64System * const SecondCPU) if (bFastSP() && m_Recomp) { -#if defined(__aarch64__) || defined(__amd64__) || defined(_M_X64) - g_Notify->BreakPoint(__FILE__, __LINE__); -#else uint32_t StackPointer = (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF); - uint32_t TargetStackPos = 0; + uint8_t * TargetStackPos = nullptr; if (StackPointer < m_MMU_VM.RdramSize()) { - TargetStackPos = (uint32_t)(m_MMU_VM.Rdram() + StackPointer); + TargetStackPos = m_MMU_VM.Rdram() + StackPointer; } else if (StackPointer > 0x04000000 && StackPointer < 0x04001000) { - TargetStackPos = (uint32_t)(m_MMU_VM.Dmem() + StackPointer - 0x04000000); + TargetStackPos = m_MMU_VM.Dmem() + StackPointer - 0x04000000; } else if (StackPointer > 0x04001000 && StackPointer < 0x04002000) { - TargetStackPos = (uint32_t)(m_MMU_VM.Imem() + StackPointer - 0x04001000); + TargetStackPos = m_MMU_VM.Imem() + StackPointer - 0x04001000; } if (m_Recomp->MemoryStackPos() != TargetStackPos) { ErrorFound = true; } -#endif } if (m_SystemTimer != SecondCPU->m_SystemTimer) @@ -1679,29 +1675,25 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU) } if (bFastSP() && m_Recomp) { -#if defined(__aarch64__) || defined(__amd64__) || defined(_M_X64) - g_Notify->BreakPoint(__FILE__, __LINE__); -#else uint32_t StackPointer = (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF); - uint32_t TargetStackPos = 0; + uint8_t * TargetStackPos = nullptr; if (StackPointer < m_MMU_VM.RdramSize()) { - TargetStackPos = (uint32_t)(m_MMU_VM.Rdram() + StackPointer); + TargetStackPos = m_MMU_VM.Rdram() + StackPointer; } else if (StackPointer > 0x04000000 && StackPointer < 0x04001000) { - TargetStackPos = (uint32_t)(m_MMU_VM.Dmem() + StackPointer - 0x04000000); + TargetStackPos = m_MMU_VM.Dmem() + StackPointer - 0x04000000; } else if (StackPointer > 0x04001000 && StackPointer < 0x04002000) { - TargetStackPos = (uint32_t)(m_MMU_VM.Imem() + StackPointer - 0x04001000); + TargetStackPos = m_MMU_VM.Imem() + StackPointer - 0x04001000; } if (m_Recomp->MemoryStackPos() != TargetStackPos) { - Error.LogF("MemoryStack = %X should be: %X\r\n", m_Recomp->MemoryStackPos(), (uint32_t)(m_MMU_VM.Rdram() + (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF))); + Error.LogF("MemoryStack = %p should be: %p\r\n", m_Recomp->MemoryStackPos(), (uint32_t)(m_MMU_VM.Rdram() + (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF))); } -#endif } uint32_t *Rdram = (uint32_t *)m_MMU_VM.Rdram(), *Rdram2 = (uint32_t *)SecondCPU->m_MMU_VM.Rdram(); diff --git a/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp b/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp index 79bda2c1a..a954c1506 100644 --- a/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp +++ b/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp @@ -13,7 +13,7 @@ extern "C" void __clear_cache_android(uint8_t * begin, uint8_t * end); #endif -CCodeBlock::CCodeBlock(CMipsMemoryVM & MMU, uint32_t VAddrEnter) : +CCodeBlock::CCodeBlock(CMipsMemoryVM & MMU, CRegisters & Reg, uint32_t VAddrEnter) : m_MMU(MMU), m_VAddrEnter(VAddrEnter), m_VAddrFirst(VAddrEnter), @@ -34,7 +34,9 @@ CCodeBlock::CCodeBlock(CMipsMemoryVM & MMU, uint32_t VAddrEnter) : } #endif #if defined(__i386__) || defined(_M_IX86) - m_RecompilerOps = new CX86RecompilerOps(MMU, *this); + m_RecompilerOps = new CX86RecompilerOps(MMU, Reg, *this); +#elif defined(__amd64__) || defined(_M_X64) + m_RecompilerOps = new CX64RecompilerOps(MMU, Reg, *this); #elif defined(__arm__) || defined(_M_ARM) m_RecompilerOps = new CArmRecompilerOps(MMU, *this); #else diff --git a/Source/Project64-core/N64System/Recompiler/CodeBlock.h b/Source/Project64-core/N64System/Recompiler/CodeBlock.h index bd9692362..58a473f17 100644 --- a/Source/Project64-core/N64System/Recompiler/CodeBlock.h +++ b/Source/Project64-core/N64System/Recompiler/CodeBlock.h @@ -13,7 +13,7 @@ class CCodeBlock : public asmjit::ErrorHandler { public: - CCodeBlock(CMipsMemoryVM & MMU, uint32_t VAddrEnter); + CCodeBlock(CMipsMemoryVM & MMU, CRegisters & Reg, uint32_t VAddrEnter); ~CCodeBlock(); bool Compile(); diff --git a/Source/Project64-core/N64System/Recompiler/CodeSection.cpp b/Source/Project64-core/N64System/Recompiler/CodeSection.cpp index 9a57ebd55..646f9f841 100644 --- a/Source/Project64-core/N64System/Recompiler/CodeSection.cpp +++ b/Source/Project64-core/N64System/Recompiler/CodeSection.cpp @@ -357,7 +357,6 @@ bool CCodeSection::ParentContinue() bool CCodeSection::GenerateNativeCode(uint32_t Test) { -#if defined(__i386__) || defined(_M_IX86) if (m_EnterLabel.isValid()) { if (m_Test == Test) @@ -785,10 +784,6 @@ bool CCodeSection::GenerateNativeCode(uint32_t Test) m_RecompilerOps->SetNextStepType(PIPELINE_STAGE_END_BLOCK); } } while (m_RecompilerOps->GetNextStepType() != PIPELINE_STAGE_END_BLOCK); -#else - Test = Test; - g_Notify->BreakPoint(__FILE__, __LINE__); -#endif return true; } diff --git a/Source/Project64-core/N64System/Recompiler/Recompiler.cpp b/Source/Project64-core/N64System/Recompiler/Recompiler.cpp index 8266be9e6..dd398a2c5 100644 --- a/Source/Project64-core/N64System/Recompiler/Recompiler.cpp +++ b/Source/Project64-core/N64System/Recompiler/Recompiler.cpp @@ -374,7 +374,7 @@ CCompiledFunc * CRecompiler::CompileCode() CheckRecompMem(); WriteTrace(TraceRecompiler, TraceDebug, "Compile Block-Start: Program Counter: %X pAddr: %X", PROGRAM_COUNTER, pAddr); - CCodeBlock CodeBlock(m_MMU, PROGRAM_COUNTER); + CCodeBlock CodeBlock(m_MMU, m_Registers, PROGRAM_COUNTER); if (!CodeBlock.Compile()) { return nullptr; diff --git a/Source/Project64-core/N64System/Recompiler/RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/RecompilerOps.cpp new file mode 100644 index 000000000..677039ef7 --- /dev/null +++ b/Source/Project64-core/N64System/Recompiler/RecompilerOps.cpp @@ -0,0 +1,15 @@ +#include "stdafx.h" + +#include "RecompilerOps.h" + +CRecompilerOpsBase::CRecompilerOpsBase(CMipsMemoryVM & MMU, CRegisters & Reg, CCodeBlock & CodeBlock) : + m_Reg(Reg), + m_MMU(MMU), + m_CodeBlock(CodeBlock), + m_Section(nullptr) +{ +} + +CRecompilerOpsBase::~CRecompilerOpsBase() +{ +} diff --git a/Source/Project64-core/N64System/Recompiler/RecompilerOps.h b/Source/Project64-core/N64System/Recompiler/RecompilerOps.h index 9fc52e55d..ecf75b299 100644 --- a/Source/Project64-core/N64System/Recompiler/RecompilerOps.h +++ b/Source/Project64-core/N64System/Recompiler/RecompilerOps.h @@ -1,4 +1,6 @@ #pragma once +#include +#include enum RecompilerBranchType { @@ -35,6 +37,29 @@ enum RecompilerTrapCompare RecompilerTrapCompare_TLTIU, }; +class CCodeBlock; +class CCodeSection; +class CMipsMemoryVM; +class CRegisters; + +class CRecompilerOpsBase : + protected CDebugSettings +{ +protected: + CRecompilerOpsBase(CMipsMemoryVM & MMU, CRegisters & Reg, CCodeBlock & CodeBlock); + ~CRecompilerOpsBase(); + + CMipsMemoryVM & m_MMU; + CRegisters & m_Reg; + CCodeBlock & m_CodeBlock; + R4300iOpcode m_Opcode; + CCodeSection * m_Section; + +private: + CRecompilerOpsBase(const CRecompilerOpsBase &); + CRecompilerOpsBase & operator=(const CRecompilerOpsBase &); +}; + #if defined(__i386__) || defined(_M_IX86) #include diff --git a/Source/Project64-core/N64System/Recompiler/x64-86/x64RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x64-86/x64RecompilerOps.cpp index 6013b9750..2908788a0 100644 --- a/Source/Project64-core/N64System/Recompiler/x64-86/x64RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/x64-86/x64RecompilerOps.cpp @@ -1,9 +1,12 @@ #include "stdafx.h" #if defined(__amd64__) || defined(_M_X64) -#include +#include +#include +#include -CX64RecompilerOps::CX64RecompilerOps(CMipsMemoryVM & /*MMU*/, CCodeBlock & CodeBlock) : +CX64RecompilerOps::CX64RecompilerOps(CMipsMemoryVM & MMU, CRegisters & Reg, CCodeBlock & CodeBlock) : + CRecompilerOpsBase(MMU, Reg, CodeBlock), m_Assembler(CodeBlock), m_RegWorkingSet(CodeBlock, m_Assembler) { @@ -795,12 +798,10 @@ void CX64RecompilerOps::UnknownOpcode() void CX64RecompilerOps::EnterCodeBlock() { - g_Notify->BreakPoint(__FILE__, __LINE__); } void CX64RecompilerOps::CompileExitCode() { - g_Notify->BreakPoint(__FILE__, __LINE__); } void CX64RecompilerOps::CompileInPermLoop(CRegInfo & /*RegSet*/, uint32_t /*ProgramCounter*/) @@ -813,14 +814,14 @@ void CX64RecompilerOps::SyncRegState(const CRegInfo & /*SyncTo*/) g_Notify->BreakPoint(__FILE__, __LINE__); } -CRegInfo & CX64RecompilerOps::GetRegWorkingSet(void) +CX64RegInfo & CX64RecompilerOps::GetRegWorkingSet(void) { return m_RegWorkingSet; } -void CX64RecompilerOps::SetRegWorkingSet(const CRegInfo & /*RegInfo*/) +void CX64RecompilerOps::SetRegWorkingSet(const CX64RegInfo & RegInfo) { - g_Notify->BreakPoint(__FILE__, __LINE__); + m_RegWorkingSet = RegInfo; } bool CX64RecompilerOps::InheritParentInfo() diff --git a/Source/Project64-core/N64System/Recompiler/x64-86/x64RecompilerOps.h b/Source/Project64-core/N64System/Recompiler/x64-86/x64RecompilerOps.h index bc1758a09..38dc46f35 100644 --- a/Source/Project64-core/N64System/Recompiler/x64-86/x64RecompilerOps.h +++ b/Source/Project64-core/N64System/Recompiler/x64-86/x64RecompilerOps.h @@ -1,22 +1,19 @@ #pragma once #if defined(__amd64__) || defined(_M_X64) -#include #include #include #include #include -class CMipsMemoryVM; -class CCodeBlock; -class CCodeSection; class CX64Ops; struct CJumpInfo; -class CX64RecompilerOps +class CX64RecompilerOps : + public CRecompilerOpsBase { public: - CX64RecompilerOps(CMipsMemoryVM & MMU, CCodeBlock & CodeBlock); + CX64RecompilerOps(CMipsMemoryVM & MMU, CRegisters & Reg, CCodeBlock & CodeBlock); ~CX64RecompilerOps(); // Trap functions @@ -203,8 +200,8 @@ public: void CompileExitCode(); void CompileInPermLoop(CRegInfo & RegSet, uint32_t ProgramCounter); void SyncRegState(const CRegInfo & SyncTo); - CRegInfo & GetRegWorkingSet(void); - void SetRegWorkingSet(const CRegInfo & RegInfo); + CX64RegInfo & GetRegWorkingSet(void); + void SetRegWorkingSet(const CX64RegInfo & RegInfo); bool InheritParentInfo(); void LinkJump(CJumpInfo & JumpInfo, uint32_t SectionID = -1, uint32_t FromSectionID = -1); void JumpToSection(CCodeSection * Section); @@ -235,7 +232,6 @@ private: CX64RegInfo m_RegWorkingSet; CX64Ops m_Assembler; - R4300iOpcode m_Opcode; }; typedef CX64RecompilerOps CRecompilerOps; diff --git a/Source/Project64-core/N64System/Recompiler/x64-86/x64RegInfo.cpp b/Source/Project64-core/N64System/Recompiler/x64-86/x64RegInfo.cpp index 51e4c61e8..a73f1d4ff 100644 --- a/Source/Project64-core/N64System/Recompiler/x64-86/x64RegInfo.cpp +++ b/Source/Project64-core/N64System/Recompiler/x64-86/x64RegInfo.cpp @@ -19,20 +19,28 @@ CX64RegInfo::~CX64RegInfo() CX64RegInfo & CX64RegInfo::operator=(const CX64RegInfo & right) { CRegBase::operator=(right); - g_Notify->BreakPoint(__FILE__, __LINE__); +#ifdef _DEBUG + if (*this != right) + { + g_Notify->BreakPoint(__FILE__, __LINE__); + } +#endif return *this; } -bool CX64RegInfo::operator==(const CX64RegInfo & /*right*/) const +bool CX64RegInfo::operator==(const CX64RegInfo & Right) const { - g_Notify->BreakPoint(__FILE__, __LINE__); - return false; + if (!CRegBase::operator==(Right)) + { + return false; + } + + return true; } -bool CX64RegInfo::operator!=(const CX64RegInfo & /*right*/) const +bool CX64RegInfo::operator!=(const CX64RegInfo & Right) const { - g_Notify->BreakPoint(__FILE__, __LINE__); - return false; + return !(Right == *this); } void CX64RegInfo::UnMap_GPR(uint32_t /*Reg*/, bool /*WriteBackValue*/) diff --git a/Source/Project64-core/N64System/Recompiler/x64-86/x64ops.cpp b/Source/Project64-core/N64System/Recompiler/x64-86/x64ops.cpp index 8f9f9c4d9..7985eb96a 100644 --- a/Source/Project64-core/N64System/Recompiler/x64-86/x64ops.cpp +++ b/Source/Project64-core/N64System/Recompiler/x64-86/x64ops.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #if defined(__amd64__) || defined(_M_X64) +#include #include CX64Ops::CX64Ops(CCodeBlock & CodeBlock) : @@ -8,4 +9,16 @@ CX64Ops::CX64Ops(CCodeBlock & CodeBlock) : { } +asmjit::Error CX64Ops::_log(const char * data, size_t size) noexcept +{ + stdstr AsmjitLog(std::string(data, size)); + AsmjitLog.Trim("\n"); + for (SymbolMap::const_iterator itr = m_Symbols.begin(); itr != m_Symbols.end(); itr++) + { + AsmjitLog.Replace(itr->first, itr->second); + } + m_CodeBlock.Log(" %s", AsmjitLog.c_str()); + return asmjit::kErrorOk; +} + #endif \ No newline at end of file diff --git a/Source/Project64-core/N64System/Recompiler/x64-86/x64ops.h b/Source/Project64-core/N64System/Recompiler/x64-86/x64ops.h index 88f3492bb..18e4fd137 100644 --- a/Source/Project64-core/N64System/Recompiler/x64-86/x64ops.h +++ b/Source/Project64-core/N64System/Recompiler/x64-86/x64ops.h @@ -1,9 +1,14 @@ #pragma once #if defined(__amd64__) || defined(_M_X64) +#include +#include +#include class CCodeBlock; -class CX64Ops +class CX64Ops : + public asmjit::x86::Assembler, + public asmjit::Logger { public: CX64Ops(CCodeBlock & CodeBlock); @@ -13,6 +18,11 @@ private: CX64Ops(const CX64Ops &); CX64Ops & operator=(const CX64Ops &); + asmjit::Error _log(const char * data, size_t size) noexcept; + + typedef std::map SymbolMap; + + SymbolMap m_Symbols; CCodeBlock & m_CodeBlock; }; diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp index a309d928d..fa67e2556 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp @@ -177,13 +177,11 @@ static void x86TestWriteBreakpoint64() } } -CX86RecompilerOps::CX86RecompilerOps(CMipsMemoryVM & MMU, CCodeBlock & CodeBlock) : - m_MMU(MMU), - m_CodeBlock(CodeBlock), +CX86RecompilerOps::CX86RecompilerOps(CMipsMemoryVM & MMU, CRegisters & Reg, CCodeBlock & CodeBlock) : + CRecompilerOpsBase(MMU, Reg, CodeBlock), m_Assembler(CodeBlock), m_RegWorkingSet(CodeBlock, m_Assembler), m_CompilePC(0), - m_Section(nullptr), m_RegBeforeDelay(CodeBlock, m_Assembler), m_EffectDelaySlot(false) { @@ -1148,31 +1146,31 @@ void CX86RecompilerOps::BNE_Compare() { if (Is64Bit(KnownReg)) { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], GetMipsRegHi(KnownReg)); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], GetMipsRegHi(KnownReg)); } else if (IsSigned(KnownReg)) { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], (GetMipsRegLo_S(KnownReg) >> 31)); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], (GetMipsRegLo_S(KnownReg) >> 31)); } else { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], 0); } } else { if (Is64Bit(KnownReg)) { - m_Assembler.CompX86regToVariable(GetMipsRegMapHi(KnownReg), &_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); + m_Assembler.CompX86regToVariable(GetMipsRegMapHi(KnownReg), &m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); } else if (IsSigned(KnownReg)) { ProtectGPR(KnownReg); - m_Assembler.CompX86regToVariable(Map_TempReg(x86Reg_Unknown, KnownReg, true, false), &_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); + m_Assembler.CompX86regToVariable(Map_TempReg(x86Reg_Unknown, KnownReg, true, false), &m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); } else { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], 0); } } if (m_Section->m_Jump.FallThrough) @@ -1188,11 +1186,11 @@ void CX86RecompilerOps::BNE_Compare() } if (IsConst(KnownReg)) { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg], GetMipsRegLo(KnownReg)); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg], GetMipsRegLo(KnownReg)); } else { - m_Assembler.CompX86regToVariable(GetMipsRegMapLo(KnownReg), &_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); + m_Assembler.CompX86regToVariable(GetMipsRegMapLo(KnownReg), &m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); } if (m_Section->m_Cont.FallThrough) { @@ -1241,7 +1239,7 @@ void CX86RecompilerOps::BNE_Compare() if (!b32BitCore()) { Reg = Map_TempReg(x86Reg_Unknown, m_Opcode.rt, true, false); - m_Assembler.CompX86regToVariable(Reg, &_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]); + m_Assembler.CompX86regToVariable(Reg, &m_Reg.m_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]); if (m_Section->m_Jump.FallThrough) { Jump = m_Assembler.newLabel(); @@ -1255,7 +1253,7 @@ void CX86RecompilerOps::BNE_Compare() } Reg = Map_TempReg(Reg, m_Opcode.rt, false, false); - m_Assembler.CompX86regToVariable(Reg, &_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); + m_Assembler.CompX86regToVariable(Reg, &m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); if (m_Section->m_Cont.FallThrough) { if (b32BitCore()) @@ -1471,15 +1469,15 @@ void CX86RecompilerOps::BEQ_Compare() { if (Is64Bit(KnownReg)) { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], GetMipsRegHi(KnownReg)); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], GetMipsRegHi(KnownReg)); } else if (IsSigned(KnownReg)) { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], GetMipsRegLo_S(KnownReg) >> 31); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], GetMipsRegLo_S(KnownReg) >> 31); } else { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], 0); } } else @@ -1487,15 +1485,15 @@ void CX86RecompilerOps::BEQ_Compare() ProtectGPR(KnownReg); if (Is64Bit(KnownReg)) { - m_Assembler.CompX86regToVariable(GetMipsRegMapHi(KnownReg), &_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); + m_Assembler.CompX86regToVariable(GetMipsRegMapHi(KnownReg), &m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); } else if (IsSigned(KnownReg)) { - m_Assembler.CompX86regToVariable(Map_TempReg(x86Reg_Unknown, KnownReg, true, false), &_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); + m_Assembler.CompX86regToVariable(Map_TempReg(x86Reg_Unknown, KnownReg, true, false), &m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); } else { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], 0); } } if (m_Section->m_Cont.FallThrough) @@ -1511,11 +1509,11 @@ void CX86RecompilerOps::BEQ_Compare() } if (IsConst(KnownReg)) { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg], GetMipsRegLo(KnownReg)); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg], GetMipsRegLo(KnownReg)); } else { - m_Assembler.CompX86regToVariable(GetMipsRegMapLo(KnownReg), &_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); + m_Assembler.CompX86regToVariable(GetMipsRegMapLo(KnownReg), &m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); } if (m_Section->m_Cont.FallThrough) { @@ -1554,7 +1552,7 @@ void CX86RecompilerOps::BEQ_Compare() if (!b32BitCore()) { Reg = Map_TempReg(x86Reg_Unknown, m_Opcode.rs, true, false); - m_Assembler.CompX86regToVariable(Reg, &_GPR[m_Opcode.rt].W[1], CRegName::GPR_Hi[m_Opcode.rt]); + m_Assembler.CompX86regToVariable(Reg, &m_Reg.m_GPR[m_Opcode.rt].W[1], CRegName::GPR_Hi[m_Opcode.rt]); if (m_Section->m_Cont.FallThrough) { Jump = m_Assembler.newLabel(); @@ -1566,7 +1564,7 @@ void CX86RecompilerOps::BEQ_Compare() m_Assembler.JneLabel(m_Section->m_Cont.BranchLabel.c_str(), m_Section->m_Cont.LinkLocation); } } - m_Assembler.CompX86regToVariable(Map_TempReg(Reg, m_Opcode.rs, false, false), &_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.CompX86regToVariable(Map_TempReg(Reg, m_Opcode.rs, false, false), &m_Reg.m_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); if (m_Section->m_Cont.FallThrough) { m_Section->m_Jump.LinkLocation = m_Assembler.newLabel(); @@ -1662,7 +1660,7 @@ void CX86RecompilerOps::BGTZ_Compare() } else if (IsUnknown(m_Opcode.rs) && b32BitCore()) { - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], 0); if (m_Section->m_Jump.FallThrough) { m_Section->m_Cont.LinkLocation = m_Assembler.newLabel(); @@ -1691,7 +1689,7 @@ void CX86RecompilerOps::BGTZ_Compare() } else { - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs], 0); } if (m_Section->m_Jump.FallThrough) { @@ -1721,7 +1719,7 @@ void CX86RecompilerOps::BGTZ_Compare() } else { - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], 0); } if (m_Section->m_Jump.FallThrough) { @@ -1822,7 +1820,7 @@ void CX86RecompilerOps::BLEZ_Compare() } else { - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs], 0); } if (m_Section->m_Jump.FallThrough) { @@ -1852,7 +1850,7 @@ void CX86RecompilerOps::BLEZ_Compare() } else { - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], 0); } if (m_Section->m_Jump.FallThrough) { @@ -1881,7 +1879,7 @@ void CX86RecompilerOps::BLEZ_Compare() if (!b32BitCore()) { - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs], 0); if (m_Section->m_Jump.FallThrough) { m_Section->m_Cont.LinkLocation = m_Assembler.newLabel(); @@ -1903,7 +1901,7 @@ void CX86RecompilerOps::BLEZ_Compare() m_Section->m_Jump.LinkLocation = m_Assembler.newLabel(); m_Assembler.JlLabel(m_Section->m_Jump.BranchLabel.c_str(), m_Section->m_Jump.LinkLocation); } - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], 0); if (m_Section->m_Jump.FallThrough) { if (b32BitCore()) @@ -1940,7 +1938,7 @@ void CX86RecompilerOps::BLEZ_Compare() } else { - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], 0); if (m_Section->m_Jump.FallThrough) { m_Section->m_Cont.LinkLocation = m_Assembler.newLabel(); @@ -2052,11 +2050,11 @@ void CX86RecompilerOps::BLTZ_Compare() { if (b32BitCore()) { - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], 0); } else { - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs], 0); } if (m_Section->m_Jump.FallThrough) { @@ -2160,11 +2158,11 @@ void CX86RecompilerOps::BGEZ_Compare() { if (b32BitCore()) { - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], 0); } else { - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs], 0); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs], 0); } if (m_Section->m_Cont.FallThrough) { @@ -2188,7 +2186,7 @@ void CX86RecompilerOps::BGEZ_Compare() void CX86RecompilerOps::COP1_BCF_Compare() { - m_Assembler.TestVariable(&_FPCR[31], "_FPCR[31]", FPCSR_C); + m_Assembler.TestVariable(&m_Reg.m_FPCR[31], "_FPCR[31]", FPCSR_C); if (m_Section->m_Cont.FallThrough) { m_Section->m_Jump.LinkLocation = m_Assembler.newLabel(); @@ -2210,7 +2208,7 @@ void CX86RecompilerOps::COP1_BCF_Compare() void CX86RecompilerOps::COP1_BCT_Compare() { - m_Assembler.TestVariable(&_FPCR[31], "_FPCR[31]", FPCSR_C); + m_Assembler.TestVariable(&m_Reg.m_FPCR[31], "_FPCR[31]", FPCSR_C); if (m_Section->m_Cont.FallThrough) { m_Section->m_Jump.LinkLocation = m_Assembler.newLabel(); @@ -2282,7 +2280,7 @@ void CX86RecompilerOps::JAL() if (m_PipelineStage == PIPELINE_STAGE_NORMAL) { Map_GPR_32bit(31, true, -1); - m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(31), _PROGRAM_COUNTER, "_PROGRAM_COUNTER"); + m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(31), &m_Reg.m_PROGRAM_COUNTER, "_PROGRAM_COUNTER"); m_Assembler.and_(GetMipsRegMapLo(31), 0xF0000000); m_Assembler.AddConstToX86Reg(GetMipsRegMapLo(31), (m_CompilePC + 8) & ~0xF0000000); if ((m_CompilePC & 0xFFC) == 0xFFC) @@ -2318,10 +2316,10 @@ void CX86RecompilerOps::JAL() m_RegWorkingSet.WriteBackRegisters(); asmjit::x86::Gp PCReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(PCReg, _PROGRAM_COUNTER, "_PROGRAM_COUNTER"); + m_Assembler.MoveVariableToX86reg(PCReg, &m_Reg.m_PROGRAM_COUNTER, "_PROGRAM_COUNTER"); m_Assembler.and_(PCReg, 0xF0000000); m_Assembler.AddConstToX86Reg(PCReg, (m_Opcode.target << 2)); - m_Assembler.MoveX86regToVariable(_PROGRAM_COUNTER, "_PROGRAM_COUNTER", PCReg); + m_Assembler.MoveX86regToVariable(&m_Reg.m_PROGRAM_COUNTER, "_PROGRAM_COUNTER", PCReg); uint32_t TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2); bool bCheck = TargetPC <= m_CompilePC; @@ -2470,17 +2468,17 @@ void CX86RecompilerOps::SLTIU() } else if (b32BitCore()) { - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], (int16_t)m_Opcode.immediate); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], (int16_t)m_Opcode.immediate); m_Assembler.SetbVariable(&m_BranchCompare, "m_BranchCompare"); Map_GPR_32bit(m_Opcode.rt, false, -1); m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rt), &m_BranchCompare, "m_BranchCompare"); } else { - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs], ((int16_t)m_Opcode.immediate >> 31)); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs], ((int16_t)m_Opcode.immediate >> 31)); asmjit::Label Jump = m_Assembler.newLabel(); m_Assembler.JneLabel("CompareSet", Jump); - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], (int16_t)m_Opcode.immediate); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], (int16_t)m_Opcode.immediate); m_CodeBlock.Log(""); m_Assembler.bind(Jump); m_Assembler.SetbVariable(&m_BranchCompare, "m_BranchCompare"); @@ -2546,7 +2544,7 @@ void CX86RecompilerOps::SLTI() else if (b32BitCore()) { Map_GPR_32bit(m_Opcode.rt, false, -1); - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], (int16_t)m_Opcode.immediate); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], (int16_t)m_Opcode.immediate); if (GetMipsRegMapLo(m_Opcode.rt) != asmjit::x86::eax && GetMipsRegMapLo(m_Opcode.rt) != asmjit::x86::ebx) { @@ -2562,7 +2560,7 @@ void CX86RecompilerOps::SLTI() else { asmjit::Label Jump[2]; - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs], ((int16_t)m_Opcode.immediate >> 31)); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs], ((int16_t)m_Opcode.immediate >> 31)); Jump[0] = m_Assembler.newLabel(); m_Assembler.JeLabel("Low Compare", Jump[0]); m_Assembler.SetlVariable(&m_BranchCompare, "m_BranchCompare"); @@ -2570,7 +2568,7 @@ void CX86RecompilerOps::SLTI() m_Assembler.JmpLabel("Continue", Jump[1]); m_CodeBlock.Log(""); m_Assembler.bind(Jump[0]); - m_Assembler.CompConstToVariable(&_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], (int16_t)m_Opcode.immediate); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs], (int16_t)m_Opcode.immediate); m_Assembler.SetbVariable(&m_BranchCompare, "m_BranchCompare"); if (Jump[1].isValid()) { @@ -2868,7 +2866,7 @@ void CX86RecompilerOps::CACHE() } else { - m_Assembler.MoveVariableToX86reg(asmjit::x86::eax, &_GPR[m_Opcode.base].UW[0], CRegName::GPR_Lo[m_Opcode.base]); + m_Assembler.MoveVariableToX86reg(asmjit::x86::eax, &m_Reg.m_GPR[m_Opcode.base].UW[0], CRegName::GPR_Lo[m_Opcode.base]); m_Assembler.AddConstToX86Reg(asmjit::x86::eax, (int16_t)m_Opcode.offset); m_Assembler.push(asmjit::x86::eax); } @@ -3264,7 +3262,7 @@ void CX86RecompilerOps::LW(bool ResultSigned, bool bRecordLLBit) CompileLoadMemoryValue(x86Reg_Unknown, x86Reg_Unknown, x86Reg_Unknown, 32, false); if (bRecordLLBit) { - m_Assembler.MoveConstToVariable(_LLBit, "LLBit", 1); + m_Assembler.MoveConstToVariable(&m_Reg.m_LLBit, "LLBit", 1); } } if (g_System->bFastSP() && m_Opcode.rt == 29) @@ -3755,7 +3753,7 @@ void CX86RecompilerOps::SWL() } else { - m_Assembler.MoveVariableToX86reg(OffsetReg, &_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.MoveVariableToX86reg(OffsetReg, &m_Reg.m_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt]); } m_Assembler.shr(OffsetReg, asmjit::x86::cl); m_Assembler.add(ValueReg, OffsetReg); @@ -3832,7 +3830,7 @@ void CX86RecompilerOps::SW(bool bCheckLLbit) asmjit::Label JumpLLBit; if (bCheckLLbit) { - m_Assembler.CompConstToVariable(_LLBit, "_LLBit", 1); + m_Assembler.CompConstToVariable(&m_Reg.m_LLBit, "_LLBit", 1); JumpLLBit = m_Assembler.newLabel(); m_Assembler.JneLabel("LLBit_Continue", JumpLLBit); } @@ -3852,7 +3850,7 @@ void CX86RecompilerOps::SW(bool bCheckLLbit) m_CodeBlock.Log(""); m_Assembler.bind(JumpLLBit); Map_GPR_32bit(m_Opcode.rt, false, -1); - m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rt), _LLBit, "_LLBit"); + m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rt), &m_Reg.m_LLBit, "_LLBit"); } } } @@ -3919,7 +3917,7 @@ void CX86RecompilerOps::SWR() } else { - m_Assembler.MoveVariableToX86reg(OffsetReg, &_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.MoveVariableToX86reg(OffsetReg, &m_Reg.m_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt]); } m_Assembler.shl(OffsetReg, asmjit::x86::cl); m_Assembler.add(ValueReg, OffsetReg); @@ -3999,7 +3997,7 @@ void CX86RecompilerOps::LWC1() LW_KnownAddress(TempReg1, Address); asmjit::x86::Gp TempReg2 = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg2, &_FPR_S[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg2, &m_Reg.m_FPR_S[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str()); m_Assembler.mov(asmjit::x86::dword_ptr(TempReg2), TempReg1); return; } @@ -4007,7 +4005,7 @@ void CX86RecompilerOps::LWC1() asmjit::x86::Gp ValueReg = Map_TempReg(x86Reg_Unknown, -1, false, false); CompileLoadMemoryValue(x86Reg_Unknown, ValueReg, x86Reg_Unknown, 32, false); asmjit::x86::Gp FPR_SPtr = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(FPR_SPtr, &_FPR_S[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str()); + m_Assembler.MoveVariableToX86reg(FPR_SPtr, &m_Reg.m_FPR_S[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str()); m_Assembler.mov(asmjit::x86::dword_ptr(FPR_SPtr), ValueReg); } @@ -4028,12 +4026,12 @@ void CX86RecompilerOps::LDC1() LW_KnownAddress(TempReg1, Address); asmjit::x86::Gp TempReg2 = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg2, &_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg2, &m_Reg.m_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str()); m_Assembler.AddConstToX86Reg(TempReg2, 4); m_Assembler.mov(asmjit::x86::dword_ptr(TempReg2), TempReg1); LW_KnownAddress(TempReg1, Address + 4); - m_Assembler.MoveVariableToX86reg(TempReg2, &_FPR_D[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg2, &m_Reg.m_FPR_D[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str()); m_Assembler.mov(asmjit::x86::dword_ptr(TempReg2), TempReg1); } else @@ -4045,7 +4043,7 @@ void CX86RecompilerOps::LDC1() CompileLoadMemoryValue(x86Reg_Unknown, ValueRegLo, ValueRegHi, 64, false); asmjit::x86::Gp FPR_DPtr = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(FPR_DPtr, &_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str()); + m_Assembler.MoveVariableToX86reg(FPR_DPtr, &m_Reg.m_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str()); m_Assembler.mov(asmjit::x86::dword_ptr(FPR_DPtr), ValueRegLo); m_Assembler.AddConstToX86Reg(FPR_DPtr, 4); m_Assembler.mov(asmjit::x86::dword_ptr(FPR_DPtr), ValueRegHi); @@ -4120,7 +4118,7 @@ void CX86RecompilerOps::SWC1() UnMap_FPR(m_Opcode.ft, true); asmjit::x86::Gp TempReg1 = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg1, &_FPR_S[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg1, &m_Reg.m_FPR_S[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str()); m_Assembler.mov(TempReg1, asmjit::x86::dword_ptr(TempReg1)); SW_Register(TempReg1, Address); return; @@ -4128,7 +4126,7 @@ void CX86RecompilerOps::SWC1() PreWriteInstruction(); UnMap_FPR(m_Opcode.ft, true); asmjit::x86::Gp ValueReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(ValueReg, &_FPR_S[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str()); + m_Assembler.MoveVariableToX86reg(ValueReg, &m_Reg.m_FPR_S[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str()); m_Assembler.mov(ValueReg, asmjit::x86::dword_ptr(ValueReg)); CompileStoreMemoryValue(x86Reg_Unknown, ValueReg, x86Reg_Unknown, 0, 32); @@ -4148,12 +4146,12 @@ void CX86RecompilerOps::SDC1() } asmjit::x86::Gp TempReg1 = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg1, (uint8_t *)&_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg1, (uint8_t *)&m_Reg.m_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str()); m_Assembler.AddConstToX86Reg(TempReg1, 4); m_Assembler.mov(TempReg1, asmjit::x86::dword_ptr(TempReg1)); SW_Register(TempReg1, Address); - m_Assembler.MoveVariableToX86reg(TempReg1, &_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg1, &m_Reg.m_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str()); m_Assembler.mov(TempReg1, asmjit::x86::dword_ptr(TempReg1)); SW_Register(TempReg1, Address + 4); return; @@ -4161,7 +4159,7 @@ void CX86RecompilerOps::SDC1() PreWriteInstruction(); UnMap_FPR(m_Opcode.ft, true); asmjit::x86::Gp ValueRegHi = Map_TempReg(x86Reg_Unknown, -1, false, false), ValueRegLo = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(ValueRegHi, (uint8_t *)&_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str()); + m_Assembler.MoveVariableToX86reg(ValueRegHi, (uint8_t *)&m_Reg.m_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str()); m_Assembler.mov(ValueRegLo, ValueRegHi); m_Assembler.AddConstToX86Reg(ValueRegHi, 4); m_Assembler.mov(ValueRegHi, asmjit::x86::dword_ptr(ValueRegHi)); @@ -4475,15 +4473,15 @@ void CX86RecompilerOps::SPECIAL_JR() { if (IsConst(m_Opcode.rs)) { - m_Assembler.MoveConstToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegLo(m_Opcode.rs)); + m_Assembler.MoveConstToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegLo(m_Opcode.rs)); } else if (IsMapped(m_Opcode.rs)) { - m_Assembler.MoveX86regToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegMapLo(m_Opcode.rs)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegMapLo(m_Opcode.rs)); } else { - m_Assembler.MoveX86regToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", Map_TempReg(x86Reg_Unknown, m_Opcode.rs, false, false)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", Map_TempReg(x86Reg_Unknown, m_Opcode.rs, false, false)); } } m_PipelineStage = PIPELINE_STAGE_DO_DELAY_SLOT; @@ -4500,15 +4498,15 @@ void CX86RecompilerOps::SPECIAL_JR() UpdateCounters(m_RegWorkingSet, true, true); if (IsConst(m_Opcode.rs)) { - m_Assembler.MoveConstToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegLo(m_Opcode.rs)); + m_Assembler.MoveConstToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegLo(m_Opcode.rs)); } else if (IsMapped(m_Opcode.rs)) { - m_Assembler.MoveX86regToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegMapLo(m_Opcode.rs)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegMapLo(m_Opcode.rs)); } else { - m_Assembler.MoveX86regToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", Map_TempReg(x86Reg_Unknown, m_Opcode.rs, false, false)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", Map_TempReg(x86Reg_Unknown, m_Opcode.rs, false, false)); } CompileExit((uint32_t)-1, (uint32_t)-1, m_RegWorkingSet, ExitReason_Normal, true, nullptr); if (m_Section->m_JumpSection) @@ -4534,15 +4532,15 @@ void CX86RecompilerOps::SPECIAL_JALR() { if (IsConst(m_Opcode.rs)) { - m_Assembler.MoveConstToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegLo(m_Opcode.rs)); + m_Assembler.MoveConstToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegLo(m_Opcode.rs)); } else if (IsMapped(m_Opcode.rs)) { - m_Assembler.MoveX86regToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegMapLo(m_Opcode.rs)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegMapLo(m_Opcode.rs)); } else { - m_Assembler.MoveX86regToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", Map_TempReg(x86Reg_Unknown, m_Opcode.rs, false, false)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", Map_TempReg(x86Reg_Unknown, m_Opcode.rs, false, false)); } } UnMap_GPR(m_Opcode.rd, false); @@ -4586,15 +4584,15 @@ void CX86RecompilerOps::SPECIAL_JALR() UpdateCounters(m_RegWorkingSet, true, true); if (IsConst(m_Opcode.rs)) { - m_Assembler.MoveConstToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegLo(m_Opcode.rs)); + m_Assembler.MoveConstToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegLo(m_Opcode.rs)); } else if (IsMapped(m_Opcode.rs)) { - m_Assembler.MoveX86regToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegMapLo(m_Opcode.rs)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", GetMipsRegMapLo(m_Opcode.rs)); } else { - m_Assembler.MoveX86regToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", Map_TempReg(x86Reg_Unknown, m_Opcode.rs, false, false)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", Map_TempReg(x86Reg_Unknown, m_Opcode.rs, false, false)); } CompileExit((uint32_t)-1, (uint32_t)-1, m_RegWorkingSet, ExitReason_Normal, true, nullptr); if (m_Section->m_JumpSection) @@ -4632,8 +4630,8 @@ void CX86RecompilerOps::SPECIAL_MFLO() } Map_GPR_64bit(m_Opcode.rd, -1); - m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &_RegLO->UW[0], "_RegLO->UW[0]"); - m_Assembler.MoveVariableToX86reg(GetMipsRegMapHi(m_Opcode.rd), &_RegLO->UW[1], "_RegLO->UW[1]"); + m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_LO.UW[0], "_RegLO->UW[0]"); + m_Assembler.MoveVariableToX86reg(GetMipsRegMapHi(m_Opcode.rd), &m_Reg.m_LO.UW[1], "_RegLO->UW[1]"); } void CX86RecompilerOps::SPECIAL_MTLO() @@ -4642,39 +4640,39 @@ void CX86RecompilerOps::SPECIAL_MTLO() { if (Is64Bit(m_Opcode.rs)) { - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", GetMipsRegHi(m_Opcode.rs)); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", GetMipsRegHi(m_Opcode.rs)); } else if (IsSigned(m_Opcode.rs) && ((GetMipsRegLo(m_Opcode.rs) & 0x80000000) != 0)) { - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); } else { - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", 0); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", 0); } - m_Assembler.MoveConstToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", GetMipsRegLo(m_Opcode.rs)); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", GetMipsRegLo(m_Opcode.rs)); } else if (IsKnown(m_Opcode.rs) && IsMapped(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rs)) { - m_Assembler.MoveX86regToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", GetMipsRegMapHi(m_Opcode.rs)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", GetMipsRegMapHi(m_Opcode.rs)); } else if (IsSigned(m_Opcode.rs)) { - m_Assembler.MoveX86regToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", Map_TempReg(x86Reg_Unknown, m_Opcode.rs, true, false)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", Map_TempReg(x86Reg_Unknown, m_Opcode.rs, true, false)); } else { - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", 0); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", 0); } - m_Assembler.MoveX86regToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", GetMipsRegMapLo(m_Opcode.rs)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", GetMipsRegMapLo(m_Opcode.rs)); } else { asmjit::x86::Gp reg = Map_TempReg(x86Reg_Unknown, m_Opcode.rs, true, false); - m_Assembler.MoveX86regToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", reg); - m_Assembler.MoveX86regToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", Map_TempReg(reg, m_Opcode.rs, false, false)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", reg); + m_Assembler.MoveX86regToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", Map_TempReg(reg, m_Opcode.rs, false, false)); } } @@ -4686,8 +4684,8 @@ void CX86RecompilerOps::SPECIAL_MFHI() } Map_GPR_64bit(m_Opcode.rd, -1); - m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &_RegHI->UW[0], "_RegHI->UW[0]"); - m_Assembler.MoveVariableToX86reg(GetMipsRegMapHi(m_Opcode.rd), &_RegHI->UW[1], "_RegHI->UW[1]"); + m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_HI.UW[0], "_RegHI->UW[0]"); + m_Assembler.MoveVariableToX86reg(GetMipsRegMapHi(m_Opcode.rd), &m_Reg.m_HI.UW[1], "_RegHI->UW[1]"); } void CX86RecompilerOps::SPECIAL_MTHI() @@ -4696,39 +4694,39 @@ void CX86RecompilerOps::SPECIAL_MTHI() { if (Is64Bit(m_Opcode.rs)) { - m_Assembler.MoveConstToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", GetMipsRegHi(m_Opcode.rs)); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", GetMipsRegHi(m_Opcode.rs)); } else if (IsSigned(m_Opcode.rs) && ((GetMipsRegLo(m_Opcode.rs) & 0x80000000) != 0)) { - m_Assembler.MoveConstToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", 0xFFFFFFFF); } else { - m_Assembler.MoveConstToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", 0); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", 0); } - m_Assembler.MoveConstToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", GetMipsRegLo(m_Opcode.rs)); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", GetMipsRegLo(m_Opcode.rs)); } else if (IsKnown(m_Opcode.rs) && IsMapped(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rs)) { - m_Assembler.MoveX86regToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", GetMipsRegMapHi(m_Opcode.rs)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", GetMipsRegMapHi(m_Opcode.rs)); } else if (IsSigned(m_Opcode.rs)) { - m_Assembler.MoveX86regToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", Map_TempReg(x86Reg_Unknown, m_Opcode.rs, true, false)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", Map_TempReg(x86Reg_Unknown, m_Opcode.rs, true, false)); } else { - m_Assembler.MoveConstToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", 0); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", 0); } - m_Assembler.MoveX86regToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", GetMipsRegMapLo(m_Opcode.rs)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", GetMipsRegMapLo(m_Opcode.rs)); } else { asmjit::x86::Gp reg = Map_TempReg(x86Reg_Unknown, m_Opcode.rs, true, false); - m_Assembler.MoveX86regToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", reg); - m_Assembler.MoveX86regToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", Map_TempReg(reg, m_Opcode.rs, false, false)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", reg); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", Map_TempReg(reg, m_Opcode.rs, false, false)); } } @@ -4883,12 +4881,12 @@ void CX86RecompilerOps::SPECIAL_MULT() m_Assembler.imul(asmjit::x86::edx); - m_Assembler.MoveX86regToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", asmjit::x86::eax); - m_Assembler.MoveX86regToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", asmjit::x86::edx); + m_Assembler.MoveX86regToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", asmjit::x86::eax); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", asmjit::x86::edx); m_Assembler.sar(asmjit::x86::eax, 31); // Paired m_Assembler.sar(asmjit::x86::edx, 31); - m_Assembler.MoveX86regToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", asmjit::x86::eax); - m_Assembler.MoveX86regToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", asmjit::x86::edx); + m_Assembler.MoveX86regToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", asmjit::x86::eax); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", asmjit::x86::edx); } void CX86RecompilerOps::SPECIAL_MULTU() @@ -4900,12 +4898,12 @@ void CX86RecompilerOps::SPECIAL_MULTU() m_Assembler.mul(asmjit::x86::edx); - m_Assembler.MoveX86regToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", asmjit::x86::eax); - m_Assembler.MoveX86regToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", asmjit::x86::edx); + m_Assembler.MoveX86regToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", asmjit::x86::eax); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", asmjit::x86::edx); m_Assembler.sar(asmjit::x86::eax, 31); // Paired m_Assembler.sar(asmjit::x86::edx, 31); - m_Assembler.MoveX86regToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", asmjit::x86::eax); - m_Assembler.MoveX86regToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", asmjit::x86::edx); + m_Assembler.MoveX86regToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", asmjit::x86::eax); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", asmjit::x86::edx); } void CX86RecompilerOps::SPECIAL_DIV() @@ -4919,10 +4917,10 @@ void CX86RecompilerOps::SPECIAL_DIV() { if (IsConst(m_Opcode.rs)) { - m_Assembler.MoveConstToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", GetMipsRegLo_S(m_Opcode.rs) < 0 ? 0x00000001 : 0xFFFFFFFF); - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", GetMipsRegLo_S(m_Opcode.rs) < 0 ? 0x00000000 : 0xFFFFFFFF); - m_Assembler.MoveConstToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", GetMipsRegLo(m_Opcode.rs)); - m_Assembler.MoveConstToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", GetMipsRegLo_S(m_Opcode.rs) < 0 ? 0xFFFFFFFF : 0x00000000); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", GetMipsRegLo_S(m_Opcode.rs) < 0 ? 0x00000001 : 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", GetMipsRegLo_S(m_Opcode.rs) < 0 ? 0x00000000 : 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", GetMipsRegLo(m_Opcode.rs)); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", GetMipsRegLo_S(m_Opcode.rs) < 0 ? 0xFFFFFFFF : 0x00000000); } else { @@ -4930,17 +4928,17 @@ void CX86RecompilerOps::SPECIAL_DIV() m_Assembler.CompConstToX86reg(Reg, 0); asmjit::Label JumpPositive = m_Assembler.newLabel(); m_Assembler.JgeLabel(stdstr_f("RsPositive_%08X", m_CompilePC).c_str(), JumpPositive); - m_Assembler.MoveConstToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", 0x00000001); - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", 0x00000000); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", 0x00000001); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", 0x00000000); asmjit::Label JumpLoSet = m_Assembler.newLabel(); m_Assembler.JmpLabel(stdstr_f("LoSet_%08X", m_CompilePC).c_str(), JumpLoSet); m_CodeBlock.Log(""); m_Assembler.bind(JumpPositive); - m_Assembler.MoveConstToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", 0xFFFFFFFF); - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); m_CodeBlock.Log(""); m_Assembler.bind(JumpLoSet); - m_Assembler.MoveX86regToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", Reg); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", Reg); if (IsMapped(m_Opcode.rs)) { Reg = Map_TempReg(x86Reg_Unknown, m_Opcode.rs, true, false); @@ -4949,7 +4947,7 @@ void CX86RecompilerOps::SPECIAL_DIV() { m_Assembler.sar(Reg, 31); } - m_Assembler.MoveX86regToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", Reg); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", Reg); } return; } @@ -4957,10 +4955,10 @@ void CX86RecompilerOps::SPECIAL_DIV() { if (IsConst(m_Opcode.rs) && GetMipsRegLo(m_Opcode.rs) == 0x80000000) { - m_Assembler.MoveConstToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", 0x80000000); - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); - m_Assembler.MoveConstToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", 0x00000000); - m_Assembler.MoveConstToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", 0x00000000); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", 0x80000000); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", 0x00000000); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", 0x00000000); return; } @@ -4980,10 +4978,10 @@ void CX86RecompilerOps::SPECIAL_DIV() m_Assembler.CompConstToX86reg(RegRs, 0x80000000); asmjit::Label JumpValid = m_Assembler.newLabel(); m_Assembler.JneLabel(stdstr_f("ValidDiv_%08X", m_CompilePC).c_str(), JumpValid); - m_Assembler.MoveConstToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", 0x80000000); - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); - m_Assembler.MoveConstToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", 0x00000000); - m_Assembler.MoveConstToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", 0x00000000); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", 0x80000000); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", 0x00000000); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", 0x00000000); JumpEnd = m_Assembler.newLabel(); m_Assembler.JmpLabel(stdstr_f("EndDiv_%08X", m_CompilePC).c_str(), JumpEnd); m_CodeBlock.Log(""); @@ -5012,22 +5010,22 @@ void CX86RecompilerOps::SPECIAL_DIV() m_Assembler.CompConstToX86reg(RegRs, 0); asmjit::Label JumpPositive = m_Assembler.newLabel(); m_Assembler.JgeLabel(stdstr_f("RsPositive_%08X", m_CompilePC).c_str(), JumpPositive); - m_Assembler.MoveConstToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", 0x00000001); - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", 0x00000000); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", 0x00000001); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", 0x00000000); asmjit::Label JumpLoSet = m_Assembler.newLabel(); m_Assembler.JmpLabel(stdstr_f("LoSet_%08X", m_CompilePC).c_str(), JumpLoSet); m_CodeBlock.Log(""); m_Assembler.bind(JumpPositive); - m_Assembler.MoveConstToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", 0xFFFFFFFF); - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); m_CodeBlock.Log(""); m_Assembler.bind(JumpLoSet); - m_Assembler.MoveX86regToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", RegRs); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", RegRs); if (!IsMapped(m_Opcode.rs)) { m_Assembler.sar(RegRsHi, 31); } - m_Assembler.MoveX86regToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", RegRsHi); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", RegRsHi); JumpEnd = m_Assembler.newLabel(); m_Assembler.JmpLabel(stdstr_f("EndDiv_%08X", m_CompilePC).c_str(), JumpEnd); @@ -5037,10 +5035,10 @@ void CX86RecompilerOps::SPECIAL_DIV() asmjit::Label JumpValidDiv0 = m_Assembler.newLabel(); m_Assembler.JneLabel(stdstr_f("ValidDiv0_%08X", m_CompilePC).c_str(), JumpValidDiv0); - m_Assembler.MoveConstToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", 0x80000000); - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); - m_Assembler.MoveConstToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", 0x00000000); - m_Assembler.MoveConstToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", 0x00000000); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", 0x80000000); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", 0x00000000); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", 0x00000000); JumpEnd2 = m_Assembler.newLabel(); m_Assembler.JmpLabel(stdstr_f("EndDiv_%08X", m_CompilePC).c_str(), JumpEnd2); @@ -5066,12 +5064,12 @@ void CX86RecompilerOps::SPECIAL_DIV() } m_Assembler.idiv(DivReg); - m_Assembler.MoveX86regToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", asmjit::x86::eax); - m_Assembler.MoveX86regToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", asmjit::x86::edx); + m_Assembler.MoveX86regToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", asmjit::x86::eax); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", asmjit::x86::edx); m_Assembler.sar(asmjit::x86::eax, 31); m_Assembler.sar(asmjit::x86::edx, 31); - m_Assembler.MoveX86regToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", asmjit::x86::eax); - m_Assembler.MoveX86regToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", asmjit::x86::edx); + m_Assembler.MoveX86regToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", asmjit::x86::eax); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", asmjit::x86::edx); if (JumpEnd.isValid() || JumpEnd2.isValid()) { @@ -5094,10 +5092,10 @@ void CX86RecompilerOps::SPECIAL_DIVU() { if (IsConst(m_Opcode.rs)) { - m_Assembler.MoveConstToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", 0xFFFFFFFF); - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); - m_Assembler.MoveConstToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", GetMipsRegLo(m_Opcode.rs)); - m_Assembler.MoveConstToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", GetMipsRegLo_S(m_Opcode.rs) < 0 ? 0xFFFFFFFF : 0x00000000); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", GetMipsRegLo(m_Opcode.rs)); + m_Assembler.MoveConstToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", GetMipsRegLo_S(m_Opcode.rs) < 0 ? 0xFFFFFFFF : 0x00000000); } else { @@ -5105,17 +5103,17 @@ void CX86RecompilerOps::SPECIAL_DIVU() m_Assembler.CompConstToX86reg(RegRs, 0); asmjit::Label JumpPositive = m_Assembler.newLabel(); m_Assembler.JgeLabel(stdstr_f("RsPositive_%08X", m_CompilePC).c_str(), JumpPositive); - m_Assembler.MoveConstToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", 0x00000001); - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", 0x00000000); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", 0x00000001); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", 0x00000000); asmjit::Label JumpLoSet = m_Assembler.newLabel(); m_Assembler.JmpLabel(stdstr_f("LoSet_%08X", m_CompilePC).c_str(), JumpLoSet); m_CodeBlock.Log(""); m_Assembler.bind(JumpPositive); - m_Assembler.MoveConstToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", 0xFFFFFFFF); - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); m_CodeBlock.Log(""); m_Assembler.bind(JumpLoSet); - m_Assembler.MoveX86regToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", RegRs); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", RegRs); if (IsMapped(m_Opcode.rs)) { RegRs = Map_TempReg(x86Reg_Unknown, m_Opcode.rs, true, false); @@ -5124,7 +5122,7 @@ void CX86RecompilerOps::SPECIAL_DIVU() { m_Assembler.sar(RegRs, 31); } - m_Assembler.MoveX86regToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", RegRs); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", RegRs); } } else @@ -5150,15 +5148,15 @@ void CX86RecompilerOps::SPECIAL_DIVU() asmjit::Label JumpNoExcept = m_Assembler.newLabel(); m_Assembler.JneLabel("NoExcept", JumpNoExcept); - m_Assembler.MoveConstToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", 0xFFFFFFFF); - m_Assembler.MoveConstToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); - m_Assembler.MoveX86regToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", RegRsLo); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", 0xFFFFFFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", 0xFFFFFFFF); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", RegRsLo); if (!IsMapped(m_Opcode.rs)) { RegRsHi = RegRsLo; m_Assembler.sar(RegRsHi, 31); } - m_Assembler.MoveX86regToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", RegRsHi); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", RegRsHi); JumpEndDivu = m_Assembler.newLabel(); m_Assembler.JmpLabel("EndDivu", JumpEndDivu); @@ -5167,12 +5165,12 @@ void CX86RecompilerOps::SPECIAL_DIVU() } m_Assembler.div(DivReg); - m_Assembler.MoveX86regToVariable(&_RegLO->UW[0], "_RegLO->UW[0]", asmjit::x86::eax); - m_Assembler.MoveX86regToVariable(&_RegHI->UW[0], "_RegHI->UW[0]", asmjit::x86::edx); + m_Assembler.MoveX86regToVariable(&m_Reg.m_LO.UW[0], "_RegLO->UW[0]", asmjit::x86::eax); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[0], "_RegHI->UW[0]", asmjit::x86::edx); m_Assembler.sar(asmjit::x86::eax, 31); m_Assembler.sar(asmjit::x86::edx, 31); - m_Assembler.MoveX86regToVariable(&_RegLO->UW[1], "_RegLO->UW[1]", asmjit::x86::eax); - m_Assembler.MoveX86regToVariable(&_RegHI->UW[1], "_RegHI->UW[1]", asmjit::x86::edx); + m_Assembler.MoveX86regToVariable(&m_Reg.m_LO.UW[1], "_RegLO->UW[1]", asmjit::x86::eax); + m_Assembler.MoveX86regToVariable(&m_Reg.m_HI.UW[1], "_RegHI->UW[1]", asmjit::x86::edx); if (JumpEndDivu.isValid()) { @@ -5270,7 +5268,7 @@ void CX86RecompilerOps::SPECIAL_ADD() } else { - m_Assembler.AddVariableToX86reg(Reg, &_GPR[source2].W[0], CRegName::GPR_Lo[source2]); + m_Assembler.AddVariableToX86reg(Reg, &m_Reg.m_GPR[source2].W[0], CRegName::GPR_Lo[source2]); } if (g_System->bFastSP() && m_Opcode.rd == 29) { @@ -5319,7 +5317,7 @@ void CX86RecompilerOps::SPECIAL_ADDU() } else { - m_Assembler.AddVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[source2].W[0], CRegName::GPR_Lo[source2]); + m_Assembler.AddVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[source2].W[0], CRegName::GPR_Lo[source2]); } if (g_System->bFastSP() && m_Opcode.rd == 29) { @@ -5365,7 +5363,7 @@ void CX86RecompilerOps::SPECIAL_SUB() } else { - m_Assembler.SubVariableFromX86reg(Reg, &_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.SubVariableFromX86reg(Reg, &m_Reg.m_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); } m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_System->CountPerOp()); CompileExit(m_CompilePC, m_CompilePC, m_RegWorkingSet, ExitReason_ExceptionOverflow, false, &CX86Ops::JoLabel); @@ -5421,7 +5419,7 @@ void CX86RecompilerOps::SPECIAL_SUBU() } else { - m_Assembler.SubVariableFromX86reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.SubVariableFromX86reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); } } @@ -5595,13 +5593,13 @@ void CX86RecompilerOps::SPECIAL_AND() if (Is64Bit(KnownReg) || !b32BitCore()) { Map_GPR_64bit(m_Opcode.rd, KnownReg); - m_Assembler.AndVariableToX86Reg(GetMipsRegMapHi(m_Opcode.rd), &_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); - m_Assembler.AndVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); + m_Assembler.AndVariableToX86Reg(GetMipsRegMapHi(m_Opcode.rd), &m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); + m_Assembler.AndVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); } else { Map_GPR_32bit(m_Opcode.rd, IsSigned(KnownReg), KnownReg); - m_Assembler.AndVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); + m_Assembler.AndVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); } } else @@ -5629,9 +5627,9 @@ void CX86RecompilerOps::SPECIAL_AND() else { Map_GPR_64bit(m_Opcode.rd, m_Opcode.rt); - m_Assembler.AndVariableToX86Reg(GetMipsRegMapHi(m_Opcode.rd), &_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]); + m_Assembler.AndVariableToX86Reg(GetMipsRegMapHi(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]); } - m_Assembler.AndVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); + m_Assembler.AndVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); } } @@ -5771,13 +5769,13 @@ void CX86RecompilerOps::SPECIAL_OR() if (b32BitCore()) { Map_GPR_32bit(m_Opcode.rd, true, KnownReg); - m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); + m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); } else { Map_GPR_64bit(m_Opcode.rd, KnownReg); - m_Assembler.OrVariableToX86Reg(GetMipsRegMapHi(m_Opcode.rd), &_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); - m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); + m_Assembler.OrVariableToX86Reg(GetMipsRegMapHi(m_Opcode.rd), &m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); + m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); } } } @@ -5786,13 +5784,13 @@ void CX86RecompilerOps::SPECIAL_OR() if (b32BitCore()) { Map_GPR_32bit(m_Opcode.rd, true, m_Opcode.rt); - m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); + m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); } else { Map_GPR_64bit(m_Opcode.rd, m_Opcode.rt); - m_Assembler.OrVariableToX86Reg(GetMipsRegMapHi(m_Opcode.rd), &_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]); - m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); + m_Assembler.OrVariableToX86Reg(GetMipsRegMapHi(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]); + m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); } } if (g_System->bFastSP() && m_Opcode.rd == 29) @@ -5950,26 +5948,26 @@ void CX86RecompilerOps::SPECIAL_XOR() if (b32BitCore()) { Map_GPR_32bit(m_Opcode.rd, true, KnownReg); - m_Assembler.XorVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); + m_Assembler.XorVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); } else { Map_GPR_64bit(m_Opcode.rd, KnownReg); - m_Assembler.XorVariableToX86reg(GetMipsRegMapHi(m_Opcode.rd), &_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); - m_Assembler.XorVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); + m_Assembler.XorVariableToX86reg(GetMipsRegMapHi(m_Opcode.rd), &m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); + m_Assembler.XorVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); } } } else if (b32BitCore()) { Map_GPR_32bit(m_Opcode.rd, true, m_Opcode.rt); - m_Assembler.XorVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); + m_Assembler.XorVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); } else { Map_GPR_64bit(m_Opcode.rd, m_Opcode.rt); - m_Assembler.XorVariableToX86reg(GetMipsRegMapHi(m_Opcode.rd), &_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]); - m_Assembler.XorVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); + m_Assembler.XorVariableToX86reg(GetMipsRegMapHi(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]); + m_Assembler.XorVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); } } @@ -6107,13 +6105,13 @@ void CX86RecompilerOps::SPECIAL_NOR() if (b32BitCore()) { Map_GPR_32bit(m_Opcode.rd, true, KnownReg); - m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); + m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); } else { Map_GPR_64bit(m_Opcode.rd, KnownReg); - m_Assembler.OrVariableToX86Reg(GetMipsRegMapHi(m_Opcode.rd), &_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); - m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); + m_Assembler.OrVariableToX86Reg(GetMipsRegMapHi(m_Opcode.rd), &m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); + m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); } } } @@ -6122,13 +6120,13 @@ void CX86RecompilerOps::SPECIAL_NOR() if (b32BitCore()) { Map_GPR_32bit(m_Opcode.rd, true, m_Opcode.rt); - m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); + m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); } else { Map_GPR_64bit(m_Opcode.rd, m_Opcode.rt); - m_Assembler.OrVariableToX86Reg(GetMipsRegMapHi(m_Opcode.rd), &_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]); - m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); + m_Assembler.OrVariableToX86Reg(GetMipsRegMapHi(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]); + m_Assembler.OrVariableToX86Reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rs].W[0], CRegName::GPR_Lo[m_Opcode.rs]); } } @@ -6307,23 +6305,23 @@ void CX86RecompilerOps::SPECIAL_SLT() { if (IsConst(KnownReg)) { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], GetMipsRegHi(KnownReg)); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], GetMipsRegHi(KnownReg)); } else { - m_Assembler.CompX86regToVariable(GetMipsRegMapHi(KnownReg), &_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); + m_Assembler.CompX86regToVariable(GetMipsRegMapHi(KnownReg), &m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); } } else { if (IsConst(KnownReg)) { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], (GetMipsRegLo_S(KnownReg) >> 31)); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], (GetMipsRegLo_S(KnownReg) >> 31)); } else { ProtectGPR(KnownReg); - m_Assembler.CompX86regToVariable(Map_TempReg(x86Reg_Unknown, KnownReg, true, false), &_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); + m_Assembler.CompX86regToVariable(Map_TempReg(x86Reg_Unknown, KnownReg, true, false), &m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); } } Jump[0] = m_Assembler.newLabel(); @@ -6343,11 +6341,11 @@ void CX86RecompilerOps::SPECIAL_SLT() m_Assembler.bind(Jump[0]); if (IsConst(KnownReg)) { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg], GetMipsRegLo(KnownReg)); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg], GetMipsRegLo(KnownReg)); } else { - m_Assembler.CompX86regToVariable(GetMipsRegMapLo(KnownReg), &_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); + m_Assembler.CompX86regToVariable(GetMipsRegMapLo(KnownReg), &m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); } if (KnownReg == (IsConst(KnownReg) ? m_Opcode.rs : m_Opcode.rt)) { @@ -6374,11 +6372,11 @@ void CX86RecompilerOps::SPECIAL_SLT() Map_GPR_32bit(m_Opcode.rd, true, -1); if (bConstant) { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg], Value); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg], Value); } else { - m_Assembler.CompX86regToVariable(GetMipsRegMapLo(KnownReg), &_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); + m_Assembler.CompX86regToVariable(GetMipsRegMapLo(KnownReg), &m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); } if (GetMipsRegMapLo(m_Opcode.rd) != asmjit::x86::eax && GetMipsRegMapLo(m_Opcode.rd) != asmjit::x86::ebx) { @@ -6410,7 +6408,7 @@ void CX86RecompilerOps::SPECIAL_SLT() { asmjit::x86::Gp Reg = Map_TempReg(x86Reg_Unknown, m_Opcode.rs, false, false); Map_GPR_32bit(m_Opcode.rd, false, -1); - m_Assembler.CompX86regToVariable(Reg, &_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.CompX86regToVariable(Reg, &m_Reg.m_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); if (GetMipsRegMapLo(m_Opcode.rd) != asmjit::x86::eax && GetMipsRegMapLo(m_Opcode.rd) != asmjit::x86::ebx) { m_Assembler.SetlVariable(&m_BranchCompare, "m_BranchCompare"); @@ -6427,7 +6425,7 @@ void CX86RecompilerOps::SPECIAL_SLT() asmjit::Label Jump[2]; asmjit::x86::Gp Reg = Map_TempReg(x86Reg_Unknown, m_Opcode.rs, true, false); - m_Assembler.CompX86regToVariable(Reg, &_GPR[m_Opcode.rt].W[1], CRegName::GPR_Hi[m_Opcode.rt]); + m_Assembler.CompX86regToVariable(Reg, &m_Reg.m_GPR[m_Opcode.rt].W[1], CRegName::GPR_Hi[m_Opcode.rt]); Jump[0] = m_Assembler.newLabel(); m_Assembler.JeLabel("Low Compare", Jump[0]); m_Assembler.SetlVariable(&m_BranchCompare, "m_BranchCompare"); @@ -6436,7 +6434,7 @@ void CX86RecompilerOps::SPECIAL_SLT() m_CodeBlock.Log(""); m_Assembler.bind(Jump[0]); - m_Assembler.CompX86regToVariable(Map_TempReg(Reg, m_Opcode.rs, false, false), &_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.CompX86regToVariable(Map_TempReg(Reg, m_Opcode.rs, false, false), &m_Reg.m_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); m_Assembler.SetbVariable(&m_BranchCompare, "m_BranchCompare"); if (Jump[1].isValid()) { @@ -6607,11 +6605,11 @@ void CX86RecompilerOps::SPECIAL_SLTU() { uint32_t Value = GetMipsRegLo(KnownReg); Map_GPR_32bit(m_Opcode.rd, true, -1); - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg], Value); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg], Value); } else { - m_Assembler.CompX86regToVariable(GetMipsRegMapLo(KnownReg), &_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); + m_Assembler.CompX86regToVariable(GetMipsRegMapLo(KnownReg), &m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); } if (KnownReg == TestReg) { @@ -6628,23 +6626,23 @@ void CX86RecompilerOps::SPECIAL_SLTU() { if (Is64Bit(KnownReg)) { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], GetMipsRegHi(KnownReg)); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], GetMipsRegHi(KnownReg)); } else { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], (GetMipsRegLo_S(KnownReg) >> 31)); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg], (GetMipsRegLo_S(KnownReg) >> 31)); } } else { if (Is64Bit(KnownReg)) { - m_Assembler.CompX86regToVariable(GetMipsRegMapHi(KnownReg), &_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); + m_Assembler.CompX86regToVariable(GetMipsRegMapHi(KnownReg), &m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); } else { ProtectGPR(KnownReg); - m_Assembler.CompX86regToVariable(Map_TempReg(x86Reg_Unknown, KnownReg, true, false), &_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); + m_Assembler.CompX86regToVariable(Map_TempReg(x86Reg_Unknown, KnownReg, true, false), &m_Reg.m_GPR[UnknownReg].W[1], CRegName::GPR_Hi[UnknownReg]); } } Jump[0] = m_Assembler.newLabel(); @@ -6665,11 +6663,11 @@ void CX86RecompilerOps::SPECIAL_SLTU() m_Assembler.bind(Jump[0]); if (IsConst(KnownReg)) { - m_Assembler.CompConstToVariable(&_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg], GetMipsRegLo(KnownReg)); + m_Assembler.CompConstToVariable(&m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg], GetMipsRegLo(KnownReg)); } else { - m_Assembler.CompX86regToVariable(GetMipsRegMapLo(KnownReg), &_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); + m_Assembler.CompX86regToVariable(GetMipsRegMapLo(KnownReg), &m_Reg.m_GPR[UnknownReg].W[0], CRegName::GPR_Lo[UnknownReg]); } if (KnownReg == (IsConst(KnownReg) ? m_Opcode.rs : m_Opcode.rt)) { @@ -6692,7 +6690,7 @@ void CX86RecompilerOps::SPECIAL_SLTU() { asmjit::x86::Gp Reg = Map_TempReg(x86Reg_Unknown, m_Opcode.rs, false, false); Map_GPR_32bit(m_Opcode.rd, false, -1); - m_Assembler.CompX86regToVariable(Reg, &_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.CompX86regToVariable(Reg, &m_Reg.m_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); m_Assembler.SetbVariable(&m_BranchCompare, "m_BranchCompare"); m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &m_BranchCompare, "m_BranchCompare"); } @@ -6701,7 +6699,7 @@ void CX86RecompilerOps::SPECIAL_SLTU() asmjit::Label Jump[2]; asmjit::x86::Gp Reg = Map_TempReg(x86Reg_Unknown, m_Opcode.rs, true, false); - m_Assembler.CompX86regToVariable(Reg, &_GPR[m_Opcode.rt].W[1], CRegName::GPR_Hi[m_Opcode.rt]); + m_Assembler.CompX86regToVariable(Reg, &m_Reg.m_GPR[m_Opcode.rt].W[1], CRegName::GPR_Hi[m_Opcode.rt]); Jump[0] = m_Assembler.newLabel(); m_Assembler.JeLabel("Low Compare", Jump[0]); m_Assembler.SetbVariable(&m_BranchCompare, "m_BranchCompare"); @@ -6710,7 +6708,7 @@ void CX86RecompilerOps::SPECIAL_SLTU() m_CodeBlock.Log(""); m_Assembler.bind(Jump[0]); - m_Assembler.CompX86regToVariable(Map_TempReg(Reg, m_Opcode.rs, false, false), &_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.CompX86regToVariable(Map_TempReg(Reg, m_Opcode.rs, false, false), &m_Reg.m_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); m_Assembler.SetbVariable(&m_BranchCompare, "m_BranchCompare"); if (Jump[1].isValid()) { @@ -6779,8 +6777,8 @@ void CX86RecompilerOps::SPECIAL_DADD() } else { - m_Assembler.AddVariableToX86reg(RegLo, &_GPR[source2].W[0], CRegName::GPR_Lo[source2]); - m_Assembler.AdcVariableToX86reg(RegHi, &_GPR[source2].W[1], CRegName::GPR_Hi[source2]); + m_Assembler.AddVariableToX86reg(RegLo, &m_Reg.m_GPR[source2].W[0], CRegName::GPR_Lo[source2]); + m_Assembler.AdcVariableToX86reg(RegHi, &m_Reg.m_GPR[source2].W[1], CRegName::GPR_Hi[source2]); } m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_System->CountPerOp()); CompileExit(m_CompilePC, m_CompilePC, m_RegWorkingSet, ExitReason_ExceptionOverflow, false, &CX86Ops::JoLabel); @@ -6855,8 +6853,8 @@ void CX86RecompilerOps::SPECIAL_DADDU() } else { - m_Assembler.AddVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[source2].W[0], CRegName::GPR_Lo[source2]); - m_Assembler.AdcVariableToX86reg(GetMipsRegMapHi(m_Opcode.rd), &_GPR[source2].W[1], CRegName::GPR_Hi[source2]); + m_Assembler.AddVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[source2].W[0], CRegName::GPR_Lo[source2]); + m_Assembler.AdcVariableToX86reg(GetMipsRegMapHi(m_Opcode.rd), &m_Reg.m_GPR[source2].W[1], CRegName::GPR_Hi[source2]); } } } @@ -6919,8 +6917,8 @@ void CX86RecompilerOps::SPECIAL_DSUB() } else { - m_Assembler.SubVariableFromX86reg(RegLo, &_GPR[source2].W[0], CRegName::GPR_Lo[source2]); - m_Assembler.SbbVariableFromX86reg(RegHi, &_GPR[source2].W[1], CRegName::GPR_Hi[source2]); + m_Assembler.SubVariableFromX86reg(RegLo, &m_Reg.m_GPR[source2].W[0], CRegName::GPR_Lo[source2]); + m_Assembler.SbbVariableFromX86reg(RegHi, &m_Reg.m_GPR[source2].W[1], CRegName::GPR_Hi[source2]); } m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_System->CountPerOp()); CompileExit(m_CompilePC, m_CompilePC, m_RegWorkingSet, ExitReason_ExceptionOverflow, false, &CX86Ops::JoLabel); @@ -6995,8 +6993,8 @@ void CX86RecompilerOps::SPECIAL_DSUBU() } else { - m_Assembler.SubVariableFromX86reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); - m_Assembler.SbbVariableFromX86reg(GetMipsRegMapHi(m_Opcode.rd), &_GPR[m_Opcode.rt].W[1], CRegName::GPR_Hi[m_Opcode.rt]); + m_Assembler.SubVariableFromX86reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rt].W[0], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.SbbVariableFromX86reg(GetMipsRegMapHi(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rt].W[1], CRegName::GPR_Hi[m_Opcode.rt]); } } } @@ -7159,7 +7157,7 @@ void CX86RecompilerOps::SPECIAL_DSLL32() else { Map_GPR_64bit(m_Opcode.rd, -1); - m_Assembler.MoveVariableToX86reg(GetMipsRegMapHi(m_Opcode.rd), &_GPR[m_Opcode.rt], CRegName::GPR_Hi[m_Opcode.rt]); + m_Assembler.MoveVariableToX86reg(GetMipsRegMapHi(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rt], CRegName::GPR_Hi[m_Opcode.rt]); if ((uint8_t)m_Opcode.sa != 0) { m_Assembler.shl(GetMipsRegMapHi(m_Opcode.rd), (uint8_t)m_Opcode.sa); @@ -7211,7 +7209,7 @@ void CX86RecompilerOps::SPECIAL_DSRL32() else { Map_GPR_32bit(m_Opcode.rd, false, -1); - m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[m_Opcode.rt].UW[1], CRegName::GPR_Hi[m_Opcode.rt]); + m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rt].UW[1], CRegName::GPR_Hi[m_Opcode.rt]); if ((uint8_t)m_Opcode.sa != 0) { m_Assembler.shr(GetMipsRegMapLo(m_Opcode.rd), (uint8_t)m_Opcode.sa); @@ -7262,7 +7260,7 @@ void CX86RecompilerOps::SPECIAL_DSRA32() else { Map_GPR_32bit(m_Opcode.rd, true, -1); - m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &_GPR[m_Opcode.rt].UW[1], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rd), &m_Reg.m_GPR[m_Opcode.rt].UW[1], CRegName::GPR_Lo[m_Opcode.rt]); if ((uint8_t)m_Opcode.sa != 0) { m_Assembler.sar(GetMipsRegMapLo(m_Opcode.rd), (uint8_t)m_Opcode.sa); @@ -7277,9 +7275,9 @@ void CX86RecompilerOps::COP0_MF() m_RegWorkingSet.BeforeCallDirect(); m_Assembler.push(m_Opcode.rd); m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::Cop0_MF), "CRegisters::Cop0_MF", 8); - m_Assembler.MoveX86regToVariable(&_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt], asmjit::x86::eax); + m_Assembler.MoveX86regToVariable(&m_Reg.m_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt], asmjit::x86::eax); m_RegWorkingSet.AfterCallDirect(); - m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rt), &_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rt), &m_Reg.m_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt]); } void CX86RecompilerOps::COP0_DMF() @@ -7288,11 +7286,11 @@ void CX86RecompilerOps::COP0_DMF() m_RegWorkingSet.BeforeCallDirect(); m_Assembler.push(m_Opcode.rd); m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::Cop0_MF), "CRegisters::Cop0_MF", 8); - m_Assembler.MoveX86regToVariable(&_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt], asmjit::x86::eax); - m_Assembler.MoveX86regToVariable(&_GPR[m_Opcode.rt].UW[1], CRegName::GPR_Hi[m_Opcode.rt], asmjit::x86::edx); + m_Assembler.MoveX86regToVariable(&m_Reg.m_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt], asmjit::x86::eax); + m_Assembler.MoveX86regToVariable(&m_Reg.m_GPR[m_Opcode.rt].UW[1], CRegName::GPR_Hi[m_Opcode.rt], asmjit::x86::edx); m_RegWorkingSet.AfterCallDirect(); - m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rt), &_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt]); - m_Assembler.MoveVariableToX86reg(GetMipsRegMapHi(m_Opcode.rt), &_GPR[m_Opcode.rt].UW[1], CRegName::GPR_Hi[m_Opcode.rt]); + m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rt), &m_Reg.m_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.MoveVariableToX86reg(GetMipsRegMapHi(m_Opcode.rt), &m_Reg.m_GPR[m_Opcode.rt].UW[1], CRegName::GPR_Hi[m_Opcode.rt]); } void CX86RecompilerOps::COP0_MT() @@ -7317,7 +7315,7 @@ void CX86RecompilerOps::COP0_MT() } else { - m_Assembler.MoveVariableToX86reg(asmjit::x86::eax, &_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.MoveVariableToX86reg(asmjit::x86::eax, &m_Reg.m_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt]); m_Assembler.mov(asmjit::x86::edx, asmjit::x86::eax); m_Assembler.sar(asmjit::x86::edx, 0x1F); m_Assembler.push(asmjit::x86::edx); @@ -7357,8 +7355,8 @@ void CX86RecompilerOps::COP0_DMT() } else { - m_Assembler.MoveVariableToX86reg(asmjit::x86::eax, &_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt]); - m_Assembler.MoveVariableToX86reg(asmjit::x86::edx, &_GPR[m_Opcode.rt].UW[1], CRegName::GPR_Hi[m_Opcode.rt]); + m_Assembler.MoveVariableToX86reg(asmjit::x86::eax, &m_Reg.m_GPR[m_Opcode.rt].UW[0], CRegName::GPR_Lo[m_Opcode.rt]); + m_Assembler.MoveVariableToX86reg(asmjit::x86::edx, &m_Reg.m_GPR[m_Opcode.rt].UW[1], CRegName::GPR_Hi[m_Opcode.rt]); m_Assembler.push(asmjit::x86::edx); m_Assembler.push(asmjit::x86::eax); } @@ -7436,12 +7434,12 @@ void CX86RecompilerOps::COP0_CO_ERET(void) // FPU options void CX86RecompilerOps::ChangeDefaultRoundingModel() { - switch ((_FPCR[31] & 3)) + switch ((g_Reg->m_FPCR[31] & 3)) { - case 0: *_RoundingModel = FE_TONEAREST; break; - case 1: *_RoundingModel = FE_TOWARDZERO; break; - case 2: *_RoundingModel = FE_UPWARD; break; - case 3: *_RoundingModel = FE_DOWNWARD; break; + case 0: g_Reg->m_RoundingModel = FE_TONEAREST; break; + case 1: g_Reg->m_RoundingModel = FE_TOWARDZERO; break; + case 2: g_Reg->m_RoundingModel = FE_UPWARD; break; + case 3: g_Reg->m_RoundingModel = FE_DOWNWARD; break; } } @@ -7453,7 +7451,7 @@ void CX86RecompilerOps::COP1_MF() UnMap_FPR(m_Opcode.fs, true); Map_GPR_32bit(m_Opcode.rt, true, -1); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_S[m_Opcode.fs], stdstr_f("_FPR_S[%d]", m_Opcode.fs).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_S[m_Opcode.fs], stdstr_f("_FPR_S[%d]", m_Opcode.fs).c_str()); m_Assembler.mov(GetMipsRegMapLo(m_Opcode.rt), asmjit::x86::dword_ptr(TempReg)); } @@ -7464,10 +7462,10 @@ void CX86RecompilerOps::COP1_DMF() UnMap_FPR(m_Opcode.fs, true); Map_GPR_64bit(m_Opcode.rt, -1); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_D[m_Opcode.fs], stdstr_f("_FPR_D[%d]", m_Opcode.fs).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_D[m_Opcode.fs], stdstr_f("_FPR_D[%d]", m_Opcode.fs).c_str()); m_Assembler.AddConstToX86Reg(TempReg, 4); m_Assembler.mov(GetMipsRegMapHi(m_Opcode.rt), asmjit::x86::dword_ptr(TempReg)); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_D[m_Opcode.fs], stdstr_f("_FPR_D[%d]", m_Opcode.fs).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_D[m_Opcode.fs], stdstr_f("_FPR_D[%d]", m_Opcode.fs).c_str()); m_Assembler.mov(GetMipsRegMapLo(m_Opcode.rt), asmjit::x86::dword_ptr(TempReg)); } @@ -7482,7 +7480,7 @@ void CX86RecompilerOps::COP1_CF() } Map_GPR_32bit(m_Opcode.rt, true, -1); - m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rt), &_FPCR[m_Opcode.fs], CRegName::FPR_Ctrl[m_Opcode.fs]); + m_Assembler.MoveVariableToX86reg(GetMipsRegMapLo(m_Opcode.rt), &m_Reg.m_FPCR[m_Opcode.fs], CRegName::FPR_Ctrl[m_Opcode.fs]); } void CX86RecompilerOps::COP1_MT() @@ -7498,7 +7496,7 @@ void CX86RecompilerOps::COP1_MT() } UnMap_FPR(m_Opcode.fs, true); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_S[m_Opcode.fs], stdstr_f("_FPR_S[%d]", m_Opcode.fs).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_S[m_Opcode.fs], stdstr_f("_FPR_S[%d]", m_Opcode.fs).c_str()); if (IsConst(m_Opcode.rt)) { @@ -7527,7 +7525,7 @@ void CX86RecompilerOps::COP1_DMT() } UnMap_FPR(m_Opcode.fs, true); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_D[m_Opcode.fs], stdstr_f("_FPR_D[%d]", m_Opcode.fs).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_D[m_Opcode.fs], stdstr_f("_FPR_D[%d]", m_Opcode.fs).c_str()); if (IsConst(m_Opcode.rt)) { @@ -7576,13 +7574,13 @@ void CX86RecompilerOps::COP1_CT() if (IsConst(m_Opcode.rt)) { - m_Assembler.MoveConstToVariable(&_FPCR[m_Opcode.fs], CRegName::FPR_Ctrl[m_Opcode.fs], GetMipsRegLo(m_Opcode.rt) & 0x183FFFF); + m_Assembler.MoveConstToVariable(&m_Reg.m_FPCR[m_Opcode.fs], CRegName::FPR_Ctrl[m_Opcode.fs], GetMipsRegLo(m_Opcode.rt) & 0x183FFFF); } else { asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, m_Opcode.rt, false, false); m_Assembler.and_(TempReg, 0x183FFFF); - m_Assembler.MoveX86regToVariable(&_FPCR[m_Opcode.fs], CRegName::FPR_Ctrl[m_Opcode.fs], TempReg); + m_Assembler.MoveX86regToVariable(&m_Reg.m_FPCR[m_Opcode.fs], CRegName::FPR_Ctrl[m_Opcode.fs], TempReg); } m_RegWorkingSet.BeforeCallDirect(); m_Assembler.CallFunc((uint32_t)ChangeDefaultRoundingModel, "ChangeDefaultRoundingModel"); @@ -7608,7 +7606,7 @@ void CX86RecompilerOps::COP1_S_ADD() { UnMap_FPR(Reg2, true); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_S[Reg2], stdstr_f("_FPR_S[%d]", Reg2).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_S[Reg2], stdstr_f("_FPR_S[%d]", Reg2).c_str()); Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fd, CRegInfo::FPU_Float); m_Assembler.fadd(asmjit::x86::dword_ptr(TempReg)); } @@ -7629,7 +7627,7 @@ void CX86RecompilerOps::COP1_S_SUB() Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fs, CRegInfo::FPU_Float); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_S[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_S[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str()); m_Assembler.fsub(asmjit::x86::dword_ptr(TempReg)); } else @@ -7645,7 +7643,7 @@ void CX86RecompilerOps::COP1_S_SUB() Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fd, CRegInfo::FPU_Float); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_S[Reg2], stdstr_f("_FPR_S[%d]", Reg2).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_S[Reg2], stdstr_f("_FPR_S[%d]", Reg2).c_str()); m_Assembler.fsub(asmjit::x86::dword_ptr(TempReg)); } } @@ -7671,7 +7669,7 @@ void CX86RecompilerOps::COP1_S_MUL() Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fd, CRegInfo::FPU_Float); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_S[Reg2], stdstr_f("_FPR_S[%d]", Reg2).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_S[Reg2], stdstr_f("_FPR_S[%d]", Reg2).c_str()); m_Assembler.fmul(asmjit::x86::dword_ptr(TempReg)); } UnMap_FPR(m_Opcode.fd, true); @@ -7691,7 +7689,7 @@ void CX86RecompilerOps::COP1_S_DIV() Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fs, CRegInfo::FPU_Float); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_S[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_S[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str()); m_Assembler.fdiv(asmjit::x86::dword_ptr(TempReg)); } else @@ -7707,7 +7705,7 @@ void CX86RecompilerOps::COP1_S_DIV() Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fd, CRegInfo::FPU_Float); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_S[Reg2], stdstr_f("_FPR_S[%d]", Reg2).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_S[Reg2], stdstr_f("_FPR_S[%d]", Reg2).c_str()); m_Assembler.fdiv(asmjit::x86::dword_ptr(TempReg)); } } @@ -7897,10 +7895,10 @@ void CX86RecompilerOps::COP1_S_CMP() Load_FPR_ToTop(Reg1, Reg1, CRegInfo::FPU_Float); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_S[Reg2], stdstr_f("_FPR_S[%d]", Reg2).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_S[Reg2], stdstr_f("_FPR_S[%d]", Reg2).c_str()); m_Assembler.fcom(asmjit::x86::dword_ptr(TempReg)); } - m_Assembler.AndConstToVariable(&_FPCR[31], "_FPCR[31]", (uint32_t)~FPCSR_C); + m_Assembler.AndConstToVariable(&m_Reg.m_FPCR[31], "_FPCR[31]", (uint32_t)~FPCSR_C); m_Assembler.fnstsw(asmjit::x86::ax); asmjit::x86::Gp Reg = Map_TempReg(x86Reg_Unknown, 0, false, true); m_Assembler.test(asmjit::x86::eax, cmp); @@ -7928,7 +7926,7 @@ void CX86RecompilerOps::COP1_S_CMP() m_Assembler.setz(Reg); } m_Assembler.shl(Reg, 23); - m_Assembler.OrX86RegToVariable(&_FPCR[31], "_FPCR[31]", Reg); + m_Assembler.OrX86RegToVariable(&m_Reg.m_FPCR[31], "_FPCR[31]", Reg); } // COP1: D functions @@ -7948,7 +7946,7 @@ void CX86RecompilerOps::COP1_D_ADD() { UnMap_FPR(Reg2, true); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_D[Reg2], stdstr_f("_FPR_D[%d]", Reg2).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_D[Reg2], stdstr_f("_FPR_D[%d]", Reg2).c_str()); Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fd, CRegInfo::FPU_Double); m_Assembler.fadd(asmjit::x86::qword_ptr(TempReg)); } @@ -7965,7 +7963,7 @@ void CX86RecompilerOps::COP1_D_SUB() { UnMap_FPR(m_Opcode.fd, true); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str()); Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fs, CRegInfo::FPU_Double); m_Assembler.fsub(asmjit::x86::qword_ptr(TempReg)); } @@ -7981,7 +7979,7 @@ void CX86RecompilerOps::COP1_D_SUB() UnMap_FPR(Reg2, true); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_D[Reg2], stdstr_f("_FPR_D[%d]", Reg2).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_D[Reg2], stdstr_f("_FPR_D[%d]", Reg2).c_str()); Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fd, CRegInfo::FPU_Double); m_Assembler.fsub(asmjit::x86::qword_ptr(TempReg)); } @@ -8006,7 +8004,7 @@ void CX86RecompilerOps::COP1_D_MUL() UnMap_FPR(Reg2, true); Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fd, CRegInfo::FPU_Double); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_D[Reg2], stdstr_f("_FPR_D[%d]", Reg2).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_D[Reg2], stdstr_f("_FPR_D[%d]", Reg2).c_str()); m_Assembler.fmul(asmjit::x86::qword_ptr(TempReg)); } } @@ -8022,7 +8020,7 @@ void CX86RecompilerOps::COP1_D_DIV() { UnMap_FPR(m_Opcode.fd, true); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str()); Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fs, CRegInfo::FPU_Double); m_Assembler.fdiv(asmjit::x86::qword_ptr(TempReg)); } @@ -8037,7 +8035,7 @@ void CX86RecompilerOps::COP1_D_DIV() { UnMap_FPR(Reg2, true); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_D[Reg2], stdstr_f("_FPR_D[%d]").c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_D[Reg2], stdstr_f("_FPR_D[%d]").c_str()); Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fd, CRegInfo::FPU_Double); m_Assembler.fdiv(asmjit::x86::qword_ptr(TempReg)); } @@ -8261,11 +8259,11 @@ void CX86RecompilerOps::COP1_D_CMP() { UnMap_FPR(Reg2, true); asmjit::x86::Gp TempReg = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&_FPR_D[Reg2], stdstr_f("_FPR_D[%d]", Reg2).c_str()); + m_Assembler.MoveVariableToX86reg(TempReg, (uint8_t *)&m_Reg.m_FPR_D[Reg2], stdstr_f("_FPR_D[%d]", Reg2).c_str()); Load_FPR_ToTop(Reg1, Reg1, CRegInfo::FPU_Double); m_Assembler.fcom(asmjit::x86::qword_ptr(TempReg)); } - m_Assembler.AndConstToVariable(&_FPCR[31], "_FPCR[31]", (uint32_t)~FPCSR_C); + m_Assembler.AndConstToVariable(&m_Reg.m_FPCR[31], "_FPCR[31]", (uint32_t)~FPCSR_C); m_Assembler.fnstsw(asmjit::x86::ax); asmjit::x86::Gp Reg = Map_TempReg(x86Reg_Unknown, 0, false, true); m_Assembler.test(asmjit::x86::eax, cmp); @@ -8292,7 +8290,7 @@ void CX86RecompilerOps::COP1_D_CMP() m_Assembler.setz(Reg); } m_Assembler.shl(Reg, 23); - m_Assembler.OrX86RegToVariable(&_FPCR[31], "_FPCR[31]", Reg); + m_Assembler.OrX86RegToVariable(&m_Reg.m_FPCR[31], "_FPCR[31]", Reg); } // COP1: W functions @@ -8487,7 +8485,7 @@ void CX86RecompilerOps::CompileCop1Test() void CX86RecompilerOps::CompileInPermLoop(CRegInfo & RegSet, uint32_t ProgramCounter) { - m_Assembler.MoveConstToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", ProgramCounter); + m_Assembler.MoveConstToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", ProgramCounter); RegSet.WriteBackRegisters(); UpdateCounters(RegSet, false, true, false); m_Assembler.CallFunc(AddressOf(CInterpreterCPU::InPermLoop), "CInterpreterCPU::InPermLoop"); @@ -8609,8 +8607,8 @@ void CX86RecompilerOps::SyncRegState(const CRegInfo & SyncTo) switch (GetMipsRegState(i)) { case CRegInfo::STATE_UNKNOWN: - m_Assembler.MoveVariableToX86reg(Reg, &_GPR[i].UW[0], CRegName::GPR_Lo[i]); - m_Assembler.MoveVariableToX86reg(x86RegHi, &_GPR[i].UW[1], CRegName::GPR_Hi[i]); + m_Assembler.MoveVariableToX86reg(Reg, &m_Reg.m_GPR[i].UW[0], CRegName::GPR_Lo[i]); + m_Assembler.MoveVariableToX86reg(x86RegHi, &m_Reg.m_GPR[i].UW[1], CRegName::GPR_Hi[i]); break; case CRegInfo::STATE_MAPPED_64: m_Assembler.mov(Reg, GetMipsRegMapLo(i)); @@ -8657,7 +8655,7 @@ void CX86RecompilerOps::SyncRegState(const CRegInfo & SyncTo) UnMap_X86reg(Reg); switch (GetMipsRegState(i)) { - case CRegInfo::STATE_UNKNOWN: m_Assembler.MoveVariableToX86reg(Reg, &_GPR[i].UW[0], CRegName::GPR_Lo[i]); break; + case CRegInfo::STATE_UNKNOWN: m_Assembler.MoveVariableToX86reg(Reg, &m_Reg.m_GPR[i].UW[0], CRegName::GPR_Lo[i]); break; case CRegInfo::STATE_CONST_32_SIGN: m_Assembler.MoveConstToX86reg(Reg, GetMipsRegLo(i)); break; case CRegInfo::STATE_MAPPED_32_SIGN: m_Assembler.mov(Reg, GetMipsRegMapLo(i)); @@ -8695,7 +8693,7 @@ void CX86RecompilerOps::SyncRegState(const CRegInfo & SyncTo) { case CRegInfo::STATE_MAPPED_64: case CRegInfo::STATE_UNKNOWN: - m_Assembler.MoveVariableToX86reg(Reg, &_GPR[i].UW[0], CRegName::GPR_Lo[i]); + m_Assembler.MoveVariableToX86reg(Reg, &m_Reg.m_GPR[i].UW[0], CRegName::GPR_Lo[i]); break; case CRegInfo::STATE_MAPPED_32_ZERO: m_Assembler.mov(Reg, GetMipsRegMapLo(i)); @@ -9327,7 +9325,7 @@ void CX86RecompilerOps::CompileExecuteBP(void) m_RegWorkingSet.WriteBackRegisters(); UpdateCounters(m_RegWorkingSet, true, true); - m_Assembler.MoveConstToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", CompilePC()); + m_Assembler.MoveConstToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", CompilePC()); if (g_SyncSystem) { m_Assembler.CallThis((uint32_t)g_BaseSystem, AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem", 4); @@ -9347,7 +9345,7 @@ void CX86RecompilerOps::CompileExecuteDelaySlotBP(void) m_RegWorkingSet.WriteBackRegisters(); UpdateCounters(m_RegWorkingSet, true, true); - m_Assembler.MoveConstToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", CompilePC()); + m_Assembler.MoveConstToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", CompilePC()); if (g_SyncSystem) { m_Assembler.CallThis((uint32_t)g_BaseSystem, AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem", 4); @@ -9365,13 +9363,13 @@ void CX86RecompilerOps::OverflowDelaySlot(bool TestTimer) if (m_PipelineStage == PIPELINE_STAGE_DELAY_SLOT) { m_Assembler.MoveVariableToX86reg(asmjit::x86::ecx, &g_System->m_JumpToLocation, "System::m_JumpToLocation"); - m_Assembler.MoveX86regToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", asmjit::x86::ecx); + m_Assembler.MoveX86regToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", asmjit::x86::ecx); m_Assembler.MoveVariableToX86reg(asmjit::x86::ecx, &g_System->m_JumpDelayLocation, "System::JumpDelayLocation"); m_Assembler.MoveX86regToVariable(&g_System->m_JumpToLocation, "System::m_JumpToLocation", asmjit::x86::ecx); } else { - m_Assembler.MoveConstToVariable(_PROGRAM_COUNTER, "PROGRAM_COUNTER", CompilePC() + 4); + m_Assembler.MoveConstToVariable(&m_Reg.m_PROGRAM_COUNTER, "PROGRAM_COUNTER", CompilePC() + 4); } if (g_SyncSystem) { @@ -9589,7 +9587,7 @@ asmjit::x86::Gp CX86RecompilerOps::BaseOffsetAddress(bool UseBaseRegister) else { asmjit::x86::Gp AddressMemoryHi = Map_TempReg(x86Reg_Unknown, -1, false, false); - m_Assembler.MoveVariableToX86reg(AddressMemoryHi, &_GPR[m_Opcode.base].W[1], CRegName::GPR_Hi[m_Opcode.base]); + m_Assembler.MoveVariableToX86reg(AddressMemoryHi, &m_Reg.m_GPR[m_Opcode.base].W[1], CRegName::GPR_Hi[m_Opcode.base]); m_Assembler.MoveX86regToVariable(&m_TempValue64 + 4, "TempValue64 + 4", AddressMemoryHi); m_Assembler.cmp(AddressRegHi, AddressMemoryHi); m_RegWorkingSet.SetX86Protected(GetIndexFromX86Reg(AddressMemoryHi), false); @@ -11106,11 +11104,11 @@ void CX86RecompilerOps::ResetMemoryStack() int32_t MipsReg = 29; if (IsConst(MipsReg)) { - m_Assembler.MoveConstToVariable(&_GPR[MipsReg].UW[0], CRegName::GPR_Lo[MipsReg], GetMipsRegLo(MipsReg)); + m_Assembler.MoveConstToVariable(&m_Reg.m_GPR[MipsReg].UW[0], CRegName::GPR_Lo[MipsReg], GetMipsRegLo(MipsReg)); } else if (IsMapped(MipsReg)) { - m_Assembler.MoveX86regToVariable(&_GPR[MipsReg].UW[0], CRegName::GPR_Lo[MipsReg], GetMipsRegMapLo(MipsReg)); + m_Assembler.MoveX86regToVariable(&m_Reg.m_GPR[MipsReg].UW[0], CRegName::GPR_Lo[MipsReg], GetMipsRegMapLo(MipsReg)); } asmjit::x86::Gp MemoryStackReg = Get_MemoryStack(); diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.h b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.h index 08828e627..a33bb8572 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.h +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.h @@ -2,7 +2,6 @@ #if defined(__i386__) || defined(_M_IX86) #include -#include #include #include #include @@ -18,13 +17,14 @@ class CCodeBlock; class CCodeSection; class CX86RecompilerOps : - protected R4300iOp, + public CRecompilerOpsBase, protected CN64SystemSettings, protected CRecompilerSettings, + protected CLogSettings, private CGameSettings { public: - CX86RecompilerOps(CMipsMemoryVM & MMU, CCodeBlock & CodeBlock); + CX86RecompilerOps(CMipsMemoryVM & MMU, CRegisters & Reg, CCodeBlock & CodeBlock); ~CX86RecompilerOps(); // Trap functions @@ -445,14 +445,10 @@ private: void ResetMemoryStack(); EXIT_LIST m_ExitInfo; - CMipsMemoryVM & m_MMU; - CCodeBlock & m_CodeBlock; CX86Ops m_Assembler; PIPELINE_STAGE m_PipelineStage; uint32_t m_CompilePC; - R4300iOpcode m_Opcode; CX86RegInfo m_RegWorkingSet; - CCodeSection * m_Section; CRegInfo m_RegBeforeDelay; bool m_EffectDelaySlot; static uint32_t m_TempValue32; diff --git a/Source/Project64-core/Project64-core.vcxproj b/Source/Project64-core/Project64-core.vcxproj index c2704efd9..4487f3bd7 100644 --- a/Source/Project64-core/Project64-core.vcxproj +++ b/Source/Project64-core/Project64-core.vcxproj @@ -104,6 +104,7 @@ + diff --git a/Source/Project64-core/Project64-core.vcxproj.filters b/Source/Project64-core/Project64-core.vcxproj.filters index 067cbf0c1..5d83c58db 100644 --- a/Source/Project64-core/Project64-core.vcxproj.filters +++ b/Source/Project64-core/Project64-core.vcxproj.filters @@ -435,6 +435,9 @@ Source Files\Settings\SettingType + + Source Files\N64 System\Recompiler +