本文整理汇总了C++中ListIterator::set方法的典型用法代码示例。如果您正苦于以下问题:C++ ListIterator::set方法的具体用法?C++ ListIterator::set怎么用?C++ ListIterator::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListIterator
的用法示例。
在下文中一共展示了ListIterator::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: postDominators
void
TR_ExpressionsSimplification::removeUncertainBlocks(TR_RegionStructure* region, List<TR::Block> *candidateBlocksList)
{
// Examine the top region block first
//
TR::Block *entryBlock = _currentRegion->getEntryBlock();
ListIterator<TR::Block> blocks;
blocks.set(candidateBlocksList);
if (trace())
traceMsg(comp(), "Number of blocks %d, entry block number %d\n", candidateBlocksList->getSize(), entryBlock->getNumber());
for (TR::Block *block = blocks.getFirst(); block; block = blocks.getNext())
{
TR::CFGNode *cfgNode = block;
if (!(cfgNode->getExceptionSuccessors().empty()) || blockHasCalls(block, comp()))
{
if (trace())
traceMsg(comp(), "An exception can be thrown from block_%d. Removing all the blocks, since we cannot know the number of iterations.\n", block->getNumber());
candidateBlocksList->deleteAll();
break;
}
}
TR_PostDominators postDominators(comp());
if (postDominators.isValid())
{
postDominators.findControlDependents();
for (TR::Block *block = blocks.getFirst(); block; block = blocks.getNext())
{
if (postDominators.dominates(block, entryBlock) == 0)
{
candidateBlocksList->remove(block);
if (trace())
traceMsg(comp(), "Block_%d is not guaranteed to be executed at least once. Removing it from the list.\n", block->getNumber());
}
}
}
else
{
if (trace())
traceMsg(comp(), "There is no post dominators information. Removing all the blocks.\n");
for (TR::Block *block = blocks.getFirst(); block; block = blocks.getNext())
{
candidateBlocksList->remove(block);
if (trace())
traceMsg(comp(), "Block_%d is removed from the list\n", block->getNumber());
}
}
}
示例2: traceMsg
void
TR_ExpressionsSimplification::findAndSimplifyInvariantLoopExpressions(TR_RegionStructure * region)
{
_currentRegion = region;
TR::Block *entryBlock = _currentRegion->getEntryBlock();
if (trace())
traceMsg(comp(), "Entry block: %p in loop region %p\n", entryBlock, region);
// Generate a list of blocks that can be processed
// Criteria: the block must be excucted exactly once
//
TR_ScratchList<TR::Block> candidateBlocksList(trMemory());
_currentRegion->getBlocks(&candidateBlocksList);
if (candidateBlocksList.getSize() > 1)
{
if (trace())
traceMsg(comp(), "More than 1 blocks in the natural loop, need to remove uncertain blocks\n");
removeUncertainBlocks(_currentRegion, &candidateBlocksList);
if (candidateBlocksList.getSize() < 1)
return;
}
_currentRegion->resetInvariance();
_currentRegion->computeInvariantExpressions();
// The rest is the transformation
//
// For each block that is definitely executed once
// analyze its nodes
//
ListIterator<TR::Block> candidateBlocks;
candidateBlocks.set(&candidateBlocksList);
simplifyInvariantLoopExpressions(candidateBlocks);
}