Fix global variable changes bypassing assembly blocks

This commit is contained in:
drmortalwombat 2024-12-30 18:06:26 +01:00
parent 87f1ddd27f
commit 38bb033328
4 changed files with 14 additions and 5 deletions

View File

@ -171,6 +171,12 @@ void vspr_init(char * screen)
}
}
void vspr_shutdown(void)
{
for(int i=0; i<VSPRITES_MAX - 7; i++)
rirq_clear(i);
}
void vspr_screen(char * screen)
{
vspriteScreen = screen + 0x3f8;

View File

@ -68,6 +68,8 @@ inline void spr_expand(char sp, bool xexpand, bool yexpand);
void vspr_init(char * screen);
void vspr_shutdown(void);
void vspr_screen(char * screen);
// set one sprite with the given attribute

View File

@ -18427,7 +18427,8 @@ void InterCodeBasicBlock::SingleBlockLoopOptimisation(const NumberSet& aliasedPa
}
}
}
#endif
#if 1
if (!hasCall && (mProc->mCompilerOptions & COPT_OPTIMIZE_BASIC))
{
// Check forwarding globals
@ -18438,7 +18439,7 @@ void InterCodeBasicBlock::SingleBlockLoopOptimisation(const NumberSet& aliasedPa
InterInstruction* ins = mInstructions[i];
// A global load
if (ins->mCode == IC_LOAD && ins->mSrc[0].mTemp < 0 && (ins->mSrc[0].mMemory == IM_GLOBAL || ins->mSrc[0].mMemory == IM_FPARAM))
if (ins->mCode == IC_LOAD && !ins->mVolatile && ins->mSrc[0].mTemp < 0 && (ins->mSrc[0].mMemory == IM_GLOBAL || ins->mSrc[0].mMemory == IM_FPARAM))
{
// Find the last store that overlaps the load
int j = mInstructions.Size() - 1;
@ -18450,7 +18451,7 @@ void InterCodeBasicBlock::SingleBlockLoopOptimisation(const NumberSet& aliasedPa
InterInstruction* sins = mInstructions[j];
// Does a full store
if (SameMem(ins->mSrc[0], sins->mSrc[1]) && !AliasingMem(this, ins, 0, mInstructions.Size()))
if (SameMem(ins->mSrc[0], sins->mSrc[1]) && !AliasingMem(this, ins, 0, mInstructions.Size()) && !DestroyingMem(this, ins, 0, j))
{
if (sins->mSrc[0].mTemp >= 0)
{
@ -23012,7 +23013,7 @@ void InterCodeProcedure::Close(void)
{
GrowingTypeArray tstack(IT_NONE);
CheckFunc = !strcmp(mIdent->mString, "main");
CheckFunc = !strcmp(mIdent->mString, "drawAllRows");
CheckCase = false;
mEntryBlock = mBlocks[0];

View File

@ -669,7 +669,7 @@ bool NativeCodeInstruction::IsUsedResultInstructions(NumberSet& requiredTemps)
if (mFlags & NCIF_VOLATILE)
{
if (mMode != ASMIM_IMPLIED && mMode != ASMIM_ZERO_PAGE)
if (mMode != ASMIM_IMPLIED && mMode != ASMIM_ZERO_PAGE && !(mMode == ASMIM_ABSOLUTE && mLinkerObject && (mLinkerObject->mFlags & LOBJF_ZEROPAGE)))
used = true;
}