diff options
Diffstat (limited to 'include/llvm/IR/Module.h')
| -rw-r--r-- | include/llvm/IR/Module.h | 43 | 
1 files changed, 38 insertions, 5 deletions
diff --git a/include/llvm/IR/Module.h b/include/llvm/IR/Module.h index a405f7df3efe..9ef35f1f73cd 100644 --- a/include/llvm/IR/Module.h +++ b/include/llvm/IR/Module.h @@ -16,6 +16,7 @@  #define LLVM_IR_MODULE_H  #include "llvm-c/Types.h" +#include "llvm/ADT/Optional.h"  #include "llvm/ADT/STLExtras.h"  #include "llvm/ADT/StringMap.h"  #include "llvm/ADT/StringRef.h" @@ -48,6 +49,7 @@ class MemoryBuffer;  class RandomNumberGenerator;  template <class PtrType> class SmallPtrSetImpl;  class StructType; +class VersionTuple;  /// A Module instance is used to store all the information related to an  /// LLVM module. Modules are the top level container of all other LLVM @@ -365,6 +367,11 @@ public:      return getOrInsertFunction(Name, AttributeList{}, RetTy, Args...);    } +  // Avoid an incorrect ordering that'd otherwise compile incorrectly. +  template <typename... ArgsTy> +  Constant *getOrInsertFunction(StringRef Name, AttributeList AttributeList, +                                FunctionType *Invalid, ArgsTy... Args) = delete; +    /// Look up the specified function in the module symbol table. If it does not    /// exist, return null.    Function *getFunction(StringRef Name) const; @@ -401,11 +408,15 @@ public:    }    /// Look up the specified global in the module symbol table. -  ///   1. If it does not exist, add a declaration of the global and return it. -  ///   2. Else, the global exists but has the wrong type: return the function -  ///      with a constantexpr cast to the right type. -  ///   3. Finally, if the existing global is the correct declaration, return -  ///      the existing global. +  /// If it does not exist, invoke a callback to create a declaration of the +  /// global and return it. The global is constantexpr casted to the expected +  /// type if necessary. +  Constant * +  getOrInsertGlobal(StringRef Name, Type *Ty, +                    function_ref<GlobalVariable *()> CreateGlobalCallback); + +  /// Look up the specified global in the module symbol table. If required, this +  /// overload constructs the global variable using its constructor's defaults.    Constant *getOrInsertGlobal(StringRef Name, Type *Ty);  /// @} @@ -840,6 +851,17 @@ public:    void setPIELevel(PIELevel::Level PL);  /// @} +  /// @} +  /// @name Utility function for querying and setting code model +  /// @{ + +  /// Returns the code model (tiny, small, kernel, medium or large model) +  Optional<CodeModel::Model> getCodeModel() const; + +  /// Set the code model (tiny, small, kernel, medium or large) +  void setCodeModel(CodeModel::Model CL); +  /// @} +    /// @name Utility functions for querying and setting PGO summary    /// @{ @@ -856,6 +878,17 @@ public:    /// Set that PLT should be avoid for RTLib calls.    void setRtLibUseGOT(); +  /// @name Utility functions for querying and setting the build SDK version +  /// @{ + +  /// Attach a build SDK version metadata to this module. +  void setSDKVersion(const VersionTuple &V); + +  /// Get the build SDK version metadata. +  /// +  /// An empty version is returned if no such metadata is attached. +  VersionTuple getSDKVersion() const; +  /// @}    /// Take ownership of the given memory buffer.    void setOwnedMemoryBuffer(std::unique_ptr<MemoryBuffer> MB);  | 
