diff options
author | Chris Lattner <sabre@nondot.org> | 2006-10-24 00:02:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-10-24 00:02:26 +0000 |
commit | 94866bef35da50d98058d6d0b5ede89d357bf842 (patch) | |
tree | 23bdb13d86c540f703437a69deefcd26567cc1f5 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | fdf614416848112917bfacefd766c7a42e02a12c (diff) | |
download | bcm5719-llvm-94866bef35da50d98058d6d0b5ede89d357bf842.tar.gz bcm5719-llvm-94866bef35da50d98058d6d0b5ede89d357bf842.zip |
add moveBefore/moveAfter helper methods
llvm-svn: 31145
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index ebd492c7ac2..fcc01299cd8 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -120,6 +120,18 @@ void MachineBasicBlock::print(std::ostream &OS) const { } } +void MachineBasicBlock::moveBefore(MachineBasicBlock *NewAfter) { + MachineFunction::BasicBlockListType &BBList =getParent()->getBasicBlockList(); + getParent()->getBasicBlockList().splice(NewAfter, BBList, this); +} + +void MachineBasicBlock::moveAfter(MachineBasicBlock *NewBefore) { + MachineFunction::BasicBlockListType &BBList =getParent()->getBasicBlockList(); + MachineFunction::iterator BBI = NewBefore; + getParent()->getBasicBlockList().splice(++BBI, BBList, this); +} + + void MachineBasicBlock::addSuccessor(MachineBasicBlock *succ) { Successors.push_back(succ); succ->addPredecessor(this); |