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


C++ FoldingSetNodeID::AddBoolean方法代码示例

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


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

示例1: 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) {
  FunctionType *FTy = F->getFunctionType();

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

示例2: switch

MDNode *MDNode::getMDNode(LLVMContext &Context, Value *const *Vals,
                          unsigned NumVals, FunctionLocalness FL,
                          bool Insert) {
  LLVMContextImpl *pImpl = Context.pImpl;
  bool isFunctionLocal = false;
  switch (FL) {
  case FL_Unknown:
    for (unsigned i = 0; i != NumVals; ++i) {
      Value *V = Vals[i];
      if (!V) continue;
      if (isFunctionLocalValue(V)) {
        isFunctionLocal = true;
        break;
      }
    }
    break;
  case FL_No:
    isFunctionLocal = false;
    break;
  case FL_Yes:
    isFunctionLocal = true;
    break;
  }

  FoldingSetNodeID ID;
  for (unsigned i = 0; i != NumVals; ++i)
    ID.AddPointer(Vals[i]);
  ID.AddBoolean(isFunctionLocal);

  void *InsertPoint;
  MDNode *N = NULL;
  
  if ((N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint)))
    return N;
    
  if (!Insert)
    return NULL;
    
  // Coallocate space for the node and Operands together, then placement new.
  void *Ptr = malloc(sizeof(MDNode)+NumVals*sizeof(MDNodeOperand));
  N = new (Ptr) MDNode(Context, Vals, NumVals, isFunctionLocal);

  // InsertPoint will have been set by the FindNodeOrInsertPos call.
  pImpl->MDNodeSet.InsertNode(N, InsertPoint);

  return N;
}
开发者ID:nickl-,项目名称:xchain-ios,代码行数:47,代码来源:Metadata.cpp

示例3: 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

示例4: Profile

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


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