mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
[mips] Make Filler a class and reduce indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174666 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e0501e866c
commit
5dd41c95f3
@ -45,15 +45,8 @@ static cl::opt<bool> SkipDelaySlotFiller(
|
|||||||
cl::Hidden);
|
cl::Hidden);
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct Filler : public MachineFunctionPass {
|
class Filler : public MachineFunctionPass {
|
||||||
typedef MachineBasicBlock::instr_iterator InstrIter;
|
public:
|
||||||
typedef MachineBasicBlock::reverse_instr_iterator ReverseInstrIter;
|
|
||||||
|
|
||||||
TargetMachine &TM;
|
|
||||||
const TargetInstrInfo *TII;
|
|
||||||
InstrIter LastFiller;
|
|
||||||
|
|
||||||
static char ID;
|
|
||||||
Filler(TargetMachine &tm)
|
Filler(TargetMachine &tm)
|
||||||
: MachineFunctionPass(ID), TM(tm), TII(tm.getInstrInfo()) { }
|
: MachineFunctionPass(ID), TM(tm), TII(tm.getInstrInfo()) { }
|
||||||
|
|
||||||
@ -61,7 +54,6 @@ namespace {
|
|||||||
return "Mips Delay Slot Filler";
|
return "Mips Delay Slot Filler";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool runOnMachineBasicBlock(MachineBasicBlock &MBB);
|
|
||||||
bool runOnMachineFunction(MachineFunction &F) {
|
bool runOnMachineFunction(MachineFunction &F) {
|
||||||
if (SkipDelaySlotFiller)
|
if (SkipDelaySlotFiller)
|
||||||
return false;
|
return false;
|
||||||
@ -73,6 +65,12 @@ namespace {
|
|||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef MachineBasicBlock::instr_iterator InstrIter;
|
||||||
|
typedef MachineBasicBlock::reverse_instr_iterator ReverseInstrIter;
|
||||||
|
|
||||||
|
bool runOnMachineBasicBlock(MachineBasicBlock &MBB);
|
||||||
|
|
||||||
bool isDelayFiller(MachineBasicBlock &MBB,
|
bool isDelayFiller(MachineBasicBlock &MBB,
|
||||||
InstrIter candidate);
|
InstrIter candidate);
|
||||||
|
|
||||||
@ -96,7 +94,11 @@ namespace {
|
|||||||
findDelayInstr(MachineBasicBlock &MBB, InstrIter slot,
|
findDelayInstr(MachineBasicBlock &MBB, InstrIter slot,
|
||||||
InstrIter &Filler);
|
InstrIter &Filler);
|
||||||
|
|
||||||
|
TargetMachine &TM;
|
||||||
|
const TargetInstrInfo *TII;
|
||||||
|
InstrIter LastFiller;
|
||||||
|
|
||||||
|
static char ID;
|
||||||
};
|
};
|
||||||
char Filler::ID = 0;
|
char Filler::ID = 0;
|
||||||
} // end of anonymous namespace
|
} // end of anonymous namespace
|
||||||
@ -108,8 +110,10 @@ runOnMachineBasicBlock(MachineBasicBlock &MBB) {
|
|||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
LastFiller = MBB.instr_end();
|
LastFiller = MBB.instr_end();
|
||||||
|
|
||||||
for (InstrIter I = MBB.instr_begin(); I != MBB.instr_end(); ++I)
|
for (InstrIter I = MBB.instr_begin(); I != MBB.instr_end(); ++I) {
|
||||||
if (I->hasDelaySlot()) {
|
if (!I->hasDelaySlot())
|
||||||
|
continue;
|
||||||
|
|
||||||
++FilledSlots;
|
++FilledSlots;
|
||||||
Changed = true;
|
Changed = true;
|
||||||
InstrIter InstrWithSlot = I;
|
InstrIter InstrWithSlot = I;
|
||||||
@ -131,8 +135,8 @@ runOnMachineBasicBlock(MachineBasicBlock &MBB) {
|
|||||||
// verifier doesn't expect this instruction to be a terminator.
|
// verifier doesn't expect this instruction to be a terminator.
|
||||||
MIBundleBuilder(MBB, InstrWithSlot, llvm::next(LastFiller));
|
MIBundleBuilder(MBB, InstrWithSlot, llvm::next(LastFiller));
|
||||||
}
|
}
|
||||||
return Changed;
|
|
||||||
|
|
||||||
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// createMipsDelaySlotFillerPass - Returns a pass that fills in delay
|
/// createMipsDelaySlotFillerPass - Returns a pass that fills in delay
|
||||||
|
Loading…
Reference in New Issue
Block a user