From e09bbc800c90ca12f65926b8fd013f693c6f5525 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 12 Aug 2005 22:14:06 +0000 Subject: [PATCH] Add a helper method llvm-svn: 22768 --- llvm/lib/VMCore/BasicBlock.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/llvm/lib/VMCore/BasicBlock.cpp b/llvm/lib/VMCore/BasicBlock.cpp index 66344db1501c..ab7798c3866e 100644 --- a/llvm/lib/VMCore/BasicBlock.cpp +++ b/llvm/lib/VMCore/BasicBlock.cpp @@ -102,6 +102,14 @@ void BasicBlock::eraseFromParent() { getParent()->getBasicBlockList().erase(this); } +/// moveBefore - Unlink this instruction from its current function and +/// insert it into the function that MovePos lives in, right before +/// MovePos. +void BasicBlock::moveBefore(BasicBlock *MovePos) { + MovePos->getParent()->getBasicBlockList().splice(MovePos, + getParent()->getBasicBlockList(), this); +} + TerminatorInst *BasicBlock::getTerminator() { if (InstList.empty()) return 0;