Fix join common branch sequence

This commit is contained in:
drmortalwombat 2023-11-26 21:34:06 +01:00
parent 57537cd43a
commit d5026ed9b0
2 changed files with 7 additions and 3 deletions

View File

@ -31,6 +31,8 @@ void dispmode80col(void);
#define PETSCII_CLEAR 0x94
#define PETSCII_DEL 0x14
#define PETSCII_INSERT 0x94
#define PETSCII_STOP 0x0c
#define PETSCII_RETURN 0x0d
#define PETSCII_F1 0x85
#define PETSCII_F2 0x89

View File

@ -22178,10 +22178,12 @@ bool NativeCodeBasicBlock::JoinCommonBranchCodeSequences(void)
if (j < mFalseJump->mIns.Size())
{
int n = 0;
while (i + n < mTrueJump->mIns.Size() && j + n < mFalseJump->mIns.Size() && ((mTrueJump->mIns[i + n].mLive & LIVE_CPU_REG) || (mFalseJump->mIns[j + n].mLive & LIVE_CPU_REG)))
while (i + n < mTrueJump->mIns.Size() && j + n < mFalseJump->mIns.Size() &&
mTrueJump->mIns[i + n].IsSame(mFalseJump->mIns[j + n]) &&
((mTrueJump->mIns[i + n].mLive & LIVE_CPU_REG) || (mFalseJump->mIns[j + n].mLive & LIVE_CPU_REG)))
n++;
if (i + n < mTrueJump->mIns.Size() && j + n < mFalseJump->mIns.Size())
if (i + n < mTrueJump->mIns.Size() && j + n < mFalseJump->mIns.Size() && mTrueJump->mIns[i + n].IsSame(mFalseJump->mIns[j + n]))
{
if (mTrueJump->MayBeMovedBeforeBlock(i, i + n + 1) && mFalseJump->MayBeMovedBeforeBlock(j, j + n + 1))
{
@ -43191,7 +43193,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
{
mInterProc = proc;
CheckFunc = !strcmp(mInterProc->mIdent->mString, "dungeon_init");
CheckFunc = !strcmp(mInterProc->mIdent->mString, "format_expression");
int nblocks = proc->mBlocks.Size();
tblocks = new NativeCodeBasicBlock * [nblocks];