X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FModule.h;h=e6303ac7752d2f6131dff709e00ae6b2bb7ff136;hb=2e522d05278a69cf75b41dcd4b358e46b5350425;hp=046798845bec97ca64d3840529f40f3f2cbcb980;hpb=d34cb1e09f5e4b3feb7305346655b83ad2f67773;p=oota-llvm.git diff --git a/include/llvm/Module.h b/include/llvm/Module.h index 046798845be..e6303ac7752 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -30,8 +30,7 @@ class GVMaterializer; class LLVMContext; class StructType; template struct DenseMapInfo; -template class DenseMap; +template class DenseMap; template<> struct ilist_traits : public SymbolTableListTraits { @@ -177,7 +176,15 @@ public: /// is an error for two (or more) llvm.module.flags with the /// same ID to have the Override behavior but different /// values. - enum ModAttrBehavior { Error = 1, Warning = 2, Require = 3, Override = 4 }; + enum ModFlagBehavior { Error = 1, Warning = 2, Require = 3, Override = 4 }; + + struct ModuleFlagEntry { + ModFlagBehavior Behavior; + MDString *Key; + Value *Val; + ModuleFlagEntry(ModFlagBehavior B, MDString *K, Value *V) + : Behavior(B), Key(K), Val(V) {} + }; /// @} /// @name Member Variables @@ -291,13 +298,9 @@ public: void getMDKindNames(SmallVectorImpl &Result) const; - typedef DenseMap, - DenseMapInfo > NumeredTypesMapTy; + typedef DenseMap > + NumeredTypesMapTy; - /// findUsedStructTypes - Walk the entire module and find all of the - /// struct types that are in use, returning them in a vector. - void findUsedStructTypes(std::vector &StructTypes) const; - /// getTypeByName - Return the type with the specified name, or null if there /// is none by that name. StructType *getTypeByName(StringRef Name) const; @@ -401,6 +404,9 @@ public: /// @name Module Flags Accessors /// @{ + /// getModuleFlagsMetadata - Returns the module flags in the provided vector. + void getModuleFlagsMetadata(SmallVectorImpl &Flags) const; + /// getModuleFlagsMetadata - Returns the NamedMDNode in the module that /// represents module-level flags. This method returns null if there are no /// module-level flags. @@ -414,8 +420,8 @@ public: /// addModuleFlag - Add a module-level flag to the module-level flags /// metadata. It will create the module-level flags named metadata if it /// doesn't already exist. - void addModuleFlag(ModAttrBehavior Behavior, StringRef Key, Value *Val); - void addModuleFlag(ModAttrBehavior Behavior, StringRef Key, uint32_t Val); + void addModuleFlag(ModFlagBehavior Behavior, StringRef Key, Value *Val); + void addModuleFlag(ModFlagBehavior Behavior, StringRef Key, uint32_t Val); void addModuleFlag(MDNode *Node); /// @} @@ -487,6 +493,13 @@ public: static iplist Module::*getSublistAccess(GlobalAlias*) { return &Module::AliasList; } + /// Get the Module's list of named metadata (constant). + const NamedMDListType &getNamedMDList() const { return NamedMDList; } + /// Get the Module's list of named metadata. + NamedMDListType &getNamedMDList() { return NamedMDList; } + static ilist Module::*getSublistAccess(NamedMDNode*) { + return &Module::NamedMDList; + } /// Get the symbol table of global variable and function identifiers const ValueSymbolTable &getValueSymbolTable() const { return *ValSymTab; } /// Get the Module's symbol table of global variable and function identifiers.