2016-01-27 09:11:59 +00:00
|
|
|
#pragma once
|
|
|
|
#include <Project64-core/N64System/Recompiler/RegInfo.h>
|
2022-07-18 08:31:00 +00:00
|
|
|
#include <Project64-core/N64System/Mips/R4300iOpcode.h>
|
2016-07-06 20:14:12 +00:00
|
|
|
#include <Project64-core/N64System/N64Types.h>
|
2022-01-18 07:47:21 +00:00
|
|
|
#include <map>
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
class CCodeSection;
|
|
|
|
class CCodeBlock;
|
|
|
|
|
|
|
|
class LoopAnalysis
|
|
|
|
{
|
|
|
|
public:
|
2022-08-08 10:52:51 +00:00
|
|
|
LoopAnalysis(CCodeBlock & CodeBlock, CCodeSection * Section);
|
2016-01-27 09:11:59 +00:00
|
|
|
~LoopAnalysis();
|
|
|
|
|
|
|
|
bool SetupRegisterForLoop();
|
|
|
|
|
|
|
|
private:
|
2021-04-13 00:07:11 +00:00
|
|
|
LoopAnalysis();
|
|
|
|
LoopAnalysis(const LoopAnalysis&);
|
|
|
|
LoopAnalysis& operator=(const LoopAnalysis&);
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
bool SetupEnterSection(CCodeSection * Section, bool & bChanged, bool & bSkipedSection);
|
|
|
|
bool CheckLoopRegisterUsage(CCodeSection * Section);
|
|
|
|
bool SyncRegState(CRegInfo & RegSet, const CRegInfo& SyncReg);
|
|
|
|
void SetJumpRegSet(CCodeSection * Section, const CRegInfo &Reg);
|
|
|
|
void SetContinueRegSet(CCodeSection * Section, const CRegInfo &Reg);
|
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
// R4300i opcodes: Special
|
2016-01-27 09:11:59 +00:00
|
|
|
void SPECIAL_SLL();
|
|
|
|
void SPECIAL_SRL();
|
|
|
|
void SPECIAL_SRA();
|
|
|
|
void SPECIAL_SLLV();
|
|
|
|
void SPECIAL_SRLV();
|
|
|
|
void SPECIAL_SRAV();
|
|
|
|
void SPECIAL_JR();
|
|
|
|
void SPECIAL_JALR();
|
|
|
|
void SPECIAL_SYSCALL(CCodeSection * Section);
|
|
|
|
void SPECIAL_BREAK(CCodeSection * Section);
|
|
|
|
void SPECIAL_MFHI();
|
|
|
|
void SPECIAL_MTHI();
|
|
|
|
void SPECIAL_MFLO();
|
|
|
|
void SPECIAL_MTLO();
|
|
|
|
void SPECIAL_DSLLV();
|
|
|
|
void SPECIAL_DSRLV();
|
|
|
|
void SPECIAL_DSRAV();
|
|
|
|
void SPECIAL_ADD();
|
|
|
|
void SPECIAL_ADDU();
|
|
|
|
void SPECIAL_SUB();
|
|
|
|
void SPECIAL_SUBU();
|
|
|
|
void SPECIAL_AND();
|
|
|
|
void SPECIAL_OR();
|
|
|
|
void SPECIAL_XOR();
|
|
|
|
void SPECIAL_NOR();
|
|
|
|
void SPECIAL_SLT();
|
|
|
|
void SPECIAL_SLTU();
|
|
|
|
void SPECIAL_DADD();
|
|
|
|
void SPECIAL_DADDU();
|
|
|
|
void SPECIAL_DSUB();
|
|
|
|
void SPECIAL_DSUBU();
|
|
|
|
void SPECIAL_DSLL();
|
|
|
|
void SPECIAL_DSRL();
|
|
|
|
void SPECIAL_DSRA();
|
|
|
|
void SPECIAL_DSLL32();
|
|
|
|
void SPECIAL_DSRL32();
|
|
|
|
void SPECIAL_DSRA32();
|
|
|
|
|
|
|
|
typedef std::map<int32_t, CRegInfo *> RegisterMap;
|
|
|
|
|
2022-01-18 07:47:21 +00:00
|
|
|
RegisterMap m_EnterRegisters;
|
|
|
|
RegisterMap m_ContinueRegisters;
|
|
|
|
RegisterMap m_JumpRegisters;
|
2016-01-27 09:11:59 +00:00
|
|
|
CCodeSection * m_EnterSection;
|
2022-08-08 10:52:51 +00:00
|
|
|
CCodeBlock & m_CodeBlock;
|
2022-01-18 07:47:21 +00:00
|
|
|
uint32_t m_PC;
|
|
|
|
CRegInfo m_Reg;
|
|
|
|
PIPELINE_STAGE m_PipelineStage;
|
2022-07-18 08:31:00 +00:00
|
|
|
R4300iOpcode m_Command;
|
2022-01-18 07:47:21 +00:00
|
|
|
uint32_t m_Test;
|
2016-01-27 09:11:59 +00:00
|
|
|
};
|