Fix join entry loadstore zp if accu is used cross block
This commit is contained in:
parent
157f9c00e5
commit
38e1cd0bab
|
@ -20235,6 +20235,8 @@ bool NativeCodeBasicBlock::JoinEntryLoadStoreZP(void)
|
|||
|
||||
CheckLive();
|
||||
|
||||
if (!mEntryRequiredRegs[CPU_REG_A] || !mEntryRequiredRegs[CPU_REG_X])
|
||||
{
|
||||
for (int i = 0; i + 1 < mIns.Size(); i++)
|
||||
{
|
||||
if (mIns[i].mType == ASMIT_LDA && mIns[i].mMode == ASMIM_ZERO_PAGE && mIns[i + 1].mType == ASMIT_STA && mIns[i + 1].mMode == ASMIM_ZERO_PAGE && !(mIns[i].mLive & LIVE_MEM) && !(mIns[i + 1].mLive & (LIVE_CPU_REG_A | LIVE_CPU_REG_Z)) ||
|
||||
|
@ -20293,8 +20295,16 @@ bool NativeCodeBasicBlock::JoinEntryLoadStoreZP(void)
|
|||
xblock->mExitRequiredRegs = mEntryRequiredRegs;
|
||||
xblock->mExitRequiredRegs += daddr;
|
||||
|
||||
xblock->mIns.Push(mIns[i + 0]);
|
||||
xblock->mIns.Push(mIns[i + 1]);
|
||||
if (!mEntryRequiredRegs[CPU_REG_A])
|
||||
{
|
||||
xblock->mIns.Push(NativeCodeInstruction(mIns[i + 0].mIns, ASMIT_LDA, ASMIM_ZERO_PAGE, mIns[i + 0].mAddress));
|
||||
xblock->mIns.Push(NativeCodeInstruction(mIns[i + 1].mIns, ASMIT_STA, ASMIM_ZERO_PAGE, mIns[i + 1].mAddress));
|
||||
}
|
||||
else
|
||||
{
|
||||
xblock->mIns.Push(NativeCodeInstruction(mIns[i + 0].mIns, ASMIT_LDX, ASMIM_ZERO_PAGE, mIns[i + 0].mAddress));
|
||||
xblock->mIns.Push(NativeCodeInstruction(mIns[i + 1].mIns, ASMIT_STX, ASMIM_ZERO_PAGE, mIns[i + 1].mAddress));
|
||||
}
|
||||
|
||||
xblock->Close(mIns[i].mIns, this, nullptr, ASMIT_JMP);
|
||||
mEntryBlocks.Push(xblock);
|
||||
|
@ -20308,6 +20318,7 @@ bool NativeCodeBasicBlock::JoinEntryLoadStoreZP(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mTrueJump && mTrueJump->JoinEntryLoadStoreZP())
|
||||
changed = true;
|
||||
|
@ -42715,7 +42726,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
|
|||
{
|
||||
mInterProc = proc;
|
||||
|
||||
CheckFunc = !strcmp(mInterProc->mIdent->mString, "parse_statement");
|
||||
CheckFunc = !strcmp(mInterProc->mIdent->mString, "interpret_builtin");
|
||||
|
||||
int nblocks = proc->mBlocks.Size();
|
||||
tblocks = new NativeCodeBasicBlock * [nblocks];
|
||||
|
@ -43623,7 +43634,6 @@ void NativeCodeProcedure::Optimize(void)
|
|||
changed = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _DEBUG
|
||||
ResetVisited();
|
||||
mEntryBlock->CheckBlocks(true);
|
||||
|
@ -43651,19 +43661,20 @@ void NativeCodeProcedure::Optimize(void)
|
|||
changed = true;
|
||||
}
|
||||
|
||||
|
||||
if (step > 6)
|
||||
{
|
||||
ResetVisited();
|
||||
if (mEntryBlock->JoinEntryLoadStoreZP())
|
||||
changed = true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if _DEBUG
|
||||
ResetVisited();
|
||||
mEntryBlock->CheckBlocks(true);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
if (step == 3 || step == 4)
|
||||
{
|
||||
|
@ -43731,6 +43742,7 @@ void NativeCodeProcedure::Optimize(void)
|
|||
changed = true;
|
||||
}
|
||||
|
||||
|
||||
#if 1
|
||||
if (step == 5 || step == 6)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue