Fix loss of zp dependency on diamond register propagation
This commit is contained in:
parent
2911321914
commit
c138c0f2ae
|
@ -16725,6 +16725,16 @@ bool NativeCodeBasicBlock::SimplifyDiamond(NativeCodeProcedure* proc)
|
||||||
{
|
{
|
||||||
if (this->CanBytepassLoad(mIns[sz], sz + 1) && mTrueJump->CanBytepassLoad(mIns[sz]) && mFalseJump->CanBytepassLoad(mIns[sz]))
|
if (this->CanBytepassLoad(mIns[sz], sz + 1) && mTrueJump->CanBytepassLoad(mIns[sz]) && mFalseJump->CanBytepassLoad(mIns[sz]))
|
||||||
{
|
{
|
||||||
|
if (mIns[sz].mMode == ASMIM_ZERO_PAGE)
|
||||||
|
{
|
||||||
|
mExitRequiredRegs += mIns[sz].mAddress;
|
||||||
|
mTrueJump->mTrueJump->mEntryRequiredRegs += mIns[sz].mAddress;
|
||||||
|
mTrueJump->mEntryRequiredRegs += mIns[sz].mAddress;
|
||||||
|
mTrueJump->mExitRequiredRegs += mIns[sz].mAddress;
|
||||||
|
mFalseJump->mEntryRequiredRegs += mIns[sz].mAddress;
|
||||||
|
mFalseJump->mExitRequiredRegs += mIns[sz].mAddress;
|
||||||
|
}
|
||||||
|
|
||||||
mTrueJump->mTrueJump->mIns.Insert(0, NativeCodeInstruction(mIns[sz].mIns, ASMIT_LDY, mIns[sz]));
|
mTrueJump->mTrueJump->mIns.Insert(0, NativeCodeInstruction(mIns[sz].mIns, ASMIT_LDY, mIns[sz]));
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
@ -16740,6 +16750,15 @@ bool NativeCodeBasicBlock::SimplifyDiamond(NativeCodeProcedure* proc)
|
||||||
{
|
{
|
||||||
if (this->CanBytepassLoad(mIns[sz], sz + 1) && mTrueJump->CanBytepassLoad(mIns[sz]) && mFalseJump->CanBytepassLoad(mIns[sz]))
|
if (this->CanBytepassLoad(mIns[sz], sz + 1) && mTrueJump->CanBytepassLoad(mIns[sz]) && mFalseJump->CanBytepassLoad(mIns[sz]))
|
||||||
{
|
{
|
||||||
|
if (mIns[sz].mMode == ASMIM_ZERO_PAGE)
|
||||||
|
{
|
||||||
|
mExitRequiredRegs += mIns[sz].mAddress;
|
||||||
|
mTrueJump->mTrueJump->mEntryRequiredRegs += mIns[sz].mAddress;
|
||||||
|
mTrueJump->mEntryRequiredRegs += mIns[sz].mAddress;
|
||||||
|
mTrueJump->mExitRequiredRegs += mIns[sz].mAddress;
|
||||||
|
mFalseJump->mEntryRequiredRegs += mIns[sz].mAddress;
|
||||||
|
mFalseJump->mExitRequiredRegs += mIns[sz].mAddress;
|
||||||
|
}
|
||||||
mTrueJump->mTrueJump->mIns.Insert(0, NativeCodeInstruction(mIns[sz].mIns, ASMIT_LDX, mIns[sz]));
|
mTrueJump->mTrueJump->mIns.Insert(0, NativeCodeInstruction(mIns[sz].mIns, ASMIT_LDX, mIns[sz]));
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
@ -16779,6 +16798,11 @@ bool NativeCodeBasicBlock::SimplifyDiamond(NativeCodeProcedure* proc)
|
||||||
if (i == mIns.Size())
|
if (i == mIns.Size())
|
||||||
{
|
{
|
||||||
mIns[sz].mLive |= mIns[mIns.Size() - 1].mLive;
|
mIns[sz].mLive |= mIns[mIns.Size() - 1].mLive;
|
||||||
|
if (mIns[sz].mMode == ASMIM_ZERO_PAGE)
|
||||||
|
{
|
||||||
|
mExitRequiredRegs += mIns[sz].mAddress;
|
||||||
|
mTrueJump->mEntryRequiredRegs += mIns[sz].mAddress;
|
||||||
|
}
|
||||||
mTrueJump->mIns.Insert(0, mIns[sz]);
|
mTrueJump->mIns.Insert(0, mIns[sz]);
|
||||||
mIns.Remove(sz);
|
mIns.Remove(sz);
|
||||||
changed = true;
|
changed = true;
|
||||||
|
@ -16798,6 +16822,11 @@ bool NativeCodeBasicBlock::SimplifyDiamond(NativeCodeProcedure* proc)
|
||||||
if (i == mIns.Size())
|
if (i == mIns.Size())
|
||||||
{
|
{
|
||||||
mIns[sz].mLive |= mIns[mIns.Size() - 1].mLive;
|
mIns[sz].mLive |= mIns[mIns.Size() - 1].mLive;
|
||||||
|
if (mIns[sz].mMode == ASMIM_ZERO_PAGE)
|
||||||
|
{
|
||||||
|
mExitRequiredRegs += mIns[sz].mAddress;
|
||||||
|
mTrueJump->mEntryRequiredRegs += mIns[sz].mAddress;
|
||||||
|
}
|
||||||
mTrueJump->mIns.Insert(0, mIns[sz]);
|
mTrueJump->mIns.Insert(0, mIns[sz]);
|
||||||
mIns.Remove(sz);
|
mIns.Remove(sz);
|
||||||
changed = true;
|
changed = true;
|
||||||
|
@ -45139,7 +45168,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
|
||||||
{
|
{
|
||||||
mInterProc = proc;
|
mInterProc = proc;
|
||||||
|
|
||||||
CheckFunc = !strcmp(mInterProc->mIdent->mString, "atan2");
|
CheckFunc = !strcmp(mInterProc->mIdent->mString, "enemies_check");
|
||||||
|
|
||||||
int nblocks = proc->mBlocks.Size();
|
int nblocks = proc->mBlocks.Size();
|
||||||
tblocks = new NativeCodeBasicBlock * [nblocks];
|
tblocks = new NativeCodeBasicBlock * [nblocks];
|
||||||
|
@ -46102,6 +46131,7 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (step > 6)
|
if (step > 6)
|
||||||
{
|
{
|
||||||
ResetVisited();
|
ResetVisited();
|
||||||
|
@ -46474,6 +46504,7 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
mEntryBlock->CheckBlocks();
|
mEntryBlock->CheckBlocks();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
if (step == 8)
|
if (step == 8)
|
||||||
{
|
{
|
||||||
|
@ -46624,7 +46655,6 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
else
|
else
|
||||||
cnt++;
|
cnt++;
|
||||||
|
|
||||||
|
|
||||||
} while (changed);
|
} while (changed);
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
|
Loading…
Reference in New Issue