Tighten up the splice() API for bundled instructions.

Remove the instr_iterator versions of the splice() functions. It doesn't
seem useful to be able to splice sequences of instructions that don't
consist of full bundles.

The normal splice functions that take MBB::iterator arguments are not
changed, and they can move whole bundles around without any problems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170456 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen
2012-12-18 20:59:41 +00:00
parent 04f52e1300
commit 9b04104a5e
2 changed files with 16 additions and 28 deletions

View File

@@ -524,23 +524,24 @@ public:
Insts.clear(); Insts.clear();
} }
/// splice - Take an instruction from MBB 'Other' at the position From, /// Take an instruction from MBB 'Other' at the position From, and insert it
/// and insert it into this MBB right before 'where'. /// into this MBB right before 'Where'.
void splice(instr_iterator where, MachineBasicBlock *Other, ///
instr_iterator From) { /// If From points to a bundle of instructions, the whole bundle is moved.
Insts.splice(where, Other->Insts, From); void splice(iterator Where, MachineBasicBlock *Other, iterator From) {
// The range splice() doesn't allow noop moves, but this one does.
if (Where != From)
splice(Where, Other, From, llvm::next(From));
} }
void splice(iterator where, MachineBasicBlock *Other, iterator From);
/// splice - Take a block of instructions from MBB 'Other' in the range [From, /// Take a block of instructions from MBB 'Other' in the range [From, To),
/// To), and insert them into this MBB right before 'where'. /// and insert them into this MBB right before 'Where'.
void splice(instr_iterator where, MachineBasicBlock *Other, instr_iterator From, ///
instr_iterator To) { /// The instruction at 'Where' must not be included in the range of
Insts.splice(where, Other->Insts, From, To); /// instructions to move.
} void splice(iterator Where, MachineBasicBlock *Other,
void splice(iterator where, MachineBasicBlock *Other, iterator From, iterator From, iterator To) {
iterator To) { Insts.splice(Where.getInstrIterator(), Other->Insts,
Insts.splice(where.getInstrIterator(), Other->Insts,
From.getInstrIterator(), To.getInstrIterator()); From.getInstrIterator(), To.getInstrIterator());
} }

View File

@@ -826,19 +826,6 @@ MachineBasicBlock::insert(instr_iterator I, MachineInstr *MI) {
return Insts.insert(I, MI); return Insts.insert(I, MI);
} }
void MachineBasicBlock::splice(MachineBasicBlock::iterator where,
MachineBasicBlock *Other,
MachineBasicBlock::iterator From) {
if (From->isBundle()) {
MachineBasicBlock::iterator To = llvm::next(From);
Insts.splice(where.getInstrIterator(), Other->Insts,
From.getInstrIterator(), To.getInstrIterator());
return;
}
Insts.splice(where.getInstrIterator(), Other->Insts, From.getInstrIterator());
}
/// removeFromParent - This method unlinks 'this' from the containing function, /// removeFromParent - This method unlinks 'this' from the containing function,
/// and returns it, but does not delete it. /// and returns it, but does not delete it.
MachineBasicBlock *MachineBasicBlock::removeFromParent() { MachineBasicBlock *MachineBasicBlock::removeFromParent() {