From c585a3f62adb2e491d792115af637ef75bdf489e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 24 Oct 2006 00:02:26 +0000 Subject: [PATCH] add moveBefore/moveAfter helper methods git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31145 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/MachineBasicBlock.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp index ebd492c7ac2..fcc01299cd8 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);