[Project64] Add CArmOps::MoveArmRegToVariable

This commit is contained in:
zilmar 2016-11-22 17:56:23 +11:00
parent 86d7fbd4b8
commit b672cfa21b
2 changed files with 21 additions and 0 deletions

View File

@ -279,6 +279,26 @@ void CArmOps::CallFunction(void * Function, const char * FunctionName)
AddCode16(op.Hex);
}
void CArmOps::MoveArmRegToVariable(ArmReg Reg, void * Variable, const char * VariableName)
{
if (mInItBlock) { g_Notify->BreakPoint(__FILE__, __LINE__); }
bool WasRegProtected = m_RegWorkingSet.GetArmRegProtected(Reg);
if (!WasRegProtected)
{
m_RegWorkingSet.SetArmRegProtected(Reg, true);
}
ArmReg VariableReg = m_RegWorkingSet.Map_TempReg(Arm_Any, -1, false);
MoveConstToArmReg(VariableReg, (uint32_t)Variable, VariableName);
StoreArmRegToArmRegPointer(Reg, VariableReg, 0);
m_RegWorkingSet.SetArmRegProtected(VariableReg, false);
if (!WasRegProtected)
{
m_RegWorkingSet.SetArmRegProtected(Reg, false);
}
}
void CArmOps::MoveConstToArmReg(ArmReg DestReg, uint16_t Const, const char * comment)
{
if (comment != NULL)

View File

@ -175,6 +175,7 @@ protected:
static void LoadArmRegPointerToFloatReg(ArmReg RegPointer, ArmFpuSingle Reg, uint8_t Offset);
static void LoadFloatingPointControlReg(ArmReg DestReg);
static void MoveArmRegArmReg(ArmReg DestReg, ArmReg SourceReg);
static void MoveArmRegToVariable(ArmReg Reg, void * Variable, const char * VariableName);
static void MoveConstToArmReg(ArmReg DestReg, uint16_t Const, const char * comment = NULL);
static void MoveConstToArmRegTop(ArmReg DestReg, uint16_t Const, const char * comment = NULL);
static void MoveConstToArmReg(ArmReg DestReg, uint32_t Const, const char * comment = NULL);