diff options
Diffstat (limited to 'include/llvm/Module.h')
-rw-r--r-- | include/llvm/Module.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/include/llvm/Module.h b/include/llvm/Module.h index 8ce5ec4..0467988 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -154,6 +154,31 @@ public: /// An enumeration for describing the size of a pointer on the target machine. enum PointerSize { AnyPointerSize, Pointer32, Pointer64 }; + /// An enumeration for the supported behaviors of module flags. The following + /// module flags behavior values are supported: + /// + /// Value Behavior + /// ----- -------- + /// 1 Error + /// Emits an error if two values disagree. + /// + /// 2 Warning + /// Emits a warning if two values disagree. + /// + /// 3 Require + /// Emits an error when the specified value is not present + /// or doesn't have the specified value. It is an error for + /// two (or more) llvm.module.flags with the same ID to have + /// the Require behavior but different values. There may be + /// multiple Require flags per ID. + /// + /// 4 Override + /// Uses the specified value if the two values disagree. It + /// 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 }; + /// @} /// @name Member Variables /// @{ @@ -373,6 +398,27 @@ public: void eraseNamedMetadata(NamedMDNode *NMD); /// @} +/// @name Module Flags Accessors +/// @{ + + /// getModuleFlagsMetadata - Returns the NamedMDNode in the module that + /// represents module-level flags. This method returns null if there are no + /// module-level flags. + NamedMDNode *getModuleFlagsMetadata() const; + + /// getOrInsertModuleFlagsMetadata - Returns the NamedMDNode in the module + /// that represents module-level flags. If module-level flags aren't found, + /// it creates the named metadata that contains them. + NamedMDNode *getOrInsertModuleFlagsMetadata(); + + /// 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(MDNode *Node); + +/// @} /// @name Materialization /// @{ |