More cross block const pointer forwarding
This commit is contained in:
parent
1bc5a2ad7e
commit
0b8304b40d
|
@ -12402,6 +12402,21 @@ InterInstruction* InterCodeBasicBlock::FindTempOrigin(int temp) const
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InterInstruction* InterCodeBasicBlock::FindTempOriginSinglePath(int temp) const
|
||||||
|
{
|
||||||
|
for (int i = mInstructions.Size() - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (mInstructions[i]->mDst.mTemp == temp)
|
||||||
|
{
|
||||||
|
mMark = i;
|
||||||
|
return mInstructions[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mEntryBlocks.Size() == 1)
|
||||||
|
return mEntryBlocks[0]->FindTempOriginSinglePath(temp);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool InterCodeBasicBlock::CanMoveInstructionDown(int si, int ti) const
|
bool InterCodeBasicBlock::CanMoveInstructionDown(int si, int ti) const
|
||||||
{
|
{
|
||||||
InterInstruction* ins = mInstructions[si];
|
InterInstruction* ins = mInstructions[si];
|
||||||
|
@ -16178,7 +16193,7 @@ bool InterCodeBasicBlock::PullStoreUpToConstAddress(void)
|
||||||
if (ins->mCode == IC_STORE && ins->mSrc[0].mTemp < 0 && ins->mSrc[1].mTemp >= 0 && CanMoveInstructionBeforeBlock(i))
|
if (ins->mCode == IC_STORE && ins->mSrc[0].mTemp < 0 && ins->mSrc[1].mTemp >= 0 && CanMoveInstructionBeforeBlock(i))
|
||||||
{
|
{
|
||||||
int j = 0;
|
int j = 0;
|
||||||
while (j < mEntryBlocks.Size() && (cins = mEntryBlocks[j]->FindTempOrigin(ins->mSrc[1].mTemp)) && cins->mCode == IC_CONSTANT)
|
while (j < mEntryBlocks.Size() && (cins = mEntryBlocks[j]->FindTempOriginSinglePath(ins->mSrc[1].mTemp)) && cins->mCode == IC_CONSTANT)
|
||||||
j++;
|
j++;
|
||||||
|
|
||||||
if (j == mEntryBlocks.Size())
|
if (j == mEntryBlocks.Size())
|
||||||
|
@ -22608,6 +22623,12 @@ void InterCodeProcedure::Close(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BuildDataFlowSets();
|
BuildDataFlowSets();
|
||||||
|
|
||||||
|
GrowingInstructionPtrArray ptemps(nullptr);
|
||||||
|
ptemps.SetSize(mTemporaries.Size());
|
||||||
|
ResetVisited();
|
||||||
|
mEntryBlock->ForwardConstTemps(ptemps);
|
||||||
|
|
||||||
ResetVisited();
|
ResetVisited();
|
||||||
mEntryBlock->PullStoreUpToConstAddress();
|
mEntryBlock->PullStoreUpToConstAddress();
|
||||||
DisassembleDebug("PullStoreUpToConstAddress");
|
DisassembleDebug("PullStoreUpToConstAddress");
|
||||||
|
|
Loading…
Reference in New Issue