llvm.org GIT mirror llvm / 3ff704f
add a new insertAfter method, patch by Tom Jablin! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62158 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 11 years ago
3 changed file(s) with 17 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
383383 return New;
384384 }
385385
386 iterator insertAfter(iterator where, NodeTy *New) {
387 if (empty())
388 return insert(begin(), New);
389 else
390 return insert(++where, New);
391 }
392
386393 NodeTy *remove(iterator &IT) {
387394 assert(IT != end() && "Cannot remove end of list!");
388395 NodeTy *Node = &*IT;
100100 /// immediately before the specified instruction.
101101 void insertBefore(Instruction *InsertPos);
102102
103 /// insertAfter - Insert an unlinked instructions into a basic block
104 /// immediately after the specified instruction.
105 void insertAfter(Instruction *InsertPos);
106
103107 /// moveBefore - Unlink this instruction from its current basic block and
104108 /// insert it into the basic block that MovePos lives in, right before
105109 /// MovePos.
7171 /// immediately before the specified instruction.
7272 void Instruction::insertBefore(Instruction *InsertPos) {
7373 InsertPos->getParent()->getInstList().insert(InsertPos, this);
74 }
75
76 /// insertAfter - Insert an unlinked instructions into a basic block
77 /// immediately after the specified instruction.
78 void Instruction::insertAfter(Instruction *InsertPos) {
79 InsertPos->getParent()->getInstList().insertAfter(InsertPos, this);
7480 }
7581
7682 /// moveBefore - Unlink this instruction from its current basic block and