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