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


C++ FoldingSetNodeID类代码示例

本文整理汇总了C++中FoldingSetNodeID的典型用法代码示例。如果您正苦于以下问题:C++ FoldingSetNodeID类的具体用法?C++ FoldingSetNodeID怎么用?C++ FoldingSetNodeID使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ProfileFunction

/// ProfileFunction - Creates a hash-code for the function which is the same
/// for any two functions that will compare equal, without looking at the
/// instructions inside the function.
static unsigned ProfileFunction(const Function *F) {
  const FunctionType *FTy = F->getFunctionType();

  FoldingSetNodeID ID;
  ID.AddInteger(F->size());
  ID.AddInteger(F->getCallingConv());
  ID.AddBoolean(F->hasGC());
  ID.AddBoolean(FTy->isVarArg());
  ID.AddInteger(FTy->getReturnType()->getTypeID());
  for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i)
    ID.AddInteger(FTy->getParamType(i)->getTypeID());
  return ID.ComputeHash();
}
开发者ID:jyasskin,项目名称:llvm-mirror,代码行数:16,代码来源:MergeFunctions.cpp

示例2: GetBucketFor

/// FindNodeOrInsertPos - Look up the node specified by ID.  If it exists,
/// return it.  If not, return the insertion token that will make insertion
/// faster.
FoldingSetImpl::Node
*FoldingSetImpl::FindNodeOrInsertPos(const FoldingSetNodeID &ID,
                                     void *&InsertPos) {
  unsigned IDHash = ID.ComputeHash();
  void **Bucket = GetBucketFor(IDHash, Buckets, NumBuckets);
  void *Probe = *Bucket;
  
  InsertPos = nullptr;
  
  FoldingSetNodeID TempID;
  while (Node *NodeInBucket = GetNextPtr(Probe)) {
    if (NodeEquals(NodeInBucket, ID, IDHash, TempID))
      return NodeInBucket;
    TempID.clear();

    Probe = NodeInBucket->getNextInBucket();
  }
  
  // Didn't find the node, return null with the bucket as the InsertPos.
  InsertPos = Bucket;
  return nullptr;
}
开发者ID:AstroVPK,项目名称:LLVM-4.0.0,代码行数:25,代码来源:FoldingSet.cpp

示例3: Profile

 static void Profile(FoldingSetNodeID &ID, const AttributeWithIndex *Attr,
                     unsigned NumAttrs) {
   for (unsigned i = 0; i != NumAttrs; ++i)
     ID.AddInteger(uint64_t(Attr[i].Attrs) << 32 | unsigned(Attr[i].Index));
 }
开发者ID:pombredanne,项目名称:llvm-mirror,代码行数:5,代码来源:Attributes.cpp

示例4:

void
ARMConstantPoolValue::addSelectionDAGCSEId(FoldingSetNodeID &ID) {
  ID.AddInteger(LabelId);
  ID.AddInteger(PCAdjust);
}
开发者ID:AstroVPK,项目名称:LLVM-4.0.0,代码行数:5,代码来源:ARMConstantPoolValue.cpp

示例5: addSelectionDAGCSEId

void ARMConstantPoolMBB::addSelectionDAGCSEId(FoldingSetNodeID &ID) {
  ID.AddPointer(MBB);
  ARMConstantPoolValue::addSelectionDAGCSEId(ID);
}
开发者ID:AstroVPK,项目名称:LLVM-4.0.0,代码行数:4,代码来源:ARMConstantPoolValue.cpp

示例6: Profile

void Pointer::Profile(FoldingSetNodeID &ID, const Type *Ty, const Value *Val) {
  ID.Add(Ty);
  ID.AddPointer(Val);
}
开发者ID:ezhangle,项目名称:rhine,代码行数:4,代码来源:Constant.cpp

示例7: Profile

/// Profile - Used to gather unique data for the abbreviation folding set.
///
void DIEAbbrevData::Profile(FoldingSetNodeID &ID) const {
  ID.AddInteger(Attribute);
  ID.AddInteger(Form);
}
开发者ID:baatar,项目名称:llvm-duetto,代码行数:6,代码来源:DIE.cpp

示例8: Profile

/// Profile - Used to gather unique data for the abbreviation folding set.
///
void DIEAbbrevData::Profile(FoldingSetNodeID &ID) const {
  // Explicitly cast to an integer type for which FoldingSetNodeID has
  // overloads.  Otherwise MSVC 2010 thinks this call is ambiguous.
  ID.AddInteger(unsigned(Attribute));
  ID.AddInteger(unsigned(Form));
}
开发者ID:Bigcheese,项目名称:llvm,代码行数:8,代码来源:DIE.cpp

示例9: addSelectionDAGCSEId

void SystemZConstantPoolValue::addSelectionDAGCSEId(FoldingSetNodeID &ID) {
  ID.AddPointer(GV);
  ID.AddInteger(Modifier);
}
开发者ID:7heaven,项目名称:softart,代码行数:4,代码来源:SystemZConstantPoolValue.cpp

示例10: addSelectionDAGCSEId

void ARMConstantPoolConstant::addSelectionDAGCSEId(FoldingSetNodeID &ID) {
  ID.AddPointer(CVal);
  for (const auto *GV : GVars)
    ID.AddPointer(GV);
  ARMConstantPoolValue::addSelectionDAGCSEId(ID);
}
开发者ID:BNieuwenhuizen,项目名称:llvm,代码行数:6,代码来源:ARMConstantPoolValue.cpp

示例11: Profile

void MDNode::Profile(FoldingSetNodeID &ID) const {
  for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
    ID.AddPointer(getOperand(i));
  ID.AddBoolean(isFunctionLocal());
}
开发者ID:nickl-,项目名称:xchain-ios,代码行数:5,代码来源:Metadata.cpp

示例12: Profile

 static void Profile(FoldingSetNodeID &ID, ArrayRef<AttributeWithIndex> Attrs){
   for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
     ID.AddInteger(Attrs[i].Attrs.Raw());
     ID.AddInteger(Attrs[i].Index);
   }
 }
开发者ID:leckiepeng,项目名称:llvm,代码行数:6,代码来源:Attributes.cpp

示例13: getFunction

// Replace value from this node's operand list.
void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) {
  Value *From = *Op;

  // If is possible that someone did GV->RAUW(inst), replacing a global variable
  // with an instruction or some other function-local object.  If this is a
  // non-function-local MDNode, it can't point to a function-local object.
  // Handle this case by implicitly dropping the MDNode reference to null.
  // Likewise if the MDNode is function-local but for a different function.
  if (To && isFunctionLocalValue(To)) {
    if (!isFunctionLocal())
      To = 0;
    else {
      const Function *F = getFunction();
      const Function *FV = getFunctionForValue(To);
      // Metadata can be function-local without having an associated function.
      // So only consider functions to have changed if non-null.
      if (F && FV && F != FV)
        To = 0;
    }
  }
  
  if (From == To)
    return;

  // Update the operand.
  Op->set(To);

  // If this node is already not being uniqued (because one of the operands
  // already went to null), then there is nothing else to do here.
  if (isNotUniqued()) return;

  LLVMContextImpl *pImpl = getType()->getContext().pImpl;

  // Remove "this" from the context map.  FoldingSet doesn't have to reprofile
  // this node to remove it, so we don't care what state the operands are in.
  pImpl->MDNodeSet.RemoveNode(this);

  // If we are dropping an argument to null, we choose to not unique the MDNode
  // anymore.  This commonly occurs during destruction, and uniquing these
  // brings little reuse.  Also, this means we don't need to include
  // isFunctionLocal bits in FoldingSetNodeIDs for MDNodes.
  if (To == 0) {
    setIsNotUniqued();
    return;
  }

  // Now that the node is out of the folding set, get ready to reinsert it.
  // First, check to see if another node with the same operands already exists
  // in the set.  If so, then this node is redundant.
  FoldingSetNodeID ID;
  Profile(ID);
  void *InsertPoint;
  if (MDNode *N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint)) {
    replaceAllUsesWith(N);
    destroy();
    return;
  }

  // Cache the operand hash.
  Hash = ID.ComputeHash();
  // InsertPoint will have been set by the FindNodeOrInsertPos call.
  pImpl->MDNodeSet.InsertNode(this, InsertPoint);

  // If this MDValue was previously function-local but no longer is, clear
  // its function-local flag.
  if (isFunctionLocal() && !isFunctionLocalValue(To)) {
    bool isStillFunctionLocal = false;
    for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
      Value *V = getOperand(i);
      if (!V) continue;
      if (isFunctionLocalValue(V)) {
        isStillFunctionLocal = true;
        break;
      }
    }
    if (!isStillFunctionLocal)
      setValueSubclassData(getSubclassDataFromValue() & ~FunctionLocalBit);
  }
}
开发者ID:QuentinFiard,项目名称:llvm,代码行数:80,代码来源:Metadata.cpp

示例14: Profile

void SuppressInlineDefensiveChecksVisitor::Profile(FoldingSetNodeID &ID) const {
  static int id = 0;
  ID.AddPointer(&id);
  ID.AddPointer(StartN);
  ID.Add(V);
}
开发者ID:Godin,项目名称:clang,代码行数:6,代码来源:BugReporterVisitors.cpp

示例15: Profile

/// Profile - Used to gather unique data for the folding set.
///
void DWLabel::Profile(FoldingSetNodeID &ID) const {
  ID.AddString(Tag);
  ID.AddInteger(Number);
}
开发者ID:HenderOrlando,项目名称:clamav-bytecode-compiler,代码行数:6,代码来源:DwarfLabel.cpp


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