本文整理汇总了C++中ListIterator::getFirst方法的典型用法代码示例。如果您正苦于以下问题:C++ ListIterator::getFirst方法的具体用法?C++ ListIterator::getFirst怎么用?C++ ListIterator::getFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListIterator
的用法示例。
在下文中一共展示了ListIterator::getFirst方法的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: simplifyInvariantLoopExpressions
void TR_ExpressionsSimplification::simplifyInvariantLoopExpressions(ListIterator<TR::Block> &blocks)
{
// Need to locate the induction variable of the loop
//
LoopInfo *loopInfo = findLoopInfo(_currentRegion);
if (trace())
{
if (!loopInfo)
{
traceMsg(comp(), "Accurate loop info is not found, cannot carry out summation reduction\n");
}
else
{
traceMsg(comp(), "Accurate loop info has been found, will try to carry out summation reduction\n");
if (loopInfo->getBoundaryNode())
{
traceMsg(comp(), "Variable iterations from node %p has not been handled\n",loopInfo->getBoundaryNode());
}
else
{
traceMsg(comp(), "Natural Loop %p will run %d times\n", _currentRegion, loopInfo->getNumIterations());
}
}
}
// Initialize the list of candidates
//
_candidateTTs = new (trStackMemory()) TR_ScratchList<TR::TreeTop>(trMemory());
for (TR::Block *currentBlock = blocks.getFirst(); currentBlock; currentBlock = blocks.getNext())
{
if (trace())
traceMsg(comp(), "Analyzing block #%d, which must be executed once per iteration\n", currentBlock->getNumber());
// Scan through each node in the block
//
TR::TreeTop *tt = currentBlock->getEntry();
TR::TreeTop *exitTreeTop = currentBlock->getExit();
while (tt != exitTreeTop)
{
TR::Node *currentNode = tt->getNode();
if (trace())
traceMsg(comp(), "Analyzing tree top node %p\n", currentNode);
if (loopInfo)
{
// requires loop info for the number of iterations
setSummationReductionCandidates(currentNode, tt);
}
setStoreMotionCandidates(currentNode, tt);
tt = tt->getNextTreeTop();
}
}
// New code: without using any UDI
// walk through the trees in the loop
// to invalidate the candidates
//
if (!_supportedExpressions)
{
_supportedExpressions = new (trStackMemory()) TR_BitVector(comp()->getNodeCount(), trMemory(), stackAlloc, growable);
}
invalidateCandidates();
ListIterator<TR::TreeTop> treeTops(_candidateTTs);
for (TR::TreeTop *treeTop = treeTops.getFirst(); treeTop; treeTop = treeTops.getNext())
{
if (trace())
traceMsg(comp(), "Candidate TreeTop: %p, Node:%p\n", treeTop, treeTop->getNode());
bool usedCandidate = false;
bool isPreheaderBlockInvalid = false;
if (loopInfo)
{
usedCandidate = tranformSummationReductionCandidate(treeTop, loopInfo, &isPreheaderBlockInvalid);
}
if (isPreheaderBlockInvalid)
{
break;
}
if (!usedCandidate)
{
tranformStoreMotionCandidate(treeTop, &isPreheaderBlockInvalid);
}
if (isPreheaderBlockInvalid)
{
break;
}
}
}