Fix prevent swap of X and Y when used in JSR

This commit is contained in:
drmortalwombat 2024-01-27 19:50:34 +01:00
parent b3d80bcb0f
commit fafbbe82d1
2 changed files with 4 additions and 2 deletions

View File

@ -1097,7 +1097,7 @@ bool Compiler::GenerateCode(void)
if (mCompilerOptions & COPT_OPTIMIZE_BASIC) if (mCompilerOptions & COPT_OPTIMIZE_BASIC)
{ {
mLinker->CombineSameConst(); mLinker->CombineSameConst();
// mLinker->InlineSimpleJumps(); mLinker->InlineSimpleJumps();
mLinker->CheckDirectJumps(); mLinker->CheckDirectJumps();
} }

View File

@ -997,6 +997,8 @@ bool NativeCodeInstruction::CanSwapXYReg(void)
return HasAsmInstructionMode(mType, ASMIM_ABSOLUTE_Y); return HasAsmInstructionMode(mType, ASMIM_ABSOLUTE_Y);
else if (mMode == ASMIM_ABSOLUTE_Y) else if (mMode == ASMIM_ABSOLUTE_Y)
return HasAsmInstructionMode(mType, ASMIM_ABSOLUTE_X); return HasAsmInstructionMode(mType, ASMIM_ABSOLUTE_X);
else if (mType == ASMIT_JSR && (mFlags & (NCIF_USE_CPU_REG_X | NCIF_USE_CPU_REG_Y)))
return false;
else else
return true; return true;
} }
@ -45477,7 +45479,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
{ {
mInterProc = proc; mInterProc = proc;
CheckFunc = !strcmp(mInterProc->mIdent->mString, "main"); CheckFunc = !strcmp(mInterProc->mIdent->mString, "krnio_setbnk");
int nblocks = proc->mBlocks.Size(); int nblocks = proc->mBlocks.Size();
tblocks = new NativeCodeBasicBlock * [nblocks]; tblocks = new NativeCodeBasicBlock * [nblocks];