Fix line directive off by one error
This commit is contained in:
parent
4e76b34f53
commit
3da58bf1ca
|
@ -216,6 +216,9 @@ rem @echo off
|
||||||
@call :testn stripedarraytest.c
|
@call :testn stripedarraytest.c
|
||||||
@if %errorlevel% neq 0 goto :error
|
@if %errorlevel% neq 0 goto :error
|
||||||
|
|
||||||
|
@call :testn mmultest.c
|
||||||
|
@if %errorlevel% neq 0 goto :error
|
||||||
|
|
||||||
@exit /b 0
|
@exit /b 0
|
||||||
|
|
||||||
:error
|
:error
|
||||||
|
|
|
@ -334,7 +334,7 @@ void test_add_word_cross(void)
|
||||||
}
|
}
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
test_char_fit();
|
test_char_fit();
|
||||||
test_char_cross();
|
test_char_cross();
|
||||||
test_word_fit();
|
test_word_fit();
|
||||||
|
@ -347,7 +347,7 @@ int main(void)
|
||||||
test_inc_char_fit();
|
test_inc_char_fit();
|
||||||
test_inc_char_cross();
|
test_inc_char_cross();
|
||||||
test_add_char_cross();
|
test_add_char_cross();
|
||||||
#endif
|
|
||||||
test_add_word_fit();
|
test_add_word_fit();
|
||||||
test_add_word_cross();
|
test_add_word_cross();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
#include <gfx/vector3d.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
Matrix4 ml, mr;
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
for(char i=0; i<16; i++)
|
||||||
|
{
|
||||||
|
for(char j=0; j<16; j++)
|
||||||
|
{
|
||||||
|
for(char k=0; k<16; k++)
|
||||||
|
{
|
||||||
|
ml.m[k] = (i == k) ? 1.0 : 0.0;
|
||||||
|
mr.m[k] = (j == k) ? 1.0 : 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat4_mmul(&ml, &mr);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
printf("%d, %d\n", i, j);
|
||||||
|
for(char k=0; k<16; k++)
|
||||||
|
printf("%f ", ml.m[k]);
|
||||||
|
printf("\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for(char k=0; k<16; k++)
|
||||||
|
{
|
||||||
|
char ix = i & 3, iy = i >> 2;
|
||||||
|
char jx = j & 3, jy = j >> 2;
|
||||||
|
char kx = k & 3, ky = k >> 2;
|
||||||
|
|
||||||
|
if (ky == jy && kx == ix && jx == iy)
|
||||||
|
assert(ml.m[k] == 1.0);
|
||||||
|
else
|
||||||
|
assert(ml.m[k] == 0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -8007,6 +8007,26 @@ void InterCodeBasicBlock::UpdateLocalIntegerRangeSets(const GrowingVariableArray
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void InterCodeBasicBlock::PruneUnusedIntegerRangeSets(void)
|
||||||
|
{
|
||||||
|
if (!mVisited)
|
||||||
|
{
|
||||||
|
mVisited = true;
|
||||||
|
|
||||||
|
if (mEntryValueRange.Size() > 0 && mEntryRequiredTemps.Size())
|
||||||
|
{
|
||||||
|
for (int i = 0; i < mEntryValueRange.Size(); i++)
|
||||||
|
{
|
||||||
|
if (!mEntryRequiredTemps[i])
|
||||||
|
mEntryValueRange[i].Reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mTrueJump) mTrueJump->PruneUnusedIntegerRangeSets();
|
||||||
|
if (mFalseJump) mFalseJump->PruneUnusedIntegerRangeSets();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InterCodeBasicBlock::RestartLocalIntegerRangeSets(int num, const GrowingVariableArray& localVars, const GrowingVariableArray& paramVars)
|
void InterCodeBasicBlock::RestartLocalIntegerRangeSets(int num, const GrowingVariableArray& localVars, const GrowingVariableArray& paramVars)
|
||||||
{
|
{
|
||||||
if (!mVisited)
|
if (!mVisited)
|
||||||
|
@ -10731,6 +10751,9 @@ void InterCodeBasicBlock::RenameValueRanges(const GrowingIntArray& renameTable,
|
||||||
{
|
{
|
||||||
if (renameTable[i] >= 0)
|
if (renameTable[i] >= 0)
|
||||||
{
|
{
|
||||||
|
assert(mLocalValueRange[i].mMinState == IntegerValueRange::S_UNKNOWN || mEntryValueRange[renameTable[i]].mMinState == IntegerValueRange::S_UNKNOWN);
|
||||||
|
assert(mLocalValueRange[i].mMaxState == IntegerValueRange::S_UNKNOWN || mEntryValueRange[renameTable[i]].mMaxState == IntegerValueRange::S_UNKNOWN);
|
||||||
|
|
||||||
mEntryValueRange[renameTable[i]].Limit(mLocalValueRange[i]);
|
mEntryValueRange[renameTable[i]].Limit(mLocalValueRange[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18017,7 +18040,7 @@ void InterCodeProcedure::Close(void)
|
||||||
{
|
{
|
||||||
GrowingTypeArray tstack(IT_NONE);
|
GrowingTypeArray tstack(IT_NONE);
|
||||||
|
|
||||||
CheckFunc = !strcmp(mIdent->mString, "test_add_char_cross");
|
CheckFunc = !strcmp(mIdent->mString, "qsort");
|
||||||
CheckCase = false;
|
CheckCase = false;
|
||||||
|
|
||||||
mEntryBlock = mBlocks[0];
|
mEntryBlock = mBlocks[0];
|
||||||
|
@ -18373,7 +18396,6 @@ void InterCodeProcedure::Close(void)
|
||||||
BuildDataFlowSets();
|
BuildDataFlowSets();
|
||||||
|
|
||||||
DisassembleDebug("Followed Jumps 2");
|
DisassembleDebug("Followed Jumps 2");
|
||||||
CheckCase = true;
|
|
||||||
|
|
||||||
RebuildIntegerRangeSet();
|
RebuildIntegerRangeSet();
|
||||||
|
|
||||||
|
@ -18502,8 +18524,6 @@ void InterCodeProcedure::Close(void)
|
||||||
Disassemble("gcp-");
|
Disassemble("gcp-");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CheckCase = true;
|
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
RebuildIntegerRangeSet();
|
RebuildIntegerRangeSet();
|
||||||
#endif
|
#endif
|
||||||
|
@ -18565,8 +18585,6 @@ void InterCodeProcedure::Close(void)
|
||||||
|
|
||||||
LoadStoreForwarding(paramMemory);
|
LoadStoreForwarding(paramMemory);
|
||||||
|
|
||||||
CheckCase = true;
|
|
||||||
|
|
||||||
RebuildIntegerRangeSet();
|
RebuildIntegerRangeSet();
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
@ -18778,6 +18796,9 @@ void InterCodeProcedure::Close(void)
|
||||||
|
|
||||||
DisassembleDebug("Peephole Temp Check");
|
DisassembleDebug("Peephole Temp Check");
|
||||||
|
|
||||||
|
if (i == 1)
|
||||||
|
CheckCase = true;
|
||||||
|
|
||||||
RemoveUnusedInstructions();
|
RemoveUnusedInstructions();
|
||||||
|
|
||||||
ReduceTemporaries();
|
ReduceTemporaries();
|
||||||
|
@ -19458,6 +19479,9 @@ void InterCodeProcedure::ReduceTemporaries(void)
|
||||||
ResetVisited();
|
ResetVisited();
|
||||||
} while (mEntryBlock->BuildGlobalRequiredTempSet(totalRequired2));
|
} while (mEntryBlock->BuildGlobalRequiredTempSet(totalRequired2));
|
||||||
|
|
||||||
|
ResetVisited();
|
||||||
|
mEntryBlock->PruneUnusedIntegerRangeSets();
|
||||||
|
|
||||||
collisionSet = new NumberSet[numTemps];
|
collisionSet = new NumberSet[numTemps];
|
||||||
|
|
||||||
for (i = 0; i < numTemps; i++)
|
for (i = 0; i < numTemps; i++)
|
||||||
|
|
|
@ -454,6 +454,7 @@ public:
|
||||||
void SimplifyIntegerRangeRelops(void);
|
void SimplifyIntegerRangeRelops(void);
|
||||||
void MarkIntegerRangeBoundUp(int temp, int64 value, GrowingIntegerValueRangeArray& range);
|
void MarkIntegerRangeBoundUp(int temp, int64 value, GrowingIntegerValueRangeArray& range);
|
||||||
void UnionIntegerRanges(const InterCodeBasicBlock* block);
|
void UnionIntegerRanges(const InterCodeBasicBlock* block);
|
||||||
|
void PruneUnusedIntegerRangeSets(void);
|
||||||
|
|
||||||
bool CombineIndirectAddressing(void);
|
bool CombineIndirectAddressing(void);
|
||||||
|
|
||||||
|
|
|
@ -26593,7 +26593,7 @@ bool NativeCodeBasicBlock::ForwardReplaceZeroPage(int at, int from, int to)
|
||||||
if (mFalseJump && mFalseJump->ForwardReplaceZeroPage(0, from, to))
|
if (mFalseJump && mFalseJump->ForwardReplaceZeroPage(0, from, to))
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
if (changed)
|
if (mEntryRequiredRegs[from])
|
||||||
mEntryRequiredRegs += to;
|
mEntryRequiredRegs += to;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29635,7 +29635,8 @@ bool NativeCodeBasicBlock::OptimizeLoopCarryOver(void)
|
||||||
mExitRequiredRegs += CPU_REG_Y;
|
mExitRequiredRegs += CPU_REG_Y;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
else if (sz > 1 && hblock->mIns[0].mType == ASMIT_LDA && mIns[sz - 1].mType == ASMIT_CMP && mIns[sz - 2].mType == ASMIT_LDA && hblock->mIns[0].SameEffectiveAddress(mIns[sz - 2]) && !(hblock->mIns[0].mLive & LIVE_CPU_REG_Z))
|
else if (sz > 1 && hblock->mIns[0].mType == ASMIT_LDA && mIns[sz - 1].mType == ASMIT_CMP && mIns[sz - 2].mType == ASMIT_LDA
|
||||||
|
&& hblock->mIns[0].SameEffectiveAddress(mIns[sz - 2]) && !(hblock->mIns[0].mLive & LIVE_CPU_REG_Z) && !(hblock->mIns[0].mFlags & NCIF_VOLATILE))
|
||||||
{
|
{
|
||||||
pblock->mIns.Push(hblock->mIns[0]);
|
pblock->mIns.Push(hblock->mIns[0]);
|
||||||
hblock->mIns.Remove(0);
|
hblock->mIns.Remove(0);
|
||||||
|
@ -41791,7 +41792,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
|
||||||
{
|
{
|
||||||
mInterProc = proc;
|
mInterProc = proc;
|
||||||
|
|
||||||
CheckFunc = !strcmp(mInterProc->mIdent->mString, "atoi");
|
CheckFunc = !strcmp(mInterProc->mIdent->mString, "mat4_mmul");
|
||||||
|
|
||||||
int nblocks = proc->mBlocks.Size();
|
int nblocks = proc->mBlocks.Size();
|
||||||
tblocks = new NativeCodeBasicBlock * [nblocks];
|
tblocks = new NativeCodeBasicBlock * [nblocks];
|
||||||
|
@ -43090,7 +43091,7 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
if (step == 10)
|
if (step == 10 && (mInterProc->mCompilerOptions & COPT_OPTIMIZE_BASIC))
|
||||||
{
|
{
|
||||||
ResetVisited();
|
ResetVisited();
|
||||||
mEntryBlock->MarkLocalUsedLinkerObjects();
|
mEntryBlock->MarkLocalUsedLinkerObjects();
|
||||||
|
@ -43126,7 +43127,6 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _DEBUG
|
#if _DEBUG
|
||||||
ResetVisited();
|
ResetVisited();
|
||||||
mEntryBlock->CheckAsmCode();
|
mEntryBlock->CheckAsmCode();
|
||||||
|
@ -43157,7 +43157,6 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
else
|
else
|
||||||
cnt++;
|
cnt++;
|
||||||
|
|
||||||
|
|
||||||
} while (changed);
|
} while (changed);
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
@ -43226,6 +43225,7 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
changed = mEntryBlock->JoinTailCodeSequences(this, true);
|
changed = mEntryBlock->JoinTailCodeSequences(this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} while (changed);
|
} while (changed);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -608,7 +608,7 @@ void Scanner::NextPreToken(void)
|
||||||
strcpy_s(mPreprocessor->mSource->mLocationFileName, mTokenString);
|
strcpy_s(mPreprocessor->mSource->mLocationFileName, mTokenString);
|
||||||
NextRawToken();
|
NextRawToken();
|
||||||
}
|
}
|
||||||
mPreprocessor->mLocation.mLine = v - 1;
|
mPreprocessor->mLocation.mLine = v + mLocation.mLine - l - 1;
|
||||||
}
|
}
|
||||||
else if (mToken == TK_PREP_FOR)
|
else if (mToken == TK_PREP_FOR)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue