forked from OSchip/llvm-project
add a new insertAfter method, patch by Tom Jablin!
llvm-svn: 62158
This commit is contained in:
parent
70ff972e52
commit
6e66d0a6a1
|
@ -384,6 +384,13 @@ public:
|
|||
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;
|
||||
|
|
|
@ -101,6 +101,10 @@ public:
|
|||
/// 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.
|
||||
|
|
|
@ -74,6 +74,12 @@ void Instruction::insertBefore(Instruction *InsertPos) {
|
|||
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.
|
||||
|
|
Loading…
Reference in New Issue