2012-12-19 09:30:18 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* *
|
2015-11-10 05:21:49 +00:00
|
|
|
* Project64 - A Nintendo 64 emulator. *
|
2012-12-19 09:30:18 +00:00
|
|
|
* 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
|
2010-05-30 01:54:42 +00:00
|
|
|
|
|
|
|
class CCodeBlock;
|
|
|
|
|
|
|
|
class CCodeSection :
|
2015-11-15 02:27:06 +00:00
|
|
|
private CRecompilerOps
|
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);
|
|
|
|
void CompileCop1Test();
|
|
|
|
bool GenerateX86Code(uint32_t Test);
|
|
|
|
void GenerateSectionLinkage();
|
|
|
|
void CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason, bool CompileNow, void(*x86Jmp)(const char * Label, uint32_t Value));
|
|
|
|
void DetermineLoop(uint32_t Test, uint32_t Test2, uint32_t TestID);
|
|
|
|
bool FixConstants(uint32_t Test);
|
|
|
|
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;
|
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:
|
2015-11-15 02:27:06 +00:00
|
|
|
CCodeSection(void); // Disable default constructor
|
|
|
|
CCodeSection(const CCodeSection&); // Disable copy constructor
|
|
|
|
CCodeSection& operator=(const CCodeSection&); // Disable assignment
|
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);
|
|
|
|
void SyncRegState(const CRegInfo & SyncTo);
|
|
|
|
bool IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test);
|
|
|
|
bool ParentContinue();
|
|
|
|
bool InheritParentInfo();
|
|
|
|
bool SetupRegisterForLoop();
|
2015-11-09 06:55:16 +00:00
|
|
|
};
|