mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-22 11:55:12 +00:00
Implement the new InsertInstBeforeInst function
llvm-svn: 1930
This commit is contained in:
parent
14fe793707
commit
559c71f6f4
@ -67,6 +67,20 @@ void ReplaceInstWithInst(Instruction *From, Instruction *To) {
|
||||
ReplaceInstWithInst(BIL, BI, To);
|
||||
}
|
||||
|
||||
// InsertInstBeforeInst - Insert 'NewInst' into the basic block that 'Existing'
|
||||
// is already in, and put it right before 'Existing'. This instruction should
|
||||
// only be used when there is no iterator to Existing already around. The
|
||||
// returned iterator points to the new instruction.
|
||||
//
|
||||
BasicBlock::iterator InsertInstBeforeInst(Instruction *NewInst,
|
||||
Instruction *Existing) {
|
||||
BasicBlock *BB = Existing->getParent();
|
||||
BasicBlock::InstListType &BIL = BB->getInstList();
|
||||
BasicBlock::iterator BI = find(BIL.begin(), BIL.end(), Existing);
|
||||
assert(BI != BIL.end() && "Inst not in it's parents BB!");
|
||||
return BIL.insert(BI, NewInst);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// getStructOffsetType - Return a vector of offsets that are to be used to index
|
||||
|
Loading…
x
Reference in New Issue
Block a user