本文整理汇总了C++中tr::Node::setLocalIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::setLocalIndex方法的具体用法?C++ Node::setLocalIndex怎么用?C++ Node::setLocalIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tr::Node
的用法示例。
在下文中一共展示了Node::setLocalIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void TR::ValidateNodeRefCountWithinBlock::validate(TR::TreeTop *firstTreeTop,
TR::TreeTop *exitTreeTop)
{
_nodeChecklist.empty();
for (TR::TreeTop *tt = firstTreeTop; tt != exitTreeTop->getNextTreeTop();
tt = tt->getNextTreeTop())
{
TR::Node *node = tt->getNode();
node->setLocalIndex(node->getReferenceCount());
validateRefCountPass1(node);
}
/**
* We start again from the start of the block, and check the localIndex to
* make sure it is 0.
*
* NOTE: Walking the tree backwards causes huge stack usage in validateRefCountPass2.
*/
_nodeChecklist.empty();
for (TR::TreeTop *tt = firstTreeTop; tt != exitTreeTop->getNextTreeTop();
tt = tt->getNextTreeTop())
{
validateRefCountPass2(tt->getNode());
}
}
示例2: if
//.........这里部分代码省略.........
if (_numNullChecks == 0)
_nullCheckNodesAsArray = NULL;
else
{
_nullCheckNodesAsArray = (TR::Node**)trMemory()->allocateStackMemory(_numNullChecks*sizeof(TR::Node*));
memset(_nullCheckNodesAsArray, 0, _numNullChecks*sizeof(TR::Node*));
}
currentTree = comp()->getStartTree();
int32_t symRefCount = comp()->getSymRefCount();
_checkSymbolReferences = new (trStackMemory()) TR_BitVector(symRefCount, trMemory(), stackAlloc);
_numNodes = 1;
_numNullChecks = 0;
// This loop counts all the nodes that are going to take part in PRE.
// This is a computation intensive loop as we check if the node that
// is syntactically equivalent to a given node has been seen before
// and if so we use the local index of the original node (that
// is syntactically equivalent to the given node). Could be improved
// in complexity with value numbering at some stage.
//
_visitCount = comp()->incVisitCount();
while (currentTree)
{
TR::Node *firstNodeInTree = currentTree->getNode();
TR::ILOpCode *opCode = &firstNodeInTree->getOpCode();
if (((firstNodeInTree->getOpCodeValue() == TR::treetop) ||
(comp()->useAnchors() && firstNodeInTree->getOpCode().isAnchor())) &&
(firstNodeInTree->getFirstChild()->getOpCode().isStore()))
{
firstNodeInTree->setLocalIndex(-1);
if (comp()->useAnchors() && firstNodeInTree->getOpCode().isAnchor())
firstNodeInTree->getSecondChild()->setLocalIndex(-1);
firstNodeInTree = firstNodeInTree->getFirstChild();
opCode = &firstNodeInTree->getOpCode();
}
// This call finds nodes with opcodes that are supported by PRE
// in this subtree; this accounts for all opcodes other than stores/checks
// which are handled later on below
//
bool firstNodeInTreeHasCallsInStoreLhs = false;
countSupportedNodes(firstNodeInTree, NULL, firstNodeInTreeHasCallsInStoreLhs);
if ((opCode->isStore() && !firstNodeInTree->getSymbolReference()->getSymbol()->isAutoOrParm()) ||
opCode->isCheck())
{
int32_t oldExpressionOnRhs = hasOldExpressionOnRhs(firstNodeInTree);
//
// Return value 0 denotes that the node contains some sub-expression
// that cannot participate in PRE; e.g. a call or a new
//
// Return value -1 denotes that the node can participate in PRE
// but did not match with any existing expression seen so far
//
// Any other return value (should be positive always) denotes that
// the node can participate in PRE and has been matched with a seen
// expression having local index == return value
//
if (oldExpressionOnRhs == -1)
{