diff options
Diffstat (limited to 'include/llvm/IR/Module.h')
-rw-r--r-- | include/llvm/IR/Module.h | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/include/llvm/IR/Module.h b/include/llvm/IR/Module.h index 196e32e3615c..a405f7df3efe 100644 --- a/include/llvm/IR/Module.h +++ b/include/llvm/IR/Module.h @@ -59,7 +59,7 @@ class StructType; /// A module maintains a GlobalValRefMap object that is used to hold all /// constant references to global variables in the module. When a global /// variable is destroyed, it should have no entries in the GlobalValueRefMap. -/// @brief The main container class for the LLVM Intermediate Representation. +/// The main container class for the LLVM Intermediate Representation. class Module { /// @name Types And Enumerations /// @{ @@ -207,13 +207,18 @@ public: /// @returns the module identifier as a string const std::string &getModuleIdentifier() const { return ModuleID; } + /// Returns the number of non-debug IR instructions in the module. + /// This is equivalent to the sum of the IR instruction counts of each + /// function contained in the module. + unsigned getInstructionCount(); + /// Get the module's original source file name. When compiling from /// bitcode, this is taken from a bitcode record where it was recorded. /// For other compiles it is the same as the ModuleID, which would /// contain the source file name. const std::string &getSourceFileName() const { return SourceFileName; } - /// \brief Get a short "name" for the module. + /// Get a short "name" for the module. /// /// This is useful for debugging or logging. It is essentially a convenience /// wrapper around getModuleIdentifier(). @@ -251,9 +256,16 @@ public: /// versions when the pass does not change. std::unique_ptr<RandomNumberGenerator> createRNG(const Pass* P) const; -/// @} -/// @name Module Level Mutators -/// @{ + /// Return true if size-info optimization remark is enabled, false + /// otherwise. + bool shouldEmitInstrCountChangedRemark() { + return getContext().getDiagHandlerPtr()->isAnalysisRemarkEnabled( + "size-info"); + } + + /// @} + /// @name Module Level Mutators + /// @{ /// Set the module identifier. void setModuleIdentifier(StringRef ID) { ModuleID = ID; } @@ -795,14 +807,14 @@ public: /// @name Utility functions for querying Debug information. /// @{ - /// \brief Returns the Number of Register ParametersDwarf Version by checking + /// Returns the Number of Register ParametersDwarf Version by checking /// module flags. unsigned getNumberRegisterParameters() const; - /// \brief Returns the Dwarf Version by checking module flags. + /// Returns the Dwarf Version by checking module flags. unsigned getDwarfVersion() const; - /// \brief Returns the CodeView Version by checking module flags. + /// Returns the CodeView Version by checking module flags. /// Returns zero if not present in module. unsigned getCodeViewFlag() const; @@ -810,10 +822,10 @@ public: /// @name Utility functions for querying and setting PIC level /// @{ - /// \brief Returns the PIC level (small or large model) + /// Returns the PIC level (small or large model) PICLevel::Level getPICLevel() const; - /// \brief Set the PIC level (small or large model) + /// Set the PIC level (small or large model) void setPICLevel(PICLevel::Level PL); /// @} @@ -821,28 +833,35 @@ public: /// @name Utility functions for querying and setting PIE level /// @{ - /// \brief Returns the PIE level (small or large model) + /// Returns the PIE level (small or large model) PIELevel::Level getPIELevel() const; - /// \brief Set the PIE level (small or large model) + /// Set the PIE level (small or large model) void setPIELevel(PIELevel::Level PL); /// @} /// @name Utility functions for querying and setting PGO summary /// @{ - /// \brief Attach profile summary metadata to this module. + /// Attach profile summary metadata to this module. void setProfileSummary(Metadata *M); - /// \brief Returns profile summary metadata + /// Returns profile summary metadata Metadata *getProfileSummary(); /// @} + /// Returns true if PLT should be avoided for RTLib calls. + bool getRtLibUseGOT() const; + + /// Set that PLT should be avoid for RTLib calls. + void setRtLibUseGOT(); + + /// Take ownership of the given memory buffer. void setOwnedMemoryBuffer(std::unique_ptr<MemoryBuffer> MB); }; -/// \brief Given "llvm.used" or "llvm.compiler.used" as a global name, collect +/// Given "llvm.used" or "llvm.compiler.used" as a global name, collect /// the initializer elements of that global in Set and return the global itself. GlobalVariable *collectUsedGlobalVariables(const Module &M, SmallPtrSetImpl<GlobalValue *> &Set, |