本文整理汇总了C++中tr::Block::splitEdge方法的典型用法代码示例。如果您正苦于以下问题:C++ Block::splitEdge方法的具体用法?C++ Block::splitEdge怎么用?C++ Block::splitEdge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tr::Block
的用法示例。
在下文中一共展示了Block::splitEdge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRegDepInfo
void
TR::RegDepCopyRemoval::makeFreshCopy(TR_GlobalRegisterNumber reg)
{
RegDepInfo &dep = getRegDepInfo(reg);
if (!performTransformation(comp(),
"%schange %s in GlRegDeps n%un to an explicit copy of n%un\n",
optDetailString(),
registerName(reg),
_regDeps->getGlobalIndex(),
dep.value->getGlobalIndex()))
return;
// Split the block at fallthrough if necessary to avoid putting copies
// between branches and BBEnd.
TR::Node *curNode = _treetop->getNode();
if (curNode->getOpCodeValue() == TR::BBEnd)
{
TR::Block *curBlock = curNode->getBlock();
if (curBlock->getLastRealTreeTop() != curBlock->getLastNonControlFlowTreeTop())
{
TR::Block *fallthrough = curBlock->getNextBlock();
fallthrough = curBlock->splitEdge(curBlock, fallthrough, comp());
TR_ASSERT(curBlock->getNextBlock() == fallthrough, "bad block placement from splitEdge\n");
fallthrough->setIsExtensionOfPreviousBlock();
_treetop = fallthrough->getExit();
TR::Node *newNode = _treetop->getNode();
newNode->setChild(0, _regDeps);
newNode->setNumChildren(1);
curNode->setNumChildren(0);
if (trace())
traceMsg(comp(), "\tsplit fallthrough edge to insert copy, created block_%d\n", fallthrough->getNumber());
}
}
// Make and insert the copy
TR::Node *copyNode = NULL;
if (dep.value->getOpCode().isLoadConst())
{
// No need to depend on the other register.
// TODO heuristic for whether this is really better than a reg-reg move?
generateRegcopyDebugCounter("const-remat");
copyNode = TR::Node::create(dep.value->getOpCodeValue(), 0);
copyNode->setConstValue(dep.value->getConstValue());
}
else
{
generateRegcopyDebugCounter("fresh-copy");
copyNode = TR::Node::create(TR::PassThrough, 1, dep.value);
copyNode->setCopyToNewVirtualRegister();
}
TR::Node *copyTreetopNode = TR::Node::create(TR::treetop, 1, copyNode);
_treetop->insertBefore(TR::TreeTop::create(comp(), copyTreetopNode));
if (trace())
traceMsg(comp(), "\tcopy is n%un\n", copyNode->getGlobalIndex());
updateSingleRegDep(reg, copyNode);
}