2010-05-30 01:54:42 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
class CCodeBlock;
|
|
|
|
|
|
|
|
class CCodeSection :
|
|
|
|
private CRecompilerOps
|
|
|
|
{
|
2012-10-14 01:05:52 +00:00
|
|
|
public:
|
2010-07-23 10:45:35 +00:00
|
|
|
typedef std::list<CCodeSection *> SECTION_LIST;
|
|
|
|
|
2012-10-14 01:05:52 +00:00
|
|
|
CCodeSection( CCodeBlock * CodeBlock, DWORD EnterPC, DWORD ID, bool LinkAllowed);
|
2010-05-30 01:54:42 +00:00
|
|
|
~CCodeSection( void );
|
|
|
|
|
2012-10-14 01:05:52 +00:00
|
|
|
void SetDelaySlot ( void );
|
2012-10-15 07:41:30 +00:00
|
|
|
void SetJumpAddress ( DWORD JumpPC, DWORD TargetPC, bool PermLoop );
|
2012-10-14 01:05:52 +00:00
|
|
|
void SetContinueAddress ( DWORD JumpPC, DWORD TargetPC );
|
2010-07-23 10:45:35 +00:00
|
|
|
void CompileCop1Test ( void );
|
|
|
|
bool CreateSectionLinkage ( void );
|
|
|
|
bool GenerateX86Code ( DWORD Test );
|
|
|
|
void GenerateSectionLinkage ( void );
|
2010-10-23 18:53:01 +00:00
|
|
|
void CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason, int CompileNow, void (*x86Jmp)(const char * Label, DWORD Value));
|
2010-07-23 10:45:35 +00:00
|
|
|
void DetermineLoop ( DWORD Test, DWORD Test2, DWORD TestID );
|
|
|
|
bool FixConstants ( DWORD Test );
|
|
|
|
CCodeSection * ExistingSection ( DWORD Addr, DWORD Test );
|
2010-10-23 18:53:01 +00:00
|
|
|
bool SectionAccessible ( DWORD SectionId, DWORD Test );
|
|
|
|
bool DisplaySectionInformation ( DWORD ID, DWORD Test );
|
2010-11-12 05:30:08 +00:00
|
|
|
void DisplaySectionInformation ( void );
|
2012-10-14 01:05:52 +00:00
|
|
|
void AddParent ( CCodeSection * Parent );
|
|
|
|
void SwitchParent ( CCodeSection * OldParent, CCodeSection * NewParent );
|
2010-05-30 01:54:42 +00:00
|
|
|
|
|
|
|
/* Block Connection info */
|
2010-07-23 10:45:35 +00:00
|
|
|
SECTION_LIST m_ParentSection;
|
2010-05-30 01:54:42 +00:00
|
|
|
CCodeBlock * const m_BlockInfo;
|
|
|
|
const DWORD m_SectionID;
|
2012-10-17 09:04:11 +00:00
|
|
|
const DWORD m_EnterPC;
|
|
|
|
DWORD m_EndPC;
|
2010-05-30 01:54:42 +00:00
|
|
|
CCodeSection * m_ContinueSection;
|
|
|
|
CCodeSection * m_JumpSection;
|
2012-10-14 01:05:52 +00:00
|
|
|
bool m_EndSection; // if this section does not link
|
2010-05-30 01:54:42 +00:00
|
|
|
bool m_LinkAllowed; // are other sections allowed to find block to link to it
|
|
|
|
DWORD m_Test;
|
2010-07-23 10:45:35 +00:00
|
|
|
DWORD m_Test2;
|
2010-05-30 01:54:42 +00:00
|
|
|
BYTE * m_CompiledLocation;
|
2010-07-23 10:45:35 +00:00
|
|
|
bool m_InLoop;
|
2012-10-14 01:05:52 +00:00
|
|
|
bool m_DelaySlot;
|
2010-05-30 01:54:42 +00:00
|
|
|
|
|
|
|
/* Register Info */
|
|
|
|
CRegInfo m_RegEnter;
|
|
|
|
|
|
|
|
/* Jump Info */
|
|
|
|
CJumpInfo m_Jump;
|
|
|
|
CJumpInfo m_Cont;
|
|
|
|
|
|
|
|
private:
|
2012-10-14 01:05:52 +00:00
|
|
|
void UnlinkParent ( CCodeSection * Parent, bool ContinueSection );
|
|
|
|
void InheritConstants ( void );
|
|
|
|
void TestRegConstantStates ( CRegInfo & Base, CRegInfo & Reg );
|
|
|
|
void SyncRegState ( const CRegInfo & SyncTo );
|
|
|
|
bool IsAllParentLoops ( CCodeSection * Parent, bool IgnoreIfCompiled, DWORD Test );
|
|
|
|
bool ParentContinue ( void );
|
|
|
|
bool InheritParentInfo ( void );
|
|
|
|
bool SetupRegisterForLoop ( void );
|
2010-05-30 01:54:42 +00:00
|
|
|
};
|
|
|
|
|