本文整理汇总了C++中Branch::setElse方法的典型用法代码示例。如果您正苦于以下问题:C++ Branch::setElse方法的具体用法?C++ Branch::setElse怎么用?C++ Branch::setElse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Branch
的用法示例。
在下文中一共展示了Branch::setElse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: splitCriticalEdge
void PhiElimination::splitCriticalEdge(
IRFunction * func, BasicBlock * block)
{
//if (block->numOfPrecursors() <= 1)
// return;
auto GetInnerBlock = [func, block]
(const std::string &from, const std::string &to) {
BasicBlock *BB = func->createBasicBlock(from + "-" + to);
Goto *go2 = IRContext::create<Goto>(block);
BB->push_back(go2);
BB->addSuccessor(block);
go2->set_parent(BB);
return BB;
};
size_t size = block->numOfPrecursors();
for (auto pre = block->precursor_begin();
pre != block->precursor_end();
++pre) {
BasicBlock *PBB = *pre;
// Check whether split.
if (PBB->numOfSuccessors() <= 1)
continue;
// split it.
BasicBlock *BB = GetInnerBlock(
PBB->getBlockName(), block->getBlockName());
*pre = BB;
PBB->successor_replace(block, BB);
if (PBB->back()->is_goto()) {
Goto *GT = static_cast<Goto*>(PBB->back());
GT->setTarget(BB);
}
else if (PBB->back()->is_branch()) {
Branch *branch = static_cast<Branch*>(PBB->back());
if (branch->then() == block)
branch->setThen(BB);
else
branch->setElse(BB);
}
else {
assert(0 && "impossible");
}
}
}