summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-10-24 00:02:26 +0000
committerChris Lattner <sabre@nondot.org>2006-10-24 00:02:26 +0000
commit94866bef35da50d98058d6d0b5ede89d357bf842 (patch)
tree23bdb13d86c540f703437a69deefcd26567cc1f5 /llvm/lib/CodeGen/MachineBasicBlock.cpp
parentfdf614416848112917bfacefd766c7a42e02a12c (diff)
downloadbcm5719-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.cpp12
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);
OpenPOWER on IntegriCloud