Recompiler: Make sure break ends a block
This commit is contained in:
parent
d7a692a943
commit
5a9cb5f768
|
@ -243,11 +243,33 @@ bool CCodeBlock::CreateBlockLinkage ( CCodeSection * EnterSection )
|
|||
CurrentSection->SetJumpAddress(TestPC, TestPC + 4,false);
|
||||
if (SetSection(CurrentSection->m_JumpSection, CurrentSection, TestPC + 4,false,TestPC))
|
||||
{
|
||||
bool BranchLikelyBranch, BranchEndBlock, BranchIncludeDelaySlot, BranchPermLoop;
|
||||
DWORD BranchTargetPC, BranchContinuePC;
|
||||
|
||||
CCodeSection * JumpSection = CurrentSection->m_JumpSection;
|
||||
if (!AnalyzeInstruction(JumpSection->m_EnterPC, BranchTargetPC, BranchContinuePC, BranchLikelyBranch, BranchIncludeDelaySlot, BranchEndBlock, BranchPermLoop))
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (BranchLikelyBranch || BranchIncludeDelaySlot || BranchPermLoop)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
JumpSection->m_EndPC = TestPC + 4;
|
||||
JumpSection->SetJumpAddress(TestPC, TargetPC,false);
|
||||
if (BranchEndBlock)
|
||||
{
|
||||
CPU_Message(__FUNCTION__ ": Jump End Block");
|
||||
JumpSection->m_EndSection = true;
|
||||
TargetPC = (DWORD)-1;
|
||||
} else {
|
||||
JumpSection->SetJumpAddress(TestPC, TargetPC,false);
|
||||
}
|
||||
JumpSection->SetDelaySlot();
|
||||
SetSection(JumpSection->m_JumpSection,CurrentSection->m_JumpSection,TargetPC,true,TestPC);
|
||||
SetSection(JumpSection->m_JumpSection,JumpSection,TargetPC,true,TestPC);
|
||||
} else {
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
#define CHECKED_BUILD 1
|
||||
#endif
|
||||
|
||||
bool DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 );
|
||||
|
||||
|
@ -183,8 +185,8 @@ bool LoopAnalysis::CheckLoopRegisterUsage( CCodeSection * Section)
|
|||
case R4300i_SPECIAL_SRAV: SPECIAL_SRAV(); break;
|
||||
case R4300i_SPECIAL_JR: SPECIAL_JR(); break;
|
||||
case R4300i_SPECIAL_JALR: SPECIAL_JALR(); break;
|
||||
case R4300i_SPECIAL_SYSCALL: SPECIAL_SYSCALL(); break;
|
||||
case R4300i_SPECIAL_BREAK: SPECIAL_BREAK(); break;
|
||||
case R4300i_SPECIAL_SYSCALL: SPECIAL_SYSCALL(Section); break;
|
||||
case R4300i_SPECIAL_BREAK: SPECIAL_BREAK(Section); break;
|
||||
case R4300i_SPECIAL_MFHI: SPECIAL_MFHI(); break;
|
||||
case R4300i_SPECIAL_MTHI: SPECIAL_MTHI(); break;
|
||||
case R4300i_SPECIAL_MFLO: SPECIAL_MFLO(); break;
|
||||
|
@ -896,14 +898,38 @@ void LoopAnalysis::SPECIAL_JALR ( void )
|
|||
m_NextInstruction = DELAY_SLOT;
|
||||
}
|
||||
|
||||
void LoopAnalysis::SPECIAL_SYSCALL ( void )
|
||||
void LoopAnalysis::SPECIAL_SYSCALL ( CCodeSection * Section )
|
||||
{
|
||||
#ifdef CHECKED_BUILD
|
||||
if (Section->m_ContinueSection != NULL &&
|
||||
Section->m_Cont.TargetPC != (DWORD)-1)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
if (Section->m_JumpSection != NULL &&
|
||||
Section->m_Jump.TargetPC != (DWORD)-1)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
#endif
|
||||
m_NextInstruction = END_BLOCK;
|
||||
m_PC -= 4;
|
||||
}
|
||||
|
||||
void LoopAnalysis::SPECIAL_BREAK ( void )
|
||||
void LoopAnalysis::SPECIAL_BREAK ( CCodeSection * Section )
|
||||
{
|
||||
#ifdef CHECKED_BUILD
|
||||
if (Section->m_ContinueSection != NULL &&
|
||||
Section->m_Cont.TargetPC != (DWORD)-1)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
if (Section->m_JumpSection != NULL &&
|
||||
Section->m_Jump.TargetPC != (DWORD)-1)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
#endif
|
||||
m_NextInstruction = END_BLOCK;
|
||||
m_PC -= 4;
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ private:
|
|||
void SPECIAL_SRAV ( void );
|
||||
void SPECIAL_JR ( void );
|
||||
void SPECIAL_JALR ( void );
|
||||
void SPECIAL_SYSCALL ( void );
|
||||
void SPECIAL_BREAK ( void );
|
||||
void SPECIAL_SYSCALL ( CCodeSection * Section );
|
||||
void SPECIAL_BREAK ( CCodeSection * Section );
|
||||
void SPECIAL_MFHI ( void );
|
||||
void SPECIAL_MTHI ( void );
|
||||
void SPECIAL_MFLO ( void );
|
||||
|
|
Loading…
Reference in New Issue