本文整理汇总了C++中tr::Block类的典型用法代码示例。如果您正苦于以下问题:C++ Block类的具体用法?C++ Block怎么用?C++ Block使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Block类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: analyzeTreeTopsInBlockStructure
void TR_Latestness::analyzeTreeTopsInBlockStructure(TR_BlockStructure *blockStructure)
{
TR::Block *block = blockStructure->getBlock();
TR::TreeTop *currentTree = block->getExit();
TR::TreeTop *entryTree = block->getEntry();
/////copyFromInto(_regularInfo, _outSetInfo[blockStructure->getNumber()]);
bool notSeenTreeWithChecks = true;
_containsExceptionTreeTop = false;
while (!(currentTree == entryTree))
{
if (notSeenTreeWithChecks)
{
bool currentTreeHasChecks = treeHasChecks(currentTree);
if (currentTreeHasChecks)
{
notSeenTreeWithChecks = false;
_containsExceptionTreeTop = true;
/////compose(_regularInfo, _exceptionInfo);
/////compose(_outSetInfo[blockStructure->getNumber()], _exceptionInfo);
}
}
else
break;
if (!(currentTree == entryTree))
currentTree = currentTree->getPrevTreeTop();
}
}
示例2: initializeGenAndKillSetInfo
void TR_ReachingDefinitions::initializeGenAndKillSetInfo()
{
// For each block in the CFG build the gen and kill set for this analysis.
// Go in treetop order, which guarantees that we see the correct (i.e. first)
// evaluation point for each node.
//
TR::Block *block;
int32_t blockNum = 0;
bool seenException = false;
TR_BitVector defsKilled(getNumberOfBits(), trMemory()->currentStackRegion());
comp()->incVisitCount();
for (TR::TreeTop *treeTop = comp()->getStartTree(); treeTop; treeTop = treeTop->getNextTreeTop())
{
TR::Node *node = treeTop->getNode();
if (node->getOpCodeValue() == TR::BBStart)
{
block = node->getBlock();
blockNum = block->getNumber();
seenException = false;
if (traceRD())
traceMsg(comp(), "\nNow generating gen and kill information for block_%d\n", blockNum);
continue;
}
#if DEBUG
if (node->getOpCodeValue() == TR::BBEnd && traceRD())
{
traceMsg(comp(), " Block %d:\n", blockNum);
traceMsg(comp(), " Gen set ");
if (_regularGenSetInfo[blockNum])
_regularGenSetInfo[blockNum]->print(comp());
else
traceMsg(comp(), "{}");
traceMsg(comp(), "\n Kill set ");
if (_regularKillSetInfo[blockNum])
_regularKillSetInfo[blockNum]->print(comp());
else
traceMsg(comp(), "{}");
traceMsg(comp(), "\n Exception Gen set ");
if (_exceptionGenSetInfo[blockNum])
_exceptionGenSetInfo[blockNum]->print(comp());
else
traceMsg(comp(), "{}");
traceMsg(comp(), "\n Exception Kill set ");
if (_exceptionKillSetInfo[blockNum])
_exceptionKillSetInfo[blockNum]->print(comp());
else
traceMsg(comp(), "{}");
continue;
}
#endif
initializeGenAndKillSetInfoForNode(node, defsKilled, seenException, blockNum, NULL);
if (!seenException && treeHasChecks(treeTop))
seenException = true;
}
}
示例3: insertReturnAsyncChecks
int32_t TR_AsyncCheckInsertion::insertReturnAsyncChecks(TR::Optimization *opt, const char *counterPrefix)
{
TR::Compilation * const comp = opt->comp();
if (opt->trace())
traceMsg(comp, "Inserting return asyncchecks (%s)\n", counterPrefix);
int numAsyncChecksInserted = 0;
for (TR::TreeTop *treeTop = comp->getStartTree();
treeTop;
/* nothing */ )
{
TR::Block *block = treeTop->getNode()->getBlock();
if (block->getLastRealTreeTop()->getNode()->getOpCode().isReturn()
&& performTransformation(comp,
"%sInserting return asynccheck (%s) in block_%d\n",
opt->optDetailString(),
counterPrefix,
block->getNumber()))
{
insertAsyncCheck(block, comp, counterPrefix);
numAsyncChecksInserted++;
}
treeTop = block->getExit()->getNextRealTreeTop();
}
return numAsyncChecksInserted;
}
示例4: resetBlockVisitFlags
static void resetBlockVisitFlags(TR::Compilation *comp)
{
for (TR::Block *block = comp->getStartBlock(); block != NULL; block = block->getNextBlock())
{
block->setHasBeenVisited(false);
}
}
示例5: it
// Process the structure recursively
//
int32_t
TR_ExpressionsSimplification::perform(TR_Structure * str)
{
if (trace())
traceMsg(comp(), "Analyzing root Structure : %p\n", str);
TR_RegionStructure *region;
// Only regions can be simplified
//
if (!(region = str->asRegion()))
return 0;
TR_RegionStructure::Cursor it(*region);
for (TR_StructureSubGraphNode *node = it.getCurrent();
node != 0;
node = it.getNext())
{
// Too strict
/*
if ((node->getPredecessors().size() == 1))
{
TR::CFGEdge *edge = node->getPredecessors().front();
TR_StructureSubGraphNode *pred = toStructureSubGraphNode(edge->getFrom());
TR_BlockStructure *b = pred->getStructure()->asBlock();
if (b && pred->getSuccessors().size() == 1))
perform(node->getStructure());
}
*/
perform(node->getStructure());
}
// debug only
//
/*
if (region->isNaturalLoop() &&
(region->getParent() &&
!region->getParent()->asRegion()->isCanonicalizedLoop()))
{
traceMsg(comp(), "Loop not canonicalized %x\n", region);
}
*/
TR::Block *entryBlock = region->getEntryBlock();
if (region->isNaturalLoop() && !entryBlock->isCold() &&
(region->getParent() /* &&
region->getParent()->asRegion()->isCanonicalizedLoop() */))
{
if (trace())
traceMsg(comp(), "Found candidate non cold loop %p for expression elimination\n", region);
findAndSimplifyInvariantLoopExpressions(region);
}
return 1; // Need to specify the cost
}
示例6: self
TR::TreeTop *
OMR::TreeTop::getExtendedBlockExitTreeTop()
{
TR_ASSERT(self()->getNode()->getOpCodeValue() == TR::BBStart, "getExitTreeTop, is only valid for a bbStart");
TR::Block * b;
TR::TreeTop * exitTT = self()->getNode()->getBlock()->getExit(), * nextTT;
while ((nextTT = exitTT->getNextTreeTop()) && (b = nextTT->getNode()->getBlock(), b->isExtensionOfPreviousBlock()))
exitTT = b->getExit();
return exitTT;
}
示例7: getBlock
void
TR_ForwardReachabilityWithoutExceptionEdges::propagateInputs(blocknum_t blockNum, int32_t depth, blocknum_t *stack, blocknum_t *depth_map, TR_BitVector *closure)
{
TR::Block *block = getBlock(blockNum);
for (auto edge = block->getPredecessors().begin(); edge != block->getPredecessors().end(); ++edge)
{
TR::Block *inputBlock = toBlock((*edge)->getFrom());
propagateOneInput(inputBlock->getNumber(), blockNum, depth, stack, depth_map, closure);
}
}
示例8: bi
void
TR_BackwardReachability::propagateInputs(blocknum_t blockNum, int32_t depth, blocknum_t *stack, blocknum_t *depth_map, TR_BitVector *closure)
{
TR::Block *block = getBlock(blockNum);
TR_SuccessorIterator bi(block);
for (TR::CFGEdge *edge = bi.getFirst(); edge != NULL; edge = bi.getNext())
{
TR::Block *inputBlock = toBlock(edge->getTo());
propagateOneInput(inputBlock->getNumber(), blockNum, depth, stack, depth_map, closure);
}
}
示例9: 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);
}
示例10: 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());
}
}
}
示例11: initializeBlocks
void TR_LocalAnalysis::initializeBlocks(TR::Block *block, TR::BitVector &blocksSeen)
{
_info[block->getNumber()]._block = block;
blocksSeen[block->getNumber()] = true;
TR::Block *next;
for (auto nextEdge = block->getSuccessors().begin(); nextEdge != block->getSuccessors().end(); ++nextEdge)
{
next = toBlock((*nextEdge)->getTo());
if (!blocksSeen.ValueAt(next->getNumber()))
initializeBlocks(next, blocksSeen);
}
for (auto nextEdge = block->getExceptionSuccessors().begin(); nextEdge != block->getExceptionSuccessors().end(); ++nextEdge)
{
next = toBlock((*nextEdge)->getTo());
if (!blocksSeen.ValueAt(next->getNumber()))
initializeBlocks(next, blocksSeen);
}
}
示例12: perform
int32_t TR_LocalLiveRangeReduction::perform()
{
if (TR::Compiler->target.cpu.isZ())
return false;
TR::TreeTop * exitTT, * nextTT;
TR::Block *b;
TR::TreeTop * tt;
//calculate number of TreeTops in each bb (or extended bb)
for (tt = comp()->getStartTree(); tt; tt = nextTT)
{
TR::StackMemoryRegion stackMemoryRegion(*trMemory());
TR::Node *node = tt->getNode();
b = node->getBlock();
exitTT = b->getExit();
_numTreeTops = b->getNumberOfRealTreeTops()+2; //include both BBStart/BBend
//support for extended blocks
while ((nextTT = exitTT->getNextTreeTop()) && (b = nextTT->getNode()->getBlock(), b->isExtensionOfPreviousBlock()))
{
_numTreeTops += b->getNumberOfRealTreeTops()+2;
exitTT = b->getExit();
}
_treesRefInfoArray = (TR_TreeRefInfo**)trMemory()->allocateStackMemory(_numTreeTops*sizeof(TR_TreeRefInfo*));
memset(_treesRefInfoArray, 0, _numTreeTops*sizeof(TR_TreeRefInfo*));
_movedTreesList.deleteAll();
_depPairList.deleteAll();
transformExtendedBlock(tt,exitTT->getNextTreeTop());
}
if (trace())
traceMsg(comp(), "\nEnding LocalLiveRangeReducer\n");
return 2;
}
示例13: comp
void
TR_ExpressionsSimplification::invalidateCandidates()
{
_visitCount = comp()->incVisitCount();
if (trace())
{
traceMsg(comp(), "Checking which candidates may be invalidated\n");
ListIterator<TR::TreeTop> treeTops(_candidateTTs);
for (TR::TreeTop *treeTop = treeTops.getFirst(); treeTop; treeTop = treeTops.getNext())
{
traceMsg(comp(), " Candidate treetop: %p node: %p\n", treeTop, treeTop->getNode());
}
}
TR_ScratchList<TR::Block> blocksInLoop(trMemory());
_currentRegion->getBlocks(&blocksInLoop);
ListIterator<TR::Block> blocks(&blocksInLoop);
for (TR::Block *currentBlock = blocks.getFirst(); currentBlock; currentBlock = blocks.getNext())
{
TR::TreeTop *tt = currentBlock->getEntry();
TR::TreeTop *exitTreeTop = currentBlock->getExit();
while (tt != exitTreeTop)
{
TR::Node *currentNode = tt->getNode();
if (trace())
traceMsg(comp(), "Looking at treeTop [%p]\n", currentNode);
removeCandidate(currentNode, tt);
tt = tt->getNextTreeTop();
}
}
removeUnsupportedCandidates();
}
示例14: toBlock
TR::Block *
TR_ExpressionsSimplification::findPredecessorBlock(TR::CFGNode *entryNode)
{
if (!(entryNode->getPredecessors().size() == 2))
return 0;
TR::Block *block = 0;
for (auto edge = entryNode->getPredecessors().begin(); edge != entryNode->getPredecessors().end(); ++edge)
{
if ((*edge)->getFrom()->getSuccessors().size() == 1)
{
block = toBlock((*edge)->getFrom());
if (block->getStructureOf()->isLoopInvariantBlock())
break;
else
block = 0;
}
}
//traceMsg(comp(), "Commoned code will be put in block_%d\n", block->getNumber());
return block;
}
示例15: comp
void
TR_ReachabilityAnalysis::perform(TR_BitVector *result)
{
TR::CFG *cfg = comp()->getFlowGraph();
int32_t numBlockIndexes = cfg->getNextNodeNumber();
int32_t numBlocks = cfg->getNumberOfNodes();
_blocks = cfg->createArrayOfBlocks();
blocknum_t *stack = (blocknum_t*)comp()->trMemory()->allocateStackMemory(numBlockIndexes * sizeof(stack[0]));
blocknum_t *depthMap = (blocknum_t*)comp()->trMemory()->allocateStackMemory(numBlockIndexes * sizeof(depthMap[0]));
memset(depthMap, 0, numBlockIndexes * sizeof(depthMap[0]));
bool trace = comp()->getOption(TR_TraceReachability);
if (trace)
traceMsg(comp(), "BEGIN REACHABILITY: %d blocks\n", numBlocks);
for (TR::Block *block = comp()->getStartBlock(); block; block = block->getNextBlock())
{
blocknum_t blockNum = block->getNumber();
if (trace)
traceMsg(comp(), "Visit block_%d\n", blockNum);
if (depthMap[blockNum] == 0)
traverse(blockNum, 0, stack, depthMap, result);
else
traceMsg(comp(), " depth is already %d; skip\n", depthMap[blockNum]);
}
if (comp()->getOption(TR_TraceReachability))
{
traceMsg(comp(), "END REACHABILITY. Result:\n");
result->print(comp(), comp()->getOutFile());
traceMsg(comp(), "\n");
}
}