mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-19 02:25:01 +00:00
Clean up Filler::runOnMachineBasicBlock. Change interface of
Filler::findDelayInstr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141150 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -78,8 +78,9 @@ namespace {
|
|||||||
SmallSet<unsigned, 32> &RegDefs,
|
SmallSet<unsigned, 32> &RegDefs,
|
||||||
SmallSet<unsigned, 32> &RegUses);
|
SmallSet<unsigned, 32> &RegUses);
|
||||||
|
|
||||||
MachineBasicBlock::iterator
|
bool
|
||||||
findDelayInstr(MachineBasicBlock &MBB, MachineBasicBlock::iterator slot);
|
findDelayInstr(MachineBasicBlock &MBB, MachineBasicBlock::iterator slot,
|
||||||
|
MachineBasicBlock::iterator &Filler);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -93,19 +94,19 @@ runOnMachineBasicBlock(MachineBasicBlock &MBB) {
|
|||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end(); ++I)
|
for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end(); ++I)
|
||||||
if (I->getDesc().hasDelaySlot()) {
|
if (I->getDesc().hasDelaySlot()) {
|
||||||
MachineBasicBlock::iterator D = MBB.end();
|
|
||||||
MachineBasicBlock::iterator J = I;
|
|
||||||
|
|
||||||
if (EnableDelaySlotFiller)
|
|
||||||
D = findDelayInstr(MBB, I);
|
|
||||||
|
|
||||||
++FilledSlots;
|
++FilledSlots;
|
||||||
Changed = true;
|
Changed = true;
|
||||||
|
|
||||||
if (D == MBB.end())
|
MachineBasicBlock::iterator D;
|
||||||
BuildMI(MBB, ++J, I->getDebugLoc(), TII->get(Mips::NOP));
|
|
||||||
else
|
if (EnableDelaySlotFiller && findDelayInstr(MBB, I, D)) {
|
||||||
MBB.splice(++J, &MBB, D);
|
MBB.splice(llvm::next(I), &MBB, D);
|
||||||
|
++UsefulSlots;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
BuildMI(MBB, llvm::next(I), I->getDebugLoc(), TII->get(Mips::NOP));
|
||||||
|
|
||||||
|
++I; // Skip instruction that has just been moved to delay slot.
|
||||||
}
|
}
|
||||||
return Changed;
|
return Changed;
|
||||||
|
|
||||||
@@ -117,9 +118,9 @@ FunctionPass *llvm::createMipsDelaySlotFillerPass(MipsTargetMachine &tm) {
|
|||||||
return new Filler(tm);
|
return new Filler(tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineBasicBlock::iterator
|
bool Filler::findDelayInstr(MachineBasicBlock &MBB,
|
||||||
Filler::findDelayInstr(MachineBasicBlock &MBB,
|
MachineBasicBlock::iterator slot,
|
||||||
MachineBasicBlock::iterator slot) {
|
MachineBasicBlock::iterator &Filler) {
|
||||||
SmallSet<unsigned, 32> RegDefs;
|
SmallSet<unsigned, 32> RegDefs;
|
||||||
SmallSet<unsigned, 32> RegUses;
|
SmallSet<unsigned, 32> RegUses;
|
||||||
bool sawLoad = false;
|
bool sawLoad = false;
|
||||||
@@ -162,9 +163,11 @@ Filler::findDelayInstr(MachineBasicBlock &MBB,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return I;
|
Filler = I;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return MBB.end();
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Filler::delayHasHazard(MachineBasicBlock::iterator candidate,
|
bool Filler::delayHasHazard(MachineBasicBlock::iterator candidate,
|
||||||
|
Reference in New Issue
Block a user