本文整理汇总了C++中MIRGraph::insertBlockAfter方法的典型用法代码示例。如果您正苦于以下问题:C++ MIRGraph::insertBlockAfter方法的具体用法?C++ MIRGraph::insertBlockAfter怎么用?C++ MIRGraph::insertBlockAfter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MIRGraph
的用法示例。
在下文中一共展示了MIRGraph::insertBlockAfter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// A critical edge is an edge which is neither its successor's only predecessor
// nor its predecessor's only successor. Critical edges must be split to
// prevent copy-insertion and code motion from affecting other edges.
bool
ion::SplitCriticalEdges(MIRGraph &graph)
{
for (MBasicBlockIterator block(graph.begin()); block != graph.end(); block++) {
if (block->numSuccessors() < 2)
continue;
for (size_t i = 0; i < block->numSuccessors(); i++) {
MBasicBlock *target = block->getSuccessor(i);
if (target->numPredecessors() < 2)
continue;
// Create a new block inheriting from the predecessor.
MBasicBlock *split = MBasicBlock::NewSplitEdge(graph, block->info(), *block);
split->setLoopDepth(block->loopDepth());
graph.insertBlockAfter(*block, split);
split->end(MGoto::New(target));
block->replaceSuccessor(i, split);
target->replacePredecessor(*block, split);
}
}
return true;
}