Fix warnings
This commit is contained in:
parent
4c8d7a08d0
commit
6308f22f25
File diff suppressed because it is too large
Load Diff
|
@ -176,7 +176,7 @@ void Compiler::RegisterRuntime(const Location & loc, const Ident* ident)
|
|||
mInterCodeGenerator->TranslateAssembler(mInterCodeModule, bcdec->mBase->mValue, nullptr);
|
||||
|
||||
linkerObject = bcdec->mBase->mLinkerObject;
|
||||
offset = bcdec->mInteger;
|
||||
offset = int(bcdec->mInteger);
|
||||
}
|
||||
else if (bcdec->mType == DT_VARIABLE)
|
||||
{
|
||||
|
@ -728,7 +728,7 @@ bool Compiler::GenerateCode(void)
|
|||
if (!bcdec->mBase->mLinkerObject)
|
||||
mInterCodeGenerator->TranslateAssembler(mInterCodeModule, bcdec->mBase->mValue, nullptr);
|
||||
linkerObject = bcdec->mBase->mLinkerObject;
|
||||
offset = bcdec->mInteger;
|
||||
offset = int(bcdec->mInteger);
|
||||
}
|
||||
|
||||
assert(linkerObject);
|
||||
|
@ -788,7 +788,9 @@ bool Compiler::BuildLZO(const char* targetPath)
|
|||
Scanner* scanner = new Scanner(mErrors, mPreprocessor);
|
||||
while (scanner->mToken == TK_INTEGER)
|
||||
{
|
||||
data[n++] = scanner->mTokenInteger;
|
||||
if (scanner->mTokenInteger < 0 || scanner->mTokenInteger > 255)
|
||||
mErrors->Error(scanner->mLocation, EWARN_CONSTANT_TRUNCATED, "Constant integer truncated");
|
||||
data[n++] = uint8(scanner->mTokenInteger);
|
||||
do {
|
||||
scanner->NextToken();
|
||||
} while (scanner->mToken == TK_COMMA);
|
||||
|
|
|
@ -291,7 +291,7 @@ Expression* Expression::ConstantFold(Errors * errors)
|
|||
Expression* ex = new Expression(mLocation, EX_CONSTANT);
|
||||
Declaration* dec = new Declaration(mLocation, DT_CONST_INTEGER);
|
||||
dec->mBase = mLeft->mDecType;
|
||||
dec->mInteger = mRight->mDecValue->mNumber;
|
||||
dec->mInteger = int64(mRight->mDecValue->mNumber);
|
||||
ex->mDecValue = dec;
|
||||
ex->mDecType = mLeft->mDecType;
|
||||
return ex;
|
||||
|
@ -323,7 +323,7 @@ Expression* Expression::ConstantFold(Errors * errors)
|
|||
Expression* ex = new Expression(mLocation, EX_CONSTANT);
|
||||
Declaration* dec = new Declaration(mLocation, DT_CONST_FLOAT);
|
||||
dec->mBase = mLeft->mDecType;
|
||||
dec->mNumber = mRight->mDecValue->mInteger;
|
||||
dec->mNumber = double(mRight->mDecValue->mInteger);
|
||||
ex->mDecValue = dec;
|
||||
ex->mDecType = mLeft->mDecType;
|
||||
return ex;
|
||||
|
@ -542,8 +542,8 @@ Expression* Expression::ConstantFold(Errors * errors)
|
|||
Declaration* dec = new Declaration(mLocation, DT_VARIABLE_REF);
|
||||
dec->mFlags = mLeft->mDecValue->mFlags;
|
||||
dec->mBase = mLeft->mDecValue;
|
||||
dec->mSize = mLeft->mDecType->mBase->mSize - mRight->mDecValue->mInteger * dec->mSize;
|
||||
dec->mOffset = mRight->mDecValue->mInteger * dec->mSize;
|
||||
dec->mSize = mLeft->mDecType->mBase->mSize - int(mRight->mDecValue->mInteger) * dec->mSize;
|
||||
dec->mOffset = int(mRight->mDecValue->mInteger) * dec->mSize;
|
||||
ex->mDecValue = dec;
|
||||
ex->mDecType = mLeft->mDecType;
|
||||
return ex;
|
||||
|
@ -554,8 +554,8 @@ Expression* Expression::ConstantFold(Errors * errors)
|
|||
Declaration* dec = new Declaration(mLocation, DT_VARIABLE_REF);
|
||||
dec->mFlags = mLeft->mDecValue->mFlags;
|
||||
dec->mBase = mLeft->mDecValue->mBase;
|
||||
dec->mSize = mLeft->mDecType->mBase->mSize - mRight->mDecValue->mInteger * dec->mSize;
|
||||
dec->mOffset = mLeft->mDecValue->mOffset + mRight->mDecValue->mInteger * dec->mSize;
|
||||
dec->mSize = mLeft->mDecType->mBase->mSize - int(mRight->mDecValue->mInteger) * dec->mSize;
|
||||
dec->mOffset = mLeft->mDecValue->mOffset + int(mRight->mDecValue->mInteger) * dec->mSize;
|
||||
ex->mDecValue = dec;
|
||||
ex->mDecType = mLeft->mDecType;
|
||||
return ex;
|
||||
|
|
|
@ -623,8 +623,6 @@ void NativeCodeDisassembler::DumpMemory(FILE* file, const uint8* memory, int ban
|
|||
else if (ident)
|
||||
fprintf(file, "%s:\n", ident->mString);
|
||||
|
||||
char tbuffer[10], abuffer[100];
|
||||
|
||||
if (lobj->mSection->mType == LST_BSS)
|
||||
{
|
||||
if (bank >= 0)
|
||||
|
|
|
@ -53,7 +53,6 @@ DiskImage::DiskImage(const char* fname)
|
|||
for (int i = 0x90; i < 0xab; i++)
|
||||
bam[i] = 0xa0;
|
||||
|
||||
char dname[200];
|
||||
int i = strlen(fname);
|
||||
|
||||
while (i > 0 && fname[i - 1] != '/' && fname[i - 1] != '\\')
|
||||
|
|
|
@ -301,7 +301,7 @@ static bool MemPtrRange(const InterInstruction* ins, const GrowingInstructionPtr
|
|||
{
|
||||
mem = ins->mConst.mMemory;
|
||||
vindex = ins->mConst.mVarIndex;
|
||||
offset = ins->mConst.mIntConst;
|
||||
offset = int(ins->mConst.mIntConst);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ static bool MemPtrRange(const InterInstruction* ins, const GrowingInstructionPtr
|
|||
{
|
||||
mem = ins->mSrc[1].mMemory;
|
||||
vindex = ins->mSrc[1].mVarIndex;
|
||||
offset = ins->mSrc[1].mIntConst;
|
||||
offset = int(ins->mSrc[1].mIntConst);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -341,14 +341,14 @@ static bool MemRange(const InterInstruction* ins, const GrowingInstructionPtrArr
|
|||
{
|
||||
mem = ins->mSrc[0].mMemory;
|
||||
vindex = ins->mSrc[0].mVarIndex;
|
||||
offset = ins->mSrc[0].mIntConst;
|
||||
offset = int(ins->mSrc[0].mIntConst);
|
||||
size = ins->mSrc[0].mOperandSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
mem = ins->mSrc[1].mMemory;
|
||||
vindex = ins->mSrc[1].mVarIndex;
|
||||
offset = ins->mSrc[1].mIntConst;
|
||||
offset = int(ins->mSrc[1].mIntConst);
|
||||
size = ins->mSrc[1].mOperandSize;
|
||||
}
|
||||
|
||||
|
@ -969,13 +969,13 @@ static void LoadConstantFold(InterInstruction* ins, InterInstruction* ains, cons
|
|||
if (ains)
|
||||
{
|
||||
lobj = ains->mConst.mLinkerObject;
|
||||
offset = ains->mConst.mIntConst;
|
||||
offset = int(ains->mConst.mIntConst);
|
||||
stride = ains->mConst.mStride;
|
||||
}
|
||||
else
|
||||
{
|
||||
lobj = ins->mSrc[0].mLinkerObject;
|
||||
offset = ins->mSrc[0].mIntConst;
|
||||
offset = int(ins->mSrc[0].mIntConst);
|
||||
stride = ins->mSrc[0].mStride;
|
||||
}
|
||||
|
||||
|
@ -1370,7 +1370,7 @@ static bool CanBypassStore(const InterInstruction* sins, const InterInstruction*
|
|||
sm = sins->mSrc[0].mMemory;
|
||||
si = sins->mSrc[0].mVarIndex;
|
||||
st = sins->mSrc[0].mTemp;
|
||||
so = sins->mSrc[0].mIntConst;
|
||||
so = int(sins->mSrc[0].mIntConst);
|
||||
slo = sins->mSrc[0].mLinkerObject;
|
||||
sz = InterTypeSize[sins->mDst.mType];
|
||||
}
|
||||
|
@ -1379,7 +1379,7 @@ static bool CanBypassStore(const InterInstruction* sins, const InterInstruction*
|
|||
sm = sins->mSrc[1].mMemory;
|
||||
si = sins->mSrc[1].mVarIndex;
|
||||
st = sins->mSrc[1].mTemp;
|
||||
so = sins->mSrc[1].mIntConst;
|
||||
so = int(sins->mSrc[1].mIntConst);
|
||||
slo = sins->mSrc[1].mLinkerObject;
|
||||
sz = InterTypeSize[sins->mSrc[0].mType];
|
||||
}
|
||||
|
@ -1389,7 +1389,7 @@ static bool CanBypassStore(const InterInstruction* sins, const InterInstruction*
|
|||
bm = bins->mSrc[0].mMemory;
|
||||
bi = bins->mSrc[0].mVarIndex;
|
||||
bt = bins->mSrc[0].mTemp;
|
||||
bo = bins->mSrc[0].mIntConst;
|
||||
bo = int(bins->mSrc[0].mIntConst);
|
||||
blo = bins->mSrc[0].mLinkerObject;
|
||||
bz = InterTypeSize[bins->mDst.mType];
|
||||
}
|
||||
|
@ -1398,7 +1398,7 @@ static bool CanBypassStore(const InterInstruction* sins, const InterInstruction*
|
|||
bm = bins->mSrc[1].mMemory;
|
||||
bi = bins->mSrc[1].mVarIndex;
|
||||
bt = bins->mSrc[1].mTemp;
|
||||
bo = bins->mSrc[1].mIntConst;
|
||||
bo = int(bins->mSrc[1].mIntConst);
|
||||
blo = bins->mSrc[1].mLinkerObject;
|
||||
bz = InterTypeSize[bins->mSrc[0].mType];
|
||||
}
|
||||
|
@ -2361,7 +2361,7 @@ void ValueSet::UpdateValue(InterInstruction * ins, const GrowingInstructionPtrAr
|
|||
|
||||
if (tvalue[ins->mSrc[1].mTemp]->mOperator == IA_EXT8TO16S || tvalue[ins->mSrc[1].mTemp]->mOperator == IA_EXT8TO32S)
|
||||
{
|
||||
int ivalue = tvalue[ins->mSrc[0].mTemp]->mConst.mIntConst;
|
||||
int64 ivalue = tvalue[ins->mSrc[0].mTemp]->mConst.mIntConst;
|
||||
if (ivalue < -128)
|
||||
{
|
||||
toconst = true;
|
||||
|
@ -2407,7 +2407,7 @@ void ValueSet::UpdateValue(InterInstruction * ins, const GrowingInstructionPtrAr
|
|||
}
|
||||
else if (tvalue[ins->mSrc[1].mTemp]->mOperator == IA_EXT8TO16U || tvalue[ins->mSrc[1].mTemp]->mOperator == IA_EXT8TO32U)
|
||||
{
|
||||
int ivalue = tvalue[ins->mSrc[0].mTemp]->mConst.mIntConst;
|
||||
int64 ivalue = tvalue[ins->mSrc[0].mTemp]->mConst.mIntConst;
|
||||
if (ivalue < 0)
|
||||
{
|
||||
toconst = true;
|
||||
|
@ -2497,7 +2497,7 @@ void ValueSet::UpdateValue(InterInstruction * ins, const GrowingInstructionPtrAr
|
|||
|
||||
if (tvalue[ins->mSrc[0].mTemp]->mOperator == IA_EXT8TO16S || tvalue[ins->mSrc[0].mTemp]->mOperator == IA_EXT8TO32S)
|
||||
{
|
||||
int ivalue = tvalue[ins->mSrc[1].mTemp]->mConst.mIntConst;
|
||||
int64 ivalue = tvalue[ins->mSrc[1].mTemp]->mConst.mIntConst;
|
||||
if (ivalue > 127)
|
||||
{
|
||||
toconst = true;
|
||||
|
@ -2543,7 +2543,7 @@ void ValueSet::UpdateValue(InterInstruction * ins, const GrowingInstructionPtrAr
|
|||
}
|
||||
else if (tvalue[ins->mSrc[0].mTemp]->mOperator == IA_EXT8TO16U || tvalue[ins->mSrc[0].mTemp]->mOperator == IA_EXT8TO32U)
|
||||
{
|
||||
int ivalue = tvalue[ins->mSrc[1].mTemp]->mConst.mIntConst;
|
||||
int64 ivalue = tvalue[ins->mSrc[1].mTemp]->mConst.mIntConst;
|
||||
if (ivalue > 255)
|
||||
{
|
||||
toconst = true;
|
||||
|
@ -4288,8 +4288,6 @@ static bool IsInfiniteLoop(InterCodeBasicBlock* head, InterCodeBasicBlock* block
|
|||
|
||||
void InterCodeBasicBlock::GenerateTraces(bool expand, bool compact)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (mInPath)
|
||||
mLoopHead = true;
|
||||
|
||||
|
@ -5910,7 +5908,7 @@ void InterCodeBasicBlock::UpdateLocalIntegerRangeSets(const GrowingVariableArray
|
|||
assert(mLocalValueRange.Size() == mExitRequiredTemps.Size());
|
||||
|
||||
InterCodeBasicBlock * pblock;
|
||||
int nloop;
|
||||
int64 nloop;
|
||||
|
||||
bool singleLoop = CheckSingleBlockLimitedLoop(pblock, nloop);
|
||||
|
||||
|
@ -6125,7 +6123,7 @@ void InterCodeBasicBlock::UpdateLocalIntegerRangeSets(const GrowingVariableArray
|
|||
{
|
||||
if (ins->mSrc[1].mTemp == ins->mDst.mTemp && dependTemps[ins->mDst.mTemp] && i + 3 != sz)
|
||||
{
|
||||
int start = pblock->mTrueValueRange[ins->mDst.mTemp].mMinValue;
|
||||
int64 start = pblock->mTrueValueRange[ins->mDst.mTemp].mMinValue;
|
||||
vr.SetLimit(start + ins->mSrc[0].mIntConst, start + nloop * ins->mSrc[0].mIntConst);
|
||||
}
|
||||
else
|
||||
|
@ -6193,7 +6191,7 @@ void InterCodeBasicBlock::UpdateLocalIntegerRangeSets(const GrowingVariableArray
|
|||
else if (ins->mSrc[1].mTemp < 0)
|
||||
{
|
||||
vr = mLocalValueRange[ins->mSrc[0].mTemp];
|
||||
int maxv = vr.mMaxValue, minv = vr.mMinValue;
|
||||
int64 maxv = vr.mMaxValue, minv = vr.mMinValue;
|
||||
|
||||
if (vr.mMaxState == IntegerValueRange::S_WEAK)
|
||||
{
|
||||
|
@ -6252,7 +6250,7 @@ void InterCodeBasicBlock::UpdateLocalIntegerRangeSets(const GrowingVariableArray
|
|||
if (vr.mMinState == IntegerValueRange::S_WEAK)
|
||||
vr.mMaxState = IntegerValueRange::S_UNBOUND;
|
||||
|
||||
int maxv = vr.mMaxValue, minv = vr.mMinValue;
|
||||
int64 maxv = vr.mMaxValue, minv = vr.mMinValue;
|
||||
vr.mMaxValue = ins->mSrc[0].mIntConst * minv;
|
||||
vr.mMinValue = ins->mSrc[0].mIntConst * maxv;
|
||||
}
|
||||
|
@ -6281,7 +6279,7 @@ void InterCodeBasicBlock::UpdateLocalIntegerRangeSets(const GrowingVariableArray
|
|||
if (vr.mMinState == IntegerValueRange::S_WEAK)
|
||||
vr.mMaxState = IntegerValueRange::S_UNBOUND;
|
||||
|
||||
int maxv = vr.mMaxValue, minv = vr.mMinValue;
|
||||
int64 maxv = vr.mMaxValue, minv = vr.mMinValue;
|
||||
vr.mMaxValue = ins->mSrc[1].mIntConst * minv;
|
||||
vr.mMinValue = ins->mSrc[1].mIntConst * maxv;
|
||||
}
|
||||
|
@ -8051,9 +8049,9 @@ static bool CheckSimplifyPointerOffsets(const InterInstruction* ins, int temp, i
|
|||
if (ins->mCode == IC_LOAD && ins->mSrc[0].mTemp == temp)
|
||||
{
|
||||
if (ins->mSrc[0].mIntConst < mino)
|
||||
mino = ins->mSrc[0].mIntConst;
|
||||
mino = int(ins->mSrc[0].mIntConst);
|
||||
if (ins->mSrc[0].mIntConst > maxo)
|
||||
maxo = ins->mSrc[0].mIntConst;
|
||||
maxo = int(ins->mSrc[0].mIntConst);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -8064,9 +8062,9 @@ static bool CheckSimplifyPointerOffsets(const InterInstruction* ins, int temp, i
|
|||
return false;
|
||||
|
||||
if (ins->mSrc[1].mIntConst < mino)
|
||||
mino = ins->mSrc[1].mIntConst;
|
||||
mino = int(ins->mSrc[1].mIntConst);
|
||||
if (ins->mSrc[1].mIntConst > maxo)
|
||||
maxo = ins->mSrc[1].mIntConst;
|
||||
maxo = int(ins->mSrc[1].mIntConst);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -9258,7 +9256,7 @@ bool InterCodeBasicBlock::LoadStoreForwarding(const GrowingInstructionPtrArray&
|
|||
}
|
||||
else if (ins->mCode == IC_LEA && ins->mSrc[1].mTemp < 0 && ins->mSrc[1].mMemory == IM_ABSOLUTE && ins->mSrc[0].mTemp >= 0)
|
||||
{
|
||||
int offset = ins->mSrc[1].mIntConst;
|
||||
int offset = int(ins->mSrc[1].mIntConst);
|
||||
|
||||
j = 0;
|
||||
while (j < mLoadStoreInstructions.Size() && !(
|
||||
|
@ -10026,7 +10024,7 @@ bool InterCodeBasicBlock::ForwardDiamondMovedTemp(void)
|
|||
{
|
||||
if (mInstructions[j]->mCode == IC_LEA && mInstructions[j]->mSrc[1].mTemp == tins->mSrc[0].mTemp && mInstructions[j]->mSrc[0].mTemp < 0)
|
||||
{
|
||||
offset += mInstructions[j]->mSrc[0].mIntConst;
|
||||
offset += int(mInstructions[j]->mSrc[0].mIntConst);
|
||||
}
|
||||
else
|
||||
fail = true;
|
||||
|
@ -10373,7 +10371,7 @@ void InterCodeBasicBlock::CollectOuterFrame(int level, int& size, bool &inner, b
|
|||
if (level == 1)
|
||||
{
|
||||
if (mInstructions[i]->mConst.mIntConst > size)
|
||||
size = mInstructions[i]->mConst.mIntConst;
|
||||
size = int(mInstructions[i]->mConst.mIntConst);
|
||||
mInstructions[i]->mCode = IC_NONE;
|
||||
}
|
||||
else
|
||||
|
@ -10632,7 +10630,7 @@ void PromoteStaticStackParam(InterOperand& iop, LinkerObject* paramlobj)
|
|||
iop.mMemory = IM_GLOBAL;
|
||||
iop.mIntConst += offset;
|
||||
iop.mLinkerObject = paramlobj;
|
||||
paramlobj->EnsureSpace(iop.mIntConst, iop.mOperandSize);
|
||||
paramlobj->EnsureSpace(int(iop.mIntConst), iop.mOperandSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11129,7 +11127,7 @@ bool InterCodeBasicBlock::SingleTailLoopOptimization(const NumberSet& aliasedPar
|
|||
InterInstruction* si = FindSourceInstruction(mLoopPrefix, ai->mDst.mTemp);
|
||||
if (si && si->mCode == IC_CONSTANT)
|
||||
{
|
||||
int num = (ci->mSrc[0].mIntConst - si->mSrc[0].mIntConst) / ai->mSrc[0].mIntConst;
|
||||
int64 num = (ci->mSrc[0].mIntConst - si->mSrc[0].mIntConst) / ai->mSrc[0].mIntConst;
|
||||
if (num > 0)
|
||||
{
|
||||
ai->mOperator = IA_SUB;
|
||||
|
@ -11574,13 +11572,13 @@ void InterCodeBasicBlock::SingleBlockLoopUnrolling(void)
|
|||
{
|
||||
if (mDominator->mTrueValueRange[ireg].IsConstant())
|
||||
{
|
||||
int start = mDominator->mTrueValueRange[ireg].mMinValue;
|
||||
int end = mInstructions[nins - 2]->mSrc[0].mIntConst;
|
||||
int64 start = mDominator->mTrueValueRange[ireg].mMinValue;
|
||||
int64 end = mInstructions[nins - 2]->mSrc[0].mIntConst;
|
||||
if (mInstructions[nins - 2]->mOperator == IA_CMPLEU)
|
||||
end++;
|
||||
|
||||
int step = mInstructions[nins - 3]->mSrc[0].mTemp < 0 ? mInstructions[nins - 3]->mSrc[0].mIntConst : mInstructions[nins - 3]->mSrc[1].mIntConst;
|
||||
int count = (end - start) / step;
|
||||
int64 step = mInstructions[nins - 3]->mSrc[0].mTemp < 0 ? mInstructions[nins - 3]->mSrc[0].mIntConst : mInstructions[nins - 3]->mSrc[1].mIntConst;
|
||||
int count = int((end - start) / step);
|
||||
|
||||
if (count < 5 && (nins - 3) * count < 20)
|
||||
{
|
||||
|
@ -11659,7 +11657,7 @@ void InterCodeBasicBlock::PushMoveOutOfLoop(void)
|
|||
else if (cins->mDst.mTemp == mins->mSrc[0].mTemp)
|
||||
{
|
||||
if (cins->mCode == IC_LEA && cins->mSrc[1].mTemp == mins->mSrc[0].mTemp && cins->mSrc[0].mTemp < 0)
|
||||
offset += cins->mSrc[0].mIntConst;
|
||||
offset += int(cins->mSrc[0].mIntConst);
|
||||
else
|
||||
fail = true;
|
||||
}
|
||||
|
@ -11728,7 +11726,7 @@ void InterCodeBasicBlock::PushMoveOutOfLoop(void)
|
|||
}
|
||||
}
|
||||
|
||||
bool InterCodeBasicBlock::CheckSingleBlockLimitedLoop(InterCodeBasicBlock*& pblock, int& nloop)
|
||||
bool InterCodeBasicBlock::CheckSingleBlockLimitedLoop(InterCodeBasicBlock*& pblock, int64& nloop)
|
||||
{
|
||||
if (mLoopHead && mNumEntries == 2 && mFalseJump && (mTrueJump == this || mFalseJump == this) && mInstructions.Size() > 3)
|
||||
{
|
||||
|
@ -11829,10 +11827,10 @@ bool InterCodeBasicBlock::SingleBlockLoopPointerToByte(int& spareTemps)
|
|||
i++;
|
||||
if (i == nins - 3)
|
||||
{
|
||||
int nloop = cins->mSrc[0].mIntConst;
|
||||
int nloop = int(cins->mSrc[0].mIntConst);
|
||||
if (cins->mOperator == IA_CMPLEU)
|
||||
nloop++;
|
||||
nloop /= ains->mSrc[0].mIntConst;
|
||||
nloop /= int(ains->mSrc[0].mIntConst);
|
||||
|
||||
for (int i = 0; i < mInstructions.Size() - 3; i++)
|
||||
{
|
||||
|
@ -11887,7 +11885,7 @@ bool InterCodeBasicBlock::SingleBlockLoopPointerToByte(int& spareTemps)
|
|||
if (spareTemps + 2 >= mEntryRequiredTemps.Size() + 16)
|
||||
return true;
|
||||
|
||||
int inc = lins->mSrc[0].mIntConst;
|
||||
int inc = int(lins->mSrc[0].mIntConst);
|
||||
|
||||
int ireg = mtemps[inc];
|
||||
|
||||
|
@ -12747,9 +12745,9 @@ void InterCodeBasicBlock::SingleBlockLoopOptimisation(const NumberSet& aliasedPa
|
|||
else if (cins->mDst.mTemp == st)
|
||||
{
|
||||
if (cins->mCode == IC_LEA && cins->mSrc[1].mTemp == st && cins->mSrc[0].mTemp < 0)
|
||||
toffset += cins->mSrc[0].mIntConst;
|
||||
toffset += int(cins->mSrc[0].mIntConst);
|
||||
else if (cins->mCode == IC_BINARY_OPERATOR && cins->mOperator == IA_ADD && cins->mSrc[1].mTemp == st && cins->mSrc[0].mTemp < 0)
|
||||
toffset += cins->mSrc[0].mIntConst;
|
||||
toffset += int(cins->mSrc[0].mIntConst);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
@ -13006,7 +13004,7 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray
|
|||
mInstructions[i + 1]->mSrc[1].mTemp == mInstructions[i + 0]->mDst.mTemp && mInstructions[i + 1]->mSrc[1].mFinal &&
|
||||
(mInstructions[i + 1]->mSrc[0].mIntConst & (1LL << mInstructions[i + 0]->mSrc[0].mIntConst)) == 0)
|
||||
{
|
||||
int shift = mInstructions[i + 0]->mSrc[0].mIntConst;
|
||||
int64 shift = mInstructions[i + 0]->mSrc[0].mIntConst;
|
||||
mInstructions[i + 1]->mSrc[0].mIntConst >>= shift;
|
||||
mInstructions[i + 0]->mOperator = IA_AND;
|
||||
mInstructions[i + 0]->mSrc[0].mIntConst = ~((1LL << shift) - 1);
|
||||
|
@ -13018,7 +13016,7 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray
|
|||
mInstructions[i + 1]->mSrc[0].mTemp == mInstructions[i + 0]->mDst.mTemp && mInstructions[i + 1]->mSrc[0].mFinal &&
|
||||
(mInstructions[i + 1]->mSrc[1].mIntConst & (1LL << mInstructions[i + 0]->mSrc[0].mIntConst)) == 0)
|
||||
{
|
||||
int shift = mInstructions[i + 0]->mSrc[0].mIntConst;
|
||||
int64 shift = mInstructions[i + 0]->mSrc[0].mIntConst;
|
||||
mInstructions[i + 1]->mSrc[1].mIntConst >>= shift;
|
||||
mInstructions[i + 0]->mOperator = IA_AND;
|
||||
mInstructions[i + 0]->mSrc[0].mIntConst = ~((1LL << shift) - 1);
|
||||
|
@ -13111,8 +13109,8 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray
|
|||
(mInstructions[i + 2]->mSrc[0].mIntConst & 1) == 0)
|
||||
{
|
||||
|
||||
int shift = mInstructions[i + 0]->mSrc[0].mIntConst;
|
||||
int mshift = 1;
|
||||
int64 shift = mInstructions[i + 0]->mSrc[0].mIntConst;
|
||||
int64 mshift = 1;
|
||||
while (!(mInstructions[i + 2]->mSrc[0].mIntConst & (1ULL << mshift)))
|
||||
mshift++;
|
||||
|
||||
|
@ -13151,10 +13149,10 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray
|
|||
mInstructions[i + 1]->mSrc[1].mTemp == mInstructions[i + 0]->mDst.mTemp && mInstructions[i + 1]->mSrc[1].mFinal)
|
||||
{
|
||||
|
||||
int shift = mInstructions[i + 0]->mSrc[0].mIntConst;
|
||||
int64 shift = mInstructions[i + 0]->mSrc[0].mIntConst;
|
||||
if (shift & 7)
|
||||
{
|
||||
int mshift = mInstructions[i + 1]->mSrc[0].mIntConst;
|
||||
int64 mshift = mInstructions[i + 1]->mSrc[0].mIntConst;
|
||||
|
||||
mInstructions[i + 0]->mOperator = IA_AND;
|
||||
mInstructions[i + 0]->mSrc[0].mType = IT_INT16;
|
||||
|
@ -13230,7 +13228,7 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray
|
|||
mInstructions[i + 1]->mSrc[1].mTemp == mInstructions[i + 0]->mDst.mTemp && mInstructions[i + 1]->mSrc[1].mFinal && mInstructions[i + 1]->mSrc[0].mTemp < 0)
|
||||
)
|
||||
{
|
||||
int v = mInstructions[i + 1]->mSrc[1].mIntConst;
|
||||
int64 v = mInstructions[i + 1]->mSrc[1].mIntConst;
|
||||
InterOperator op = mInstructions[i + 1]->mOperator;
|
||||
if (mInstructions[i + 1]->mSrc[1].mTemp >= 0)
|
||||
{
|
||||
|
@ -13631,7 +13629,7 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray
|
|||
{
|
||||
if ((o0 == IA_ADD || o0 == IA_SUB && c0 == 0) && (o1 == IA_ADD || o1 == IA_SUB && c1 == 0))
|
||||
{
|
||||
int iconst =
|
||||
int64 iconst =
|
||||
(o1 == IA_ADD ? mInstructions[s1]->mSrc[c1].mIntConst : -mInstructions[s1]->mSrc[c1].mIntConst) -
|
||||
(o0 == IA_ADD ? mInstructions[s0]->mSrc[c0].mIntConst : -mInstructions[s0]->mSrc[c0].mIntConst);
|
||||
|
||||
|
@ -13650,7 +13648,7 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray
|
|||
{
|
||||
if ((o0 == IA_ADD || o0 == IA_SUB && c0 == 0) && (o1 == IA_ADD || o1 == IA_SUB && c1 == 0))
|
||||
{
|
||||
int iconst =
|
||||
int64 iconst =
|
||||
(o1 == IA_ADD ? mInstructions[s1]->mSrc[c1].mIntConst : -mInstructions[s1]->mSrc[c1].mIntConst) +
|
||||
(o0 == IA_ADD ? mInstructions[s0]->mSrc[c0].mIntConst : -mInstructions[s0]->mSrc[c0].mIntConst);
|
||||
|
||||
|
@ -13709,7 +13707,7 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray
|
|||
mInstructions[i + 3]->mCode == IC_LEA && mInstructions[i + 3]->mSrc[1].mTemp < 0 &&
|
||||
mInstructions[i + 3]->mSrc[0].mTemp == mInstructions[i + 2]->mDst.mTemp && mInstructions[i + 3]->mSrc[0].mFinal)
|
||||
{
|
||||
int d = mInstructions[i + 0]->mSrc[0].mIntConst * mInstructions[i + 1]->mSrc[0].mIntConst;
|
||||
int64 d = mInstructions[i + 0]->mSrc[0].mIntConst * mInstructions[i + 1]->mSrc[0].mIntConst;
|
||||
mInstructions[i + 3]->mSrc[1].mIntConst += d;
|
||||
mInstructions[i + 1]->mSrc[1] = mInstructions[i + 0]->mSrc[1];
|
||||
mInstructions[i + 1]->mDst.mRange.mMinValue -= d; mInstructions[i + 1]->mDst.mRange.mMaxValue -= d;
|
||||
|
@ -14142,7 +14140,7 @@ void InterCodeBasicBlock::PeepholeOptimization(const GrowingVariableArray& stati
|
|||
{
|
||||
if (ins->mCode == IC_BINARY_OPERATOR && ins->mOperator == IA_ADD && ins->mSrc[0].mTemp < 0 && ins->mSrc[1].mTemp == si)
|
||||
{
|
||||
ioffset += ins->mSrc[0].mIntConst;
|
||||
ioffset += int(ins->mSrc[0].mIntConst);
|
||||
ains = ins;
|
||||
}
|
||||
else
|
||||
|
@ -14285,7 +14283,7 @@ void InterCodeBasicBlock::CollectVariables(GrowingVariableArray& globalVars, Gro
|
|||
if (!localVars[varIndex])
|
||||
localVars[varIndex] = new InterVariable;
|
||||
|
||||
int size = ins->mConst.mOperandSize + ins->mConst.mIntConst;
|
||||
int size = int(ins->mConst.mOperandSize + ins->mConst.mIntConst);
|
||||
if (size > localVars[varIndex]->mSize)
|
||||
localVars[varIndex]->mSize = size;
|
||||
localVars[varIndex]->mAliased = true;
|
||||
|
@ -14296,7 +14294,7 @@ void InterCodeBasicBlock::CollectVariables(GrowingVariableArray& globalVars, Gro
|
|||
if (!paramVars[varIndex])
|
||||
paramVars[varIndex] = new InterVariable;
|
||||
|
||||
int size = ins->mConst.mOperandSize + ins->mConst.mIntConst;
|
||||
int size = int(ins->mConst.mOperandSize + ins->mConst.mIntConst);
|
||||
if (size > paramVars[varIndex]->mSize)
|
||||
paramVars[varIndex]->mSize = size;
|
||||
paramVars[varIndex]->mAliased = true;
|
||||
|
@ -14310,7 +14308,7 @@ void InterCodeBasicBlock::CollectVariables(GrowingVariableArray& globalVars, Gro
|
|||
if (!localVars[varIndex])
|
||||
localVars[varIndex] = new InterVariable;
|
||||
|
||||
int size = ins->mSrc[1].mOperandSize + ins->mSrc[1].mIntConst;
|
||||
int size = int(ins->mSrc[1].mOperandSize + ins->mSrc[1].mIntConst);
|
||||
if (size > localVars[varIndex]->mSize)
|
||||
localVars[varIndex]->mSize = size;
|
||||
localVars[varIndex]->mAliased = true;
|
||||
|
@ -14321,7 +14319,7 @@ void InterCodeBasicBlock::CollectVariables(GrowingVariableArray& globalVars, Gro
|
|||
if (!paramVars[varIndex])
|
||||
paramVars[varIndex] = new InterVariable;
|
||||
|
||||
int size = ins->mSrc[1].mOperandSize + ins->mSrc[1].mIntConst;
|
||||
int size = int(ins->mSrc[1].mOperandSize + ins->mSrc[1].mIntConst);
|
||||
if (size > paramVars[varIndex]->mSize)
|
||||
paramVars[varIndex]->mSize = size;
|
||||
paramVars[varIndex]->mAliased = true;
|
||||
|
@ -14343,7 +14341,7 @@ void InterCodeBasicBlock::CollectVariables(GrowingVariableArray& globalVars, Gro
|
|||
if (!localVars[varIndex])
|
||||
localVars[varIndex] = new InterVariable;
|
||||
|
||||
int size = ins->mSrc[j].mOperandSize + ins->mSrc[j].mIntConst;
|
||||
int size = int(ins->mSrc[j].mOperandSize + ins->mSrc[j].mIntConst);
|
||||
if (size > localVars[varIndex]->mSize)
|
||||
localVars[varIndex]->mSize = size;
|
||||
}
|
||||
|
@ -14353,7 +14351,7 @@ void InterCodeBasicBlock::CollectVariables(GrowingVariableArray& globalVars, Gro
|
|||
if (!paramVars[varIndex])
|
||||
paramVars[varIndex] = new InterVariable;
|
||||
|
||||
int size = ins->mSrc[j].mOperandSize + ins->mSrc[j].mIntConst;
|
||||
int size = int(ins->mSrc[j].mOperandSize + ins->mSrc[j].mIntConst);
|
||||
if (size > paramVars[varIndex]->mSize)
|
||||
paramVars[varIndex]->mSize = size;
|
||||
}
|
||||
|
@ -15336,7 +15334,6 @@ void InterCodeProcedure::PropagateConstOperationsUp(void)
|
|||
|
||||
void InterCodeProcedure::Close(void)
|
||||
{
|
||||
int i, j, k, start;
|
||||
GrowingTypeArray tstack(IT_NONE);
|
||||
|
||||
mEntryBlock = mBlocks[0];
|
||||
|
|
|
@ -426,7 +426,7 @@ public:
|
|||
bool BuildGlobalRequiredStaticVariableSet(const GrowingVariableArray& staticVars, NumberSet& fromRequiredVars);
|
||||
bool RemoveUnusedStaticStoreInstructions(const GrowingVariableArray& staticVars);
|
||||
|
||||
bool CheckSingleBlockLimitedLoop(InterCodeBasicBlock*& pblock, int& nloop);
|
||||
bool CheckSingleBlockLimitedLoop(InterCodeBasicBlock*& pblock, int64 & nloop);
|
||||
|
||||
void RestartLocalIntegerRangeSets(int num, const GrowingVariableArray& localVars, const GrowingVariableArray& paramVars);
|
||||
void BuildLocalIntegerRangeSets(int num, const GrowingVariableArray& localVars, const GrowingVariableArray& paramVars);
|
||||
|
|
|
@ -474,7 +474,7 @@ void InterCodeGenerator::TranslateAssembler(InterCodeModule* mod, Expression* ex
|
|||
else
|
||||
ref.mFlags = LREF_LOWBYTE;
|
||||
ref.mRefObject = aexp->mBase->mBase->mLinkerObject;
|
||||
ref.mRefOffset = aexp->mOffset + aexp->mBase->mInteger;
|
||||
ref.mRefOffset = aexp->mOffset + int(aexp->mBase->mInteger);
|
||||
ref.mRefObject->mFlags |= LOBJF_RELEVANT;
|
||||
dec->mLinkerObject->AddReference(ref);
|
||||
}
|
||||
|
@ -581,7 +581,7 @@ void InterCodeGenerator::TranslateAssembler(InterCodeModule* mod, Expression* ex
|
|||
mErrors->Error(aexp->mLocation, EERR_ASM_INVALD_OPERAND, "Local variable outside scope");
|
||||
}
|
||||
else
|
||||
d[offset] = aexp->mInteger;
|
||||
d[offset] = uint8(aexp->mInteger);
|
||||
offset += 1;
|
||||
break;
|
||||
case ASMIM_ABSOLUTE:
|
||||
|
@ -592,8 +592,8 @@ void InterCodeGenerator::TranslateAssembler(InterCodeModule* mod, Expression* ex
|
|||
mErrors->Error(cexp->mLocation, EERR_ASM_INVALD_OPERAND, "Missing assembler operand");
|
||||
else if (aexp->mType == DT_CONST_INTEGER)
|
||||
{
|
||||
d[offset + 0] = cexp->mLeft->mDecValue->mInteger & 255;
|
||||
d[offset + 1] = cexp->mLeft->mDecValue->mInteger >> 8;
|
||||
d[offset + 0] = uint8(cexp->mLeft->mDecValue->mInteger & 255);
|
||||
d[offset + 1] = uint8(cexp->mLeft->mDecValue->mInteger >> 8);
|
||||
}
|
||||
else if (aexp->mType == DT_LABEL)
|
||||
{
|
||||
|
@ -607,7 +607,7 @@ void InterCodeGenerator::TranslateAssembler(InterCodeModule* mod, Expression* ex
|
|||
ref.mOffset = offset;
|
||||
ref.mFlags = LREF_LOWBYTE | LREF_HIGHBYTE;
|
||||
ref.mRefObject = aexp->mBase->mLinkerObject;
|
||||
ref.mRefOffset = aexp->mInteger;
|
||||
ref.mRefOffset = uint8(aexp->mInteger);
|
||||
ref.mRefObject->mFlags |= LOBJF_RELEVANT;
|
||||
dec->mLinkerObject->AddReference(ref);
|
||||
}
|
||||
|
@ -626,7 +626,7 @@ void InterCodeGenerator::TranslateAssembler(InterCodeModule* mod, Expression* ex
|
|||
ref.mOffset = offset;
|
||||
ref.mFlags = LREF_LOWBYTE | LREF_HIGHBYTE;
|
||||
ref.mRefObject = aexp->mBase->mBase->mLinkerObject;
|
||||
ref.mRefOffset = aexp->mOffset + aexp->mBase->mInteger;
|
||||
ref.mRefOffset = aexp->mOffset + int(aexp->mBase->mInteger);
|
||||
ref.mRefObject->mFlags |= LOBJF_RELEVANT;
|
||||
dec->mLinkerObject->AddReference(ref);
|
||||
}
|
||||
|
@ -722,12 +722,12 @@ void InterCodeGenerator::TranslateAssembler(InterCodeModule* mod, Expression* ex
|
|||
if (aexp->mType == DT_LABEL_REF)
|
||||
{
|
||||
if (aexp->mBase->mBase)
|
||||
d[offset] = aexp->mOffset + aexp->mBase->mInteger - offset - 1;
|
||||
d[offset] = uint8(aexp->mOffset + aexp->mBase->mInteger - offset - 1);
|
||||
else
|
||||
mErrors->Error(aexp->mLocation, EERR_ASM_INVALD_OPERAND, "Undefined immediate operand", aexp->mBase->mIdent);
|
||||
}
|
||||
else
|
||||
d[offset] = aexp->mInteger - offset - 1;
|
||||
d[offset] = uint8(aexp->mInteger - offset - 1);
|
||||
}
|
||||
offset++;
|
||||
break;
|
||||
|
@ -844,7 +844,6 @@ void InterCodeGenerator::BuildSwitchTree(InterCodeProcedure* proc, Expression* e
|
|||
|
||||
InterCodeGenerator::ExValue InterCodeGenerator::TranslateInline(Declaration* procType, InterCodeProcedure* proc, InterCodeBasicBlock*& block, Expression* exp, InterCodeBasicBlock* breakBlock, InterCodeBasicBlock* continueBlock, InlineMapper* inlineMapper, bool inlineConstexpr)
|
||||
{
|
||||
Declaration* dec;
|
||||
ExValue vl, vr;
|
||||
|
||||
Declaration* fdec = exp->mLeft->mDecValue;
|
||||
|
@ -2325,9 +2324,9 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration*
|
|||
ins->mSrc[1].mType = IT_POINTER;
|
||||
ins->mSrc[1].mMemory = IM_INDIRECT;
|
||||
ins->mSrc[1].mTemp = vl.mTemp;
|
||||
ins->mSrc[0].mOperandSize = nex->mDecValue->mInteger;
|
||||
ins->mSrc[1].mOperandSize = nex->mDecValue->mInteger;
|
||||
ins->mConst.mOperandSize = nex->mDecValue->mInteger;
|
||||
ins->mSrc[0].mOperandSize = int(nex->mDecValue->mInteger);
|
||||
ins->mSrc[1].mOperandSize = int(nex->mDecValue->mInteger);
|
||||
ins->mConst.mOperandSize = int(nex->mDecValue->mInteger);
|
||||
block->Append(ins);
|
||||
|
||||
return vl;
|
||||
|
@ -3491,7 +3490,7 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration*
|
|||
snode.mValue = 0;
|
||||
|
||||
if (cexp->mLeft->mType == EX_CONSTANT && cexp->mLeft->mDecValue->mType == DT_CONST_INTEGER)
|
||||
snode.mValue = cexp->mLeft->mDecValue->mInteger;
|
||||
snode.mValue = int(cexp->mLeft->mDecValue->mInteger);
|
||||
else
|
||||
mErrors->Error(cexp->mLeft->mLocation, ERRR_INVALID_CASE, "Integral constant expected");
|
||||
|
||||
|
@ -3589,12 +3588,12 @@ void InterCodeGenerator::BuildInitializer(InterCodeModule * mod, uint8* dp, int
|
|||
{
|
||||
int64 t = data->mInteger;
|
||||
dp[offset + 0] = uint8(t & 0xff);
|
||||
dp[offset + data->mBase->mStripe] = t >> 8;
|
||||
dp[offset + data->mBase->mStripe] = uint8(t >> 8);
|
||||
}
|
||||
else if (data->mType == DT_CONST_FLOAT)
|
||||
{
|
||||
union { float f; uint32 i; } cast;
|
||||
cast.f = data->mNumber;
|
||||
cast.f = float(data->mNumber);
|
||||
int64 t = cast.i;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
|
|
@ -268,7 +268,7 @@ public:
|
|||
|
||||
bool mCartridgeBankUsed[64];
|
||||
|
||||
uint32 mCartridgeBankStart[64], mCartridgeBankEnd[64];
|
||||
int mCartridgeBankStart[64], mCartridgeBankEnd[64];
|
||||
|
||||
int mProgramStart, mProgramEnd;
|
||||
|
||||
|
|
|
@ -281,8 +281,8 @@ NativeCodeInstruction::NativeCodeInstruction(void)
|
|||
: mIns(nullptr), mType(ASMIT_INV), mMode(ASMIM_IMPLIED), mAddress(0), mLinkerObject(nullptr), mFlags(NCIF_LOWER | NCIF_UPPER), mParam(0), mLive(LIVE_ALL)
|
||||
{}
|
||||
|
||||
NativeCodeInstruction::NativeCodeInstruction(const InterInstruction* ins, AsmInsType type, AsmInsMode mode, int address, LinkerObject* linkerObject, uint32 flags, int param)
|
||||
: mIns(ins), mType(type), mMode(mode), mAddress(address), mLinkerObject(linkerObject), mFlags(flags), mParam(param), mLive(LIVE_ALL)
|
||||
NativeCodeInstruction::NativeCodeInstruction(const InterInstruction* ins, AsmInsType type, AsmInsMode mode, int64 address, LinkerObject* linkerObject, uint32 flags, int param)
|
||||
: mIns(ins), mType(type), mMode(mode), mAddress(int(address)), mLinkerObject(linkerObject), mFlags(flags), mParam(param), mLive(LIVE_ALL)
|
||||
{
|
||||
if (mode == ASMIM_IMMEDIATE_ADDRESS)
|
||||
{
|
||||
|
@ -4395,7 +4395,7 @@ void NativeCodeInstruction::Assemble(NativeCodeBasicBlock* block)
|
|||
{
|
||||
if (mType == ASMIT_JSR && (mFlags & NCIF_USE_ZP_32_X))
|
||||
{
|
||||
block->PutByte(AsmInsOpcodes[ASMIT_LDX][ASMIM_IMMEDIATE]);
|
||||
block->PutOpcode(AsmInsOpcodes[ASMIT_LDX][ASMIM_IMMEDIATE]);
|
||||
block->PutByte(mParam);
|
||||
}
|
||||
|
||||
|
@ -4418,12 +4418,12 @@ void NativeCodeInstruction::Assemble(NativeCodeBasicBlock* block)
|
|||
{
|
||||
assert((mFlags & (NCIF_LOWER | NCIF_UPPER)) != (NCIF_LOWER | NCIF_UPPER));
|
||||
assert(HasAsmInstructionMode(mType, ASMIM_IMMEDIATE));
|
||||
block->PutByte(AsmInsOpcodes[mType][ASMIM_IMMEDIATE]);
|
||||
block->PutOpcode(AsmInsOpcodes[mType][ASMIM_IMMEDIATE]);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(HasAsmInstructionMode(mType, mode));
|
||||
block->PutByte(AsmInsOpcodes[mType][mode]);
|
||||
block->PutOpcode(AsmInsOpcodes[mType][mode]);
|
||||
}
|
||||
|
||||
switch (mode)
|
||||
|
@ -4547,6 +4547,12 @@ void NativeCodeBasicBlock::PutLocation(const Location& location)
|
|||
}
|
||||
}
|
||||
|
||||
void NativeCodeBasicBlock::PutOpcode(short opcode)
|
||||
{
|
||||
assert(opcode >= 0 && opcode < 256);
|
||||
this->mCode.Push(uint8(opcode));
|
||||
}
|
||||
|
||||
void NativeCodeBasicBlock::PutByte(uint8 code)
|
||||
{
|
||||
this->mCode.Push(code);
|
||||
|
@ -4610,9 +4616,9 @@ int NativeCodeBasicBlock::PutJump(NativeCodeProcedure* proc, NativeCodeBasicBloc
|
|||
if (mNDataSet.mRegs[CPU_REG_C].mMode == NRDM_IMMEDIATE)
|
||||
{
|
||||
if (mNDataSet.mRegs[CPU_REG_C].mValue)
|
||||
PutByte(AsmInsOpcodes[ASMIT_BCS][ASMIM_RELATIVE]);
|
||||
PutOpcode(AsmInsOpcodes[ASMIT_BCS][ASMIM_RELATIVE]);
|
||||
else
|
||||
PutByte(AsmInsOpcodes[ASMIT_BCC][ASMIM_RELATIVE]);
|
||||
PutOpcode(AsmInsOpcodes[ASMIT_BCC][ASMIM_RELATIVE]);
|
||||
|
||||
PutByte(offset - 2);
|
||||
return 2;
|
||||
|
@ -4620,9 +4626,9 @@ int NativeCodeBasicBlock::PutJump(NativeCodeProcedure* proc, NativeCodeBasicBloc
|
|||
else if (mNDataSet.mRegs[CPU_REG_Z].mMode == NRDM_IMMEDIATE)
|
||||
{
|
||||
if (mNDataSet.mRegs[CPU_REG_Z].mValue)
|
||||
PutByte(AsmInsOpcodes[ASMIT_BNE][ASMIM_RELATIVE]);
|
||||
PutOpcode(AsmInsOpcodes[ASMIT_BNE][ASMIM_RELATIVE]);
|
||||
else
|
||||
PutByte(AsmInsOpcodes[ASMIT_BEQ][ASMIM_RELATIVE]);
|
||||
PutOpcode(AsmInsOpcodes[ASMIT_BEQ][ASMIM_RELATIVE]);
|
||||
|
||||
PutByte(offset - 2);
|
||||
return 2;
|
||||
|
@ -4684,13 +4690,13 @@ int NativeCodeBasicBlock::PutBranch(NativeCodeProcedure* proc, NativeCodeBasicBl
|
|||
{
|
||||
if (offset >= -126 && offset <= 129)
|
||||
{
|
||||
PutByte(AsmInsOpcodes[code][ASMIM_RELATIVE]);
|
||||
PutOpcode(AsmInsOpcodes[code][ASMIM_RELATIVE]);
|
||||
PutByte(offset - 2);
|
||||
return 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
PutByte(AsmInsOpcodes[InvertBranchCondition(code)][ASMIM_RELATIVE]);
|
||||
PutOpcode(AsmInsOpcodes[InvertBranchCondition(code)][ASMIM_RELATIVE]);
|
||||
|
||||
if (target->mIns.Size() == 1 && target->mIns[0].mType == ASMIT_RTS)
|
||||
{
|
||||
|
@ -4722,7 +4728,7 @@ void NativeCodeBasicBlock::LoadConstantToReg(InterCodeProcedure * proc, const In
|
|||
if (type == IT_FLOAT)
|
||||
{
|
||||
union { float f; unsigned int v; } cc;
|
||||
cc.f = ins->mConst.mFloatConst;
|
||||
cc.f = float(ins->mConst.mFloatConst);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_IMMEDIATE, cc.v & 0xff));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, reg));
|
||||
|
@ -4758,7 +4764,7 @@ void NativeCodeBasicBlock::LoadConstantToReg(InterCodeProcedure * proc, const In
|
|||
}
|
||||
else if (ins->mConst.mMemory == IM_FRAME)
|
||||
{
|
||||
int index = ins->mConst.mVarIndex + ins->mConst.mIntConst + 2;
|
||||
int index = ins->mConst.mVarIndex + int(ins->mConst.mIntConst) + 2;
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_CLC, ASMIM_IMPLIED));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_STACK));
|
||||
|
@ -4770,7 +4776,7 @@ void NativeCodeBasicBlock::LoadConstantToReg(InterCodeProcedure * proc, const In
|
|||
}
|
||||
else if (ins->mConst.mMemory == IM_LOCAL || ins->mConst.mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mConst.mIntConst;
|
||||
int index = int(ins->mConst.mIntConst);
|
||||
int areg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mConst.mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mConst.mVarIndex]->mOffset;
|
||||
|
@ -4863,7 +4869,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
if (ins->mSrc[0].mTemp < 0)
|
||||
{
|
||||
union { float f; unsigned int v; } cc;
|
||||
cc.f = ins->mSrc[0].mFloatConst;
|
||||
cc.f = float(ins->mSrc[0].mFloatConst);
|
||||
|
||||
if (ins->mSrc[1].mMemory == IM_GLOBAL)
|
||||
{
|
||||
|
@ -4900,7 +4906,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_LOCAL || ins->mSrc[1].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int reg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[1].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[1].mVarIndex]->mOffset;
|
||||
|
@ -4924,7 +4930,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_FRAME)
|
||||
{
|
||||
int index = ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2;
|
||||
int index = int(ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDY, ASMIM_IMMEDIATE, index));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_IMMEDIATE, cc.v & 0xff));
|
||||
|
@ -4986,7 +4992,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_LOCAL || ins->mSrc[1].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int reg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[1].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[1].mVarIndex]->mOffset;
|
||||
|
@ -5010,7 +5016,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_FRAME)
|
||||
{
|
||||
int index = ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2;
|
||||
int index = int(ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDY, ASMIM_IMMEDIATE, index));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ZERO_PAGE, sreg));
|
||||
|
@ -5034,10 +5040,10 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
if (ins->mSrc[1].mMemory == IM_INDIRECT)
|
||||
{
|
||||
union { float f; unsigned int v; } cc;
|
||||
cc.f = ins->mSrc[0].mFloatConst;
|
||||
cc.f = float(ins->mSrc[0].mFloatConst);
|
||||
|
||||
int reg = BC_REG_TMP + proc->mTempOffset[ins->mSrc[1].mTemp];
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int stride = ins->mSrc[1].mStride;
|
||||
|
||||
if (stride * 4 <= 256)
|
||||
|
@ -5071,7 +5077,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
if (ins->mSrc[1].mMemory == IM_INDIRECT)
|
||||
{
|
||||
int reg = BC_REG_TMP + proc->mTempOffset[ins->mSrc[1].mTemp];
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int stride = ins->mSrc[1].mStride;
|
||||
|
||||
if (stride * 4 <= 256)
|
||||
|
@ -5133,7 +5139,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_LOCAL || ins->mSrc[1].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int reg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[1].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[1].mVarIndex]->mOffset;
|
||||
|
@ -5151,7 +5157,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_FRAME)
|
||||
{
|
||||
int index = ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2;
|
||||
int index = int(ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDY, ASMIM_IMMEDIATE, index));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_IMMEDIATE, ins->mSrc[0].mIntConst & 0xff));
|
||||
|
@ -5186,7 +5192,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_LOCAL || ins->mSrc[1].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int reg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[1].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[1].mVarIndex]->mOffset;
|
||||
|
@ -5204,7 +5210,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_FRAME)
|
||||
{
|
||||
int index = ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2;
|
||||
int index = int(ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDY, ASMIM_IMMEDIATE, index));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mSrc[0].mTemp]));
|
||||
|
@ -5222,7 +5228,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
if (ins->mSrc[1].mMemory == IM_INDIRECT)
|
||||
{
|
||||
int reg = BC_REG_TMP + proc->mTempOffset[ins->mSrc[1].mTemp];
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int stride = ins->mSrc[1].mStride;
|
||||
|
||||
if (2 * stride <= 256)
|
||||
|
@ -5256,7 +5262,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
if (ins->mSrc[1].mMemory == IM_INDIRECT)
|
||||
{
|
||||
int reg = BC_REG_TMP + proc->mTempOffset[ins->mSrc[1].mTemp];
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int stride = ins->mSrc[1].mStride;
|
||||
|
||||
if (2 * stride <= 256)
|
||||
|
@ -5312,7 +5318,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_LOCAL || ins->mSrc[1].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int reg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[1].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[1].mVarIndex]->mOffset;
|
||||
|
@ -5327,7 +5333,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_FRAME)
|
||||
{
|
||||
int index = ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2;
|
||||
int index = int(ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDY, ASMIM_IMMEDIATE, index));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_IMMEDIATE, ins->mSrc[0].mIntConst & 0xff));
|
||||
|
@ -5361,7 +5367,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_LOCAL || ins->mSrc[1].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int reg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[1].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[1].mVarIndex]->mOffset;
|
||||
|
@ -5379,7 +5385,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_FRAME)
|
||||
{
|
||||
int index = ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2;
|
||||
int index = int(ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDY, ASMIM_IMMEDIATE, index));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_IMMEDIATE, ins->mSrc[0].mIntConst & 0xff));
|
||||
|
@ -5428,7 +5434,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_LOCAL || ins->mSrc[1].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int reg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[1].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[1].mVarIndex]->mOffset;
|
||||
|
@ -5452,7 +5458,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_FRAME)
|
||||
{
|
||||
int index = ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2;
|
||||
int index = int(ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDY, ASMIM_IMMEDIATE, index));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_IMMEDIATE, ins->mSrc[0].mIntConst & 0xff));
|
||||
|
@ -5490,7 +5496,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_LOCAL || ins->mSrc[1].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int reg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[1].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[1].mVarIndex]->mOffset;
|
||||
|
@ -5505,7 +5511,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_FRAME)
|
||||
{
|
||||
int index = ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2;
|
||||
int index = int(ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDY, ASMIM_IMMEDIATE, index));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mSrc[0].mTemp]));
|
||||
|
@ -5539,7 +5545,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_LOCAL || ins->mSrc[1].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int reg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
|
||||
if (ins->mSrc[1].mMemory == IM_LOCAL)
|
||||
|
@ -5558,7 +5564,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_FRAME)
|
||||
{
|
||||
int index = ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2;
|
||||
int index = int(ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDY, ASMIM_IMMEDIATE, index));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mSrc[0].mTemp]));
|
||||
|
@ -5607,7 +5613,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_LOCAL || ins->mSrc[1].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int reg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
|
||||
if (ins->mSrc[1].mMemory == IM_LOCAL)
|
||||
|
@ -5632,7 +5638,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_FRAME)
|
||||
{
|
||||
int index = ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2;
|
||||
int index = int(ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDY, ASMIM_IMMEDIATE, index));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mSrc[0].mTemp]));
|
||||
|
@ -5657,7 +5663,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
if (ins->mSrc[1].mMemory == IM_INDIRECT)
|
||||
{
|
||||
int reg = BC_REG_TMP + proc->mTempOffset[ins->mSrc[1].mTemp];
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int stride = ins->mSrc[1].mStride;
|
||||
int size = InterTypeSize[ins->mSrc[0].mType];
|
||||
|
||||
|
@ -5692,7 +5698,7 @@ void NativeCodeBasicBlock::StoreValue(InterCodeProcedure* proc, const InterInstr
|
|||
if (ins->mSrc[1].mMemory == IM_INDIRECT)
|
||||
{
|
||||
int reg = BC_REG_TMP + proc->mTempOffset[ins->mSrc[1].mTemp];
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int stride = ins->mSrc[1].mStride;
|
||||
int size = InterTypeSize[ins->mSrc[0].mType];
|
||||
|
||||
|
@ -5770,7 +5776,7 @@ void NativeCodeBasicBlock::LoadStoreIndirectValue(InterCodeProcedure* proc, cons
|
|||
int size = InterTypeSize[wins->mSrc[0].mType];
|
||||
|
||||
AsmInsMode rmode = ASMIM_INDIRECT_Y;
|
||||
int rindex = rins->mSrc[0].mIntConst;
|
||||
int rindex = int(rins->mSrc[0].mIntConst);
|
||||
int rareg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
LinkerObject* rlobject = nullptr;
|
||||
int rstride = rins->mSrc[0].mStride;
|
||||
|
@ -5791,10 +5797,10 @@ void NativeCodeBasicBlock::LoadStoreIndirectValue(InterCodeProcedure* proc, cons
|
|||
case IM_GLOBAL:
|
||||
rmode = ASMIM_ABSOLUTE;
|
||||
rlobject = rins->mSrc[0].mLinkerObject;
|
||||
rindex = rins->mSrc[0].mIntConst;
|
||||
rindex = int(rins->mSrc[0].mIntConst);
|
||||
break;
|
||||
case IM_FRAME:
|
||||
rindex = rins->mSrc[0].mVarIndex + rins->mSrc[0].mIntConst + 2;
|
||||
rindex = int(rins->mSrc[0].mVarIndex + rins->mSrc[0].mIntConst + 2);
|
||||
rareg = BC_REG_STACK;
|
||||
break;
|
||||
case IM_INDIRECT:
|
||||
|
@ -5802,17 +5808,17 @@ void NativeCodeBasicBlock::LoadStoreIndirectValue(InterCodeProcedure* proc, cons
|
|||
break;
|
||||
case IM_ABSOLUTE:
|
||||
rmode = ASMIM_ABSOLUTE;
|
||||
rindex = rins->mSrc[0].mIntConst;
|
||||
rindex = int(rins->mSrc[0].mIntConst);
|
||||
break;
|
||||
case IM_FPARAM:
|
||||
case IM_FFRAME:
|
||||
rmode = ASMIM_ZERO_PAGE;
|
||||
rareg = BC_REG_FPARAMS + rins->mSrc[0].mVarIndex + rins->mSrc[0].mIntConst;
|
||||
rareg = int(BC_REG_FPARAMS + rins->mSrc[0].mVarIndex + rins->mSrc[0].mIntConst);
|
||||
break;
|
||||
}
|
||||
|
||||
AsmInsMode wmode = ASMIM_INDIRECT_Y;
|
||||
int windex = wins->mSrc[1].mIntConst;
|
||||
int windex = int(wins->mSrc[1].mIntConst);
|
||||
int wareg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
LinkerObject* wlobject = nullptr;
|
||||
int wstride = wins->mSrc[1].mStride;
|
||||
|
@ -5833,10 +5839,10 @@ void NativeCodeBasicBlock::LoadStoreIndirectValue(InterCodeProcedure* proc, cons
|
|||
case IM_GLOBAL:
|
||||
wmode = ASMIM_ABSOLUTE;
|
||||
wlobject = wins->mSrc[1].mLinkerObject;
|
||||
windex = wins->mSrc[1].mIntConst;
|
||||
windex = int(wins->mSrc[1].mIntConst);
|
||||
break;
|
||||
case IM_FRAME:
|
||||
windex = wins->mSrc[1].mVarIndex + wins->mSrc[1].mIntConst + 2;
|
||||
windex = int(wins->mSrc[1].mVarIndex + wins->mSrc[1].mIntConst + 2);
|
||||
wareg = BC_REG_STACK;
|
||||
break;
|
||||
case IM_INDIRECT:
|
||||
|
@ -5844,12 +5850,12 @@ void NativeCodeBasicBlock::LoadStoreIndirectValue(InterCodeProcedure* proc, cons
|
|||
break;
|
||||
case IM_ABSOLUTE:
|
||||
wmode = ASMIM_ABSOLUTE;
|
||||
windex = wins->mSrc[1].mIntConst;
|
||||
windex = int(wins->mSrc[1].mIntConst);
|
||||
break;
|
||||
case IM_FPARAM:
|
||||
case IM_FFRAME:
|
||||
wmode = ASMIM_ZERO_PAGE;
|
||||
wareg = BC_REG_FPARAMS + wins->mSrc[1].mVarIndex + wins->mSrc[1].mIntConst;
|
||||
wareg = BC_REG_FPARAMS + wins->mSrc[1].mVarIndex + int(wins->mSrc[1].mIntConst);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5925,7 +5931,7 @@ void NativeCodeBasicBlock::LoadStoreValue(InterCodeProcedure* proc, const InterI
|
|||
}
|
||||
else if (rins->mSrc[0].mMemory == IM_LOCAL || rins->mSrc[0].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = rins->mSrc[0].mIntConst;
|
||||
int index = int(rins->mSrc[0].mIntConst);
|
||||
int areg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (rins->mSrc[0].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[rins->mSrc[0].mVarIndex]->mOffset;
|
||||
|
@ -5943,7 +5949,7 @@ void NativeCodeBasicBlock::LoadStoreValue(InterCodeProcedure* proc, const InterI
|
|||
if (rins->mSrc[0].mMemory == IM_INDIRECT)
|
||||
{
|
||||
int areg = BC_REG_TMP + proc->mTempOffset[rins->mSrc[0].mTemp];
|
||||
int index = rins->mSrc[0].mIntConst;
|
||||
int index = int(rins->mSrc[0].mIntConst);
|
||||
|
||||
CheckFrameIndex(rins, areg, index, 1);
|
||||
|
||||
|
@ -5968,7 +5974,7 @@ void NativeCodeBasicBlock::LoadStoreValue(InterCodeProcedure* proc, const InterI
|
|||
}
|
||||
else if (wins->mSrc[1].mMemory == IM_LOCAL || wins->mSrc[1].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = wins->mSrc[1].mIntConst;
|
||||
int index = int(wins->mSrc[1].mIntConst);
|
||||
int areg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (wins->mSrc[1].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[wins->mSrc[1].mVarIndex]->mOffset;
|
||||
|
@ -5982,7 +5988,7 @@ void NativeCodeBasicBlock::LoadStoreValue(InterCodeProcedure* proc, const InterI
|
|||
}
|
||||
else if (wins->mSrc[1].mMemory == IM_FRAME)
|
||||
{
|
||||
int index = wins->mSrc[1].mVarIndex + wins->mSrc[1].mIntConst + 2;
|
||||
int index = wins->mSrc[1].mVarIndex + int(wins->mSrc[1].mIntConst) + 2;
|
||||
|
||||
mIns.Push(NativeCodeInstruction(wins, ASMIT_LDY, ASMIM_IMMEDIATE, index));
|
||||
mIns.Push(NativeCodeInstruction(wins, ASMIT_STA, ASMIM_INDIRECT_Y, BC_REG_STACK));
|
||||
|
@ -5993,7 +5999,7 @@ void NativeCodeBasicBlock::LoadStoreValue(InterCodeProcedure* proc, const InterI
|
|||
if (wins->mSrc[1].mMemory == IM_INDIRECT)
|
||||
{
|
||||
int areg = BC_REG_TMP + proc->mTempOffset[wins->mSrc[1].mTemp];
|
||||
int index = wins->mSrc[1].mIntConst;
|
||||
int index = int(wins->mSrc[1].mIntConst);
|
||||
|
||||
CheckFrameIndex(wins, areg, index, 1);
|
||||
|
||||
|
@ -6082,7 +6088,7 @@ bool NativeCodeBasicBlock::LoadUnopStoreIndirectValue(InterCodeProcedure* proc,
|
|||
return false;
|
||||
}
|
||||
|
||||
int rindex = rins->mSrc[0].mIntConst;
|
||||
int rindex = int(rins->mSrc[0].mIntConst);
|
||||
int rareg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
|
||||
switch (rins->mSrc[0].mMemory)
|
||||
|
@ -6099,13 +6105,13 @@ bool NativeCodeBasicBlock::LoadUnopStoreIndirectValue(InterCodeProcedure* proc,
|
|||
case IM_FPARAM:
|
||||
case IM_FFRAME:
|
||||
ram = ASMIM_ZERO_PAGE;
|
||||
rareg = BC_REG_FPARAMS + rins->mSrc[0].mVarIndex + rins->mSrc[0].mIntConst;
|
||||
rareg = BC_REG_FPARAMS + rins->mSrc[0].mVarIndex + int(rins->mSrc[0].mIntConst);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
int windex = wins->mSrc[1].mIntConst;
|
||||
int windex = int(wins->mSrc[1].mIntConst);
|
||||
int wareg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
|
||||
switch (wins->mSrc[1].mMemory)
|
||||
|
@ -6122,7 +6128,7 @@ bool NativeCodeBasicBlock::LoadUnopStoreIndirectValue(InterCodeProcedure* proc,
|
|||
case IM_FPARAM:
|
||||
case IM_FFRAME:
|
||||
wam = ASMIM_ZERO_PAGE;
|
||||
wareg = BC_REG_FPARAMS + +wins->mSrc[1].mVarIndex + wins->mSrc[1].mIntConst;
|
||||
wareg = BC_REG_FPARAMS + +wins->mSrc[1].mVarIndex + int(wins->mSrc[1].mIntConst);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
@ -6212,7 +6218,7 @@ bool NativeCodeBasicBlock::LoadOpStoreIndirectValue(InterCodeProcedure* proc, co
|
|||
return false;
|
||||
}
|
||||
|
||||
int rindex = rins->mSrc[0].mIntConst;
|
||||
int rindex = int(rins->mSrc[0].mIntConst);
|
||||
int rareg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
int rstride = rins->mSrc[0].mStride;
|
||||
|
||||
|
@ -6230,13 +6236,13 @@ bool NativeCodeBasicBlock::LoadOpStoreIndirectValue(InterCodeProcedure* proc, co
|
|||
case IM_FPARAM:
|
||||
case IM_FFRAME:
|
||||
ram = ASMIM_ZERO_PAGE;
|
||||
rareg = BC_REG_FPARAMS + rins->mSrc[0].mVarIndex + rins->mSrc[0].mIntConst;
|
||||
rareg = BC_REG_FPARAMS + rins->mSrc[0].mVarIndex + int(rins->mSrc[0].mIntConst);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
int windex = wins->mSrc[1].mIntConst;
|
||||
int windex = int(wins->mSrc[1].mIntConst);
|
||||
int wareg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
int wstride = wins->mSrc[1].mStride;
|
||||
|
||||
|
@ -6254,7 +6260,7 @@ bool NativeCodeBasicBlock::LoadOpStoreIndirectValue(InterCodeProcedure* proc, co
|
|||
case IM_FPARAM:
|
||||
case IM_FFRAME:
|
||||
wam = ASMIM_ZERO_PAGE;
|
||||
wareg = BC_REG_FPARAMS + +wins->mSrc[1].mVarIndex + wins->mSrc[1].mIntConst;
|
||||
wareg = BC_REG_FPARAMS + +wins->mSrc[1].mVarIndex + int(wins->mSrc[1].mIntConst);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
@ -6396,7 +6402,7 @@ void NativeCodeBasicBlock::LoadValueToReg(InterCodeProcedure* proc, const InterI
|
|||
}
|
||||
else if (ins->mSrc[0].mMemory == IM_LOCAL || ins->mSrc[0].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[0].mIntConst;
|
||||
int index = int(ins->mSrc[0].mIntConst);
|
||||
int areg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[0].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[0].mVarIndex]->mOffset;
|
||||
|
@ -6424,7 +6430,7 @@ void NativeCodeBasicBlock::LoadValueToReg(InterCodeProcedure* proc, const InterI
|
|||
if (ins->mSrc[0].mMemory == IM_INDIRECT)
|
||||
{
|
||||
int areg = BC_REG_TMP + proc->mTempOffset[ins->mSrc[0].mTemp];
|
||||
int index = ins->mSrc[0].mIntConst;
|
||||
int index = int(ins->mSrc[0].mIntConst);
|
||||
int stride = ins->mSrc[0].mStride;
|
||||
|
||||
if (stride * 4 <= 256)
|
||||
|
@ -6510,7 +6516,7 @@ void NativeCodeBasicBlock::LoadValueToReg(InterCodeProcedure* proc, const InterI
|
|||
}
|
||||
else if (ins->mSrc[0].mMemory == IM_LOCAL || ins->mSrc[0].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[0].mIntConst;
|
||||
int index = int(ins->mSrc[0].mIntConst);
|
||||
int areg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[0].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[0].mVarIndex]->mOffset;
|
||||
|
@ -6541,7 +6547,7 @@ void NativeCodeBasicBlock::LoadValueToReg(InterCodeProcedure* proc, const InterI
|
|||
if (ins->mSrc[0].mMemory == IM_INDIRECT)
|
||||
{
|
||||
int areg = BC_REG_TMP + proc->mTempOffset[ins->mSrc[0].mTemp];
|
||||
int index = ins->mSrc[0].mIntConst;
|
||||
int index = int(ins->mSrc[0].mIntConst);
|
||||
|
||||
CheckFrameIndex(ins, areg, index, 2);
|
||||
|
||||
|
@ -6592,7 +6598,7 @@ void NativeCodeBasicBlock::LoadValueToReg(InterCodeProcedure* proc, const InterI
|
|||
}
|
||||
else if (ins->mSrc[0].mMemory == IM_LOCAL || ins->mSrc[0].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[0].mIntConst;
|
||||
int index = int(ins->mSrc[0].mIntConst);
|
||||
int areg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[0].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[0].mVarIndex]->mOffset;
|
||||
|
@ -6676,7 +6682,7 @@ void NativeCodeBasicBlock::LoadValueToReg(InterCodeProcedure* proc, const InterI
|
|||
}
|
||||
else if (ins->mSrc[0].mMemory == IM_LOCAL || ins->mSrc[0].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[0].mIntConst;
|
||||
int index = int(ins->mSrc[0].mIntConst);
|
||||
int areg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[0].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[0].mVarIndex]->mOffset;
|
||||
|
@ -6741,7 +6747,7 @@ void NativeCodeBasicBlock::LoadValueToReg(InterCodeProcedure* proc, const InterI
|
|||
}
|
||||
else if (ins->mSrc[0].mMemory == IM_LOCAL || ins->mSrc[0].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[0].mIntConst;
|
||||
int index = int(ins->mSrc[0].mIntConst);
|
||||
int areg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[0].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[0].mVarIndex]->mOffset;
|
||||
|
@ -6770,7 +6776,7 @@ void NativeCodeBasicBlock::LoadValueToReg(InterCodeProcedure* proc, const InterI
|
|||
if (ins->mSrc[0].mMemory == IM_INDIRECT)
|
||||
{
|
||||
int areg = BC_REG_TMP + proc->mTempOffset[ins->mSrc[0].mTemp];
|
||||
int index = ins->mSrc[0].mIntConst;
|
||||
int index = int(ins->mSrc[0].mIntConst);
|
||||
int stride = ins->mSrc[0].mStride;
|
||||
int size = InterTypeSize[ins->mDst.mType];
|
||||
bool accu = false;
|
||||
|
@ -6868,7 +6874,7 @@ NativeCodeBasicBlock * NativeCodeBasicBlock::CopyValue(InterCodeProcedure* proc,
|
|||
{
|
||||
int areg = BC_REG_STACK;
|
||||
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
if (ins->mSrc[1].mMemory == IM_FRAME)
|
||||
index += ins->mSrc[1].mVarIndex + 2;
|
||||
else
|
||||
|
@ -7034,7 +7040,7 @@ NativeCodeBasicBlock * NativeCodeBasicBlock::CopyValue(InterCodeProcedure* proc,
|
|||
}
|
||||
else if (ins->mSrc[0].mMemory == IM_LOCAL || ins->mSrc[0].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[0].mIntConst;
|
||||
int index = int(ins->mSrc[0].mIntConst);
|
||||
sreg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[0].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[0].mVarIndex]->mOffset;
|
||||
|
@ -7046,7 +7052,7 @@ NativeCodeBasicBlock * NativeCodeBasicBlock::CopyValue(InterCodeProcedure* proc,
|
|||
}
|
||||
else if (ins->mSrc[0].mIntConst != 0)
|
||||
{
|
||||
int index = ins->mSrc[0].mIntConst;
|
||||
int index = int(ins->mSrc[0].mIntConst);
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_CLC, ASMIM_IMPLIED));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mSrc[0].mTemp]));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_ADC, ASMIM_IMMEDIATE, index & 0xff));
|
||||
|
@ -7089,7 +7095,7 @@ NativeCodeBasicBlock * NativeCodeBasicBlock::CopyValue(InterCodeProcedure* proc,
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_LOCAL || ins->mSrc[1].mMemory == IM_PARAM)
|
||||
{
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
dreg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[1].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[1].mVarIndex]->mOffset;
|
||||
|
@ -7100,7 +7106,7 @@ NativeCodeBasicBlock * NativeCodeBasicBlock::CopyValue(InterCodeProcedure* proc,
|
|||
}
|
||||
else if (ins->mSrc[1].mMemory == IM_FRAME)
|
||||
{
|
||||
int index = ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + 2;
|
||||
int index = ins->mSrc[1].mVarIndex + int(ins->mSrc[1].mIntConst) + 2;
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_CLC, ASMIM_IMPLIED));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_STACK));
|
||||
|
@ -7114,7 +7120,7 @@ NativeCodeBasicBlock * NativeCodeBasicBlock::CopyValue(InterCodeProcedure* proc,
|
|||
}
|
||||
else if (ins->mSrc[1].mIntConst != 0)
|
||||
{
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_CLC, ASMIM_IMPLIED));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mSrc[1].mTemp]));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_ADC, ASMIM_IMMEDIATE, index & 0xff));
|
||||
|
@ -7570,7 +7576,7 @@ int NativeCodeBasicBlock::ShortMultiply(InterCodeProcedure* proc, NativeCodeProc
|
|||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDX, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mSrc[index].mTemp]));
|
||||
}
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_MUL, mul, ins->mSrc[index].mRange.mMaxValue + 1, false)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_MUL, mul, int(ins->mSrc[index].mRange.mMaxValue) + 1, false)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, dreg));
|
||||
if (ins->mDst.IsUByte())
|
||||
{
|
||||
|
@ -7579,7 +7585,7 @@ int NativeCodeBasicBlock::ShortMultiply(InterCodeProcedure* proc, NativeCodeProc
|
|||
}
|
||||
else
|
||||
{
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_MUL, mul, ins->mSrc[index].mRange.mMaxValue + 1, true)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_MUL, mul, int(ins->mSrc[index].mRange.mMaxValue) + 1, true)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, dreg + 1));
|
||||
}
|
||||
|
||||
|
@ -7599,7 +7605,7 @@ int NativeCodeBasicBlock::ShortMultiply(InterCodeProcedure* proc, NativeCodeProc
|
|||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, dreg + 1));
|
||||
}
|
||||
else if (ins->mSrc[index].IsUByte())
|
||||
ShiftRegisterLeftFromByte(proc, ins, dreg, lshift, ins->mSrc[index].mRange.mMaxValue);
|
||||
ShiftRegisterLeftFromByte(proc, ins, dreg, lshift, int(ins->mSrc[index].mRange.mMaxValue));
|
||||
else
|
||||
ShiftRegisterLeft(proc, ins, dreg, lshift);
|
||||
return dreg;
|
||||
|
@ -7637,7 +7643,7 @@ int NativeCodeBasicBlock::ShortMultiply(InterCodeProcedure* proc, NativeCodeProc
|
|||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, dreg + 1));
|
||||
}
|
||||
else if (ins->mSrc[index].IsUByte())
|
||||
ShiftRegisterLeftFromByte(proc, ins, dreg, lshift, ins->mSrc[index].mRange.mMaxValue);
|
||||
ShiftRegisterLeftFromByte(proc, ins, dreg, lshift, int(ins->mSrc[index].mRange.mMaxValue));
|
||||
else
|
||||
ShiftRegisterLeft(proc, ins, dreg, lshift);
|
||||
return dreg;
|
||||
|
@ -7690,7 +7696,7 @@ int NativeCodeBasicBlock::ShortMultiply(InterCodeProcedure* proc, NativeCodeProc
|
|||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, dreg + 1));
|
||||
}
|
||||
else
|
||||
ShiftRegisterLeftFromByte(proc, ins, dreg, lshift, ins->mSrc[index].mRange.mMaxValue * 5);
|
||||
ShiftRegisterLeftFromByte(proc, ins, dreg, lshift, int(ins->mSrc[index].mRange.mMaxValue) * 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -7958,10 +7964,10 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
if (ins->mOperator == IA_SUB && flipop)
|
||||
{
|
||||
changedSign = true;
|
||||
cc.f = -ins->mSrc[sop1].mFloatConst;
|
||||
cc.f = float(-ins->mSrc[sop1].mFloatConst);
|
||||
}
|
||||
else
|
||||
cc.f = ins->mSrc[sop1].mFloatConst;
|
||||
cc.f = float(ins->mSrc[sop1].mFloatConst);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_IMMEDIATE, cc.v & 0xff));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, BC_REG_ACCU + 0));
|
||||
|
@ -8005,10 +8011,10 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
if (ins->mOperator == IA_SUB && !flipop)
|
||||
{
|
||||
changedSign = true;
|
||||
cc.f = -ins->mSrc[sop0].mFloatConst;
|
||||
cc.f = float(-ins->mSrc[sop0].mFloatConst);
|
||||
}
|
||||
else
|
||||
cc.f = ins->mSrc[sop0].mFloatConst;
|
||||
cc.f = float(ins->mSrc[sop0].mFloatConst);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_IMMEDIATE, cc.v & 0xff));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, BC_REG_WORK + 0));
|
||||
|
@ -9206,11 +9212,11 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
|
||||
if (ins->mOperator == IA_MUL && ins->mSrc[1].mTemp < 0)
|
||||
{
|
||||
reg = ShortMultiply(proc, nproc, ins, sins0, 0, ins->mSrc[1].mIntConst);
|
||||
reg = ShortMultiply(proc, nproc, ins, sins0, 0, int(ins->mSrc[1].mIntConst));
|
||||
}
|
||||
else if (ins->mOperator == IA_MUL && ins->mSrc[0].mTemp < 0)
|
||||
{
|
||||
reg = ShortMultiply(proc, nproc, ins, sins1, 1, ins->mSrc[0].mIntConst);
|
||||
reg = ShortMultiply(proc, nproc, ins, sins1, 1, int(ins->mSrc[0].mIntConst));
|
||||
}
|
||||
else if (ins->mOperator == IA_MUL && ins->mSrc[0].IsUByte())
|
||||
{
|
||||
|
@ -9262,7 +9268,7 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
}
|
||||
else if (ins->mOperator == IA_DIVS && ins->mSrc[0].mTemp < 0 && ins->mSrc[0].mIntConst == 2)
|
||||
{
|
||||
reg = ShortSignedDivide(proc, nproc, ins, sins1, ins->mSrc[0].mIntConst);
|
||||
reg = ShortSignedDivide(proc, nproc, ins, sins1, int(ins->mSrc[0].mIntConst));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -9504,7 +9510,7 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
|
||||
int check = 0xffff;
|
||||
if (ins->mSrc[1].IsUByte())
|
||||
check = ins->mSrc[1].mRange.mMaxValue;
|
||||
check = int(ins->mSrc[1].mRange.mMaxValue);
|
||||
|
||||
check <<= 1;
|
||||
if (check >= 0x100)
|
||||
|
@ -9542,7 +9548,7 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
}
|
||||
else if (ins->mSrc[1].mTemp < 0)
|
||||
{
|
||||
int size = ins->mSrc[0].mRange.mMaxValue + 1;
|
||||
int size = int(ins->mSrc[0].mRange.mMaxValue) + 1;
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mSrc[0].mTemp]));
|
||||
if (!ins->mSrc[0].IsUByte() || ins->mSrc[0].mRange.mMaxValue > 15)
|
||||
{
|
||||
|
@ -9551,7 +9557,7 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
}
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_TAX, ASMIM_IMPLIED));
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_SHL, ins->mSrc[1].mIntConst, size, false)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_SHL, int(ins->mSrc[1].mIntConst), size, false)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg));
|
||||
if (ins->mDst.IsUByte())
|
||||
{
|
||||
|
@ -9560,7 +9566,7 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
}
|
||||
else
|
||||
{
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_SHL, ins->mSrc[1].mIntConst, size, true)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_SHL, int(ins->mSrc[1].mIntConst), size, true)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg + 1));
|
||||
}
|
||||
}
|
||||
|
@ -9784,7 +9790,7 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
}
|
||||
else if (ins->mSrc[1].mTemp < 0)
|
||||
{
|
||||
int size = ins->mSrc[0].mRange.mMaxValue + 1;
|
||||
int size = int(ins->mSrc[0].mRange.mMaxValue) + 1;
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mSrc[0].mTemp]));
|
||||
if (!ins->mSrc[0].IsUByte() || ins->mSrc[0].mRange.mMaxValue > 15)
|
||||
{
|
||||
|
@ -9793,7 +9799,7 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
}
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_TAX, ASMIM_IMPLIED));
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_SHR, ins->mSrc[1].mIntConst, size, false)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_SHR, int(ins->mSrc[1].mIntConst), size, false)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg));
|
||||
if (ins->mDst.IsUByte())
|
||||
{
|
||||
|
@ -9802,7 +9808,7 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
}
|
||||
else
|
||||
{
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_SHR, ins->mSrc[1].mIntConst, size, true)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_SHR, int(ins->mSrc[1].mIntConst), size, true)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg + 1));
|
||||
}
|
||||
}
|
||||
|
@ -10060,7 +10066,7 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
}
|
||||
else if (ins->mSrc[1].mTemp < 0)
|
||||
{
|
||||
int size = ins->mSrc[0].mRange.mMaxValue + 1;
|
||||
int size = int(ins->mSrc[0].mRange.mMaxValue) + 1;
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mSrc[0].mTemp]));
|
||||
if (!ins->mSrc[0].IsUByte() || ins->mSrc[0].mRange.mMaxValue > 15)
|
||||
{
|
||||
|
@ -10069,7 +10075,7 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
}
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_TAX, ASMIM_IMPLIED));
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_SAR, ins->mSrc[1].mIntConst, size, false)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_SAR, int(ins->mSrc[1].mIntConst), size, false)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg));
|
||||
if (ins->mDst.IsUByte())
|
||||
{
|
||||
|
@ -10078,7 +10084,7 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
}
|
||||
else
|
||||
{
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_SAR, ins->mSrc[1].mIntConst, size, true)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, 0, nproc->mGenerator->AllocateShortMulTable(IA_SAR, int(ins->mSrc[1].mIntConst), size, true)));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg + 1));
|
||||
}
|
||||
}
|
||||
|
@ -10160,7 +10166,7 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
|
||||
void NativeCodeBasicBlock::SignExtendAddImmediate(InterCodeProcedure* proc, const InterInstruction* xins, const InterInstruction* ains)
|
||||
{
|
||||
int val = ains->mSrc[0].mTemp == xins->mDst.mTemp ? ains->mSrc[1].mIntConst : ains->mSrc[0].mIntConst;
|
||||
int val = ains->mSrc[0].mTemp == xins->mDst.mTemp ? int(ains->mSrc[1].mIntConst) : int(ains->mSrc[0].mIntConst);
|
||||
val -= 128;
|
||||
|
||||
mIns.Push(NativeCodeInstruction(xins, ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[xins->mSrc[0].mTemp] + 0));
|
||||
|
@ -10459,7 +10465,7 @@ void NativeCodeBasicBlock::RelationalOperator(InterCodeProcedure* proc, const In
|
|||
}
|
||||
|
||||
union { float f; unsigned int v; } cc;
|
||||
cc.f = ins->mSrc[ci].mFloatConst;
|
||||
cc.f = float(ins->mSrc[ci].mFloatConst);
|
||||
|
||||
int ti = BC_REG_TMP + proc->mTempOffset[ins->mSrc[vi].mTemp];
|
||||
|
||||
|
@ -10615,7 +10621,7 @@ void NativeCodeBasicBlock::RelationalOperator(InterCodeProcedure* proc, const In
|
|||
if (ins->mSrc[li].mTemp < 0)
|
||||
{
|
||||
union { float f; unsigned int v; } cc;
|
||||
cc.f = ins->mSrc[li].mFloatConst;
|
||||
cc.f = float(ins->mSrc[li].mFloatConst);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_IMMEDIATE, cc.v & 0xff));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, BC_REG_ACCU + 0));
|
||||
|
@ -10646,7 +10652,7 @@ void NativeCodeBasicBlock::RelationalOperator(InterCodeProcedure* proc, const In
|
|||
if (ins->mSrc[ri].mTemp < 0)
|
||||
{
|
||||
union { float f; unsigned int v; } cc;
|
||||
cc.f = ins->mSrc[ri].mFloatConst;
|
||||
cc.f = float(ins->mSrc[ri].mFloatConst);
|
||||
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_IMMEDIATE, cc.v & 0xff));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, BC_REG_WORK + 0));
|
||||
|
@ -10917,7 +10923,7 @@ void NativeCodeBasicBlock::RelationalOperator(InterCodeProcedure* proc, const In
|
|||
|
||||
if (ins->mSrc[li].mTemp < 0 && (op == IA_CMPGES || op == IA_CMPLS) && int16(ins->mSrc[li].mIntConst) > - 128)
|
||||
{
|
||||
iconst = ins->mSrc[li].mIntConst - 1;
|
||||
iconst = int(ins->mSrc[li].mIntConst) - 1;
|
||||
rconst = true;
|
||||
li = ri; ri = 1 - li;
|
||||
|
||||
|
@ -10925,7 +10931,7 @@ void NativeCodeBasicBlock::RelationalOperator(InterCodeProcedure* proc, const In
|
|||
}
|
||||
else if (ins->mSrc[li].mTemp < 0 && (op == IA_CMPLES || op == IA_CMPGS) && int16(ins->mSrc[li].mIntConst) < 127)
|
||||
{
|
||||
iconst = ins->mSrc[li].mIntConst + 1;
|
||||
iconst = int(ins->mSrc[li].mIntConst) + 1;
|
||||
rconst = true;
|
||||
li = ri; ri = 1 - li;
|
||||
|
||||
|
@ -10933,7 +10939,7 @@ void NativeCodeBasicBlock::RelationalOperator(InterCodeProcedure* proc, const In
|
|||
}
|
||||
else if (ins->mSrc[ri].mTemp < 0)
|
||||
{
|
||||
iconst = ins->mSrc[ri].mIntConst;
|
||||
iconst = int(ins->mSrc[ri].mIntConst);
|
||||
rconst = true;
|
||||
}
|
||||
|
||||
|
@ -10999,13 +11005,13 @@ void NativeCodeBasicBlock::RelationalOperator(InterCodeProcedure* proc, const In
|
|||
else if (ins->mSrc[1].mTemp < 0 && ins->mSrc[1].mIntConst < 256 && ins->mSrc[1].mIntConst > 0 || ins->mSrc[0].mTemp < 0 && ins->mSrc[0].mIntConst < 256 && ins->mSrc[0].mIntConst > 0)
|
||||
{
|
||||
int rt = ins->mSrc[1].mTemp;
|
||||
int ival = ins->mSrc[0].mIntConst;
|
||||
int ival = int(ins->mSrc[0].mIntConst);
|
||||
bool u8 = ins->mSrc[1].IsUByte();
|
||||
if (rt < 0)
|
||||
{
|
||||
rt = ins->mSrc[0].mTemp;
|
||||
u8 = ins->mSrc[0].IsUByte();;
|
||||
ival = ins->mSrc[1].mIntConst;
|
||||
ival = int(ins->mSrc[1].mIntConst);
|
||||
switch (op)
|
||||
{
|
||||
case IA_CMPLEU:
|
||||
|
@ -11174,7 +11180,7 @@ void NativeCodeBasicBlock::RelationalOperator(InterCodeProcedure* proc, const In
|
|||
|
||||
if (ins->mSrc[ri].mTemp < 0)
|
||||
{
|
||||
iconst = ins->mSrc[ri].mIntConst;
|
||||
iconst = int(ins->mSrc[ri].mIntConst);
|
||||
rconst = true;
|
||||
}
|
||||
|
||||
|
@ -11228,7 +11234,7 @@ void NativeCodeBasicBlock::RelationalOperator(InterCodeProcedure* proc, const In
|
|||
|
||||
if (ins->mSrc[li].mTemp < 0 && (op == IA_CMPGES || op == IA_CMPLS) && int16(ins->mSrc[li].mIntConst) > - 32768)
|
||||
{
|
||||
iconst = ins->mSrc[li].mIntConst - 1;
|
||||
iconst = int(ins->mSrc[li].mIntConst) - 1;
|
||||
rconst = true;
|
||||
li = ri; ri = 1 - li;
|
||||
|
||||
|
@ -11236,7 +11242,7 @@ void NativeCodeBasicBlock::RelationalOperator(InterCodeProcedure* proc, const In
|
|||
}
|
||||
else if (ins->mSrc[li].mTemp < 0 && (op == IA_CMPLES || op == IA_CMPGS) && int16(ins->mSrc[li].mIntConst) < 32767)
|
||||
{
|
||||
iconst = ins->mSrc[li].mIntConst + 1;
|
||||
iconst = int(ins->mSrc[li].mIntConst) + 1;
|
||||
rconst = true;
|
||||
li = ri; ri = 1 - li;
|
||||
|
||||
|
@ -11244,7 +11250,7 @@ void NativeCodeBasicBlock::RelationalOperator(InterCodeProcedure* proc, const In
|
|||
}
|
||||
else if (ins->mSrc[ri].mTemp < 0)
|
||||
{
|
||||
iconst = ins->mSrc[ri].mIntConst;
|
||||
iconst = int(ins->mSrc[ri].mIntConst);
|
||||
rconst = true;
|
||||
}
|
||||
|
||||
|
@ -11524,7 +11530,7 @@ void NativeCodeBasicBlock::LoadEffectiveAddress(InterCodeProcedure* proc, const
|
|||
else if (ins->mSrc[1].mMemory == IM_LOCAL || ins->mSrc[1].mMemory == IM_PARAM)
|
||||
{
|
||||
int dreg = BC_REG_TMP + proc->mTempOffset[ins->mDst.mTemp];
|
||||
int index = ins->mSrc[1].mIntConst;
|
||||
int index = int(ins->mSrc[1].mIntConst);
|
||||
int areg = mNoFrame ? BC_REG_STACK : BC_REG_LOCALS;
|
||||
if (ins->mSrc[1].mMemory == IM_LOCAL)
|
||||
index += proc->mLocalVars[ins->mSrc[1].mVarIndex]->mOffset;
|
||||
|
@ -11742,7 +11748,7 @@ void NativeCodeBasicBlock::CallAssembler(InterCodeProcedure* proc, NativeCodePro
|
|||
if (ins->mSrc[i].mTemp < 0)
|
||||
{
|
||||
if (ins->mSrc[i].mMemory == IM_FPARAM || ins->mSrc[i].mMemory == IM_FFRAME)
|
||||
ins->mSrc[0].mLinkerObject->mTemporaries[i - 1] = BC_REG_FPARAMS + ins->mSrc[i].mVarIndex + ins->mSrc[i].mIntConst;
|
||||
ins->mSrc[0].mLinkerObject->mTemporaries[i - 1] = BC_REG_FPARAMS + ins->mSrc[i].mVarIndex + int(ins->mSrc[i].mIntConst);
|
||||
}
|
||||
else
|
||||
ins->mSrc[0].mLinkerObject->mTemporaries[i - 1] = BC_REG_TMP + proc->mTempOffset[ins->mSrc[i].mTemp];
|
||||
|
@ -18544,7 +18550,7 @@ bool NativeCodeBasicBlock::JoinTailCodeSequences(NativeCodeProcedure* proc, bool
|
|||
|
||||
if (mTrueJump && mFalseJump)
|
||||
{
|
||||
int addr, index, taddr;
|
||||
int addr, index;
|
||||
if (HasTailSTX(addr, index))
|
||||
{
|
||||
if (mTrueJump->mEntryRequiredRegs[addr] && !mFalseJump->mEntryRequiredRegs[addr] && mTrueJump->mNumEntries == 1)
|
||||
|
@ -22652,8 +22658,8 @@ bool NativeCodeBasicBlock::JoinTAXARange(int from, int to)
|
|||
{
|
||||
if (mIns[to + 1].mType == ASMIT_ORA && mIns[to + 1].mMode == ASMIM_IMMEDIATE)
|
||||
{
|
||||
mIns[to + 0].mType = ASMIT_NOP; mIns[to + 0].mMode == ASMIM_IMPLIED;
|
||||
mIns[to + 1].mType = ASMIT_NOP; mIns[to + 1].mMode == ASMIM_IMPLIED;
|
||||
mIns[to + 0].mType = ASMIT_NOP; mIns[to + 0].mMode = ASMIM_IMPLIED;
|
||||
mIns[to + 1].mType = ASMIT_NOP; mIns[to + 1].mMode = ASMIM_IMPLIED;
|
||||
mIns[to + 2].mType = ASMIT_STX;
|
||||
mIns.Insert(from, NativeCodeInstruction(mIns[to + 0].mIns, ASMIT_ORA, ASMIM_IMMEDIATE, mIns[to + 1].mAddress));
|
||||
return true;
|
||||
|
@ -28352,9 +28358,9 @@ bool NativeCodeBasicBlock::SimpleLoopReversal(NativeCodeProcedure* proc)
|
|||
if (!mExitRequiredRegs[CPU_REG_A])
|
||||
{
|
||||
if (lb->mIns[lbs - 2].mType == ASMIT_ROR)
|
||||
mIns.Push(NativeCodeInstruction(lb->mIns[lbs - 2].mIns, ASMIT_LDA, ASMIM_IMMEDIATE, 1 << (lcount - 1)));
|
||||
mIns.Push(NativeCodeInstruction(lb->mIns[lbs - 2].mIns, ASMIT_LDA, ASMIM_IMMEDIATE, 1LL << (lcount - 1)));
|
||||
else
|
||||
mIns.Push(NativeCodeInstruction(lb->mIns[lbs - 2].mIns, ASMIT_LDA, ASMIM_IMMEDIATE, 1 << (8 - lcount)));
|
||||
mIns.Push(NativeCodeInstruction(lb->mIns[lbs - 2].mIns, ASMIT_LDA, ASMIM_IMMEDIATE, 1LL << (8 - lcount)));
|
||||
|
||||
mIns.Push(NativeCodeInstruction(lb->mIns[lbs - 2].mIns, ASMIT_STA, ASMIM_ZERO_PAGE, lb->mIns[lbs - 2].mAddress));
|
||||
lb->mBranch = ASMIT_BCC;
|
||||
|
@ -28522,9 +28528,9 @@ bool NativeCodeBasicBlock::SimpleLoopReversal(NativeCodeProcedure* proc)
|
|||
if (!mExitRequiredRegs[CPU_REG_A])
|
||||
{
|
||||
if (lb->mIns[lbs - 2].mType == ASMIT_ROR)
|
||||
mIns.Push(NativeCodeInstruction(lb->mIns[lbs - 2].mIns, ASMIT_LDA, ASMIM_IMMEDIATE, 1 << (lcount - 1)));
|
||||
mIns.Push(NativeCodeInstruction(lb->mIns[lbs - 2].mIns, ASMIT_LDA, ASMIM_IMMEDIATE, 1LL << (lcount - 1)));
|
||||
else
|
||||
mIns.Push(NativeCodeInstruction(lb->mIns[lbs - 2].mIns, ASMIT_LDA, ASMIM_IMMEDIATE, 1 << (8 - lcount)));
|
||||
mIns.Push(NativeCodeInstruction(lb->mIns[lbs - 2].mIns, ASMIT_LDA, ASMIM_IMMEDIATE, 1LL << (8 - lcount)));
|
||||
|
||||
mIns.Push(NativeCodeInstruction(lb->mIns[lbs - 2].mIns, ASMIT_STA, ASMIM_ZERO_PAGE, lb->mIns[lbs - 3].mAddress));
|
||||
lb->mBranch = ASMIT_BCC;
|
||||
|
@ -33491,12 +33497,9 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(NativeCodeProcedure* proc, int pass
|
|||
mIns[i + 0].mMode == ASMIM_INDIRECT_Y && (mIns[i + 0].mFlags & NCIF_YZERO) &&
|
||||
mIns[i + 1].mMode == ASMIM_INDIRECT_Y && mIns[i + 0].mAddress == mIns[i + 1].mAddress)
|
||||
{
|
||||
const NativeCodeInstruction* ains, * iins;
|
||||
|
||||
int sreg = mIns[i + 0].mAddress;
|
||||
|
||||
int apos, breg, ireg;
|
||||
uint32 flags;
|
||||
|
||||
if (FindAddressSumY(i, sreg, apos, breg, ireg))
|
||||
{
|
||||
|
@ -40007,7 +40010,7 @@ void NativeCodeProcedure::CompileInterBlock(InterCodeProcedure* iproc, InterCode
|
|||
if (ins->mSrc[0].mType == IT_FLOAT)
|
||||
{
|
||||
union { float f; unsigned int v; } cc;
|
||||
cc.f = ins->mSrc[0].mFloatConst;
|
||||
cc.f = float(ins->mSrc[0].mFloatConst);
|
||||
|
||||
block->mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_IMMEDIATE, cc.v & 0xff));
|
||||
block->mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, BC_REG_ACCU + 0));
|
||||
|
|
|
@ -112,7 +112,7 @@ class NativeCodeInstruction
|
|||
{
|
||||
public:
|
||||
NativeCodeInstruction(void);
|
||||
NativeCodeInstruction(const InterInstruction * ins, AsmInsType type, AsmInsMode mode = ASMIM_IMPLIED, int address = 0, LinkerObject * linkerObject = nullptr, uint32 flags = NCIF_LOWER | NCIF_UPPER, int param = 0);
|
||||
NativeCodeInstruction(const InterInstruction * ins, AsmInsType type, AsmInsMode mode = ASMIM_IMPLIED, int64 address = 0, LinkerObject * linkerObject = nullptr, uint32 flags = NCIF_LOWER | NCIF_UPPER, int param = 0);
|
||||
NativeCodeInstruction(const InterInstruction* ins, AsmInsType type, const NativeCodeInstruction & addr);
|
||||
|
||||
AsmInsType mType;
|
||||
|
@ -284,6 +284,7 @@ public:
|
|||
NativeCodeBasicBlock* BuildSingleExit(NativeCodeProcedure* proc, NativeCodeBasicBlock* block);
|
||||
|
||||
void PutLocation(const Location& loc);
|
||||
void PutOpcode(short opcode);
|
||||
void PutByte(uint8 code);
|
||||
void PutWord(uint16 code);
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ Declaration* Parser::ParseBaseTypeDeclaration(uint64 flags)
|
|||
mScanner->NextToken();
|
||||
if (mScanner->mToken == TK_IDENT)
|
||||
{
|
||||
int minValue = 0, maxValue = 0;
|
||||
int64 minValue = 0, maxValue = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -764,7 +764,7 @@ Expression* Parser::ParseInitExpression(Declaration* dtype)
|
|||
mErrors->Error(mScanner->mLocation, EERR_CONSTANT_INITIALIZER, "Constant index expected");
|
||||
else
|
||||
{
|
||||
index = stride * istart->mDecValue->mInteger;
|
||||
index = stride * int(istart->mDecValue->mInteger);
|
||||
if (index >= dtype->mSize)
|
||||
{
|
||||
mErrors->Error(mScanner->mLocation, EERR_CONSTANT_INITIALIZER, "Constant initializer out of range");
|
||||
|
@ -778,7 +778,7 @@ Expression* Parser::ParseInitExpression(Declaration* dtype)
|
|||
mErrors->Error(mScanner->mLocation, EERR_CONSTANT_INITIALIZER, "Constant index expected");
|
||||
else
|
||||
{
|
||||
nrep = iend->mDecValue->mInteger - istart->mDecValue->mInteger + 1;
|
||||
nrep = int(iend->mDecValue->mInteger - istart->mDecValue->mInteger + 1);
|
||||
|
||||
if (size + nrep * dtype->mBase->mSize > dtype->mSize)
|
||||
{
|
||||
|
@ -2279,11 +2279,11 @@ Expression* Parser::ParseStatement(void)
|
|||
{
|
||||
if (initExp->mRight->mDecValue->mType == DT_CONST_INTEGER && conditionExp->mRight->mDecValue->mType == DT_CONST_INTEGER)
|
||||
{
|
||||
int startValue = initExp->mRight->mDecValue->mInteger;
|
||||
int endValue = conditionExp->mRight->mDecValue->mInteger;
|
||||
int startValue = int(initExp->mRight->mDecValue->mInteger);
|
||||
int endValue = int(conditionExp->mRight->mDecValue->mInteger);
|
||||
int stepValue = 1;
|
||||
if (iterateExp->mType == EX_ASSIGNMENT)
|
||||
stepValue = iterateExp->mRight->mDecValue->mInteger;
|
||||
stepValue = int(iterateExp->mRight->mDecValue->mInteger);
|
||||
|
||||
if (unrollPage)
|
||||
{
|
||||
|
@ -3341,7 +3341,7 @@ void Parser::ParsePragma(void)
|
|||
ConsumeToken(TK_COMMA);
|
||||
Expression* exp = ParseRExpression();
|
||||
if (exp->mType == EX_CONSTANT && exp->mDecValue->mType == DT_CONST_INTEGER && exp->mDecValue->mInteger >= 2 && exp->mDecValue->mInteger < 0x100)
|
||||
index = exp->mDecValue->mInteger;
|
||||
index = int(exp->mDecValue->mInteger);
|
||||
else
|
||||
mErrors->Error(mScanner->mLocation, EERR_PRAGMA_PARAMETER, "Integer number for start expected");
|
||||
|
||||
|
@ -3477,7 +3477,7 @@ void Parser::ParsePragma(void)
|
|||
ConsumeToken(TK_OPEN_PARENTHESIS);
|
||||
if (mScanner->mToken == TK_INTEGER)
|
||||
{
|
||||
mCompilationUnits->mSectionStack->mSize = mScanner->mTokenInteger;
|
||||
mCompilationUnits->mSectionStack->mSize = int(mScanner->mTokenInteger);
|
||||
mScanner->NextToken();
|
||||
}
|
||||
else
|
||||
|
@ -3491,7 +3491,7 @@ void Parser::ParsePragma(void)
|
|||
ConsumeToken(TK_OPEN_PARENTHESIS);
|
||||
if (mScanner->mToken == TK_INTEGER)
|
||||
{
|
||||
mCompilationUnits->mSectionHeap->mSize = mScanner->mTokenInteger;
|
||||
mCompilationUnits->mSectionHeap->mSize = int(mScanner->mTokenInteger);
|
||||
mScanner->NextToken();
|
||||
}
|
||||
else
|
||||
|
@ -3505,20 +3505,20 @@ void Parser::ParsePragma(void)
|
|||
ConsumeToken(TK_OPEN_PARENTHESIS);
|
||||
if (mScanner->mToken == TK_INTEGER)
|
||||
{
|
||||
int cindex = mScanner->mTokenInteger;
|
||||
int cindex = int(mScanner->mTokenInteger);
|
||||
mScanner->NextToken();
|
||||
ConsumeToken(TK_COMMA);
|
||||
|
||||
if (mScanner->mToken == TK_INTEGER)
|
||||
{
|
||||
int ccode = mScanner->mTokenInteger;
|
||||
int ccode = int(mScanner->mTokenInteger);
|
||||
int ccount = 1;
|
||||
mScanner->NextToken();
|
||||
if (ConsumeTokenIf(TK_COMMA))
|
||||
{
|
||||
if (mScanner->mToken == TK_INTEGER)
|
||||
{
|
||||
ccount = mScanner->mTokenInteger;
|
||||
ccount = int(mScanner->mTokenInteger);
|
||||
mScanner->NextToken();
|
||||
}
|
||||
else
|
||||
|
@ -3558,7 +3558,7 @@ void Parser::ParsePragma(void)
|
|||
|
||||
exp = ParseRExpression();
|
||||
if (exp->mType == EX_CONSTANT && exp->mDecValue->mType == DT_CONST_INTEGER)
|
||||
start = exp->mDecValue->mInteger;
|
||||
start = int(exp->mDecValue->mInteger);
|
||||
else
|
||||
mErrors->Error(mScanner->mLocation, EERR_PRAGMA_PARAMETER, "Integer number for start expected");
|
||||
|
||||
|
@ -3566,7 +3566,7 @@ void Parser::ParsePragma(void)
|
|||
|
||||
exp = ParseRExpression();
|
||||
if (exp->mType == EX_CONSTANT && exp->mDecValue->mType == DT_CONST_INTEGER)
|
||||
end = exp->mDecValue->mInteger;
|
||||
end = int(exp->mDecValue->mInteger);
|
||||
else
|
||||
mErrors->Error(mScanner->mLocation, EERR_PRAGMA_PARAMETER, "Integer number for end expected");
|
||||
|
||||
|
@ -3576,7 +3576,7 @@ void Parser::ParsePragma(void)
|
|||
{
|
||||
exp = ParseRExpression();
|
||||
if (exp->mType == EX_CONSTANT && exp->mDecValue->mType == DT_CONST_INTEGER)
|
||||
flags = exp->mDecValue->mInteger;
|
||||
flags = int(exp->mDecValue->mInteger);
|
||||
else
|
||||
mErrors->Error(mScanner->mLocation, EERR_PRAGMA_PARAMETER, "Integer number for flags expected");
|
||||
}
|
||||
|
@ -3649,7 +3649,7 @@ void Parser::ParsePragma(void)
|
|||
{
|
||||
exp = ParseRExpression();
|
||||
if (exp->mType == EX_CONSTANT && exp->mDecValue->mType == DT_CONST_INTEGER)
|
||||
rgn->mReloc = exp->mDecValue->mInteger - rgn->mStart;
|
||||
rgn->mReloc = int(exp->mDecValue->mInteger - rgn->mStart);
|
||||
else
|
||||
mErrors->Error(mScanner->mLocation, EERR_PRAGMA_PARAMETER, "Integer number for bank expected");
|
||||
}
|
||||
|
@ -3677,7 +3677,7 @@ void Parser::ParsePragma(void)
|
|||
|
||||
exp = ParseRExpression();
|
||||
if (exp->mType == EX_CONSTANT && exp->mDecValue->mType == DT_CONST_INTEGER)
|
||||
bank = exp->mDecValue->mInteger;
|
||||
bank = int(exp->mDecValue->mInteger);
|
||||
else
|
||||
mErrors->Error(mScanner->mLocation, EERR_PRAGMA_PARAMETER, "Integer number for bank expected");
|
||||
|
||||
|
@ -3705,7 +3705,7 @@ void Parser::ParsePragma(void)
|
|||
|
||||
exp = ParseRExpression();
|
||||
if (exp->mType == EX_CONSTANT && exp->mDecValue->mType == DT_CONST_INTEGER)
|
||||
flags = exp->mDecValue->mInteger;
|
||||
flags = int(exp->mDecValue->mInteger);
|
||||
else
|
||||
mErrors->Error(mScanner->mLocation, EERR_PRAGMA_PARAMETER, "Integer number for flags expected");
|
||||
|
||||
|
@ -3856,7 +3856,7 @@ void Parser::ParsePragma(void)
|
|||
Expression * exp = ParseRExpression();
|
||||
if (exp->mType == EX_CONSTANT && exp->mDecValue->mType == DT_CONST_INTEGER)
|
||||
{
|
||||
dec->mAlignment = exp->mDecValue->mInteger;
|
||||
dec->mAlignment = int(exp->mDecValue->mInteger);
|
||||
}
|
||||
else
|
||||
mErrors->Error(mScanner->mLocation, EERR_PRAGMA_PARAMETER, "Integer number for alignment expected");
|
||||
|
@ -3936,7 +3936,7 @@ void Parser::ParsePragma(void)
|
|||
|
||||
if (mScanner->mToken == TK_INTEGER)
|
||||
{
|
||||
mUnrollLoop = mScanner->mTokenInteger;
|
||||
mUnrollLoop = int(mScanner->mTokenInteger);
|
||||
mScanner->NextToken();
|
||||
}
|
||||
else if (mScanner->mToken == TK_IDENT && !strcmp(mScanner->mTokenIdent->mString, "full"))
|
||||
|
|
|
@ -455,7 +455,7 @@ void SourceFile::ReadCharPad(SourceFileDecoder decoder)
|
|||
{
|
||||
int16 d;
|
||||
fread(&d, 2, 1, mFile);
|
||||
mMemData[i] = d;
|
||||
mMemData[i] = uint8(d);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ void SourceFile::ReadCharPad(SourceFileDecoder decoder)
|
|||
{
|
||||
int16 d;
|
||||
fread(&d, 2, 1, mFile);
|
||||
mMemData[i] = d;
|
||||
mMemData[i] = uint8(d);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -444,7 +444,7 @@ void Scanner::NextToken(void)
|
|||
mPrepCondFalse = 0;
|
||||
|
||||
NextToken();
|
||||
int v = PrepParseConditional();
|
||||
int64 v = PrepParseConditional();
|
||||
if (v)
|
||||
{
|
||||
mPrepCondFalse = 0;
|
||||
|
@ -592,7 +592,7 @@ void Scanner::NextToken(void)
|
|||
{
|
||||
mPreprocessorMode = true;
|
||||
NextToken();
|
||||
int v = PrepParseConditional();
|
||||
int64 v = PrepParseConditional();
|
||||
if (v)
|
||||
mPrepCondDepth++;
|
||||
else
|
||||
|
@ -611,7 +611,7 @@ void Scanner::NextToken(void)
|
|||
|
||||
NextToken();
|
||||
|
||||
int v = PrepParseConditional();
|
||||
int64 v = PrepParseConditional();
|
||||
Macro* macro = mDefines->Lookup(ident);
|
||||
if (!macro)
|
||||
{
|
||||
|
@ -619,7 +619,7 @@ void Scanner::NextToken(void)
|
|||
mDefines->Insert(macro);
|
||||
}
|
||||
char buffer[20];
|
||||
sprintf_s(buffer, "%d", v);
|
||||
sprintf_s(buffer, "%d", int(v));
|
||||
macro->SetString(buffer);
|
||||
mPreprocessorMode = false;
|
||||
if (mToken != TK_EOL)
|
||||
|
@ -634,7 +634,7 @@ void Scanner::NextToken(void)
|
|||
{
|
||||
mPreprocessorMode = true;
|
||||
NextToken();
|
||||
int v = PrepParseConditional();
|
||||
int64 v = PrepParseConditional();
|
||||
if (mToken != TK_EOL)
|
||||
mErrors->Error(mLocation, ERRR_PREPROCESSOR, "End of line expected");
|
||||
|
||||
|
@ -659,12 +659,12 @@ void Scanner::NextToken(void)
|
|||
NextRawToken();
|
||||
if (mToken == TK_INTEGER)
|
||||
{
|
||||
limit = mTokenInteger;
|
||||
limit = int(mTokenInteger);
|
||||
NextRawToken();
|
||||
|
||||
if (mToken == TK_INTEGER)
|
||||
{
|
||||
skip = mTokenInteger;
|
||||
skip = int(mTokenInteger);
|
||||
NextRawToken();
|
||||
}
|
||||
}
|
||||
|
@ -1791,7 +1791,7 @@ void Scanner::ParseNumberToken(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
double facc = mant, fract = 1.0;
|
||||
double facc = double(mant), fract = 1.0;
|
||||
|
||||
NextChar();
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ public:
|
|||
|
||||
Token mToken;
|
||||
double mTokenNumber;
|
||||
unsigned int mTokenInteger;
|
||||
int64 mTokenInteger;
|
||||
|
||||
Location mLocation;
|
||||
|
||||
|
|
Loading…
Reference in New Issue