1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 13:11:39 +01:00

Add an insertBefore method for attaching previously unattached instructions,

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

llvm-svn: 52424
This commit is contained in:
Owen Anderson 2008-06-17 18:29:27 +00:00
parent 609a53ac86
commit 79605db969
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.