From d1a2e29f9bdb5f2234b96d1b6b743f9176cb2c0f Mon Sep 17 00:00:00 2001 From: zilmar Date: Wed, 23 Nov 2016 08:47:28 +1100 Subject: [PATCH] [Project64] Add LogRegisterState when no registers available --- .../N64System/Recompiler/Arm/ArmRegInfo.cpp | 46 +++++++++++++++++++ .../N64System/Recompiler/Arm/ArmRegInfo.h | 2 + 2 files changed, 48 insertions(+) diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp index 2fac080d9..4d62becff 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp @@ -749,10 +749,56 @@ CArmOps::ArmReg CArmRegInfo::FreeArmReg(bool TempMapping) } } } + + LogRegisterState(); g_Notify->BreakPoint(__FILE__, __LINE__); return Arm_Unknown; } +void CArmRegInfo::LogRegisterState(void) +{ + if (!g_bRecompilerLogging) + { + return; + } + + for (uint32_t i = 0; i < 16; i++) + { + stdstr regname; + + if (GetArmRegMapped((ArmReg)i) == CArmRegInfo::GPR_Mapped) + { + for (uint32_t count = 1; count < 32; count++) + { + if (!IsMapped(count)) + { + continue; + } + + if (Is64Bit(count) && GetMipsRegMapHi(count) == (ArmReg)i) + { + regname = CRegName::GPR_Hi[count]; + break; + } + if (GetMipsRegMapLo(count) == (ArmReg)i) + { + regname = CRegName::GPR_Lo[count]; + break; + } + } + } + + CPU_Message("GetArmRegMapped(%s) = %X%s%s Protected: %s MapOrder: %d", + ArmRegName((ArmReg)i), + GetArmRegMapped((ArmReg)i), + GetArmRegMapped((ArmReg)i) == CArmRegInfo::Variable_Mapped ? stdstr_f(" (%s)", CArmRegInfo::VariableMapName(GetVariableMappedTo((ArmReg)i))).c_str() : "", + regname.length() > 0 ? stdstr_f(" (%s)", regname.c_str()).c_str() : "", + GetArmRegProtected((ArmReg)i) ? "true" : "false", + GetArmRegMapOrder((ArmReg)i) + ); + } +} + CArmOps::ArmReg CArmRegInfo::Map_TempReg(ArmReg Reg, int32_t MipsReg, bool LoadHiWord) { if (m_InCallDirect) diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h index 935a77fe7..9821b7f92 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h @@ -87,6 +87,8 @@ public: inline void SetVariableMappedTo(ArmReg Reg, VARIABLE_MAPPED variable) { m_Variable_MappedTo[Reg] = variable; } static const char * VariableMapName(VARIABLE_MAPPED variable); + void LogRegisterState(void); + private: bool ShouldPushPopReg (ArmReg Reg);