Fix analysis of register usage of inline assembler

This commit is contained in:
drmortalwombat 2024-12-06 18:54:55 +01:00
parent ccdbbe799a
commit 067e169803
2 changed files with 15 additions and 1 deletions

View File

@ -434,6 +434,7 @@ InterCodeGenerator::ExValue InterCodeGenerator::CoerceType(InterCodeProcedure* p
v.mTemp = cins->mDst.mTemp;
v.mType = type;
}
#if 1
else if (type->mType == DT_TYPE_BOOL && v.mType->IsIntegerType() && v.mType->mType != DT_TYPE_BOOL)
{
InterInstruction* zins = new InterInstruction(MapLocation(exp, inlineMapper), IC_CONSTANT);
@ -455,6 +456,7 @@ InterCodeGenerator::ExValue InterCodeGenerator::CoerceType(InterCodeProcedure* p
v.mTemp = cins->mDst.mTemp;
v.mType = type;
}
#endif
else if (v.mType->mSize < type->mSize)
{
if (v.mType->mSize == 1 && type->mSize == 2)

View File

@ -1291,6 +1291,14 @@ void NativeCodeInstruction::BuildCollisionTable(NumberSet& liveTemps, NumberSet*
for (int i = BC_REG_TMP; i < BC_REG_TMP + mLinkerObject->mProc->mCallerSavedTemps; i++)
UpdateCollisionSet(liveTemps, collisionSets, i);
}
else if (mLinkerObject && mLinkerObject->mNumTemporaries)
{
for (int i = 0; i < mLinkerObject->mNumTemporaries; i++)
{
for (int j = 0; j < mLinkerObject->mTempSizes[i]; j++)
UpdateCollisionSet(liveTemps, collisionSets, mLinkerObject->mTemporaries[i] + j);
}
}
else
{
for (int i = BC_REG_TMP; i < BC_REG_TMP_SAVED; i++)
@ -1409,6 +1417,8 @@ bool NativeCodeInstruction::ChangesZeroPage(int address) const
return mType == ASMIT_INC || mType == ASMIT_DEC || mType == ASMIT_ASL || mType == ASMIT_LSR || mType == ASMIT_ROL || mType == ASMIT_ROR || mType == ASMIT_STA || mType == ASMIT_STX || mType == ASMIT_STY;
else if (mType == ASMIT_JSR)
{
if (address == BC_REG_WORK_Y)
return true;
if (address >= BC_REG_ACCU && address < BC_REG_ACCU + 4)
return true;
if (address >= BC_REG_WORK && address < BC_REG_WORK + 8)
@ -51801,7 +51811,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
mInterProc = proc;
mInterProc->mLinkerObject->mNativeProc = this;
CheckFunc = !strcmp(mInterProc->mIdent->mString, "diggers_vacate_room");
CheckFunc = !strcmp(mInterProc->mIdent->mString, "bmmcu_line");
int nblocks = proc->mBlocks.Size();
tblocks = new NativeCodeBasicBlock * [nblocks];
@ -53636,6 +53646,7 @@ void NativeCodeProcedure::Optimize(void)
ResetVisited();
mEntryBlock->CombineAlternateLoads();
#endif
#if 1
ResetVisited();
mEntryBlock->ReduceLocalYPressure();
@ -53650,6 +53661,7 @@ void NativeCodeProcedure::Optimize(void)
CompressTemporaries(true);
#endif
do {
ResetVisited();
NativeRegisterDataSet data;