Add a convenience function on SILBasicBlock to move it after another Block

Swift SVN r19633
This commit is contained in:
Arnold Schwaighofer
2014-07-07 21:05:22 +00:00
parent 7207b6ca0b
commit 2e83bdf01b
2 changed files with 13 additions and 0 deletions

View File

@@ -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);
}