本文整理汇总了C++中tr::Block::setIsCold方法的典型用法代码示例。如果您正苦于以下问题:C++ Block::setIsCold方法的具体用法?C++ Block::setIsCold怎么用?C++ Block::setIsCold使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tr::Block
的用法示例。
在下文中一共展示了Block::setIsCold方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tailSplitBlock
// This function splits a single succeesor block following an guard and is used to
// do the following transform
// block - cold1 block - cold1
// \ / => | |
// nextBlock nextBlock nextBlock' (called tailSplitBlock below)
// | \ /
// ... ...
void TR_VirtualGuardHeadMerger::tailSplitBlock(TR::Block * block, TR::Block * cold1)
{
TR::CFG *cfg = comp()->getFlowGraph();
cfg->setStructure(NULL);
TR_BlockCloner cloner(cfg);
TR::Block *tailSplitBlock = cloner.cloneBlocks(block->getNextBlock(), block->getNextBlock());
tailSplitBlock->setFrequency(cold1->getFrequency());
if (cold1->isCold())
tailSplitBlock->setIsCold();
// physically put the block after cold1 since we want cold1 to fall through
tailSplitBlock->getExit()->join(cold1->getExit()->getNextTreeTop());
cold1->getExit()->join(tailSplitBlock->getEntry());
// remove cold1's goto
TR::TransformUtil::removeTree(comp(), cold1->getExit()->getPrevRealTreeTop());
// copy the exception edges
for (auto e = block->getNextBlock()->getExceptionSuccessors().begin(); e != block->getNextBlock()->getExceptionSuccessors().end(); ++e)
cfg->addExceptionEdge(tailSplitBlock, (*e)->getTo());
cfg->addEdge(cold1, tailSplitBlock);
// lastly fix up the exit of tailSplitBlock
TR::Node *tailSplitEnd = tailSplitBlock->getExit()->getPrevRealTreeTop()->getNode();
if (tailSplitEnd->getOpCode().isGoto())
{
tailSplitEnd->setBranchDestination(block->getNextBlock()->getLastRealTreeTop()->getNode()->getBranchDestination());
cfg->addEdge(tailSplitBlock, block->getNextBlock()->getSuccessors().front()->getTo());
}
else if (tailSplitEnd->getOpCode().isBranch())
{
TR::Block *gotoBlock = TR::Block::createEmptyBlock(tailSplitEnd, comp(), cold1->getFrequency());
if (cold1->isCold())
gotoBlock->setIsCold(true);
gotoBlock->getExit()->join(tailSplitBlock->getExit()->getNextTreeTop());
tailSplitBlock->getExit()->join(gotoBlock->getEntry());
cfg->addNode(gotoBlock);
gotoBlock->append(TR::TreeTop::create(comp(), TR::Node::create(tailSplitEnd, TR::Goto, 0, block->getNextBlock()->getExit()->getNextTreeTop())));
cfg->addEdge(tailSplitBlock, gotoBlock);
cfg->addEdge(tailSplitBlock, tailSplitBlock->getLastRealTreeTop()->getNode()->getBranchDestination()->getEnclosingBlock());
cfg->addEdge(gotoBlock, block->getNextBlock()->getNextBlock());
}
else if (
!tailSplitEnd->getOpCode().isReturn() &&
!tailSplitEnd->getOpCode().isJumpWithMultipleTargets() &&
tailSplitEnd->getOpCodeValue() != TR::athrow &&
!(tailSplitEnd->getNumChildren() >= 1 && tailSplitEnd->getFirstChild()->getOpCodeValue() == TR::athrow)
)
{
tailSplitBlock->append(TR::TreeTop::create(comp(), TR::Node::create(tailSplitEnd, TR::Goto, 0, block->getNextBlock()->getExit()->getNextTreeTop())));
cfg->addEdge(tailSplitBlock, block->getNextBlock()->getNextBlock());
}
else
{
for (auto e = block->getNextBlock()->getSuccessors().begin(); e != block->getNextBlock()->getSuccessors().end(); ++e)
cfg->addEdge(tailSplitBlock, (*e)->getTo());
}
cfg->removeEdge(cold1, block->getNextBlock());
optimizer()->setUseDefInfo(NULL);
optimizer()->setValueNumberInfo(NULL);
}