diff --git a/include/opp/ifstream.cpp b/include/opp/ifstream.cpp index 430912c..d0f6c50 100644 --- a/include/opp/ifstream.cpp +++ b/include/opp/ifstream.cpp @@ -6,7 +6,7 @@ namespace opp { ifstream::ifstream(char fnum, char device, char channel, const string & name) { this->fnum = fnum; - krnio_setnam(name); + krnio_setnam(name.tocstr()); krnio_open(fnum, device, channel); } diff --git a/oscar64/InterCode.cpp b/oscar64/InterCode.cpp index ebe188e..9b47981 100644 --- a/oscar64/InterCode.cpp +++ b/oscar64/InterCode.cpp @@ -17826,6 +17826,23 @@ void InterCodeBasicBlock::PeepholeOptimization(const GrowingVariableArray& stati } while (changed); + // Move conversion from float to int upwards + for (int i = 1; i < mInstructions.Size(); i++) + { + InterInstruction* ins(mInstructions[i]); + if (ins->mCode == IC_CONVERSION_OPERATOR && (ins->mOperator == IA_FLOAT2INT || ins->mOperator == IA_FLOAT2UINT) && ins->mSrc[0].mFinal) + { + int j = i - 1; + while (j > 0 && CanSwapInstructions(ins, mInstructions[j])) + { + SwapInstructions(mInstructions[j], ins); + mInstructions[j + 1] = mInstructions[j]; + j--; + } + mInstructions[j + 1] = ins; + } + } + // move div up to mod int imod = -1, idiv = -1; for (int i = 0; i < mInstructions.Size(); i++) @@ -18751,6 +18768,8 @@ void InterCodeProcedure::MoveConditionsOutOfLoop(void) { Disassemble("MoveConditionOutOfLoop"); + BuildTraces(false); + BuildDataFlowSets(); TempForwarding(); RemoveUnusedInstructions(); @@ -19398,7 +19417,7 @@ void InterCodeProcedure::Close(void) { GrowingTypeArray tstack(IT_NONE); - CheckFunc = !strcmp(mIdent->mString, "JSONParser::Next"); + CheckFunc = !strcmp(mIdent->mString, "_menuShowSprites"); CheckCase = false; mEntryBlock = mBlocks[0]; diff --git a/oscar64/NativeCodeGenerator.cpp b/oscar64/NativeCodeGenerator.cpp index 9a41c65..f014b7e 100644 --- a/oscar64/NativeCodeGenerator.cpp +++ b/oscar64/NativeCodeGenerator.cpp @@ -26915,13 +26915,14 @@ bool NativeCodeBasicBlock::JoinTAXARange(int from, int to) } else if (mIns[start].mType == ASMIT_LDA && mIns[start].mMode == ASMIM_ABSOLUTE_X && mIns[start + 1].ChangesAccu() && !mIns[start + 1].ChangesAddress() && !mIns[start + 1].RequiresYReg()) { - for (int i = from + 1; i < to; i++) { if (mIns[start].MayBeChangedOnAddress(mIns[i]) || mIns[start + 1].MayBeChangedOnAddress(mIns[i])) return false; if (mIns[start + 1].RequiresCarry() && mIns[i].ChangesCarry()) return false; + if ((mIns[start + 1].mLive & LIVE_CPU_REG_C) && mIns[i].RequiresCarry()) + return false; } int live = mIns[to].mLive; @@ -45426,7 +45427,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc) { mInterProc = proc; - CheckFunc = !strcmp(mInterProc->mIdent->mString, "test"); + CheckFunc = !strcmp(mInterProc->mIdent->mString, "_menuShowSprites"); int nblocks = proc->mBlocks.Size(); tblocks = new NativeCodeBasicBlock * [nblocks];