mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add a convenience function on SILBasicBlock to move it after another Block
Swift SVN r19633
This commit is contained in:
@@ -129,3 +129,12 @@ SILBasicBlock *SILBasicBlock::splitBasicBlockAndBranch(iterator I,
|
||||
BranchInst::create(BranchLoc, New, *getParent()));
|
||||
return New;
|
||||
}
|
||||
|
||||
/// \brief Move the basic block to after the specified basic block in the IR.
|
||||
void SILBasicBlock::moveAfter(SILBasicBlock *After) {
|
||||
assert(getParent() && getParent() == After->getParent() &&
|
||||
"Blocks must be in the same function");
|
||||
auto InsertPt = std::next(SILFunction::iterator(After));
|
||||
auto &BlkList = getParent()->getBlocks();
|
||||
BlkList.splice(InsertPt, BlkList, this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user