[llvm-commits] [llvm] r62158 - in /llvm/trunk: include/llvm/ADT/ilist.h include/llvm/Instruction.h lib/VMCore/Instruction.cpp
Chris Lattner
sabre at nondot.org
Mon Jan 12 23:43:51 PST 2009
Author: lattner
Date: Tue Jan 13 01:43:51 2009
New Revision: 62158
URL: http://llvm.org/viewvc/llvm-project?rev=62158&view=rev
Log:
add a new insertAfter method, patch by Tom Jablin!
Modified:
llvm/trunk/include/llvm/ADT/ilist.h
llvm/trunk/include/llvm/Instruction.h
llvm/trunk/lib/VMCore/Instruction.cpp
Modified: llvm/trunk/include/llvm/ADT/ilist.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist.h?rev=62158&r1=62157&r2=62158&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ilist.h (original)
+++ llvm/trunk/include/llvm/ADT/ilist.h Tue Jan 13 01:43:51 2009
@@ -384,6 +384,13 @@
return New;
}
+ iterator insertAfter(iterator where, NodeTy *New) {
+ if (empty())
+ return insert(begin(), New);
+ else
+ return insert(++where, New);
+ }
+
NodeTy *remove(iterator &IT) {
assert(IT != end() && "Cannot remove end of list!");
NodeTy *Node = &*IT;
Modified: llvm/trunk/include/llvm/Instruction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instruction.h?rev=62158&r1=62157&r2=62158&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instruction.h (original)
+++ llvm/trunk/include/llvm/Instruction.h Tue Jan 13 01:43:51 2009
@@ -101,6 +101,10 @@
/// immediately before the specified instruction.
void insertBefore(Instruction *InsertPos);
+ /// insertAfter - Insert an unlinked instructions into a basic block
+ /// immediately after the specified instruction.
+ void insertAfter(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=62158&r1=62157&r2=62158&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instruction.cpp (original)
+++ llvm/trunk/lib/VMCore/Instruction.cpp Tue Jan 13 01:43:51 2009
@@ -74,6 +74,12 @@
InsertPos->getParent()->getInstList().insert(InsertPos, this);
}
+/// insertAfter - Insert an unlinked instructions into a basic block
+/// immediately after the specified instruction.
+void Instruction::insertAfter(Instruction *InsertPos) {
+ InsertPos->getParent()->getInstList().insertAfter(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