当前位置: 首页>>代码示例>>C++>>正文


C++ Node::setAndIncChild方法代码示例

本文整理汇总了C++中tr::Node::setAndIncChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::setAndIncChild方法的具体用法?C++ Node::setAndIncChild怎么用?C++ Node::setAndIncChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tr::Node的用法示例。


在下文中一共展示了Node::setAndIncChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

TR::Node *TR_OutlinedInstructions::createOutlinedCallNode(TR::Node *callNode, TR::ILOpCodes callOp)
   {
   int32_t   i;
   TR::Node  *child;

   //We pass true for getSymbolReference because
   TR::Node *newCallNode = TR::Node::createWithSymRef(callNode, callOp, callNode->getNumChildren(), callNode->getSymbolReference());

   newCallNode->setReferenceCount(1);

   for (i=0; i<callNode->getNumChildren(); i++)
      {
      child = callNode->getChild(i);

      if (child->getRegister() != NULL)
         {
         // Child has already been evaluated outside this tree.
         //
         newCallNode->setAndIncChild(i, child);
         }
      else if (child->getOpCode().isLoadConst())
         {
         // Copy unevaluated constant nodes.
         //
         child = TR::Node::copy(child);
         child->setReferenceCount(1);
         newCallNode->setChild(i, child);
         }
      else
         {
         if ((child->getOpCodeValue() == TR::loadaddr) &&
             /*(callNode->getOpCodeValue() == TR::instanceof || callNode->getOpCodeValue() == TR::checkcast || callNode->getOpCodeValue() == TR::checkcastAndNULLCHK || callNode->getOpCodeValue() == TR::New || callNode->getOpCodeValue() == TR::anewarray)    &&*/
             (child->getSymbolReference()->getSymbol()) &&
             (child->getSymbolReference()->getSymbol()->getStaticSymbol()))
            {
            child = TR::Node::copy(child);
            child->setReferenceCount(1);
            newCallNode->setChild(i, child);
            }
         else
            {
            // Be very conservative at this point, even though it is possible to make it less so.  For example, this will catch
            // the case of an unevaluated argument not persisting outside of the outlined region even though one of its subtrees will.
            //
            (void)_cg->evaluate(child);

            // Do not decrement the reference count here.  It will be decremented when the call node is evaluated
            // again in the helper instruction stream.
            //
            newCallNode->setAndIncChild(i, child);
            }
         }
      }
   if(callNode->isPreparedForDirectJNI())
      {
         newCallNode->setPreparedForDirectJNI();
      }

   return newCallNode;
   }
开发者ID:TianyuZuo,项目名称:omr,代码行数:60,代码来源:OutlinedInstructions.cpp

示例2: traceMsg

TR::Node *
OMR::TransformUtil::scalarizeAddressParameter(
      TR::Compilation *comp,
      TR::Node *address,
      size_t byteLengthOrPrecision, // precision for BCD types and byteLength for all other types
      TR::DataType dataType,
      TR::SymbolReference *ref,
      bool store)
   {
   TR_ASSERT(ref,"symRef should not be NULL in scalarizeAddressParameter for address node %p\n",address);

   TR::Node * loadOrStore = NULL;

#ifdef J9_PROJECT_SPECIFIC
   size_t byteLength = dataType.isBCD() ? TR::DataType::getSizeFromBCDPrecision(dataType, byteLengthOrPrecision) : byteLengthOrPrecision;
#else
   size_t byteLength = byteLengthOrPrecision;
#endif

   bool isLengthValidForDirect = false;
   if (address->getOpCodeValue() == TR::loadaddr &&
       address->getOpCode().hasSymbolReference() &&
       address->getSymbolReference() &&
       !address->getSymbol()->isStatic())
      {
      if (byteLength == address->getSymbol()->getSize())
         isLengthValidForDirect = true;
      }

   if (address->getOpCodeValue() == TR::loadaddr &&
            !address->getSymbol()->isStatic() &&
            isLengthValidForDirect &&
            address->getSymbolReference() == ref &&
            ref->getSymbol()->getDataType() == dataType)
      {
      if (comp->getOption(TR_TraceScalarizeSSOps))
         traceMsg(comp,"\n\tscalarizeAddressParameter auto direct case: address %p, dt %s\n",address,dataType.toString());

      TR::ILOpCodes opcode = store ? comp->il.opCodeForDirectStore(dataType)
                                  : comp->il.opCodeForDirectLoad(dataType);

      loadOrStore = TR::Node::create(address, opcode, store ? 1 : 0);
      loadOrStore->setSymbolReference(ref);
      }
   else
      {
      TR::ILOpCodes opcode = store ? comp->il.opCodeForIndirectArrayStore(dataType)
                                  : comp->il.opCodeForIndirectArrayLoad(dataType);

      loadOrStore = TR::Node::create(address, opcode, store ? 2 : 1);
      loadOrStore->setSymbolReference(ref);
      loadOrStore->setAndIncChild(0, address);
      }

   if (byteLength == 8)
      {
      comp->getJittedMethodSymbol()->setMayHaveLongOps(true);
      }
#ifdef J9_PROJECT_SPECIFIC
   if (loadOrStore->getType().isBCD())
      {
      loadOrStore->setDecimalPrecision(byteLengthOrPrecision);
      }
   else
#endif
      if (!store && loadOrStore->getType().isIntegral() && !loadOrStore->getType().isInt64())
      {
      loadOrStore->setUnsigned(true);
      }

   return loadOrStore;
   }
开发者ID:lmaisons,项目名称:omr,代码行数:72,代码来源:OMRTransformUtil.cpp

示例3: stackRegion

int32_t TR::DeadTreesElimination::process(TR::TreeTop *startTree, TR::TreeTop *endTree)
   {
   TR::StackMemoryRegion stackRegion(*comp()->trMemory());
   LongestPathMap longestPaths(std::less<TR::Node*>(), stackRegion);

   typedef TR::typed_allocator<CRAnchor, TR::Region&> CRAnchorAlloc;
   typedef TR::forward_list<CRAnchor, CRAnchorAlloc> CRAnchorList;
   CRAnchorList anchors(stackRegion);

   vcount_t visitCount = comp()->incOrResetVisitCount();
   TR::TreeTop *treeTop;
   for (treeTop = startTree; (treeTop != endTree); treeTop = treeTop->getNextTreeTop())
      treeTop->getNode()->initializeFutureUseCounts(visitCount);

   TR::Block *block = NULL;
   bool delayedRegStoresBeforeThisPass = _delayedRegStores;

   // Update visitCount as they are used in this optimization and need to be
   visitCount = comp()->incOrResetVisitCount();
   for (TR::TreeTopIterator iter(startTree, comp()); iter != endTree; ++iter)
      {
      TR::Node *node = iter.currentTree()->getNode();

      if (node->getOpCodeValue() == TR::BBStart)
         {
         block = node->getBlock();
         if (!block->isExtensionOfPreviousBlock())
            longestPaths.clear();
         }

      int vcountLimit = MAX_VCOUNT - 3;
      if (comp()->getVisitCount() > vcountLimit)
         {
         dumpOptDetails(comp(),
            "%sVisit count %d exceeds limit %d; stopping\n",
            optDetailString(), comp()->getVisitCount(), vcountLimit);
         return 0;
         }

      // correct at all intermediate stages
      //
      if ((node->getOpCodeValue() != TR::treetop) &&
          (!node->getOpCode().isAnchor() || (node->getFirstChild()->getReferenceCount() != 1)) &&
          (!node->getOpCode().isStoreReg() || (node->getFirstChild()->getReferenceCount() != 1)) &&
          (delayedRegStoresBeforeThisPass ||
           (iter.currentTree() == block->getLastRealTreeTop()) ||
           !node->getOpCode().isStoreReg() ||
           (node->getVisitCount() == visitCount)))
         {
         if (node->getOpCode().isAnchor() && node->getFirstChild()->getOpCode().isLoadIndirect())
            anchors.push_front(CRAnchor(iter.currentTree(), block));

         TR::TransformUtil::recursivelySetNodeVisitCount(node, visitCount);
         continue;
         }

      if (node->getOpCode().isStoreReg())
         _delayedRegStores = true;

      TR::Node *child = node->getFirstChild();
      if (child->getOpCodeValue() == TR::PassThrough)
         {
         TR::Node *newChild = child->getFirstChild();
         node->setAndIncChild(0, newChild);
         newChild->incFutureUseCount();
         if (child->getReferenceCount() <= 1)
            optimizer()->prepareForNodeRemoval(child);
         child->recursivelyDecReferenceCount();
         recursivelyDecFutureUseCount(child);
         child = newChild;
         }

      bool treeTopCanBeEliminated = false;

      // If the treetop child has been seen before then it must be anchored
      // somewhere above already; so we don't need the treetop to be anchoring
      // this node (as the computation is already done at the first reference to
      // the node).
      //

      if (visitCount == child->getVisitCount())
         {
         treeTopCanBeEliminated = true;
         }
      else
         {
         TR::ILOpCode &childOpCode = child->getOpCode();
         TR::ILOpCodes opCodeValue = childOpCode.getOpCodeValue();
         bool seenConditionalBranch = false;

         bool callWithNoSideEffects = child->getOpCode().isCall() &&
              child->getSymbolReference()->getSymbol()->isResolvedMethod() &&
              child->getSymbolReference()->getSymbol()->castToResolvedMethodSymbol()->isSideEffectFree();

         if (callWithNoSideEffects)
            {
            treeTopCanBeEliminated = true;
            }
         else if (!((childOpCode.isCall() && !callWithNoSideEffects) ||
               childOpCode.isStore() ||
//.........这里部分代码省略.........
开发者ID:lmaisons,项目名称:omr,代码行数:101,代码来源:DeadTreesElimination.cpp


注:本文中的tr::Node::setAndIncChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。