Fix propagation of volatile memory reads in loops
This commit is contained in:
parent
53e4019ecd
commit
77010a0ab2
|
@ -7381,15 +7381,25 @@ bool InterCodeBasicBlock::SimplifyIntegerNumeric(const GrowingInstructionPtrArra
|
|||
if (spareTemps + 2 >= ltvalue.Size())
|
||||
return true;
|
||||
|
||||
InterInstruction* cins = new InterInstruction();
|
||||
cins->mCode = IC_CONVERSION_OPERATOR;
|
||||
cins->mOperator = IA_EXT8TO16U;
|
||||
cins->mSrc[0] = ains->mSrc[1];
|
||||
cins->mDst.mTemp = spareTemps++;
|
||||
cins->mDst.mType = IT_INT16;
|
||||
cins->mDst.mRange = ains->mSrc[1].mRange;
|
||||
cins->mDst.mRange.LimitMin(0);
|
||||
mInstructions.Insert(i, cins);
|
||||
|
||||
InterInstruction* nins = new InterInstruction();
|
||||
nins->mCode = IC_BINARY_OPERATOR;
|
||||
nins->mOperator = IA_SHL;
|
||||
nins->mSrc[0] = ins->mSrc[0];
|
||||
nins->mSrc[1] = ains->mSrc[1];
|
||||
nins->mSrc[1] = cins->mDst;
|
||||
nins->mDst.mTemp = spareTemps++;
|
||||
nins->mDst.mType = IT_INT16;
|
||||
nins->mDst.mRange = ins->mDst.mRange;
|
||||
mInstructions.Insert(i, nins);
|
||||
mInstructions.Insert(i + 1, nins);
|
||||
|
||||
ins->mOperator = IA_ADD;
|
||||
ins->mSrc[0] = ains->mSrc[0];
|
||||
|
|
|
@ -3910,7 +3910,7 @@ void NativeCodeInstruction::CopyMode(const NativeCodeInstruction& ins)
|
|||
mMode = ins.mMode;
|
||||
mAddress = ins.mAddress;
|
||||
mLinkerObject = ins.mLinkerObject;
|
||||
mFlags = (mFlags & ~(NCIF_LOWER | NCIF_UPPER)) | (ins.mFlags & (NCIF_LOWER | NCIF_UPPER));
|
||||
mFlags = (mFlags & ~(NCIF_LOWER | NCIF_UPPER)) | (ins.mFlags & (NCIF_LOWER | NCIF_UPPER | NCIF_VOLATILE));
|
||||
}
|
||||
|
||||
void NativeCodeInstruction::Assemble(NativeCodeBasicBlock* block)
|
||||
|
@ -16256,7 +16256,25 @@ bool NativeCodeBasicBlock::FindImmediateStore(int at, int reg, const NativeCodeI
|
|||
return false;
|
||||
}
|
||||
|
||||
bool NativeCodeBasicBlock::CheckPatchFail(const NativeCodeBasicBlock* block, int reg)
|
||||
bool NativeCodeBasicBlock::CheckPatchFailUse(void)
|
||||
{
|
||||
if (mPatchChecked)
|
||||
return false;
|
||||
|
||||
if (!mPatchFail)
|
||||
{
|
||||
mPatchFail = true;
|
||||
|
||||
if (mTrueJump && !mTrueJump->CheckPatchFailUse())
|
||||
return false;
|
||||
if (mFalseJump && !mFalseJump->CheckPatchFailUse())
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NativeCodeBasicBlock::CheckPatchFailReg(const NativeCodeBasicBlock* block, int reg)
|
||||
{
|
||||
if (mPatched)
|
||||
return false;
|
||||
|
@ -16265,9 +16283,9 @@ bool NativeCodeBasicBlock::CheckPatchFail(const NativeCodeBasicBlock* block, int
|
|||
{
|
||||
mPatchFail = true;
|
||||
|
||||
if (mTrueJump && !mTrueJump->CheckPatchFail(block, reg))
|
||||
if (mTrueJump && !mTrueJump->CheckPatchFailReg(block, reg))
|
||||
return false;
|
||||
if (mFalseJump && !mFalseJump->CheckPatchFail(block, reg))
|
||||
if (mFalseJump && !mFalseJump->CheckPatchFailReg(block, reg))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -16289,9 +16307,9 @@ bool NativeCodeBasicBlock::CheckSingleUseGlobalLoad(const NativeCodeBasicBlock*
|
|||
{
|
||||
if (mExitRequiredRegs[reg])
|
||||
{
|
||||
if (mTrueJump && !mTrueJump->CheckPatchFail(block, reg))
|
||||
if (mTrueJump && !mTrueJump->CheckPatchFailReg(block, reg))
|
||||
return false;
|
||||
if (mFalseJump && !mFalseJump->CheckPatchFail(block, reg))
|
||||
if (mFalseJump && !mFalseJump->CheckPatchFailReg(block, reg))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -16332,9 +16350,9 @@ bool NativeCodeBasicBlock::CheckSingleUseGlobalLoad(const NativeCodeBasicBlock*
|
|||
{
|
||||
if (mExitRequiredRegs[reg])
|
||||
{
|
||||
if (mTrueJump && !mTrueJump->CheckPatchFail(block, reg))
|
||||
if (mTrueJump && !mTrueJump->CheckPatchFailReg(block, reg))
|
||||
return false;
|
||||
if (mFalseJump && !mFalseJump->CheckPatchFail(block, reg))
|
||||
if (mFalseJump && !mFalseJump->CheckPatchFailReg(block, reg))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -16345,9 +16363,9 @@ bool NativeCodeBasicBlock::CheckSingleUseGlobalLoad(const NativeCodeBasicBlock*
|
|||
{
|
||||
if (mExitRequiredRegs[reg])
|
||||
{
|
||||
if (mTrueJump && !mTrueJump->CheckPatchFail(block, reg))
|
||||
if (mTrueJump && !mTrueJump->CheckPatchFailReg(block, reg))
|
||||
return false;
|
||||
if (mFalseJump && !mFalseJump->CheckPatchFail(block, reg))
|
||||
if (mFalseJump && !mFalseJump->CheckPatchFailReg(block, reg))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -16612,7 +16630,7 @@ bool NativeCodeBasicBlock::CheckGlobalAddressSumYPointer(const NativeCodeBasicBl
|
|||
if (at == 0)
|
||||
{
|
||||
if (!mEntryRequiredRegs[reg] && !mEntryRequiredRegs[reg + 1])
|
||||
return true;
|
||||
return CheckPatchFailUse();
|
||||
|
||||
if (mNumEntries > 1)
|
||||
{
|
||||
|
@ -16634,7 +16652,10 @@ bool NativeCodeBasicBlock::CheckGlobalAddressSumYPointer(const NativeCodeBasicBl
|
|||
if (yval < 0)
|
||||
return false;
|
||||
else if (!(ins.mLive & LIVE_MEM))
|
||||
return true;
|
||||
{
|
||||
mPatchChecked = true;
|
||||
return !mPatchFail;
|
||||
}
|
||||
}
|
||||
|
||||
if (ins.mType == ASMIT_LDY && ins.mMode == ASMIM_IMMEDIATE)
|
||||
|
@ -30402,7 +30423,7 @@ void NativeCodeProcedure::RebuildEntry(void)
|
|||
|
||||
void NativeCodeProcedure::Optimize(void)
|
||||
{
|
||||
CheckFunc = !strcmp(mInterProc->mIdent->mString, "plant_draw");
|
||||
CheckFunc = !strcmp(mInterProc->mIdent->mString, "main");
|
||||
|
||||
#if 1
|
||||
int step = 0;
|
||||
|
@ -30516,14 +30537,13 @@ void NativeCodeProcedure::Optimize(void)
|
|||
mEntryBlock->CheckBlocks();
|
||||
#endif
|
||||
|
||||
|
||||
#if 1
|
||||
ResetVisited();
|
||||
if (mEntryBlock->PeepHoleOptimizer(this, step))
|
||||
changed = true;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// if (cnt == 2)
|
||||
// return;
|
||||
#if 1
|
||||
|
@ -30572,6 +30592,7 @@ void NativeCodeProcedure::Optimize(void)
|
|||
if (mEntryBlock->MergeBasicBlocks())
|
||||
changed = true;
|
||||
#endif
|
||||
|
||||
ResetEntryBlocks();
|
||||
ResetVisited();
|
||||
mEntryBlock->CollectEntryBlocks(nullptr);
|
||||
|
@ -30598,6 +30619,7 @@ void NativeCodeProcedure::Optimize(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if _DEBUG
|
||||
ResetVisited();
|
||||
mEntryBlock->CheckBlocks(true);
|
||||
|
@ -30892,9 +30914,6 @@ void NativeCodeProcedure::Optimize(void)
|
|||
else
|
||||
cnt++;
|
||||
|
||||
// if (CheckFunc && cnt == 3)
|
||||
// return;
|
||||
|
||||
} while (changed);
|
||||
|
||||
#if 1
|
||||
|
|
|
@ -442,7 +442,8 @@ public:
|
|||
bool CheckShortcutPointerAddForward(int at);
|
||||
bool ShortcutPointerAddForward(void);
|
||||
|
||||
bool CheckPatchFail(const NativeCodeBasicBlock* block, int reg);
|
||||
bool CheckPatchFailReg(const NativeCodeBasicBlock* block, int reg);
|
||||
bool CheckPatchFailUse(void);
|
||||
|
||||
bool CheckGlobalAddressSumYPointer(const NativeCodeBasicBlock * block, int reg, int at, int yval);
|
||||
bool PatchGlobalAddressSumYPointer(const NativeCodeBasicBlock* block, int reg, int at, int yval, LinkerObject * lobj, int address);
|
||||
|
|
|
@ -74,7 +74,7 @@ int main2(int argc, const char** argv)
|
|||
|
||||
#else
|
||||
strcpy(strProductName, "oscar64");
|
||||
strcpy(strProductVersion, "1.10.164");
|
||||
strcpy(strProductVersion, "1.10.165");
|
||||
|
||||
#ifdef __APPLE__
|
||||
uint32_t length = sizeof(basePath);
|
||||
|
|
|
@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,10,164,0
|
||||
PRODUCTVERSION 1,10,164,0
|
||||
FILEVERSION 1,10,165,0
|
||||
PRODUCTVERSION 1,10,165,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -43,12 +43,12 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "oscar64"
|
||||
VALUE "FileDescription", "oscar64 compiler"
|
||||
VALUE "FileVersion", "1.10.164.0"
|
||||
VALUE "FileVersion", "1.10.165.0"
|
||||
VALUE "InternalName", "oscar64.exe"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2021"
|
||||
VALUE "OriginalFilename", "oscar64.exe"
|
||||
VALUE "ProductName", "oscar64"
|
||||
VALUE "ProductVersion", "1.10.164.0"
|
||||
VALUE "ProductVersion", "1.10.165.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -4283,15 +4283,15 @@
|
|||
{
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:oscar64"
|
||||
"ProductCode" = "8:{BD8162B1-0E46-49AE-B175-3744635D30CB}"
|
||||
"PackageCode" = "8:{C35B4B0B-03DD-4A60-A44F-6A3EFA3204B4}"
|
||||
"ProductCode" = "8:{FA6B070F-EBAE-4CDF-97EF-D58E25C49F74}"
|
||||
"PackageCode" = "8:{E315B6E4-249C-4D1D-86E1-E018924BC8EE}"
|
||||
"UpgradeCode" = "8:{9AB61EFF-ACAC-4079-9950-8D96615CD4EF}"
|
||||
"AspNetVersion" = "8:2.0.50727.0"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
"RemovePreviousVersions" = "11:TRUE"
|
||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||
"InstallAllUsers" = "11:FALSE"
|
||||
"ProductVersion" = "8:1.10.164"
|
||||
"ProductVersion" = "8:1.10.165"
|
||||
"Manufacturer" = "8:oscar64"
|
||||
"ARPHELPTELEPHONE" = "8:"
|
||||
"ARPHELPLINK" = "8:"
|
||||
|
|
Loading…
Reference in New Issue