本文整理汇总了C++中llvm::DenseMap::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ DenseMap::begin方法的具体用法?C++ DenseMap::begin怎么用?C++ DenseMap::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::DenseMap
的用法示例。
在下文中一共展示了DenseMap::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: areIdentical
/// Are all available values identicalTo each other.
static bool areIdentical(llvm::DenseMap<SILBasicBlock *, SILValue> &Avails) {
if (auto *First = dyn_cast<SingleValueInstruction>(Avails.begin()->second)) {
for (auto Avail : Avails) {
auto *Inst = dyn_cast<SingleValueInstruction>(Avail.second);
if (!Inst)
return false;
if (!Inst->isIdenticalTo(First))
return false;
}
return true;
}
auto *MVIR = dyn_cast<MultipleValueInstructionResult>(Avails.begin()->second);
if (!MVIR)
return false;
for (auto Avail : Avails) {
auto *Result = dyn_cast<MultipleValueInstructionResult>(Avail.second);
if (!Result)
return false;
if (!Result->getParent()->isIdenticalTo(MVIR->getParent()) ||
Result->getIndex() != MVIR->getIndex()) {
return false;
}
}
return true;
}
示例2: getTaintedEdges
int Graph::getTaintedEdges () {
int countEdges=0;
for (llvm::DenseMap<GraphNode*, bool>::iterator it = taintedMap.begin(); it != taintedMap.end(); ++it) {
std::map<GraphNode*, edgeType> succs = it->first->getSuccessors();
for (std::map<GraphNode*, edgeType>::iterator succ = succs.begin(), s_end = succs.end(); succ != s_end; succ++) {
if (taintedMap.count(succ->first) > 0) {
countEdges++;
}
}
}
return (countEdges);
}
示例3: AddMethodsToClass
void CGObjCJit::AddMethodsToClass(void *theClass) {
// Methods need to be added at runtime. Method function pointers (IMP)
// are not available until then.
CGBuilderTy Builder(JitInitBlock);
CodeGen::CodeGenFunction CGF(CGM);
void *theMetaclass = _object_getClass(theClass);
llvm::DenseMap<const ObjCMethodDecl*, llvm::Function*>::iterator I =
MethodDefinitions.begin();
while (I != MethodDefinitions.end()) {
const ObjCMethodDecl *D = I->first;
std::string TypeStr;
CGM.getContext().getObjCEncodingForMethodDecl(const_cast<ObjCMethodDecl*>(D),
TypeStr);
const char* TypeCStr = // keep in a set
MethodTypeStrings.insert(MethodTypeStrings.begin(), TypeStr)->c_str();
void *ClassObject = D->isClassMethod() ? theMetaclass : theClass;
llvm::Value *ClassArg =
llvm::Constant::getIntegerValue(ObjCTypes.ClassPtrTy,
llvm::APInt(sizeof(void*) * 8,
(uint64_t)ClassObject));
llvm::Value *SelectorArg = GetSelector(CGF, D->getSelector());
llvm::Value *TypeArg =
llvm::Constant::getIntegerValue(ObjCTypes.Int8PtrTy,
llvm::APInt(sizeof(void*) * 8,
(uint64_t)TypeCStr));
llvm::Value *MethodArg = Builder.CreateBitCast(I->second, ImpPtrTy);
Builder.CreateCall4(fn_class_addMethod,
ClassArg,
SelectorArg,
MethodArg,
TypeArg);
I++;
}
// Done with list for this implementation, so clear it
MethodDefinitions.clear();
}
示例4: printMap
// a function which iterates over the map passed in, printing the key & value fields of the map
int printMap(llvm::DenseMap<llvm::Instruction*, int>&map){
llvm::DenseMap<llvm::Instruction*, int>::iterator i = map.begin();
for(; i!= map.end(); ++i)
std::cerr << "Key: " << i->first << "\tValue: " << i->second << "\n";
return 0;
}