Fix 16bit const add propagation
This commit is contained in:
parent
064fed63f5
commit
fccfe35c4f
|
@ -2910,7 +2910,7 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration*
|
||||||
ptype->mSize = 2;
|
ptype->mSize = 2;
|
||||||
ptype->mStride = vl.mType->mStride;
|
ptype->mStride = vl.mType->mStride;
|
||||||
vl.mReference = 0;
|
vl.mReference = 0;
|
||||||
vl.mType = exp->mDecType; // ptype;
|
vl.mType = ptype;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vr.mType->mType == DT_TYPE_POINTER)
|
if (vr.mType->mType == DT_TYPE_POINTER)
|
||||||
|
@ -2972,7 +2972,7 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration*
|
||||||
ins->mDst.mTemp = proc->AddTemporary(ins->mDst.mType);
|
ins->mDst.mTemp = proc->AddTemporary(ins->mDst.mType);
|
||||||
block->Append(ins);
|
block->Append(ins);
|
||||||
}
|
}
|
||||||
else if (vr.mType->mType == DT_TYPE_POINTER && vr.mType->mBase->IsConstSame(vl.mType->mBase))
|
else if ((vr.mType->mType == DT_TYPE_POINTER || vr.mType->mType == DT_TYPE_ARRAY) && (vl.mType->mType == DT_TYPE_POINTER || vl.mType->mType == DT_TYPE_ARRAY) && vr.mType->mBase->IsConstSame(vl.mType->mBase))
|
||||||
{
|
{
|
||||||
if (exp->mToken == TK_SUB)
|
if (exp->mToken == TK_SUB)
|
||||||
{
|
{
|
||||||
|
@ -3035,6 +3035,8 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration*
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mErrors->Error(exp->mLocation, EERR_INCOMPATIBLE_OPERATOR, "Invalid pointer operation");
|
mErrors->Error(exp->mLocation, EERR_INCOMPATIBLE_OPERATOR, "Invalid pointer operation");
|
||||||
|
|
||||||
|
vl.mType = exp->mDecType;
|
||||||
}
|
}
|
||||||
else if (vr.mType->mType == DT_TYPE_POINTER || vr.mType->mType == DT_TYPE_ARRAY)
|
else if (vr.mType->mType == DT_TYPE_POINTER || vr.mType->mType == DT_TYPE_ARRAY)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34496,7 +34496,10 @@ bool NativeCodeBasicBlock::Propagate16BitSum(const ExpandingArray<NativeRegister
|
||||||
if (!info.mLinkerObject && !mRSumInfos[j].mLinkerObject)
|
if (!info.mLinkerObject && !mRSumInfos[j].mLinkerObject)
|
||||||
{
|
{
|
||||||
info.mAddress += mRSumInfos[j].mAddress;
|
info.mAddress += mRSumInfos[j].mAddress;
|
||||||
info.mAddL->mType = ASMIT_ADC;
|
if (info.mSrcL->mType == ASMIT_LDA)
|
||||||
|
info.mAddL->mType = ASMIT_ADC;
|
||||||
|
else
|
||||||
|
info.mSrcL->mType = ASMIT_ADC;
|
||||||
info.mAddL->mAddress = info.mAddress & 0xff;
|
info.mAddL->mAddress = info.mAddress & 0xff;
|
||||||
info.mAddH->mAddress = info.mAddress >> 8;
|
info.mAddH->mAddress = info.mAddress >> 8;
|
||||||
info.mSrcL->mAddress = mRSumInfos[j].mSrcL->mAddress;
|
info.mSrcL->mAddress = mRSumInfos[j].mSrcL->mAddress;
|
||||||
|
@ -34507,7 +34510,10 @@ bool NativeCodeBasicBlock::Propagate16BitSum(const ExpandingArray<NativeRegister
|
||||||
else if (!mRSumInfos[j].mLinkerObject)
|
else if (!mRSumInfos[j].mLinkerObject)
|
||||||
{
|
{
|
||||||
info.mAddress += mRSumInfos[j].mAddress;
|
info.mAddress += mRSumInfos[j].mAddress;
|
||||||
info.mAddL->mType = ASMIT_ADC;
|
if (info.mSrcL->mType == ASMIT_LDA)
|
||||||
|
info.mAddL->mType = ASMIT_ADC;
|
||||||
|
else
|
||||||
|
info.mSrcL->mType = ASMIT_ADC;
|
||||||
info.mAddL->mAddress = info.mAddress;
|
info.mAddL->mAddress = info.mAddress;
|
||||||
info.mAddH->mAddress = info.mAddress;
|
info.mAddH->mAddress = info.mAddress;
|
||||||
info.mSrcL->mAddress = mRSumInfos[j].mSrcL->mAddress;
|
info.mSrcL->mAddress = mRSumInfos[j].mSrcL->mAddress;
|
||||||
|
@ -34519,7 +34525,10 @@ bool NativeCodeBasicBlock::Propagate16BitSum(const ExpandingArray<NativeRegister
|
||||||
{
|
{
|
||||||
info.mAddress += mRSumInfos[j].mAddress;
|
info.mAddress += mRSumInfos[j].mAddress;
|
||||||
info.mLinkerObject = mRSumInfos[j].mLinkerObject;
|
info.mLinkerObject = mRSumInfos[j].mLinkerObject;
|
||||||
info.mAddL->mType = ASMIT_ADC;
|
if (info.mSrcL->mType == ASMIT_LDA)
|
||||||
|
info.mAddL->mType = ASMIT_ADC;
|
||||||
|
else
|
||||||
|
info.mSrcL->mType = ASMIT_ADC;
|
||||||
info.mAddL->mAddress = info.mAddress;
|
info.mAddL->mAddress = info.mAddress;
|
||||||
info.mAddL->mLinkerObject = info.mLinkerObject;
|
info.mAddL->mLinkerObject = info.mLinkerObject;
|
||||||
info.mAddL->mMode = ASMIM_IMMEDIATE_ADDRESS;
|
info.mAddL->mMode = ASMIM_IMMEDIATE_ADDRESS;
|
||||||
|
@ -54464,7 +54473,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
|
||||||
|
|
||||||
mInterProc->mLinkerObject->mNativeProc = this;
|
mInterProc->mLinkerObject->mNativeProc = this;
|
||||||
|
|
||||||
CheckFunc = !strcmp(mIdent->mString, "midc<u8>");
|
CheckFunc = !strcmp(mIdent->mString, "main");
|
||||||
|
|
||||||
int nblocks = proc->mBlocks.Size();
|
int nblocks = proc->mBlocks.Size();
|
||||||
tblocks = new NativeCodeBasicBlock * [nblocks];
|
tblocks = new NativeCodeBasicBlock * [nblocks];
|
||||||
|
|
Loading…
Reference in New Issue