2016-07-06 20:14:12 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* *
|
|
|
|
* Project64 - A Nintendo 64 emulator. *
|
|
|
|
* http://www.pj64-emu.com/ *
|
|
|
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
|
|
* *
|
|
|
|
* License: *
|
|
|
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
#pragma once
|
|
|
|
#if defined(__arm__) || defined(_M_ARM)
|
|
|
|
#include <Project64-core/N64System/Recompiler/RegBase.h>
|
2016-09-29 12:15:33 +00:00
|
|
|
#include <Project64-core/N64System/Recompiler/Arm/ArmOps.h>
|
2016-09-30 13:33:07 +00:00
|
|
|
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
2016-07-06 20:14:12 +00:00
|
|
|
|
|
|
|
class CArmRegInfo :
|
2016-09-29 12:15:33 +00:00
|
|
|
public CRegBase,
|
2016-09-30 13:33:07 +00:00
|
|
|
public CArmOps,
|
|
|
|
private CSystemRegisters
|
2016-07-06 20:14:12 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-09-30 13:33:07 +00:00
|
|
|
//enums
|
|
|
|
enum REG_MAPPED
|
|
|
|
{
|
|
|
|
NotMapped = 0,
|
|
|
|
GPR_Mapped = 1,
|
|
|
|
Temp_Mapped = 2,
|
|
|
|
Variable_Mapped = 3,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum VARIABLE_MAPPED
|
|
|
|
{
|
|
|
|
VARIABLE_UNKNOWN = 0,
|
|
|
|
VARIABLE_GPR = 1,
|
|
|
|
VARIABLE_FPR = 2,
|
|
|
|
VARIABLE_TLB_READMAP = 3,
|
|
|
|
VARIABLE_NEXT_TIMER = 4,
|
|
|
|
};
|
|
|
|
|
2016-08-11 11:09:21 +00:00
|
|
|
CArmRegInfo();
|
|
|
|
CArmRegInfo(const CArmRegInfo&);
|
|
|
|
~CArmRegInfo();
|
|
|
|
|
|
|
|
CArmRegInfo& operator=(const CArmRegInfo&);
|
|
|
|
|
2016-07-06 20:14:12 +00:00
|
|
|
bool operator==(const CArmRegInfo& right) const;
|
2016-08-11 11:09:21 +00:00
|
|
|
bool operator!=(const CArmRegInfo& right) const;
|
2016-09-30 19:58:04 +00:00
|
|
|
|
2016-08-11 11:09:21 +00:00
|
|
|
void BeforeCallDirect(void);
|
|
|
|
void AfterCallDirect(void);
|
|
|
|
|
2016-09-30 13:33:07 +00:00
|
|
|
ArmReg FreeArmReg();
|
2016-08-11 11:09:21 +00:00
|
|
|
void WriteBackRegisters();
|
2016-07-06 20:14:12 +00:00
|
|
|
|
2016-09-30 19:58:04 +00:00
|
|
|
ArmReg Map_TempReg(ArmReg Reg, int32_t MipsReg, bool LoadHiWord);
|
2016-09-30 13:33:07 +00:00
|
|
|
ArmReg Map_Variable(VARIABLE_MAPPED variable);
|
2016-09-30 19:58:04 +00:00
|
|
|
inline uint32_t GetArmRegMapOrder(ArmReg Reg) const { return m_ArmReg_MapOrder[Reg]; }
|
2016-09-30 13:33:07 +00:00
|
|
|
inline bool GetArmRegProtected(ArmReg Reg) const { return m_ArmReg_Protected[Reg]; }
|
|
|
|
inline REG_MAPPED GetArmRegMapped(ArmReg Reg) const { return m_ArmReg_MappedTo[Reg]; }
|
2016-09-30 19:58:04 +00:00
|
|
|
inline void SetArmRegMapOrder(ArmReg Reg, uint32_t Order) { m_ArmReg_MapOrder[Reg] = Order; }
|
2016-09-30 13:33:07 +00:00
|
|
|
inline void SetArmRegProtected(ArmReg Reg, bool Protected) { m_ArmReg_Protected[Reg] = Protected; }
|
|
|
|
inline void SetArmRegMapped(ArmReg Reg, REG_MAPPED Mapping) { m_ArmReg_MappedTo[Reg] = Mapping; }
|
2016-08-11 11:09:21 +00:00
|
|
|
private:
|
2016-09-30 19:58:04 +00:00
|
|
|
uint32_t m_ArmReg_MapOrder[16];
|
2016-09-30 13:33:07 +00:00
|
|
|
bool m_ArmReg_Protected[16];
|
|
|
|
REG_MAPPED m_ArmReg_MappedTo[16];
|
|
|
|
VARIABLE_MAPPED m_Variable_MappedTo[16];
|
2016-09-29 12:17:54 +00:00
|
|
|
bool m_InCallDirect;
|
2016-08-11 11:09:21 +00:00
|
|
|
};
|
2016-07-06 20:14:12 +00:00
|
|
|
#endif
|