Skip to content

Commit

Permalink
Fixed negative offset leas
Browse files Browse the repository at this point in the history
  • Loading branch information
drmortalwombat committed Nov 3, 2024
1 parent 51c38a4 commit cee2801
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions oscar64/InterCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19925,6 +19925,18 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray
changed = true;
}
#endif
#if 1
else if (
mInstructions[i + 0]->mCode == IC_BINARY_OPERATOR && mInstructions[i + 0]->mOperator == IA_SUB && mInstructions[i + 0]->mSrc[0].mTemp < 0 &&
mInstructions[i + 1]->mCode == IC_LEA && mInstructions[i + 1]->mSrc[1].mTemp < 0 && mInstructions[i + 1]->mSrc[0].mTemp == mInstructions[i + 0]->mDst.mTemp && mInstructions[i + 1]->mSrc[0].mFinal)
{
mInstructions[i + 1]->mSrc[0] = mInstructions[i + 0]->mSrc[1];
mInstructions[i + 1]->mSrc[1].mIntConst -= mInstructions[i + 0]->mSrc[0].mIntConst;

mInstructions[i + 0]->mCode = IC_NONE; mInstructions[i + 0]->mNumOperands = 0;
changed = true;
}
#endif
#if 1
else if (
mInstructions[i + 0]->mCode == IC_LEA && mInstructions[i + 0]->mSrc[0].mTemp < 0 &&
Expand Down
2 changes: 1 addition & 1 deletion oscar64/NativeCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51718,7 +51718,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
mInterProc = proc;
mInterProc->mLinkerObject->mNativeProc = this;

CheckFunc = !strcmp(mInterProc->mIdent->mString, "Level::method");
CheckFunc = !strcmp(mInterProc->mIdent->mString, "status_draw_map");

int nblocks = proc->mBlocks.Size();
tblocks = new NativeCodeBasicBlock * [nblocks];
Expand Down

0 comments on commit cee2801

Please sign in to comment.