Clean up Filler::findDelayInstr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141152 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Akira Hatanaka 2011-10-05 01:57:46 +00:00
parent 53120e0a9f
commit 7d8e04d5f1

View File

@ -128,10 +128,6 @@ bool Filler::findDelayInstr(MachineBasicBlock &MBB,
MachineBasicBlock::iterator &Filler) { MachineBasicBlock::iterator &Filler) {
SmallSet<unsigned, 32> RegDefs; SmallSet<unsigned, 32> RegDefs;
SmallSet<unsigned, 32> RegUses; SmallSet<unsigned, 32> RegUses;
bool sawLoad = false;
bool sawStore = false;
MachineBasicBlock::iterator I = slot;
// Call's delay filler can def some of call's uses. // Call's delay filler can def some of call's uses.
if (slot->getDesc().isCall()) if (slot->getDesc().isCall())
@ -139,22 +135,21 @@ bool Filler::findDelayInstr(MachineBasicBlock &MBB,
else else
insertDefsUses(slot, RegDefs, RegUses); insertDefsUses(slot, RegDefs, RegUses);
bool done = false; bool sawLoad = false;
bool sawStore = false;
while (!done) {
done = (I == MBB.begin());
if (!done)
--I;
for (MachineBasicBlock::reverse_iterator I(slot); I != MBB.rend(); ++I) {
// skip debug value // skip debug value
if (I->isDebugValue()) if (I->isDebugValue())
continue; continue;
// Convert to forward iterator.
MachineBasicBlock::iterator FI(next(I).base());
if (I->hasUnmodeledSideEffects() if (I->hasUnmodeledSideEffects()
|| I->isInlineAsm() || I->isInlineAsm()
|| I->isLabel() || I->isLabel()
|| I == LastFiller || FI == LastFiller
|| I->getDesc().isPseudo() || I->getDesc().isPseudo()
// //
// Should not allow: // Should not allow:
@ -163,12 +158,12 @@ bool Filler::findDelayInstr(MachineBasicBlock &MBB,
) )
break; break;
if (delayHasHazard(I, sawLoad, sawStore, RegDefs, RegUses)) { if (delayHasHazard(FI, sawLoad, sawStore, RegDefs, RegUses)) {
insertDefsUses(I, RegDefs, RegUses); insertDefsUses(FI, RegDefs, RegUses);
continue; continue;
} }
Filler = I; Filler = FI;
return true; return true;
} }