本文整理汇总了C++中llvm::DenseMap::end方法的典型用法代码示例。如果您正苦于以下问题:C++ DenseMap::end方法的具体用法?C++ DenseMap::end怎么用?C++ DenseMap::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::DenseMap
的用法示例。
在下文中一共展示了DenseMap::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addDecl
void addDecl(llvm::DenseMap<K, FoundDecl> &Map, K Key, FoundDecl FD) {
// Add the declaration if we haven't found an equivalent yet, otherwise
// replace the equivalent if the found decl has a higher access level.
auto existingDecl = Map.find(Key);
if ((existingDecl == Map.end()) ||
(Map[Key].first->getFormalAccess() < FD.first->getFormalAccess())) {
if (existingDecl != Map.end())
declsToReport.erase({existingDecl->getSecond().first});
Map[Key] = FD;
declsToReport.insert(FD);
}
}
示例2: getICInfo
ICInfo* getICInfo(void* rtn_addr) {
// TODO: load this from the CF instead of tracking it separately
auto&& it = ics_by_return_addr.find(rtn_addr);
if (it == ics_by_return_addr.end())
return NULL;
return it->second;
}
示例3: findKey
// a function which searches for the key in the map passed in. Returns 0 if unsuccessful or the instruction number on success
int findKey(llvm::DenseMap<llvm::Instruction*, int>& map, llvm::Instruction* key){
llvm::DenseMap<llvm::Instruction*, int>::iterator iter = map.find(key);
if(iter == map.end())
return 0;
else
return iter->second;
}
示例4:
static
llvm::MDNode *myGetType(const Type *type) {
typedef llvm::DenseMap<const Type*, llvm::MDNode *>::const_iterator TypeNodeIter;
TypeNodeIter i = myTypeDescriptors.find(type);
if(i != myTypeDescriptors.end())
return i->second;
return NULL;
}
示例5: getClosureScopes
// Return a range of scopes for the given closure. The elements of the
// returned range have type `SILFunction *` and are non-null. Return an empty
// range for a SILFunction that is not a closure or is a dead closure.
ScopeRange getClosureScopes(SILFunction *ClosureF) {
IndexRange indexRange(nullptr, nullptr);
auto closureScopesPos = closureToScopesMap.find(ClosureF);
if (closureScopesPos != closureToScopesMap.end()) {
auto &indexedScopes = closureScopesPos->second;
indexRange = IndexRange(indexedScopes.begin(), indexedScopes.end());
}
return makeOptionalTransformRange(indexRange,
IndexLookupFunc(indexedScopes));
}
示例6: lookupScopeIndex
int lookupScopeIndex(SILFunction *scopeFunc) {
auto indexPos = scopeToIndexMap.find(scopeFunc);
if (indexPos != scopeToIndexMap.end())
return indexPos->second;
int scopeIdx = indexedScopes.size();
scopeToIndexMap[scopeFunc] = scopeIdx;
indexedScopes.push_back(scopeFunc);
return scopeIdx;
}
示例7: erase
void erase(SILFunction *F) {
// If this function is a mapped closure scope, remove it, leaving a nullptr
// sentinel.
auto indexPos = scopeToIndexMap.find(F);
if (indexPos != scopeToIndexMap.end()) {
indexedScopes[indexPos->second] = nullptr;
scopeToIndexMap.erase(F);
}
// If this function is a closure, remove it.
closureToScopesMap.erase(F);
}
示例8: mapOperands
static void mapOperands(SILInstruction *I,
const llvm::DenseMap<ValueBase *, SILValue> &ValueMap) {
for (auto &Opd : I->getAllOperands()) {
SILValue OrigVal = Opd.get();
ValueBase *OrigDef = OrigVal;
auto Found = ValueMap.find(OrigDef);
if (Found != ValueMap.end()) {
SILValue MappedVal = Found->second;
Opd.set(MappedVal);
}
}
}
示例9: 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);
}
示例10: insert
/// Insert a block into the worklist and set its stack depth.
void insert(SILBasicBlock *BB, int StackDepth) {
auto Iter = Block2StackDepth.find(BB);
if (Iter != Block2StackDepth.end()) {
// We already handled the block.
assert(StackDepth >= 0);
if (Iter->second < 0) {
// Update the stack depth if we didn't set it yet for the block.
Iter->second = StackDepth;
} else {
assert(Iter->second == StackDepth &&
"inconsistent stack depth at a CFG merge point");
}
} else {
Block2StackDepth[BB] = StackDepth;
ToHandle.push_back(BB);
}
}
示例11: mapOperands
static void mapOperands(SILInstruction *I,
const llvm::DenseMap<ValueBase *, SILValue> &ValueMap) {
for (auto &Opd : I->getAllOperands()) {
SILValue OrigVal = Opd.get();
ValueBase *OrigDef = OrigVal.getDef();
auto Found = ValueMap.find(OrigDef);
if (Found != ValueMap.end()) {
SILValue MappedVal = Found->second;
unsigned ResultIdx = OrigVal.getResultNumber();
// All mapped instructions have their result number set to zero. Except
// for arguments that we followed along one edge to their incoming value
// on that edge.
if (isa<SILArgument>(OrigDef))
ResultIdx = MappedVal.getResultNumber();
Opd.set(SILValue(MappedVal.getDef(), ResultIdx));
}
}
}
示例12: 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();
}
示例13: new
ModuleDecl *loadModule(SourceLoc importLoc,
ArrayRef<std::pair<Identifier, SourceLoc>> path) {
// FIXME: Implement submodule support!
Identifier name = path[0].first;
auto it = ModuleWrappers.find(name);
if (it != ModuleWrappers.end())
return it->second->getParentModule();
auto *decl = ModuleDecl::create(name, SwiftContext);
// Silence error messages about testably importing a Clang module.
decl->setTestingEnabled();
decl->setHasResolvedImports();
auto wrapperUnit = new (SwiftContext) DWARFModuleUnit(*decl);
ModuleWrappers.insert({name, wrapperUnit});
decl->addFile(*wrapperUnit);
// Force load adapter modules for all imported modules.
decl->forAllVisibleModules({}, [](ModuleDecl::ImportedModule import) {});
return decl;
}
示例14: getStackDepth
int getStackDepth(SILBasicBlock *BB) {
assert(Block2StackDepth.find(BB) != Block2StackDepth.end());
int Depth = Block2StackDepth.lookup(BB);
assert(Depth >= 0 && "EndBlock not reachable from StartBlock");
return Depth;
}
示例15: 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;
}