Fix pointer to object size propagation
This commit is contained in:
parent
92b72b19ec
commit
dfe233a95e
|
@ -267,13 +267,15 @@ bool GlobalOptimizer::ReplaceGlobalConst(Expression* exp)
|
||||||
if (exp->mType == EX_VARIABLE && (exp->mDecValue->mFlags & (DTF_GLOBAL | DTF_STATIC)) && !(exp->mDecValue->mOptFlags & (OPTF_VAR_MODIFIED | OPTF_VAR_ADDRESS)) && exp->mDecValue->mValue)
|
if (exp->mType == EX_VARIABLE && (exp->mDecValue->mFlags & (DTF_GLOBAL | DTF_STATIC)) && !(exp->mDecValue->mOptFlags & (OPTF_VAR_MODIFIED | OPTF_VAR_ADDRESS)) && exp->mDecValue->mValue)
|
||||||
{
|
{
|
||||||
Expression* cexp = exp->mDecValue->mValue;
|
Expression* cexp = exp->mDecValue->mValue;
|
||||||
if (cexp->mType == EX_CONSTANT)
|
if (cexp->mType == EX_CONSTANT &&
|
||||||
|
(cexp->mDecValue->mType == DT_CONST_ADDRESS || cexp->mDecValue->mType == DT_CONST_INTEGER ||
|
||||||
|
cexp->mDecValue->mType == DT_CONST_POINTER || cexp->mDecValue->mType == DT_CONST_FLOAT))
|
||||||
{
|
{
|
||||||
exp->mType = EX_CONSTANT;
|
exp->mType = EX_CONSTANT;
|
||||||
exp->mDecValue = cexp->mDecValue;
|
exp->mDecValue = cexp->mDecValue;
|
||||||
}
|
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ReplaceGlobalConst(exp->mLeft))
|
if (ReplaceGlobalConst(exp->mLeft))
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
|
@ -4202,12 +4202,7 @@ bool InterInstruction::PropagateConstTemps(const GrowingInstructionPtrArray& cte
|
||||||
{
|
{
|
||||||
InterInstruction* ains = ctemps[mSrc[0].mTemp];
|
InterInstruction* ains = ctemps[mSrc[0].mTemp];
|
||||||
mCode = IC_CONSTANT;
|
mCode = IC_CONSTANT;
|
||||||
mConst.mIntConst = ains->mConst.mIntConst;
|
mConst = ains->mConst;
|
||||||
mConst.mFloatConst = ains->mConst.mFloatConst;
|
|
||||||
mConst.mLinkerObject = ains->mConst.mLinkerObject;
|
|
||||||
mConst.mVarIndex = ains->mConst.mVarIndex;
|
|
||||||
mConst.mMemory = ains->mConst.mMemory;
|
|
||||||
mConst.mType = ains->mConst.mType;
|
|
||||||
mSrc[0].mTemp = -1;
|
mSrc[0].mTemp = -1;
|
||||||
mNumOperands = 0;
|
mNumOperands = 0;
|
||||||
return true;
|
return true;
|
||||||
|
@ -22243,7 +22238,7 @@ void InterCodeProcedure::Close(void)
|
||||||
{
|
{
|
||||||
GrowingTypeArray tstack(IT_NONE);
|
GrowingTypeArray tstack(IT_NONE);
|
||||||
|
|
||||||
CheckFunc = !strcmp(mIdent->mString, "main");
|
CheckFunc = !strcmp(mIdent->mString, "intro_display");
|
||||||
CheckCase = false;
|
CheckCase = false;
|
||||||
|
|
||||||
mEntryBlock = mBlocks[0];
|
mEntryBlock = mBlocks[0];
|
||||||
|
|
Loading…
Reference in New Issue