[llvm-commits] [llvm] r52424 - in /llvm/trunk: include/llvm/Instruction.h lib/VMCore/Instruction.cpp
Owen Anderson
resistor at mac.com
Tue Jun 17 11:29:27 PDT 2008
Author: resistor
Date: Tue Jun 17 13:29:27 2008
New Revision: 52424
URL: http://llvm.org/viewvc/llvm-project?rev=52424&view=rev
Log:
Add an insertBefore method for attaching previously unattached instructions,
such as those created by clone(), to a basic block.
Modified:
llvm/trunk/include/llvm/Instruction.h
llvm/trunk/lib/VMCore/Instruction.cpp
Modified: llvm/trunk/include/llvm/Instruction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instruction.h?rev=52424&r1=52423&r2=52424&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instruction.h (original)
+++ llvm/trunk/include/llvm/Instruction.h Tue Jun 17 13:29:27 2008
@@ -102,6 +102,10 @@
///
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.
Modified: llvm/trunk/lib/VMCore/Instruction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instruction.cpp?rev=52424&r1=52423&r2=52424&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instruction.cpp (original)
+++ llvm/trunk/lib/VMCore/Instruction.cpp Tue Jun 17 13:29:27 2008
@@ -68,6 +68,12 @@
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.
More information about the llvm-commits
mailing list