Reduce index register usage, where ORA Imm would suffice
This commit is contained in:
parent
dd1f5b9043
commit
a3bf7296bb
|
@ -8284,6 +8284,14 @@ void InterCodeBasicBlock::UpdateLocalIntegerRangeSetsForward(const GrowingVariab
|
||||||
vr.mMaxState = vr.mMinState = IntegerValueRange::S_UNBOUND;
|
vr.mMaxState = vr.mMinState = IntegerValueRange::S_UNBOUND;
|
||||||
break;
|
break;
|
||||||
#if 1
|
#if 1
|
||||||
|
case IA_DIVU:
|
||||||
|
vr = mProc->mLocalValueRange[ins->mSrc[1].mTemp];
|
||||||
|
vr.LimitMin(0);
|
||||||
|
vr.mMinValue = 0;
|
||||||
|
if (ins->mSrc[0].mTemp < 0 && ins->mSrc[0].mIntConst > 1)
|
||||||
|
vr.mMaxValue /= ins->mSrc[0].mIntConst;
|
||||||
|
break;
|
||||||
|
|
||||||
case IA_MODU:
|
case IA_MODU:
|
||||||
vr.LimitMin(0);
|
vr.LimitMin(0);
|
||||||
if (ins->mSrc[0].mTemp < 0)
|
if (ins->mSrc[0].mTemp < 0)
|
||||||
|
@ -15229,7 +15237,7 @@ void InterCodeBasicBlock::EliminateDoubleLoopCounter(void)
|
||||||
|
|
||||||
if (lcs.Size() >= 2)
|
if (lcs.Size() >= 2)
|
||||||
{
|
{
|
||||||
int loop = -1;
|
int64 loop = -1;
|
||||||
int k = 0;
|
int k = 0;
|
||||||
while (k < lcs.Size() && !lcs[k].mCmp)
|
while (k < lcs.Size() && !lcs[k].mCmp)
|
||||||
k++;
|
k++;
|
||||||
|
|
|
@ -42175,6 +42175,20 @@ bool NativeCodeBasicBlock::PeepHoleOptimizerIterate1(int i, int pass)
|
||||||
mIns[i].mType = ASMIT_ASL;
|
mIns[i].mType = ASMIT_ASL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (mIns[i].mType == ASMIT_TAY && !(mIns[i].mLive & LIVE_CPU_REG_Y))
|
||||||
|
{
|
||||||
|
mIns[i].mType = ASMIT_ORA;
|
||||||
|
mIns[i].mMode = ASMIM_IMMEDIATE;
|
||||||
|
mIns[i].mAddress = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (mIns[i].mType == ASMIT_TAX && !(mIns[i].mLive & LIVE_CPU_REG_X))
|
||||||
|
{
|
||||||
|
mIns[i].mType = ASMIT_ORA;
|
||||||
|
mIns[i].mMode = ASMIM_IMMEDIATE;
|
||||||
|
mIns[i].mAddress = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int apos;
|
int apos;
|
||||||
if (mIns[i].mMode == ASMIM_INDIRECT_Y && FindGlobalAddress(i, mIns[i].mAddress, apos))
|
if (mIns[i].mMode == ASMIM_INDIRECT_Y && FindGlobalAddress(i, mIns[i].mAddress, apos))
|
||||||
|
@ -44400,6 +44414,16 @@ bool NativeCodeBasicBlock::PeepHoleOptimizerIterate3(int i, int pass)
|
||||||
mIns.Remove(i + 2);
|
mIns.Remove(i + 2);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (
|
||||||
|
mIns[i + 0].ChangesAccuAndFlag() && mIns[i + 0].mMode == ASMIM_IMPLIED &&
|
||||||
|
(mIns[i + 1].mType == ASMIT_INX || mIns[i + 1].mType == ASMIT_DEX || mIns[i + 1].mType == ASMIT_INY || mIns[i + 1].mType == ASMIT_DEY) &&
|
||||||
|
mIns[i + 2].mType == ASMIT_ORA && mIns[i + 2].mMode == ASMIM_IMMEDIATE && mIns[i + 2].mAddress == 0)
|
||||||
|
{
|
||||||
|
mIns[i + 2] = mIns[i + 0];
|
||||||
|
mIns[i + 0].mType = ASMIT_NOP; mIns[i + 0].mMode = ASMIM_IMPLIED;
|
||||||
|
mIns[i + 1].mLive |= LIVE_CPU_REG_A;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if (
|
else if (
|
||||||
mIns[i + 0].mType == ASMIT_LDA &&
|
mIns[i + 0].mType == ASMIT_LDA &&
|
||||||
mIns[i + 1].mType == ASMIT_STA &&
|
mIns[i + 1].mType == ASMIT_STA &&
|
||||||
|
@ -49486,7 +49510,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
|
||||||
mInterProc = proc;
|
mInterProc = proc;
|
||||||
mInterProc->mLinkerObject->mNativeProc = this;
|
mInterProc->mLinkerObject->mNativeProc = this;
|
||||||
|
|
||||||
CheckFunc = !strcmp(mInterProc->mIdent->mString, "main");
|
CheckFunc = !strcmp(mInterProc->mIdent->mString, "clz");
|
||||||
|
|
||||||
int nblocks = proc->mBlocks.Size();
|
int nblocks = proc->mBlocks.Size();
|
||||||
tblocks = new NativeCodeBasicBlock * [nblocks];
|
tblocks = new NativeCodeBasicBlock * [nblocks];
|
||||||
|
|
Loading…
Reference in New Issue