Add an insertBefore method for attaching previously unattached instructions,

such as those created by clone(), to a basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52424 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2008-06-17 18:29:27 +00:00
parent 2b7470eb54
commit 26bb50ab48
2 changed files with 10 additions and 0 deletions

View File

@ -102,6 +102,10 @@ public:
///
void eraseFromParent();
/// insertBefore - Insert an unlinked instructions into a basic block
/// immediately before the specified instruction.
void insertBefore(Instruction *InsertPos);
/// moveBefore - Unlink this instruction from its current basic block and
/// insert it into the basic block that MovePos lives in, right before
/// MovePos.

View File

@ -68,6 +68,12 @@ void Instruction::eraseFromParent() {
getParent()->getInstList().erase(this);
}
/// insertBefore - Insert an unlinked instructions into a basic block
/// immediately before the specified instruction.
void Instruction::insertBefore(Instruction *InsertPos) {
InsertPos->getParent()->getInstList().insert(InsertPos, this);
}
/// moveBefore - Unlink this instruction from its current basic block and
/// insert it into the basic block that MovePos lives in, right before
/// MovePos.