Keep unused variable stores if optimization is turned off

This commit is contained in:
drmortalwombat 2023-05-01 17:10:27 +02:00
parent d047152646
commit 30b3ed610e

View File

@ -4,6 +4,8 @@
#include <stdio.h>
#include <math.h>
static bool CheckFunc;
int InterTypeSize[] = {
0,
1,
@ -14905,6 +14907,8 @@ void InterCodeProcedure::RemoveUnusedInstructions(void)
}
void InterCodeProcedure::RemoveUnusedStoreInstructions(InterMemory paramMemory)
{
if (mCompilerOptions & COPT_OPTIMIZE_BASIC)
{
if (mLocalVars.Size() > 0 || mParamVars.Size() > 0)
{
@ -14966,6 +14970,7 @@ void InterCodeProcedure::RemoveUnusedStoreInstructions(InterMemory paramMemory)
DisassembleDebug("removed unused static stores");
}
}
}
void InterCodeProcedure::MergeCommonPathInstructions(void)
{
@ -15336,6 +15341,8 @@ void InterCodeProcedure::Close(void)
{
GrowingTypeArray tstack(IT_NONE);
// CheckFunc = !strcmp(mIdent->mString, "joy_poll");
mEntryBlock = mBlocks[0];
DisassembleDebug("start");
@ -16157,11 +16164,14 @@ void InterCodeProcedure::MarkRelevantStatics(void)
}
void InterCodeProcedure::RemoveNonRelevantStatics(void)
{
if (mCompilerOptions & COPT_OPTIMIZE_BASIC)
{
ResetVisited();
mEntryBlock->RemoveNonRelevantStatics();
RemoveUnusedInstructions();
}
}
void InterCodeProcedure::MapVariables(void)
{
@ -16647,6 +16657,9 @@ void InterCodeProcedure::Disassemble(const char* name, bool dumpSets)
FILE* file;
static bool initial = true;
if (!CheckFunc)
return;
if (!initial)
{
fopen_s(&file, "r:\\cldiss.txt", "a");