aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-06-17 18:29:27 +0000
committerOwen Anderson <resistor@mac.com>2008-06-17 18:29:27 +0000
commitc2d50caa7ba89e0614cf21a11d33530c69c084c5 (patch)
tree931011ab005e420535a3cca22020397b7d224154 /lib
parent4a85af47f06019931d6efd14165d4d9325051c89 (diff)
downloadexternal_llvm-c2d50caa7ba89e0614cf21a11d33530c69c084c5.zip
external_llvm-c2d50caa7ba89e0614cf21a11d33530c69c084c5.tar.gz
external_llvm-c2d50caa7ba89e0614cf21a11d33530c69c084c5.tar.bz2
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
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Instruction.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp
index 1fe7a2c..e8738d2 100644
--- a/lib/VMCore/Instruction.cpp
+++ b/lib/VMCore/Instruction.cpp
@@ -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.