diff options
author | Owen Anderson <resistor@mac.com> | 2008-06-17 18:29:27 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-06-17 18:29:27 +0000 |
commit | 26bb50ab48c561adfd32d129e0eff0cbf0a04625 (patch) | |
tree | 931011ab005e420535a3cca22020397b7d224154 /lib | |
parent | 2b7470eb54880ce7f74469d6e09eaf7f0864f8ab (diff) | |
download | llvm-26bb50ab48c561adfd32d129e0eff0cbf0a04625.tar.gz llvm-26bb50ab48c561adfd32d129e0eff0cbf0a04625.tar.bz2 llvm-26bb50ab48c561adfd32d129e0eff0cbf0a04625.tar.xz |
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.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp index 1fe7a2cc8b..e8738d2ba7 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. |