Fix global aliasing collision with striped data
This commit is contained in:
parent
0a76a57f18
commit
0b58e9eaaf
|
@ -11719,7 +11719,6 @@ bool InterCodeBasicBlock::LoadStoreForwarding(const GrowingInstructionPtrArray&
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mTrueJump && mTrueJump->LoadStoreForwarding(mLoadStoreInstructions, staticVars))
|
||||
changed = true;
|
||||
if (mFalseJump && mFalseJump->LoadStoreForwarding(mLoadStoreInstructions, staticVars))
|
||||
|
@ -18790,6 +18789,8 @@ void InterCodeBasicBlock::CollectGlobalReferences(NumberSet& referencedGlobals,
|
|||
case IC_LOAD:
|
||||
if (ins->mSrc[0].mTemp < 0 && ins->mSrc[0].mMemory == IM_GLOBAL && ins->mSrc[0].mVarIndex >= 0)
|
||||
referencedGlobals += ins->mSrc[0].mVarIndex;
|
||||
else if (ins->mSrc[0].mMemoryBase == IM_GLOBAL && ins->mSrc[0].mVarIndex >= 0)
|
||||
referencedGlobals += ins->mSrc[0].mVarIndex;
|
||||
else if (ins->mSrc[0].mTemp >= 0 && (ins->mSrc[0].mMemoryBase == IM_NONE || ins->mSrc[0].mMemoryBase == IM_INDIRECT))
|
||||
loadsIndirect = true;
|
||||
break;
|
||||
|
@ -18799,6 +18800,11 @@ void InterCodeBasicBlock::CollectGlobalReferences(NumberSet& referencedGlobals,
|
|||
referencedGlobals += ins->mSrc[1].mVarIndex;
|
||||
modifiedGlobals += ins->mSrc[1].mVarIndex;
|
||||
}
|
||||
else if (ins->mSrc[1].mMemoryBase == IM_GLOBAL && ins->mSrc[1].mVarIndex >= 0)
|
||||
{
|
||||
referencedGlobals += ins->mSrc[1].mVarIndex;
|
||||
modifiedGlobals += ins->mSrc[1].mVarIndex;
|
||||
}
|
||||
else if (ins->mSrc[1].mTemp >= 0 && (ins->mSrc[1].mMemoryBase == IM_NONE || ins->mSrc[1].mMemoryBase == IM_INDIRECT))
|
||||
storesIndirect = true;
|
||||
break;
|
||||
|
@ -18806,6 +18812,8 @@ void InterCodeBasicBlock::CollectGlobalReferences(NumberSet& referencedGlobals,
|
|||
case IC_STRCPY:
|
||||
if (ins->mSrc[0].mTemp < 0 && ins->mSrc[0].mMemory == IM_GLOBAL && ins->mSrc[0].mVarIndex >= 0)
|
||||
referencedGlobals += ins->mSrc[0].mVarIndex;
|
||||
else if (ins->mSrc[0].mMemoryBase == IM_GLOBAL && ins->mSrc[0].mVarIndex >= 0)
|
||||
referencedGlobals += ins->mSrc[0].mVarIndex;
|
||||
else if (ins->mSrc[0].mTemp >= 0 && (ins->mSrc[0].mMemoryBase == IM_NONE || ins->mSrc[0].mMemoryBase == IM_INDIRECT))
|
||||
loadsIndirect = true;
|
||||
if (ins->mSrc[1].mTemp < 0 && ins->mSrc[1].mMemory == IM_GLOBAL && ins->mSrc[1].mVarIndex >= 0)
|
||||
|
@ -18813,6 +18821,11 @@ void InterCodeBasicBlock::CollectGlobalReferences(NumberSet& referencedGlobals,
|
|||
referencedGlobals += ins->mSrc[1].mVarIndex;
|
||||
modifiedGlobals += ins->mSrc[1].mVarIndex;
|
||||
}
|
||||
else if (ins->mSrc[1].mMemoryBase == IM_GLOBAL && ins->mSrc[1].mVarIndex >= 0)
|
||||
{
|
||||
referencedGlobals += ins->mSrc[1].mVarIndex;
|
||||
modifiedGlobals += ins->mSrc[1].mVarIndex;
|
||||
}
|
||||
else if (ins->mSrc[1].mTemp >= 0 && (ins->mSrc[1].mMemoryBase == IM_NONE || ins->mSrc[1].mMemoryBase == IM_INDIRECT))
|
||||
storesIndirect = true;
|
||||
break;
|
||||
|
@ -20226,7 +20239,7 @@ void InterCodeProcedure::Close(void)
|
|||
{
|
||||
GrowingTypeArray tstack(IT_NONE);
|
||||
|
||||
CheckFunc = !strcmp(mIdent->mString, "test");
|
||||
CheckFunc = !strcmp(mIdent->mString, "interpret_expression");
|
||||
CheckCase = false;
|
||||
|
||||
mEntryBlock = mBlocks[0];
|
||||
|
@ -21678,9 +21691,10 @@ bool InterCodeProcedure::ModifiesGlobal(int varindex)
|
|||
{
|
||||
if (varindex >= 0)
|
||||
{
|
||||
if (mModule->mGlobalVars[varindex]->mAliased)
|
||||
return mStoresIndirect;
|
||||
else if (varindex < mModifiedGlobals.Size())
|
||||
if (mModule->mGlobalVars[varindex]->mAliased && mStoresIndirect)
|
||||
return true;
|
||||
|
||||
if (varindex < mModifiedGlobals.Size())
|
||||
return mModifiedGlobals[varindex];
|
||||
else
|
||||
return false;
|
||||
|
|
|
@ -1081,15 +1081,21 @@ void InterCodeGenerator::TranslateAssembler(InterCodeModule* mod, Expression* ex
|
|||
mErrors->Error(cexp->mLocation, EERR_ASM_INVALD_OPERAND, "Missing assembler operand");
|
||||
else
|
||||
{
|
||||
int64 disp = 0;
|
||||
if (aexp->mType == DT_LABEL_REF)
|
||||
{
|
||||
if (aexp->mBase->mBase)
|
||||
d[offset] = uint8(aexp->mOffset + aexp->mBase->mInteger - offset - 1);
|
||||
disp = aexp->mOffset + aexp->mBase->mInteger - offset - 1;
|
||||
else
|
||||
mErrors->Error(aexp->mLocation, EERR_ASM_INVALD_OPERAND, "Undefined immediate operand", aexp->mBase->mQualIdent);
|
||||
}
|
||||
else
|
||||
d[offset] = uint8(aexp->mInteger - offset - 1);
|
||||
disp = aexp->mInteger - offset - 1;
|
||||
|
||||
if (disp < -128 || disp > 127)
|
||||
mErrors->Error(aexp->mLocation, EERR_ASM_INVALD_OPERAND, "Branch target out of range");
|
||||
|
||||
d[offset] = uint8(disp);
|
||||
}
|
||||
offset++;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue