2012-12-19 09:30:18 +00:00
|
|
|
#pragma once
|
2015-12-06 09:59:58 +00:00
|
|
|
#include "JumpInfo.h"
|
2016-07-04 07:51:11 +00:00
|
|
|
#include <Project64-core/N64System/Recompiler/RecompilerOps.h>
|
2019-01-15 19:45:54 +00:00
|
|
|
#include <Project64-core/Settings/DebugSettings.h>
|
2010-05-30 01:54:42 +00:00
|
|
|
|
|
|
|
class CCodeBlock;
|
|
|
|
|
2018-01-20 23:18:52 +00:00
|
|
|
class CCodeSection :
|
|
|
|
private CDebugSettings
|
2010-05-30 01:54:42 +00:00
|
|
|
{
|
2012-10-14 01:05:52 +00:00
|
|
|
public:
|
2015-11-15 02:27:06 +00:00
|
|
|
typedef std::list<CCodeSection *> SECTION_LIST;
|
2010-07-23 10:45:35 +00:00
|
|
|
|
2015-11-15 02:27:06 +00:00
|
|
|
CCodeSection(CCodeBlock * CodeBlock, uint32_t EnterPC, uint32_t ID, bool LinkAllowed);
|
|
|
|
~CCodeSection();
|
2010-05-30 01:54:42 +00:00
|
|
|
|
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);
|
2016-06-27 11:49:15 +00:00
|
|
|
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);
|
2010-05-30 01:54:42 +00:00
|
|
|
|
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;
|
2016-07-03 05:22:14 +00:00
|
|
|
CRecompilerOps * & m_RecompilerOps;
|
2010-05-30 01:54:42 +00:00
|
|
|
|
2015-11-15 02:27:06 +00:00
|
|
|
/* Register Info */
|
|
|
|
CRegInfo m_RegEnter;
|
2010-05-30 01:54:42 +00:00
|
|
|
|
2015-11-15 02:27:06 +00:00
|
|
|
/* Jump Info */
|
|
|
|
CJumpInfo m_Jump;
|
|
|
|
CJumpInfo m_Cont;
|
2010-05-30 01:54:42 +00:00
|
|
|
|
|
|
|
private:
|
2021-04-13 00:07:11 +00:00
|
|
|
CCodeSection(void);
|
|
|
|
CCodeSection(const CCodeSection&);
|
|
|
|
CCodeSection& operator=(const CCodeSection&);
|
2010-05-30 01:54:42 +00:00
|
|
|
|
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();
|
2015-11-09 06:55:16 +00:00
|
|
|
};
|