Fix cost method selection for pointers to incomplete types
This commit is contained in:
parent
18f044e90c
commit
f99abb32e2
|
@ -2771,6 +2771,9 @@ bool Declaration::IsSame(const Declaration* dec) const
|
|||
if (mType != dec->mType)
|
||||
return false;
|
||||
|
||||
if ((mFlags & (DTF_SIGNED | DTF_CONST | DTF_VOLATILE)) != (dec->mFlags & (DTF_SIGNED | DTF_CONST | DTF_VOLATILE)))
|
||||
return false;
|
||||
|
||||
if (!(mFlags & dec->mFlags & DTF_DEFINED) && mType == DT_TYPE_STRUCT)
|
||||
return mIdent == dec->mIdent;
|
||||
|
||||
|
@ -2779,9 +2782,6 @@ bool Declaration::IsSame(const Declaration* dec) const
|
|||
if (mStripe != dec->mStripe)
|
||||
return false;
|
||||
|
||||
if ((mFlags & (DTF_SIGNED | DTF_CONST | DTF_VOLATILE)) != (dec->mFlags & (DTF_SIGNED | DTF_CONST | DTF_VOLATILE)))
|
||||
return false;
|
||||
|
||||
if (mType == DT_CONST_INTEGER)
|
||||
return mInteger == dec->mInteger;
|
||||
else if (mType == DT_TYPE_INTEGER)
|
||||
|
|
|
@ -49687,6 +49687,20 @@ bool NativeCodeBasicBlock::PeepHoleOptimizerIterate4(int i, int pass)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (mIns[i + 0].mType == ASMIT_CMP && mIns[i + 0].mMode == ASMIM_IMMEDIATE &&
|
||||
mIns[i + 1].mType == ASMIT_LDA && mIns[i + 1].mMode == ASMIM_IMMEDIATE && mIns[i + 1].mAddress == 0 &&
|
||||
mIns[i + 2].mType == ASMIT_ADC && mIns[i + 2].mMode == ASMIM_IMMEDIATE && mIns[i + 2].mAddress == 0xff &&
|
||||
mIns[i + 3].mType == ASMIT_LSR && mIns[i + 3].mMode == ASMIM_IMPLIED && !(mIns[i + 3].mLive & (LIVE_CPU_REG_A | LIVE_CPU_REG_Z)))
|
||||
{
|
||||
int val = mIns[i + 0].mAddress;
|
||||
mIns[i + 0].mType = ASMIT_EOR; mIns[i + 0].mAddress = 0xff;
|
||||
mIns[i + 1].mType = ASMIT_CLC; mIns[i + 1].mMode = ASMIM_IMPLIED;
|
||||
mIns[i + 2].mAddress = val;
|
||||
mIns[i + 3].mType = ASMIT_NOP; mIns[i + 3].mMode = ASMIM_IMPLIED;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mIns[i + 0].mType == ASMIT_LDY && mIns[i + 2].mType == ASMIT_LDX && mIns[i + 0].SameEffectiveAddress(mIns[i + 2]) &&
|
||||
!mIns[i + 0].MayBeChangedOnAddress(mIns[i + 1]) && !mIns[i + 1].ChangesYReg() &&
|
||||
mIns[i + 1].mMode == ASMIM_ABSOLUTE_Y && mIns[i + 3].mMode == ASMIM_ABSOLUTE_X && !(mIns[i + 2].mLive & LIVE_CPU_REG_Z))
|
||||
|
@ -50215,6 +50229,22 @@ bool NativeCodeBasicBlock::PeepHoleOptimizerIterate5(int i, int pass)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
mIns[i + 0].mType == ASMIT_AND && mIns[i + 0].mMode == ASMIM_IMMEDIATE && mIns[i + 0].mAddress == 1 &&
|
||||
mIns[i + 1].mType == ASMIT_STA && mIns[i + 1].mMode == ASMIM_ZERO_PAGE &&
|
||||
mIns[i + 2].mType == ASMIT_LDA && mIns[i + 2].mMode == ASMIM_ZERO_PAGE && mIns[i + 2].mAddress != mIns[i + 1].mAddress &&
|
||||
mIns[i + 3].mType == ASMIT_ASL && mIns[i + 3].mMode == ASMIM_IMPLIED &&
|
||||
mIns[i + 4].mType == ASMIT_ORA && mIns[i + 4].mMode == ASMIM_ZERO_PAGE && mIns[i + 4].mAddress == mIns[i + 1].mAddress && !(mIns[i + 4].mLive & LIVE_MEM))
|
||||
{
|
||||
mIns[i + 0].mType = ASMIT_LSR; mIns[i + 0].mMode = ASMIM_IMPLIED; mIns[i + 0].mLive |= LIVE_CPU_REG_C;
|
||||
mIns[i + 1].mType = ASMIT_NOP; mIns[i + 1].mMode = ASMIM_IMPLIED;
|
||||
mIns[i + 2].mLive |= LIVE_CPU_REG_C;
|
||||
mIns[i + 3].mType = ASMIT_ROL;
|
||||
mIns[i + 4].mType = ASMIT_NOP; mIns[i + 4].mMode = ASMIM_IMPLIED;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -53048,7 +53078,27 @@ bool NativeCodeBasicBlock::PeepHoleOptimizerExits(int pass)
|
|||
changed = true;
|
||||
}
|
||||
#endif
|
||||
#if 1
|
||||
if (sz >= 3 && (mBranch == ASMIT_BCC || mBranch == ASMIT_BCS) && !mExitRequiredRegs[CPU_REG_C])
|
||||
{
|
||||
if (mIns[sz - 3].mType == ASMIT_LDA && !(mIns[sz - 3].ReferencesXReg()) &&
|
||||
mIns[sz - 2].mType == ASMIT_ASL && mIns[sz - 2].mMode == ASMIM_IMPLIED && !(mIns[sz - 2].mLive & LIVE_CPU_REG_A) &&
|
||||
mIns[sz - 1].mType == ASMIT_LDX)
|
||||
{
|
||||
mIns[sz - 2] = mIns[sz - 3];
|
||||
mIns[sz - 3] = mIns[sz - 1];
|
||||
mIns[sz - 1].mType = ASMIT_NOP; mIns[sz - 1].mMode = ASMIM_IMPLIED;
|
||||
|
||||
mIns[sz - 2].mLive |= LIVE_CPU_REG_Z;
|
||||
if (mIns[sz - 2].ReferencesYReg()) mIns[sz - 3].mLive |= LIVE_CPU_REG_Y;
|
||||
if (mBranch == ASMIT_BCC)
|
||||
mBranch = ASMIT_BPL;
|
||||
else
|
||||
mBranch = ASMIT_BMI;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if 1
|
||||
if (sz > 1 && mFalseJump &&
|
||||
mIns[sz - 2].mType == ASMIT_LDA && mIns[sz - 2].mMode == ASMIM_IMMEDIATE && mIns[sz - 2].mAddress == 0xff &&
|
||||
|
|
|
@ -7858,7 +7858,17 @@ Expression * Parser::ResolveOverloadCall(Expression* exp, Expression* exp2)
|
|||
mErrors->Error(exp->mLocation, ERRO_NO_MATCHING_FUNCTION_CALL, "No matching function call", exp->mLeft->mDecValue->mQualIdent);
|
||||
}
|
||||
else if (nbest > 1)
|
||||
{
|
||||
#if _DEBUG
|
||||
fdec = exp->mLeft->mDecValue;
|
||||
while (fdec)
|
||||
{
|
||||
int d = OverloadDistance(fdec, exp->mRight);
|
||||
fdec = fdec->mNext;
|
||||
}
|
||||
#endif
|
||||
mErrors->Error(exp->mLocation, ERRO_AMBIGUOUS_FUNCTION_CALL, "Ambiguous function call", exp->mLeft->mDecValue->mQualIdent);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(dbest);
|
||||
|
|
Loading…
Reference in New Issue