aboutsummaryrefslogtreecommitdiffstats
path: root/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
commitc585a3f62adb2e491d792115af637ef75bdf489e (patch)
treec24cbefba827d854cca2d91d7e9bc0dfea7a1b3d /lib/CodeGen/MachineBasicBlock.cpp
parent2a4dd685357e2fd248ab458d3bed4ea21350815b (diff)
downloadexternal_llvm-c585a3f62adb2e491d792115af637ef75bdf489e.zip
external_llvm-c585a3f62adb2e491d792115af637ef75bdf489e.tar.gz
external_llvm-c585a3f62adb2e491d792115af637ef75bdf489e.tar.bz2
add moveBefore/moveAfter helper methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31145 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r--lib/CodeGen/MachineBasicBlock.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp
index ebd492c..fcc0129 100644
--- a/lib/CodeGen/MachineBasicBlock.cpp
+++ b/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);