Skip to content

Commit

Permalink
Bump version number
Browse files Browse the repository at this point in the history
  • Loading branch information
drmortalwombat committed May 26, 2024
1 parent 13629c7 commit 2e1c020
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 288 deletions.
Empty file added oscar64.zip
Empty file.
64 changes: 59 additions & 5 deletions oscar64/InterCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14390,7 +14390,7 @@ bool InterCodeBasicBlock::SingleTailLoopOptimization(const NumberSet& aliasedPar
}
}
#endif

#if 1
GrowingIntArray indexScale(0);

if (!modified)
Expand Down Expand Up @@ -14694,7 +14694,7 @@ bool InterCodeBasicBlock::SingleTailLoopOptimization(const NumberSet& aliasedPar

i++;
}

#if 1
if (modified)
{
for (int j = 0; j < indexScale.Size(); j++)
Expand All @@ -14706,7 +14706,7 @@ bool InterCodeBasicBlock::SingleTailLoopOptimization(const NumberSet& aliasedPar
while (k < tz && tail->mInstructions[k]->mDst.mTemp != j)
k++;

if (k < tz && !tail->IsTempReferencedInRange(0, k - 1, j) && !tail->IsTempReferencedInRange(k + 1, tz, j))
if (k < tz && !tail->IsTempReferencedInRange(0, k, j) && !tail->IsTempReferencedInRange(k + 1, tz, j))
{
int bi = 0;
while (bi + 1 < body.Size() && !body[bi]->IsTempReferenced(j))
Expand All @@ -14719,6 +14719,8 @@ bool InterCodeBasicBlock::SingleTailLoopOptimization(const NumberSet& aliasedPar
}
}
}
#endif
#endif
}
}
}
Expand Down Expand Up @@ -15311,6 +15313,49 @@ static int FindStore(InterCodeBasicBlock* block, int pos, const InterOperand& op
return -1;
}

bool InterCodeBasicBlock::CollapseDispatch()
{
bool changed = false;

if (!mVisited)
{
mVisited = true;

for (int i = 0; i + 2 < mInstructions.Size(); i++)
{
if (mInstructions[i + 0]->mCode == IC_LEA && mInstructions[i + 0]->mSrc[1].mTemp < 0 &&
mInstructions[i + 1]->mCode == IC_LOAD && mInstructions[i + 1]->mSrc[0].mTemp == mInstructions[i + 0]->mDst.mTemp && mInstructions[i + 1]->mSrc[0].mStride == 2 &&
mInstructions[i + 2]->mCode == IC_DISPATCH)
{
LinkerObject* lo = mInstructions[i + 0]->mSrc[1].mLinkerObject;
if (lo && lo->mReferences.Size() > 0)
{
int j = 1;
while (2 * j < lo->mReferences.Size() && lo->mReferences[0]->mRefObject == lo->mReferences[2 * j]->mRefObject)
j++;
if (2 * j == lo->mReferences.Size())
{
mInstructions[i + 1]->mCode = IC_CONSTANT;
mInstructions[i + 1]->mNumOperands = 0;
mInstructions[i + 1]->mConst.mType = IT_POINTER;
mInstructions[i + 1]->mConst.mMemory = IM_GLOBAL;
mInstructions[i + 1]->mConst.mLinkerObject = lo->mReferences[0]->mRefObject;
changed = true;
printf("dispatch");
}
}
}
}

if (mTrueJump && mTrueJump->CollapseDispatch())
changed = true;
if (mFalseJump && mFalseJump->CollapseDispatch())
changed = true;
}

return changed;
}

bool InterCodeBasicBlock::CheapInlining(int & numTemps)
{
bool changed = false;
Expand Down Expand Up @@ -19843,6 +19888,12 @@ void InterCodeProcedure::CheckBlocks(void)
mEntryBlock->CheckBlocks();
}

void InterCodeProcedure::CollapseDispatch(void)
{
ResetVisited();
mEntryBlock->CollapseDispatch();
}

void InterCodeProcedure::CheckFinal(void)
{
ResetVisited();
Expand Down Expand Up @@ -20780,7 +20831,7 @@ void InterCodeProcedure::Close(void)
{
GrowingTypeArray tstack(IT_NONE);

CheckFunc = !strcmp(mIdent->mString, "VerifyLogo");
CheckFunc = !strcmp(mIdent->mString, "bmmc_circle_fill");
CheckCase = false;

mEntryBlock = mBlocks[0];
Expand Down Expand Up @@ -21563,9 +21614,12 @@ void InterCodeProcedure::Close(void)
BuildDataFlowSets();
ResetVisited();
mEntryBlock->ForwardShortLoadStoreOffsets();

DisassembleDebug("ForwardShortLoadStoreOffsets");

// CollapseDispatch();
// DisassembleDebug("CollapseDispatch");


#if 1
for (int i = 0; i < 8; i++)
{
Expand Down
3 changes: 3 additions & 0 deletions oscar64/InterCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,8 @@ class InterCodeBasicBlock
InterInstruction* FindTempOrigin(int temp) const;

bool CheapInlining(int & numTemps);
bool CollapseDispatch();


void CheckFinalLocal(void);
void CheckFinal(void);
Expand Down Expand Up @@ -743,6 +745,7 @@ friend class InterCodeBasicBlock;
void PropagateMemoryAliasingInfo(void);
void MoveConditionsOutOfLoop(void);

void CollapseDispatch(void);

void PeepholeOptimization(void);

Expand Down
2 changes: 1 addition & 1 deletion oscar64/oscar64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int main2(int argc, const char** argv)

#else
strcpy(strProductName, "oscar64");
strcpy(strProductVersion, "1.27.244");
strcpy(strProductVersion, "1.28.245");

#ifdef __APPLE__
uint32_t length = sizeof(basePath);
Expand Down
8 changes: 4 additions & 4 deletions oscar64/oscar64.rc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,27,244,0
PRODUCTVERSION 1,27,244,0
FILEVERSION 1,28,245,0
PRODUCTVERSION 1,28,245,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -43,12 +43,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "oscar64"
VALUE "FileDescription", "oscar64 compiler"
VALUE "FileVersion", "1.27.244.0"
VALUE "FileVersion", "1.28.245.0"
VALUE "InternalName", "oscar64.exe"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "oscar64.exe"
VALUE "ProductName", "oscar64"
VALUE "ProductVersion", "1.27.244.0"
VALUE "ProductVersion", "1.28.245.0"
END
END
BLOCK "VarFileInfo"
Expand Down
Loading

0 comments on commit 2e1c020

Please sign in to comment.