project64/Source/Project64-core/N64System/Recompiler/CodeSection.h

66 lines
2.3 KiB
C
Raw Normal View History

2012-12-19 09:30:18 +00:00
#pragma once
2015-12-06 09:59:58 +00:00
#include "JumpInfo.h"
#include <Project64-core/N64System/Recompiler/RecompilerOps.h>
#include <Project64-core/Settings/DebugSettings.h>
class CCodeBlock;
class CCodeSection :
private CDebugSettings
{
2012-10-14 01:05:52 +00:00
public:
2015-11-15 02:27:06 +00:00
typedef std::list<CCodeSection *> SECTION_LIST;
2015-11-15 02:27:06 +00:00
CCodeSection(CCodeBlock * CodeBlock, uint32_t EnterPC, uint32_t ID, bool LinkAllowed);
~CCodeSection();
2015-11-15 02:27:06 +00:00
void SetDelaySlot();
void SetJumpAddress(uint32_t JumpPC, uint32_t TargetPC, bool PermLoop);
void SetContinueAddress(uint32_t JumpPC, uint32_t TargetPC);
bool GenerateNativeCode(uint32_t Test);
2015-11-15 02:27:06 +00:00
void GenerateSectionLinkage();
void DetermineLoop(uint32_t Test, uint32_t Test2, uint32_t TestID);
CCodeSection * ExistingSection(uint32_t Addr, uint32_t Test);
bool SectionAccessible(uint32_t SectionId, uint32_t Test);
bool DisplaySectionInformation(uint32_t ID, uint32_t Test);
void DisplaySectionInformation();
void AddParent(CCodeSection * Parent);
void SwitchParent(CCodeSection * OldParent, CCodeSection * NewParent);
2015-11-15 02:27:06 +00:00
/* Block Connection info */
SECTION_LIST m_ParentSection;
CCodeBlock * const m_BlockInfo;
const uint32_t m_SectionID;
const uint32_t m_EnterPC;
uint32_t m_EndPC;
CCodeSection * m_ContinueSection;
CCodeSection * m_JumpSection;
bool m_EndSection; // if this section does not link
bool m_LinkAllowed; // are other sections allowed to find block to link to it
uint32_t m_Test;
uint32_t m_Test2;
uint8_t * m_CompiledLocation;
bool m_InLoop;
bool m_DelaySlot;
CRecompilerOps * & m_RecompilerOps;
2015-11-15 02:27:06 +00:00
/* Register Info */
CRegInfo m_RegEnter;
2015-11-15 02:27:06 +00:00
/* Jump Info */
CJumpInfo m_Jump;
CJumpInfo m_Cont;
private:
CCodeSection(void);
CCodeSection(const CCodeSection&);
CCodeSection& operator=(const CCodeSection&);
2015-11-15 02:27:06 +00:00
void UnlinkParent(CCodeSection * Parent, bool ContinueSection);
void InheritConstants();
void TestRegConstantStates(CRegInfo & Base, CRegInfo & Reg);
bool IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test);
bool ParentContinue();
bool SetupRegisterForLoop();
};