diff --git a/oscar64/InterCode.cpp b/oscar64/InterCode.cpp index 6001fb4..76e12d9 100644 --- a/oscar64/InterCode.cpp +++ b/oscar64/InterCode.cpp @@ -16789,6 +16789,7 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray mInstructions[i + 2]->mSrc[0].mType == IT_INT8) { mInstructions[i + 1]->mSrc[1] = mInstructions[i + 0]->mSrc[0]; + mInstructions[i + 0]->mSrc[0].mFinal = false; mInstructions[i + 1]->mDst.mType = IT_INT8; changed = true; @@ -16807,6 +16808,7 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray mInstructions[i + 2]->mSrc[0].mType == IT_INT8) { mInstructions[i + 1]->mSrc[0] = mInstructions[i + 0]->mSrc[0]; + mInstructions[i + 0]->mSrc[0].mFinal = false; mInstructions[i + 1]->mDst.mType = IT_INT8; changed = true; @@ -19139,7 +19141,7 @@ void InterCodeProcedure::Close(void) { GrowingTypeArray tstack(IT_NONE); - CheckFunc = !strcmp(mIdent->mString, "main"); + CheckFunc = !strcmp(mIdent->mString, "interpret_statement"); CheckCase = false; mEntryBlock = mBlocks[0]; @@ -20303,7 +20305,7 @@ bool InterCodeBasicBlock::SameExitCode(const InterCodeBasicBlock* block) const { if (mInstructions[j0]->mCode == IC_LEA && mInstructions[j0]->mSrc[1].mTemp < 0) return false; - if (block->mInstructions[j1]->mCode == IC_LEA && mInstructions[j1]->mSrc[1].mTemp < 0) + if (block->mInstructions[j1]->mCode == IC_LEA && block->mInstructions[j1]->mSrc[1].mTemp < 0) return false; } } diff --git a/oscar64/NativeCodeGenerator.cpp b/oscar64/NativeCodeGenerator.cpp index 2c332c1..ed42100 100644 --- a/oscar64/NativeCodeGenerator.cpp +++ b/oscar64/NativeCodeGenerator.cpp @@ -21816,8 +21816,8 @@ bool NativeCodeBasicBlock::JoinTailCodeSequences(NativeCodeProcedure* proc, bool { if (!mTrueJump->mIns[0].ChangesCarry() && mTrueJump->mIns[0].IsSame(mFalseJump->mIns[0])) { - int live = mTrueJump->mIns[0].mLive; - mTrueJump->mIns[0].mLive |= LIVE_CPU_REG_C; + int live = mTrueJump->mIns[0].mLive | mFalseJump->mIns[0].mLive; + mTrueJump->mIns[0].mLive |= LIVE_CPU_REG_C | live; mIns.Push(mTrueJump->mIns[0]); mTrueJump->mIns.Remove(0); mFalseJump->mIns.Remove(0); @@ -44723,7 +44723,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc) { mInterProc = proc; - CheckFunc = !strcmp(mInterProc->mIdent->mString, "mh_size"); + CheckFunc = !strcmp(mInterProc->mIdent->mString, "interpret_builtin"); int nblocks = proc->mBlocks.Size(); tblocks = new NativeCodeBasicBlock * [nblocks]; @@ -45664,6 +45664,7 @@ void NativeCodeProcedure::Optimize(void) changed = true; } + if (step > 2 && !changed) { ResetVisited();