LLVM 22.0.0git
llvm::Module Class Reference

A Module instance is used to store all the information related to an LLVM module. More...

#include "llvm/IR/Module.h"

Classes

class  debug_compile_units_iterator
 An iterator for DICompileUnits that skips those marked NoDebug. More...
struct  ModuleFlagEntry

Public Member Functions

bool getSemanticInterposition () const
 Returns whether semantic interposition is to be respected.
void setSemanticInterposition (bool)
 Set whether semantic interposition is to be respected.
bool getRtLibUseGOT () const
 Returns true if PLT should be avoided for RTLib calls.
void setRtLibUseGOT ()
 Set that PLT should be avoid for RTLib calls.
bool getDirectAccessExternalData () const
 Get/set whether referencing global variables can use direct access relocations on ELF targets.
void setDirectAccessExternalData (bool Value)
UWTableKind getUwtable () const
 Get/set whether synthesized functions should get the uwtable attribute.
void setUwtable (UWTableKind Kind)
FramePointerKind getFramePointer () const
 Get/set whether synthesized functions should get the "frame-pointer" attribute.
void setFramePointer (FramePointerKind Kind)
StringRef getStackProtectorGuard () const
 Get/set what kind of stack protector guard to use.
void setStackProtectorGuard (StringRef Kind)
StringRef getStackProtectorGuardReg () const
 Get/set which register to use as the stack protector guard register.
void setStackProtectorGuardReg (StringRef Reg)
StringRef getStackProtectorGuardSymbol () const
 Get/set a symbol to use as the stack protector guard.
void setStackProtectorGuardSymbol (StringRef Symbol)
int getStackProtectorGuardOffset () const
 Get/set what offset from the stack protector to use.
void setStackProtectorGuardOffset (int Offset)
unsigned getOverrideStackAlignment () const
 Get/set the stack alignment overridden from the default.
void setOverrideStackAlignment (unsigned Align)
unsigned getMaxTLSAlignment () const
void setOwnedMemoryBuffer (std::unique_ptr< MemoryBuffer > MB)
 Take ownership of the given memory buffer.
void setPartialSampleProfileRatio (const ModuleSummaryIndex &Index)
 Set the partial sample profile ratio in the profile summary module flag, if applicable.
StringRef getDarwinTargetVariantTriple () const
 Get the target variant triple which is a string describing a variant of the target host platform.
void setDarwinTargetVariantTriple (StringRef T)
 Set the target variant triple which is a string describing a variant of the target host platform.
VersionTuple getDarwinTargetVariantSDKVersion () const
 Get the target variant version build SDK version metadata.
void setDarwinTargetVariantSDKVersion (VersionTuple Version)
 Set the target variant version build SDK version metadata.
StringRef getTargetABIFromMD ()
 Returns target-abi from MDString, null if target-abi is absent.
WinX64EHUnwindV2Mode getWinX64EHUnwindV2Mode () const
 Get how unwind v2 (epilog) information should be generated for x64 Windows.
Constructors
void removeDebugIntrinsicDeclarations ()
 Used when printing this module in the new debug info format; removes all declarations of debug intrinsics that are replaced by non-intrinsic records in the new format.
void convertToNewDbgValues ()
void convertFromNewDbgValues ()
 Module (StringRef ModuleID, LLVMContext &C)
 The Module constructor.
 ~Module ()
 The module destructor. This will dropAllReferences.
Moduleoperator= (Module &&Other)
 Move assignment.
Module Level Accessors
const std::string & getModuleIdentifier () const
 Get the module identifier which is, essentially, the name of the module.
unsigned getInstructionCount () const
 Returns the number of non-debug IR instructions in the module.
const std::string & getSourceFileName () const
 Get the module's original source file name.
StringRef getName () const
 Get a short "name" for the module.
const std::string & getDataLayoutStr () const
 Get the data layout string for the module's target platform.
const DataLayoutgetDataLayout () const
 Get the data layout for the module's target platform.
const TriplegetTargetTriple () const
 Get the target triple which is a string describing the target host.
LLVMContextgetContext () const
 Get the global data context.
const std::string & getModuleInlineAsm () const
 Get any module-scope inline assembly blocks.
std::unique_ptr< RandomNumberGeneratorcreateRNG (const StringRef Name) const
 Get a RandomNumberGenerator salted for use with this module.
bool shouldEmitInstrCountChangedRemark ()
 Return true if size-info optimization remark is enabled, false otherwise.
Module Level Mutators
void setModuleIdentifier (StringRef ID)
 Set the module identifier.
void setSourceFileName (StringRef Name)
 Set the module's original source file name.
void setDataLayout (StringRef Desc)
 Set the data layout.
void setDataLayout (const DataLayout &Other)
void setTargetTriple (Triple T)
 Set the target triple.
void setModuleInlineAsm (StringRef Asm)
 Set the module-scope inline assembly blocks.
void appendModuleInlineAsm (StringRef Asm)
 Append to the module-scope inline assembly blocks.
Generic Value Accessors
GlobalValuegetNamedValue (StringRef Name) const
 Return the global value in the module with the specified name, of arbitrary type.
unsigned getNumNamedValues () const
 Return the number of global values in the module.
unsigned getMDKindID (StringRef Name) const
 Return a unique non-zero ID for the specified metadata kind.
void getMDKindNames (SmallVectorImpl< StringRef > &Result) const
 Populate client supplied SmallVector with the name for custom metadata IDs registered in this LLVMContext.
void getOperandBundleTags (SmallVectorImpl< StringRef > &Result) const
 Populate client supplied SmallVector with the bundle tags registered in this LLVMContext.
std::vector< StructType * > getIdentifiedStructTypes () const
std::string getUniqueIntrinsicName (StringRef BaseName, Intrinsic::ID Id, const FunctionType *Proto)
 Return a unique name for an intrinsic whose mangling is based on an unnamed type.
Function Accessors
FunctionCallee getOrInsertFunction (StringRef Name, FunctionType *T, AttributeList AttributeList)
 Look up the specified function in the module symbol table.
FunctionCallee getOrInsertFunction (StringRef Name, FunctionType *T)
template<typename... ArgsTy>
FunctionCallee getOrInsertFunction (StringRef Name, AttributeList AttributeList, Type *RetTy, ArgsTy... Args)
 Same as above, but takes a list of function arguments, which makes it easier for clients to use.
template<typename... ArgsTy>
FunctionCallee getOrInsertFunction (StringRef Name, Type *RetTy, ArgsTy... Args)
 Same as above, but without the attributes.
template<typename... ArgsTy>
FunctionCallee getOrInsertFunction (StringRef Name, AttributeList AttributeList, FunctionType *Invalid, ArgsTy... Args)=delete
FunctiongetFunction (StringRef Name) const
 Look up the specified function in the module symbol table.
Global Variable Accessors
GlobalVariablegetGlobalVariable (StringRef Name) const
 Look up the specified global variable in the module symbol table.
GlobalVariablegetGlobalVariable (StringRef Name, bool AllowInternal) const
 getGlobalVariable - Look up the specified global variable in the module symbol table.
GlobalVariablegetGlobalVariable (StringRef Name, bool AllowInternal=false)
const GlobalVariablegetNamedGlobal (StringRef Name) const
 Return the global variable in the module with the specified name, of arbitrary type.
GlobalVariablegetNamedGlobal (StringRef Name)
GlobalVariablegetOrInsertGlobal (StringRef Name, Type *Ty, function_ref< GlobalVariable *()> CreateGlobalCallback)
 Look up the specified global in the module symbol table.
GlobalVariablegetOrInsertGlobal (StringRef Name, Type *Ty)
 Look up the specified global in the module symbol table.
Global Alias Accessors
GlobalAliasgetNamedAlias (StringRef Name) const
 Return the global alias in the module with the specified name, of arbitrary type.
Global IFunc Accessors
GlobalIFuncgetNamedIFunc (StringRef Name) const
 Return the global ifunc in the module with the specified name, of arbitrary type.
Named Metadata Accessors
NamedMDNodegetNamedMetadata (StringRef Name) const
 Return the first NamedMDNode in the module with the specified name.
NamedMDNodegetOrInsertNamedMetadata (StringRef Name)
 Return the named MDNode in the module with the specified name.
void eraseNamedMetadata (NamedMDNode *NMD)
 Remove the given NamedMDNode from this module and delete it.
Comdat Accessors
ComdatgetOrInsertComdat (StringRef Name)
 Return the Comdat in the module with the specified name.
Module Flags Accessors
void getModuleFlagsMetadata (SmallVectorImpl< ModuleFlagEntry > &Flags) const
 Returns the module flags in the provided vector.
MetadatagetModuleFlag (StringRef Key) const
 Return the corresponding value if Key appears in module flags, otherwise return null.
NamedMDNodegetModuleFlagsMetadata () const
 Returns the NamedMDNode in the module that represents module-level flags.
NamedMDNodegetOrInsertModuleFlagsMetadata ()
 Returns the NamedMDNode in the module that represents module-level flags.
void addModuleFlag (ModFlagBehavior Behavior, StringRef Key, Metadata *Val)
 Add a module-level flag to the module-level flags metadata.
void addModuleFlag (ModFlagBehavior Behavior, StringRef Key, Constant *Val)
void addModuleFlag (ModFlagBehavior Behavior, StringRef Key, uint32_t Val)
void addModuleFlag (MDNode *Node)
void setModuleFlag (ModFlagBehavior Behavior, StringRef Key, Metadata *Val)
 Like addModuleFlag but replaces the old module flag if it already exists.
void setModuleFlag (ModFlagBehavior Behavior, StringRef Key, Constant *Val)
void setModuleFlag (ModFlagBehavior Behavior, StringRef Key, uint32_t Val)
Materialization
void setMaterializer (GVMaterializer *GVM)
 Sets the GVMaterializer to GVM.
GVMaterializergetMaterializer () const
 Retrieves the GVMaterializer, if any, for this Module.
bool isMaterialized () const
llvm::Error materialize (GlobalValue *GV)
 Make sure the GlobalValue is fully read.
llvm::Error materializeAll ()
 Make sure all GlobalValues in this Module are fully read and clear the Materializer.
llvm::Error materializeMetadata ()
void removeGlobalVariable (GlobalVariable *GV)
 Detach global variable GV from the list but don't delete it.
void eraseGlobalVariable (GlobalVariable *GV)
 Remove global variable GV from the list and delete it.
void insertGlobalVariable (GlobalVariable *GV)
 Insert global variable GV at the end of the global variable list and take ownership.
void insertGlobalVariable (GlobalListType::iterator Where, GlobalVariable *GV)
 Insert global variable GV into the global variable list before Where and take ownership.
Global Variable Iteration
global_iterator global_begin ()
const_global_iterator global_begin () const
global_iterator global_end ()
const_global_iterator global_end () const
size_t global_size () const
bool global_empty () const
iterator_range< global_iteratorglobals ()
iterator_range< const_global_iteratorglobals () const
Function Iteration
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
reverse_iterator rbegin ()
const_reverse_iterator rbegin () const
reverse_iterator rend ()
const_reverse_iterator rend () const
size_t size () const
bool empty () const
iterator_range< iteratorfunctions ()
iterator_range< const_iteratorfunctions () const
Alias Iteration
alias_iterator alias_begin ()
const_alias_iterator alias_begin () const
alias_iterator alias_end ()
const_alias_iterator alias_end () const
size_t alias_size () const
bool alias_empty () const
iterator_range< alias_iteratoraliases ()
iterator_range< const_alias_iteratoraliases () const
IFunc Iteration
ifunc_iterator ifunc_begin ()
const_ifunc_iterator ifunc_begin () const
ifunc_iterator ifunc_end ()
const_ifunc_iterator ifunc_end () const
size_t ifunc_size () const
bool ifunc_empty () const
iterator_range< ifunc_iteratorifuncs ()
iterator_range< const_ifunc_iteratorifuncs () const
Named Metadata Iteration
named_metadata_iterator named_metadata_begin ()
const_named_metadata_iterator named_metadata_begin () const
named_metadata_iterator named_metadata_end ()
const_named_metadata_iterator named_metadata_end () const
size_t named_metadata_size () const
bool named_metadata_empty () const
iterator_range< named_metadata_iteratornamed_metadata ()
iterator_range< const_named_metadata_iteratornamed_metadata () const
debug_compile_units_iterator debug_compile_units_begin () const
debug_compile_units_iterator debug_compile_units_end () const
iterator_range< debug_compile_units_iteratordebug_compile_units () const
 Return an iterator for all DICompileUnits listed in this Module's llvm.dbg.cu named metadata node and aren't explicitly marked as NoDebug.
Utility functions for printing and dumping Module objects
void print (raw_ostream &OS, AssemblyAnnotationWriter *AAW, bool ShouldPreserveUseListOrder=false, bool IsForDebug=false) const
 Print the module to an output stream with an optional AssemblyAnnotationWriter.
void dump () const
 Dump the module to stderr (for debugging).
void dropAllReferences ()
 This function causes all the subinstructions to "let go" of all references that they are maintaining.
Utility functions for querying Debug information.
unsigned getNumberRegisterParameters () const
 Returns the Number of Register ParametersDwarf Version by checking module flags.
unsigned getDwarfVersion () const
 Returns the Dwarf Version by checking module flags.
bool isDwarf64 () const
 Returns the DWARF format by checking module flags.
unsigned getCodeViewFlag () const
 Returns the CodeView Version by checking module flags.
Utility functions for querying and setting PIC level
PICLevel::Level getPICLevel () const
 Returns the PIC level (small or large model)
void setPICLevel (PICLevel::Level PL)
 Set the PIC level (small or large model)
Utility functions for querying and setting PIE level
PIELevel::Level getPIELevel () const
 Returns the PIE level (small or large model)
void setPIELevel (PIELevel::Level PL)
 Set the PIE level (small or large model)
Utility function for querying and setting code model
std::optional< CodeModel::ModelgetCodeModel () const
 Returns the code model (tiny, small, kernel, medium or large model)
void setCodeModel (CodeModel::Model CL)
 Set the code model (tiny, small, kernel, medium or large)
Utility function for querying and setting the large data threshold
std::optional< uint64_tgetLargeDataThreshold () const
 Returns the large data threshold.
void setLargeDataThreshold (uint64_t Threshold)
 Set the large data threshold.
Utility functions for querying and setting PGO summary
void setProfileSummary (Metadata *M, ProfileSummary::Kind Kind)
 Attach profile summary metadata to this module.
MetadatagetProfileSummary (bool IsCS) const
 Returns profile summary metadata.
Utility functions for querying and setting the build SDK version
void setSDKVersion (const VersionTuple &V)
 Attach a build SDK version metadata to this module.
VersionTuple getSDKVersion () const
 Get the build SDK version metadata.

Types And Enumerations

enum  ModFlagBehavior {
  Error = 1 , Warning = 2 , Require = 3 , Override = 4 ,
  Append = 5 , AppendUnique = 6 , Max = 7 , Min = 8 ,
  ModFlagBehaviorFirstVal = Error , ModFlagBehaviorLastVal = Min
}
 This enumeration defines the supported behaviors of module flags. More...
using GlobalListType = SymbolTableList<GlobalVariable>
 The type for the list of global variables.
using FunctionListType = SymbolTableList<Function>
 The type for the list of functions.
using AliasListType = SymbolTableList<GlobalAlias>
 The type for the list of aliases.
using IFuncListType = SymbolTableList<GlobalIFunc>
 The type for the list of ifuncs.
using NamedMDListType = ilist<NamedMDNode>
 The type for the list of named metadata.
using ComdatSymTabType = StringMap<Comdat>
 The type of the comdat "symbol" table.
using NamedMDSymTabType = StringMap<NamedMDNode *>
 The type for mapping names to named metadata.
using global_iterator = GlobalListType::iterator
 The Global Variable iterator.
using const_global_iterator = GlobalListType::const_iterator
 The Global Variable constant iterator.
using iterator = FunctionListType::iterator
 The Function iterators.
using const_iterator = FunctionListType::const_iterator
 The Function constant iterator.
using reverse_iterator = FunctionListType::reverse_iterator
 The Function reverse iterator.
using const_reverse_iterator = FunctionListType::const_reverse_iterator
 The Function constant reverse iterator.
using alias_iterator = AliasListType::iterator
 The Global Alias iterators.
using const_alias_iterator = AliasListType::const_iterator
 The Global Alias constant iterator.
using ifunc_iterator = IFuncListType::iterator
 The Global IFunc iterators.
using const_ifunc_iterator = IFuncListType::const_iterator
 The Global IFunc constant iterator.
using named_metadata_iterator = NamedMDListType::iterator
 The named metadata iterators.
using const_named_metadata_iterator = NamedMDListType::const_iterator
 The named metadata constant iterators.
static bool isValidModFlagBehavior (Metadata *MD, ModFlagBehavior &MFB)
 Checks if Metadata represents a valid ModFlagBehavior, and stores the converted result in MFB.

Convenience iterators

using global_object_iterator
using const_global_object_iterator
using global_value_iterator
using const_global_value_iterator
iterator_range< global_object_iteratorglobal_objects ()
iterator_range< const_global_object_iteratorglobal_objects () const
iterator_range< global_value_iteratorglobal_values ()
iterator_range< const_global_value_iteratorglobal_values () const

Member Variables

class Constant

Direct access to the globals list, functions list, and symbol table

class llvm::SymbolTableListTraits< llvm::GlobalVariable >
class llvm::SymbolTableListTraits< llvm::GlobalAlias >
class llvm::SymbolTableListTraits< llvm::GlobalIFunc >
static FunctionListType Module::* getSublistAccess (Function *)
const FunctionListTypegetFunctionList () const
 Get the Module's list of functions (constant).
FunctionListTypegetFunctionList ()
 Get the Module's list of functions.
void removeAlias (GlobalAlias *Alias)
 Detach Alias from the list but don't delete it.
void eraseAlias (GlobalAlias *Alias)
 Remove Alias from the list and delete it.
void insertAlias (GlobalAlias *Alias)
 Insert Alias at the end of the alias list and take ownership.
void removeIFunc (GlobalIFunc *IFunc)
 Detach IFunc from the list but don't delete it.
void eraseIFunc (GlobalIFunc *IFunc)
 Remove IFunc from the list and delete it.
void insertIFunc (GlobalIFunc *IFunc)
 Insert IFunc at the end of the alias list and take ownership.
void removeNamedMDNode (NamedMDNode *MDNode)
 Detach MDNode from the list but don't delete it.
void eraseNamedMDNode (NamedMDNode *MDNode)
 Remove MDNode from the list and delete it.
void insertNamedMDNode (NamedMDNode *MDNode)
 Insert MDNode at the end of the alias list and take ownership.
const ValueSymbolTablegetValueSymbolTable () const
 Get the symbol table of global variable and function identifiers.
ValueSymbolTablegetValueSymbolTable ()
 Get the Module's symbol table of global variable and function identifiers.
const ComdatSymTabTypegetComdatSymbolTable () const
 Get the Module's symbol table for COMDATs (constant).
ComdatSymTabTypegetComdatSymbolTable ()
 Get the Module's symbol table for COMDATs.

Detailed Description

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 Intermediate Representation (IR) objects. Each module directly contains a list of globals variables, a list of functions, a list of libraries (or other modules) this module depends on, a symbol table, and various data about the target's characteristics.

A module maintains a GlobalList 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 GlobalList. The main container class for the LLVM Intermediate Representation.

Definition at line 67 of file Module.h.

Member Typedef Documentation

◆ alias_iterator

The Global Alias iterators.

Definition at line 102 of file Module.h.

◆ AliasListType

The type for the list of aliases.

Definition at line 76 of file Module.h.

◆ ComdatSymTabType

The type of the comdat "symbol" table.

Definition at line 82 of file Module.h.

◆ const_alias_iterator

The Global Alias constant iterator.

Definition at line 104 of file Module.h.

◆ const_global_iterator

The Global Variable constant iterator.

Definition at line 89 of file Module.h.

◆ const_global_object_iterator

Initial value:
GlobalListType::const_iterator const_global_iterator
The Global Variable constant iterator.
Definition Module.h:89
FunctionListType::const_iterator const_iterator
The Function constant iterator.
Definition Module.h:94
Iterator wrapper that concatenates sequences together.
Definition STLExtras.h:993

Definition at line 755 of file Module.h.

◆ const_global_value_iterator

Initial value:
IFuncListType::const_iterator const_ifunc_iterator
The Global IFunc constant iterator.
Definition Module.h:109
AliasListType::const_iterator const_alias_iterator
The Global Alias constant iterator.
Definition Module.h:104

Definition at line 765 of file Module.h.

◆ const_ifunc_iterator

The Global IFunc constant iterator.

Definition at line 109 of file Module.h.

◆ const_iterator

The Function constant iterator.

Definition at line 94 of file Module.h.

◆ const_named_metadata_iterator

The named metadata constant iterators.

Definition at line 114 of file Module.h.

◆ const_reverse_iterator

The Function constant reverse iterator.

Definition at line 99 of file Module.h.

◆ FunctionListType

The type for the list of functions.

Definition at line 74 of file Module.h.

◆ global_iterator

The Global Variable iterator.

Definition at line 87 of file Module.h.

◆ global_object_iterator

◆ global_value_iterator

Initial value:
IFuncListType::iterator ifunc_iterator
The Global IFunc iterators.
Definition Module.h:107
FunctionListType::iterator iterator
The Function iterators.
Definition Module.h:92
GlobalListType::iterator global_iterator
The Global Variable iterator.
Definition Module.h:87
AliasListType::iterator alias_iterator
The Global Alias iterators.
Definition Module.h:102

Definition at line 762 of file Module.h.

◆ GlobalListType

The type for the list of global variables.

Definition at line 72 of file Module.h.

◆ ifunc_iterator

The Global IFunc iterators.

Definition at line 107 of file Module.h.

◆ IFuncListType

The type for the list of ifuncs.

Definition at line 78 of file Module.h.

◆ iterator

The Function iterators.

Definition at line 92 of file Module.h.

◆ named_metadata_iterator

The named metadata iterators.

Definition at line 112 of file Module.h.

◆ NamedMDListType

The type for the list of named metadata.

Definition at line 80 of file Module.h.

◆ NamedMDSymTabType

The type for mapping names to named metadata.

Definition at line 84 of file Module.h.

◆ reverse_iterator

The Function reverse iterator.

Definition at line 97 of file Module.h.

Member Enumeration Documentation

◆ ModFlagBehavior

This enumeration defines the supported behaviors of module flags.

Enumerator
Error 

Emits an error if two values disagree, otherwise the resulting value is that of the operands.

Warning 

Emits a warning if two values disagree.

The result value will be the operand for the flag from the first module being linked.

Require 

Adds a requirement that another module flag be present and have a specified value after linking is performed.

The value must be a metadata pair, where the first element of the pair is the ID of the module flag to be restricted, and the second element of the pair is the value the module flag should be restricted to. This behavior can be used to restrict the allowable results (via triggering of an error) of linking IDs with the Override behavior.

Override 

Uses the specified value, regardless of the behavior or value of the other module.

If both modules specify Override, but the values differ, an error will be emitted.

Append 

Appends the two values, which are required to be metadata nodes.

AppendUnique 

Appends the two values, which are required to be metadata nodes.

However, duplicate entries in the second list are dropped during the append operation.

Max 

Takes the max of the two values, which are required to be integers.

Min 

Takes the min of the two values, which are required to be integers.

ModFlagBehaviorFirstVal 
ModFlagBehaviorLastVal 

Definition at line 117 of file Module.h.

Constructor & Destructor Documentation

◆ Module()

Module::Module ( StringRef ModuleID,
LLVMContext & C )
explicit

The Module constructor.

Note that there is no default constructor. You must provide a name for the module upon construction.

Definition at line 73 of file Module.cpp.

Referenced by getGlobalVariable(), getNamedGlobal(), getSublistAccess(), llvm::SymbolTableListTraits< llvm::GlobalAlias >, llvm::SymbolTableListTraits< llvm::GlobalIFunc >, and llvm::SymbolTableListTraits< llvm::GlobalVariable >.

◆ ~Module()

Module::~Module ( )

The module destructor. This will dropAllReferences.

Definition at line 113 of file Module.cpp.

Member Function Documentation

◆ addModuleFlag() [1/4]

void Module::addModuleFlag ( MDNode * Node)

Definition at line 393 of file Module.cpp.

◆ addModuleFlag() [2/4]

void Module::addModuleFlag ( ModFlagBehavior Behavior,
StringRef Key,
Constant * Val )

Definition at line 384 of file Module.cpp.

◆ addModuleFlag() [3/4]

void Module::addModuleFlag ( ModFlagBehavior Behavior,
StringRef Key,
Metadata * Val )

Add a module-level flag to the module-level flags metadata.

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.

Definition at line 376 of file Module.cpp.

◆ addModuleFlag() [4/4]

void Module::addModuleFlag ( ModFlagBehavior Behavior,
StringRef Key,
uint32_t Val )

Definition at line 388 of file Module.cpp.

◆ alias_begin() [1/2]

alias_iterator llvm::Module::alias_begin ( )
inline

Definition at line 717 of file Module.h.

Referenced by aliases(), aliases(), and LLVMGetPreviousGlobalAlias().

◆ alias_begin() [2/2]

const_alias_iterator llvm::Module::alias_begin ( ) const
inline

Definition at line 718 of file Module.h.

◆ alias_empty()

bool llvm::Module::alias_empty ( ) const
inline

Definition at line 722 of file Module.h.

◆ alias_end() [1/2]

alias_iterator llvm::Module::alias_end ( )
inline

Definition at line 719 of file Module.h.

Referenced by aliases(), aliases(), and LLVMGetNextGlobalAlias().

◆ alias_end() [2/2]

const_alias_iterator llvm::Module::alias_end ( ) const
inline

Definition at line 720 of file Module.h.

◆ alias_size()

size_t llvm::Module::alias_size ( ) const
inline

Definition at line 721 of file Module.h.

◆ aliases() [1/2]

iterator_range< alias_iterator > llvm::Module::aliases ( )
inline

◆ aliases() [2/2]

iterator_range< const_alias_iterator > llvm::Module::aliases ( ) const
inline

Definition at line 727 of file Module.h.

References alias_begin(), alias_end(), and llvm::make_range().

◆ appendModuleInlineAsm()

void llvm::Module::appendModuleInlineAsm ( StringRef Asm)
inline

Append to the module-scope inline assembly blocks.

A trailing newline is added if the input doesn't have one.

Definition at line 336 of file Module.h.

◆ begin() [1/2]

iterator llvm::Module::begin ( )
inline

Definition at line 695 of file Module.h.

Referenced by functions(), and functions().

◆ begin() [2/2]

const_iterator llvm::Module::begin ( ) const
inline

Definition at line 696 of file Module.h.

◆ convertFromNewDbgValues()

void llvm::Module::convertFromNewDbgValues ( )
inline
See also
BasicBlock::convertFromNewDbgValues.

Definition at line 231 of file Module.h.

References F.

◆ convertToNewDbgValues()

void llvm::Module::convertToNewDbgValues ( )
inline
See also
BasicBlock::convertToNewDbgValues.

Definition at line 224 of file Module.h.

References F.

◆ createRNG()

std::unique_ptr< RandomNumberGenerator > Module::createRNG ( const StringRef Name) const

Get a RandomNumberGenerator salted for use with this module.

The RNG can be seeded via -rng-seed=<uint64> and is salted with the ModuleID and the provided pass salt. The returned RNG should not be shared across threads or passes.

A unique RNG per pass ensures a reproducible random stream even when other randomness consuming passes are added or removed. In addition, the random stream will be reproducible across LLVM versions when the pass does not change.

Definition at line 150 of file Module.cpp.

◆ debug_compile_units()

iterator_range< debug_compile_units_iterator > llvm::Module::debug_compile_units ( ) const
inline

Return an iterator for all DICompileUnits listed in this Module's llvm.dbg.cu named metadata node and aren't explicitly marked as NoDebug.

Definition at line 852 of file Module.h.

References getNamedMetadata(), and llvm::make_range().

◆ debug_compile_units_begin()

debug_compile_units_iterator llvm::Module::debug_compile_units_begin ( ) const
inline

Definition at line 839 of file Module.h.

References getNamedMetadata().

◆ debug_compile_units_end()

debug_compile_units_iterator llvm::Module::debug_compile_units_end ( ) const
inline

Definition at line 844 of file Module.h.

References getNamedMetadata().

◆ dropAllReferences()

void Module::dropAllReferences ( )

This function causes all the subinstructions to "let go" of all references that they are maintaining.

This allows one to 'delete' a whole class at a time, even though there may be circular references... first all references are dropped, and all use counts go to zero. Then everything is delete'd for real. Note that no operations are valid on an object that has "dropped all references", except operator delete.

Definition at line 563 of file Module.cpp.

◆ dump()

void Module::dump ( ) const

Dump the module to stderr (for debugging).

Definition at line 5486 of file AsmWriter.cpp.

References llvm::dbgs(), dump(), and print().

Referenced by dump().

◆ empty()

bool llvm::Module::empty ( ) const
inline

Definition at line 704 of file Module.h.

◆ end() [1/2]

iterator llvm::Module::end ( )
inline

Definition at line 697 of file Module.h.

Referenced by functions(), and functions().

◆ end() [2/2]

const_iterator llvm::Module::end ( ) const
inline

Definition at line 698 of file Module.h.

◆ eraseAlias()

void llvm::Module::eraseAlias ( GlobalAlias * Alias)
inline

Remove Alias from the list and delete it.

Definition at line 606 of file Module.h.

Referenced by llvm::GlobalAlias::eraseFromParent().

◆ eraseGlobalVariable()

void llvm::Module::eraseGlobalVariable ( GlobalVariable * GV)
inline

Remove global variable GV from the list and delete it.

Definition at line 565 of file Module.h.

Referenced by llvm::GlobalVariable::eraseFromParent().

◆ eraseIFunc()

void llvm::Module::eraseIFunc ( GlobalIFunc * IFunc)
inline

Remove IFunc from the list and delete it.

Definition at line 615 of file Module.h.

Referenced by llvm::GlobalIFunc::eraseFromParent().

◆ eraseNamedMDNode()

void llvm::Module::eraseNamedMDNode ( NamedMDNode * MDNode)
inline

Remove MDNode from the list and delete it.

Definition at line 624 of file Module.h.

◆ eraseNamedMetadata()

void Module::eraseNamedMetadata ( NamedMDNode * NMD)

Remove the given NamedMDNode from this module and delete it.

eraseNamedMetadata - Remove the given NamedMDNode from this module and delete it.

Definition at line 317 of file Module.cpp.

Referenced by llvm::NamedMDNode::eraseFromParent().

◆ functions() [1/2]

iterator_range< iterator > llvm::Module::functions ( )
inline

Definition at line 706 of file Module.h.

References begin(), end(), and llvm::make_range().

◆ functions() [2/2]

iterator_range< const_iterator > llvm::Module::functions ( ) const
inline

Definition at line 709 of file Module.h.

References begin(), end(), and llvm::make_range().

◆ getCodeModel()

std::optional< CodeModel::Model > Module::getCodeModel ( ) const

Returns the code model (tiny, small, kernel, medium or large model)

Definition at line 647 of file Module.cpp.

Referenced by llvm::setGlobalVariableLargeSection().

◆ getCodeViewFlag()

unsigned Module::getCodeViewFlag ( ) const

Returns the CodeView Version by checking module flags.

Returns zero if not present in module.

Definition at line 597 of file Module.cpp.

Referenced by llvm::X86FrameLowering::emitPrologue().

◆ getComdatSymbolTable() [1/2]

ComdatSymTabType & llvm::Module::getComdatSymbolTable ( )
inline

Get the Module's symbol table for COMDATs.

Definition at line 671 of file Module.h.

◆ getComdatSymbolTable() [2/2]

const ComdatSymTabType & llvm::Module::getComdatSymbolTable ( ) const
inline

Get the Module's symbol table for COMDATs (constant).

Definition at line 669 of file Module.h.

◆ getContext()

◆ getDarwinTargetVariantSDKVersion()

VersionTuple Module::getDarwinTargetVariantSDKVersion ( ) const

Get the target variant version build SDK version metadata.

An empty version is returned if no such metadata is attached.

Definition at line 911 of file Module.cpp.

◆ getDarwinTargetVariantTriple()

StringRef Module::getDarwinTargetVariantTriple ( ) const

Get the target variant triple which is a string describing a variant of the target host platform.

For example, Mac Catalyst can be a variant target triple for a macOS target.

Returns
a string containing the target variant triple.

Definition at line 900 of file Module.cpp.

◆ getDataLayout()

◆ getDataLayoutStr()

const std::string & llvm::Module::getDataLayoutStr ( ) const
inline

Get the data layout string for the module's target platform.

This is equivalent to getDataLayout()->getStringRepresentation().

Definition at line 273 of file Module.h.

◆ getDirectAccessExternalData()

bool Module::getDirectAccessExternalData ( ) const

Get/set whether referencing global variables can use direct access relocations on ELF targets.

Definition at line 721 of file Module.cpp.

◆ getDwarfVersion()

unsigned Module::getDwarfVersion ( ) const

Returns the Dwarf Version by checking module flags.

Definition at line 585 of file Module.cpp.

◆ getFramePointer()

FramePointerKind Module::getFramePointer ( ) const

Get/set whether synthesized functions should get the "frame-pointer" attribute.

Definition at line 743 of file Module.cpp.

◆ getFunction()

Function * Module::getFunction ( StringRef Name) const

Look up the specified function in the module symbol table.

If it does not exist, return null.

Definition at line 230 of file Module.cpp.

Referenced by llvm::SelectionDAG::getSymbolFunctionGlobalAddress(), llvm::VFABI::getVectorVariantNames(), and llvm::LoopVectorizationCostModel::setVectorizedCallDecision().

◆ getFunctionList() [1/2]

FunctionListType & llvm::Module::getFunctionList ( )
inline

Get the Module's list of functions.

Definition at line 598 of file Module.h.

◆ getFunctionList() [2/2]

const FunctionListType & llvm::Module::getFunctionList ( ) const
inline

Get the Module's list of functions (constant).

Definition at line 596 of file Module.h.

References const, and getFunctionList().

Referenced by getFunctionList(), and moveFunctionAdaptingType().

◆ getGlobalVariable() [1/3]

GlobalVariable * llvm::Module::getGlobalVariable ( StringRef Name) const
inline

Look up the specified global variable in the module symbol table.

If it does not exist, return null. If AllowInternal is set to true, this function will return types that have InternalLinkage. By default, these types are not returned.

Definition at line 430 of file Module.h.

References getGlobalVariable().

◆ getGlobalVariable() [2/3]

GlobalVariable * Module::getGlobalVariable ( StringRef Name,
bool AllowLocal ) const

getGlobalVariable - Look up the specified global variable in the module symbol table.

If it does not exist, return null. The type argument should be the underlying type of the global, i.e., it should not have the top-level PointerType, which represents the address of the global. If AllowLocal is set to true, this function will return types that have an local. By default, these types are not returned.

Definition at line 245 of file Module.cpp.

◆ getGlobalVariable() [3/3]

GlobalVariable * llvm::Module::getGlobalVariable ( StringRef Name,
bool AllowInternal = false )
inline

Definition at line 436 of file Module.h.

References getGlobalVariable(), and Module().

◆ getIdentifiedStructTypes()

std::vector< StructType * > Module::getIdentifiedStructTypes ( ) const

Definition at line 492 of file Module.cpp.

◆ getInstructionCount()

unsigned Module::getInstructionCount ( ) const

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.

Definition at line 604 of file Module.cpp.

◆ getLargeDataThreshold()

std::optional< uint64_t > Module::getLargeDataThreshold ( ) const

Returns the large data threshold.

Definition at line 665 of file Module.cpp.

◆ getMaterializer()

GVMaterializer * llvm::Module::getMaterializer ( ) const
inline

Retrieves the GVMaterializer, if any, for this Module.

Definition at line 550 of file Module.h.

Referenced by isMaterialized().

◆ getMaxTLSAlignment()

unsigned Module::getMaxTLSAlignment ( ) const

Definition at line 807 of file Module.cpp.

◆ getMDKindID()

unsigned Module::getMDKindID ( StringRef Name) const

Return a unique non-zero ID for the specified metadata kind.

getMDKindID - Return a unique non-zero ID for the specified metadata kind.

This ID is uniqued across modules in the current LLVMContext.

Definition at line 182 of file Module.cpp.

◆ getMDKindNames()

void Module::getMDKindNames ( SmallVectorImpl< StringRef > & Result) const

Populate client supplied SmallVector with the name for custom metadata IDs registered in this LLVMContext.

getMDKindNames - Populate client supplied SmallVector with the name for custom metadata IDs registered in this LLVMContext.

ID #0 is not used, so it is filled in as an empty string.

Definition at line 189 of file Module.cpp.

◆ getModuleFlag()

Metadata * Module::getModuleFlag ( StringRef Key) const

Return the corresponding value if Key appears in module flags, otherwise return null.

Definition at line 353 of file Module.cpp.

Referenced by llvm::calculateSEHStateNumbers(), llvm::calculateWinCXXEHStateNumbers(), and llvm::CC_RISCV().

◆ getModuleFlagsMetadata() [1/2]

NamedMDNode * llvm::Module::getModuleFlagsMetadata ( ) const
inline

Returns the NamedMDNode in the module that represents module-level flags.

This method returns null if there are no module-level flags.

Definition at line 519 of file Module.h.

◆ getModuleFlagsMetadata() [2/2]

void Module::getModuleFlagsMetadata ( SmallVectorImpl< ModuleFlagEntry > & Flags) const

Returns the module flags in the provided vector.

getModuleFlagsMetadata - Returns the module flags in the provided vector.

Definition at line 336 of file Module.cpp.

◆ getModuleIdentifier()

◆ getModuleInlineAsm()

const std::string & llvm::Module::getModuleInlineAsm ( ) const
inline

Get any module-scope inline assembly blocks.

Returns
a string containing the module-scope inline assembly blocks.

Definition at line 289 of file Module.h.

◆ getName()

StringRef llvm::Module::getName ( ) const
inline

Get a short "name" for the module.

This is useful for debugging or logging. It is essentially a convenience wrapper around getModuleIdentifier().

Definition at line 269 of file Module.h.

Referenced by llvm::DwarfCompileUnit::constructImportedEntityDIE(), and llvm::ThinLTOCodeGenerator::run().

◆ getNamedAlias()

GlobalAlias * Module::getNamedAlias ( StringRef Name) const

Return the global alias in the module with the specified name, of arbitrary type.

This method returns null if a global with the specified name is not found.

Definition at line 285 of file Module.cpp.

◆ getNamedGlobal() [1/2]

GlobalVariable * llvm::Module::getNamedGlobal ( StringRef Name)
inline

Definition at line 448 of file Module.h.

References Module().

◆ getNamedGlobal() [2/2]

const GlobalVariable * llvm::Module::getNamedGlobal ( StringRef Name) const
inline

Return the global variable in the module with the specified name, of arbitrary type.

This method returns null if a global with the specified name is not found.

Definition at line 445 of file Module.h.

References getGlobalVariable().

Referenced by llvm::TargetLowering::LowerToTLSEmulatedModel().

◆ getNamedIFunc()

GlobalIFunc * Module::getNamedIFunc ( StringRef Name) const

Return the global ifunc in the module with the specified name, of arbitrary type.

This method returns null if a global with the specified name is not found.

Definition at line 289 of file Module.cpp.

◆ getNamedMetadata()

NamedMDNode * Module::getNamedMetadata ( StringRef Name) const

Return the first NamedMDNode in the module with the specified name.

getNamedMetadata - Return the first NamedMDNode in the module with the specified name.

This method returns null if a NamedMDNode with the specified name is not found.

Definition at line 296 of file Module.cpp.

Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), llvm::cacheAnnotationFromMD(), debug_compile_units(), debug_compile_units_begin(), and debug_compile_units_end().

◆ getNamedValue()

GlobalValue * Module::getNamedValue ( StringRef Name) const

Return the global value in the module with the specified name, of arbitrary type.

getNamedValue - Return the first global value in the module with the specified name, of arbitrary type.

This method returns null if a global with the specified name is not found.

Definition at line 172 of file Module.cpp.

Referenced by getComdatGVForCOFF().

◆ getNumberRegisterParameters()

unsigned Module::getNumberRegisterParameters ( ) const

Returns the Number of Register ParametersDwarf Version by checking module flags.

Definition at line 577 of file Module.cpp.

◆ getNumNamedValues()

unsigned Module::getNumNamedValues ( ) const

Return the number of global values in the module.

Definition at line 176 of file Module.cpp.

◆ getOperandBundleTags()

void Module::getOperandBundleTags ( SmallVectorImpl< StringRef > & Result) const

Populate client supplied SmallVector with the bundle tags registered in this LLVMContext.

The bundle tags are ordered by increasing bundle IDs.

See also
LLVMContext::getOperandBundleTagID

Definition at line 193 of file Module.cpp.

◆ getOrInsertComdat()

Comdat * Module::getOrInsertComdat ( StringRef Name)

Return the Comdat in the module with the specified name.

It is created if it didn't already exist.

Definition at line 611 of file Module.cpp.

◆ getOrInsertFunction() [1/5]

template<typename... ArgsTy>
FunctionCallee llvm::Module::getOrInsertFunction ( StringRef Name,
AttributeList AttributeList,
FunctionType * Invalid,
ArgsTy... Args )
delete

References llvm::Invalid.

◆ getOrInsertFunction() [2/5]

template<typename... ArgsTy>
FunctionCallee llvm::Module::getOrInsertFunction ( StringRef Name,
AttributeList AttributeList,
Type * RetTy,
ArgsTy... Args )
inline

Same as above, but takes a list of function arguments, which makes it easier for clients to use.

Definition at line 396 of file Module.h.

References llvm::FunctionType::get(), and getOrInsertFunction().

◆ getOrInsertFunction() [3/5]

FunctionCallee Module::getOrInsertFunction ( StringRef Name,
FunctionType * T )

Definition at line 223 of file Module.cpp.

◆ getOrInsertFunction() [4/5]

FunctionCallee Module::getOrInsertFunction ( StringRef Name,
FunctionType * T,
AttributeList AttributeList )

Look up the specified function in the module symbol table.

If it does not exist, add a prototype for the function and return it. Otherwise, return the existing function.

In all cases, the returned value is a FunctionCallee wrapper around the 'FunctionType T' passed in, as well as the 'Value' of the Function. The function type of the function may differ from the function type stored in FunctionCallee if it was previously created with a different type.

Note: For library calls getOrInsertLibFunc() should be used instead.

Definition at line 206 of file Module.cpp.

Referenced by getOrInsertFunction(), getOrInsertFunction(), InsertCall(), and insertCallBeforeInstruction().

◆ getOrInsertFunction() [5/5]

template<typename... ArgsTy>
FunctionCallee llvm::Module::getOrInsertFunction ( StringRef Name,
Type * RetTy,
ArgsTy... Args )
inline

Same as above, but without the attributes.

Definition at line 407 of file Module.h.

References getOrInsertFunction().

◆ getOrInsertGlobal() [1/2]

GlobalVariable * Module::getOrInsertGlobal ( StringRef Name,
Type * Ty )

Look up the specified global in the module symbol table.

If required, this overload constructs the global variable using its constructor's defaults.

Definition at line 271 of file Module.cpp.

◆ getOrInsertGlobal() [2/2]

GlobalVariable * Module::getOrInsertGlobal ( StringRef Name,
Type * Ty,
function_ref< GlobalVariable *()> CreateGlobalCallback )

Look up the specified global in the module symbol table.

getOrInsertGlobal - Look up the specified global in the module symbol table.

If it does not exist, invoke a callback to create a declaration of the global and return it.

If it does not exist, add a declaration of the global and return it. Otherwise, return the existing global.

Definition at line 257 of file Module.cpp.

◆ getOrInsertModuleFlagsMetadata()

NamedMDNode * Module::getOrInsertModuleFlagsMetadata ( )

Returns the NamedMDNode in the module that represents module-level flags.

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.

Definition at line 367 of file Module.cpp.

◆ getOrInsertNamedMetadata()

NamedMDNode * Module::getOrInsertNamedMetadata ( StringRef Name)

Return the named MDNode in the module with the specified name.

getOrInsertNamedMetadata - Return the first named MDNode in the module with the specified name.

This method returns a new NamedMDNode if a NamedMDNode with the specified name is not found.

Definition at line 303 of file Module.cpp.

Referenced by llvm::CloneFunctionInto().

◆ getOverrideStackAlignment()

unsigned Module::getOverrideStackAlignment ( ) const

Get/set the stack alignment overridden from the default.

Definition at line 800 of file Module.cpp.

◆ getPICLevel()

PICLevel::Level Module::getPICLevel ( ) const

Returns the PIC level (small or large model)

Definition at line 617 of file Module.cpp.

◆ getPIELevel()

PIELevel::Level Module::getPIELevel ( ) const

Returns the PIE level (small or large model)

Definition at line 633 of file Module.cpp.

Referenced by llvm::TargetMachine::getTLSModel(), and ProcessThinLTOModule().

◆ getProfileSummary()

Metadata * Module::getProfileSummary ( bool IsCS) const

Returns profile summary metadata.

When IsCS is true, use the context sensitive profile summary.

Definition at line 689 of file Module.cpp.

◆ getRtLibUseGOT()

bool Module::getRtLibUseGOT ( ) const

Returns true if PLT should be avoided for RTLib calls.

Definition at line 712 of file Module.cpp.

◆ getSDKVersion()

VersionTuple Module::getSDKVersion ( ) const

Get the build SDK version metadata.

An empty version is returned if no such metadata is attached.

Definition at line 861 of file Module.cpp.

◆ getSemanticInterposition()

bool Module::getSemanticInterposition ( ) const

Returns whether semantic interposition is to be respected.

Definition at line 694 of file Module.cpp.

Referenced by llvm::GlobalValue::isInterposable().

◆ getSourceFileName()

const std::string & llvm::Module::getSourceFileName ( ) const
inline

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.

Definition at line 263 of file Module.h.

Referenced by llvm::getStrippedSourceFileName(), llvm::FunctionImporter::importFunctions(), selectExplicitSectionGlobal(), and llvm::thinLTOInternalizeModule().

◆ getStackProtectorGuard()

StringRef Module::getStackProtectorGuard ( ) const

Get/set what kind of stack protector guard to use.

Definition at line 753 of file Module.cpp.

◆ getStackProtectorGuardOffset()

int Module::getStackProtectorGuardOffset ( ) const

Get/set what offset from the stack protector to use.

Definition at line 789 of file Module.cpp.

◆ getStackProtectorGuardReg()

StringRef Module::getStackProtectorGuardReg ( ) const

Get/set which register to use as the stack protector guard register.

The empty string is equivalent to "global". Other values may be "tls" or "sysreg".

Definition at line 765 of file Module.cpp.

◆ getStackProtectorGuardSymbol()

StringRef Module::getStackProtectorGuardSymbol ( ) const

Get/set a symbol to use as the stack protector guard.

Definition at line 777 of file Module.cpp.

◆ getSublistAccess()

FunctionListType Module::* llvm::Module::getSublistAccess ( Function * )
inlinestatic

Definition at line 599 of file Module.h.

References Module().

◆ getTargetABIFromMD()

StringRef Module::getTargetABIFromMD ( )

Returns target-abi from MDString, null if target-abi is absent.

Definition at line 919 of file Module.cpp.

◆ getTargetTriple()

◆ getUniqueIntrinsicName()

std::string Module::getUniqueIntrinsicName ( StringRef BaseName,
Intrinsic::ID Id,
const FunctionType * Proto )

Return a unique name for an intrinsic whose mangling is based on an unnamed type.

The Proto represents the function prototype.

Definition at line 506 of file Module.cpp.

◆ getUwtable()

UWTableKind Module::getUwtable ( ) const

Get/set whether synthesized functions should get the uwtable attribute.

Definition at line 733 of file Module.cpp.

◆ getValueSymbolTable() [1/2]

ValueSymbolTable & llvm::Module::getValueSymbolTable ( )
inline

Get the Module's symbol table of global variable and function identifiers.

Definition at line 666 of file Module.h.

◆ getValueSymbolTable() [2/2]

const ValueSymbolTable & llvm::Module::getValueSymbolTable ( ) const
inline

Get the symbol table of global variable and function identifiers.

Definition at line 664 of file Module.h.

◆ getWinX64EHUnwindV2Mode()

WinX64EHUnwindV2Mode Module::getWinX64EHUnwindV2Mode ( ) const

Get how unwind v2 (epilog) information should be generated for x64 Windows.

Definition at line 927 of file Module.cpp.

◆ global_begin() [1/2]

global_iterator llvm::Module::global_begin ( )
inline

Definition at line 677 of file Module.h.

Referenced by globals(), globals(), and LLVMGetPreviousGlobal().

◆ global_begin() [2/2]

const_global_iterator llvm::Module::global_begin ( ) const
inline

Definition at line 678 of file Module.h.

◆ global_empty()

bool llvm::Module::global_empty ( ) const
inline

Definition at line 682 of file Module.h.

◆ global_end() [1/2]

global_iterator llvm::Module::global_end ( )
inline

Definition at line 679 of file Module.h.

Referenced by globals(), globals(), and LLVMGetNextGlobal().

◆ global_end() [2/2]

const_global_iterator llvm::Module::global_end ( ) const
inline

Definition at line 680 of file Module.h.

◆ global_objects() [1/2]

iterator_range< Module::global_object_iterator > Module::global_objects ( )

Definition at line 441 of file Module.cpp.

Referenced by llvm::thinLTOFinalizeInModule().

◆ global_objects() [2/2]

iterator_range< Module::const_global_object_iterator > Module::global_objects ( ) const

Definition at line 445 of file Module.cpp.

◆ global_size()

size_t llvm::Module::global_size ( ) const
inline

Definition at line 681 of file Module.h.

◆ global_values() [1/2]

iterator_range< Module::global_value_iterator > Module::global_values ( )

Definition at line 449 of file Module.cpp.

◆ global_values() [2/2]

iterator_range< Module::const_global_value_iterator > Module::global_values ( ) const

Definition at line 453 of file Module.cpp.

◆ globals() [1/2]

iterator_range< global_iterator > llvm::Module::globals ( )
inline

◆ globals() [2/2]

iterator_range< const_global_iterator > llvm::Module::globals ( ) const
inline

Definition at line 687 of file Module.h.

References global_begin(), global_end(), and llvm::make_range().

◆ ifunc_begin() [1/2]

ifunc_iterator llvm::Module::ifunc_begin ( )
inline

Definition at line 735 of file Module.h.

Referenced by ifuncs(), ifuncs(), and LLVMGetPreviousGlobalIFunc().

◆ ifunc_begin() [2/2]

const_ifunc_iterator llvm::Module::ifunc_begin ( ) const
inline

Definition at line 736 of file Module.h.

◆ ifunc_empty()

bool llvm::Module::ifunc_empty ( ) const
inline

Definition at line 740 of file Module.h.

◆ ifunc_end() [1/2]

ifunc_iterator llvm::Module::ifunc_end ( )
inline

Definition at line 737 of file Module.h.

Referenced by ifuncs(), ifuncs(), and LLVMGetNextGlobalIFunc().

◆ ifunc_end() [2/2]

const_ifunc_iterator llvm::Module::ifunc_end ( ) const
inline

Definition at line 738 of file Module.h.

◆ ifunc_size()

size_t llvm::Module::ifunc_size ( ) const
inline

Definition at line 739 of file Module.h.

◆ ifuncs() [1/2]

iterator_range< ifunc_iterator > llvm::Module::ifuncs ( )
inline

Definition at line 742 of file Module.h.

References ifunc_begin(), ifunc_end(), and llvm::make_range().

Referenced by llvm::sandboxir::Context::createModule().

◆ ifuncs() [2/2]

iterator_range< const_ifunc_iterator > llvm::Module::ifuncs ( ) const
inline

Definition at line 745 of file Module.h.

References ifunc_begin(), ifunc_end(), and llvm::make_range().

◆ insertAlias()

void llvm::Module::insertAlias ( GlobalAlias * Alias)
inline

Insert Alias at the end of the alias list and take ownership.

Definition at line 608 of file Module.h.

◆ insertGlobalVariable() [1/2]

void llvm::Module::insertGlobalVariable ( GlobalListType::iterator Where,
GlobalVariable * GV )
inline

Insert global variable GV into the global variable list before Where and take ownership.

Definition at line 573 of file Module.h.

◆ insertGlobalVariable() [2/2]

void llvm::Module::insertGlobalVariable ( GlobalVariable * GV)
inline

Insert global variable GV at the end of the global variable list and take ownership.

Definition at line 568 of file Module.h.

References insertGlobalVariable().

Referenced by llvm::GlobalVariable::GlobalVariable(), insertGlobalVariable(), OptimizeGlobalAddressOfAllocation(), removeGlobalCtors(), and TryToShrinkGlobalToBoolean().

◆ insertIFunc()

void llvm::Module::insertIFunc ( GlobalIFunc * IFunc)
inline

Insert IFunc at the end of the alias list and take ownership.

Definition at line 617 of file Module.h.

◆ insertNamedMDNode()

void llvm::Module::insertNamedMDNode ( NamedMDNode * MDNode)
inline

Insert MDNode at the end of the alias list and take ownership.

Definition at line 626 of file Module.h.

◆ isDwarf64()

bool Module::isDwarf64 ( ) const

Returns the DWARF format by checking module flags.

Definition at line 592 of file Module.cpp.

◆ isMaterialized()

bool llvm::Module::isMaterialized ( ) const
inline

Definition at line 551 of file Module.h.

References getMaterializer().

◆ isValidModFlagBehavior()

bool Module::isValidModFlagBehavior ( Metadata * MD,
ModFlagBehavior & MFB )
static

Checks if Metadata represents a valid ModFlagBehavior, and stores the converted result in MFB.

Definition at line 324 of file Module.cpp.

◆ materialize()

Error Module::materialize ( GlobalValue * GV)

Make sure the GlobalValue is fully read.

Definition at line 467 of file Module.cpp.

Referenced by llvm::GlobalValue::materialize().

◆ materializeAll()

Error Module::materializeAll ( )

Make sure all GlobalValues in this Module are fully read and clear the Materializer.

Definition at line 474 of file Module.cpp.

◆ materializeMetadata()

Error Module::materializeMetadata ( )

Definition at line 481 of file Module.cpp.

◆ named_metadata() [1/2]

iterator_range< named_metadata_iterator > llvm::Module::named_metadata ( )
inline

Definition at line 789 of file Module.h.

References llvm::make_range(), named_metadata_begin(), and named_metadata_end().

◆ named_metadata() [2/2]

iterator_range< const_named_metadata_iterator > llvm::Module::named_metadata ( ) const
inline

Definition at line 792 of file Module.h.

References llvm::make_range(), named_metadata_begin(), and named_metadata_end().

◆ named_metadata_begin() [1/2]

named_metadata_iterator llvm::Module::named_metadata_begin ( )
inline

Definition at line 776 of file Module.h.

Referenced by LLVMGetPreviousNamedMetadata(), named_metadata(), and named_metadata().

◆ named_metadata_begin() [2/2]

const_named_metadata_iterator llvm::Module::named_metadata_begin ( ) const
inline

Definition at line 777 of file Module.h.

◆ named_metadata_empty()

bool llvm::Module::named_metadata_empty ( ) const
inline

Definition at line 787 of file Module.h.

◆ named_metadata_end() [1/2]

named_metadata_iterator llvm::Module::named_metadata_end ( )
inline

Definition at line 781 of file Module.h.

Referenced by LLVMGetNextNamedMetadata(), named_metadata(), and named_metadata().

◆ named_metadata_end() [2/2]

const_named_metadata_iterator llvm::Module::named_metadata_end ( ) const
inline

Definition at line 782 of file Module.h.

◆ named_metadata_size()

size_t llvm::Module::named_metadata_size ( ) const
inline

Definition at line 786 of file Module.h.

◆ operator=()

Module & Module::operator= ( Module && Other)

Move assignment.

Definition at line 79 of file Module.cpp.

◆ print()

void Module::print ( raw_ostream & OS,
AssemblyAnnotationWriter * AAW,
bool ShouldPreserveUseListOrder = false,
bool IsForDebug = false ) const

Print the module to an output stream with an optional AssemblyAnnotationWriter.

If ShouldPreserveUseListOrder, then include uselistorder directives so that use-lists can be recreated when reading the assembly.

Definition at line 5075 of file AsmWriter.cpp.

References print().

Referenced by llvm::MemorySSA::print(), and print().

◆ rbegin() [1/2]

reverse_iterator llvm::Module::rbegin ( )
inline

Definition at line 699 of file Module.h.

◆ rbegin() [2/2]

const_reverse_iterator llvm::Module::rbegin ( ) const
inline

Definition at line 700 of file Module.h.

◆ removeAlias()

void llvm::Module::removeAlias ( GlobalAlias * Alias)
inline

Detach Alias from the list but don't delete it.

Definition at line 604 of file Module.h.

Referenced by llvm::GlobalAlias::removeFromParent().

◆ removeDebugIntrinsicDeclarations()

void Module::removeDebugIntrinsicDeclarations ( )

Used when printing this module in the new debug info format; removes all declarations of debug intrinsics that are replaced by non-intrinsic records in the new format.

Definition at line 122 of file Module.cpp.

Referenced by Constant.

◆ removeGlobalVariable()

void llvm::Module::removeGlobalVariable ( GlobalVariable * GV)
inline

Detach global variable GV from the list but don't delete it.

Definition at line 563 of file Module.h.

Referenced by llvm::GlobalVariable::removeFromParent().

◆ removeIFunc()

void llvm::Module::removeIFunc ( GlobalIFunc * IFunc)
inline

Detach IFunc from the list but don't delete it.

Definition at line 613 of file Module.h.

Referenced by llvm::GlobalIFunc::removeFromParent().

◆ removeNamedMDNode()

void llvm::Module::removeNamedMDNode ( NamedMDNode * MDNode)
inline

Detach MDNode from the list but don't delete it.

Definition at line 622 of file Module.h.

◆ rend() [1/2]

reverse_iterator llvm::Module::rend ( )
inline

Definition at line 701 of file Module.h.

◆ rend() [2/2]

const_reverse_iterator llvm::Module::rend ( ) const
inline

Definition at line 702 of file Module.h.

◆ setCodeModel()

void Module::setCodeModel ( CodeModel::Model CL)

Set the code model (tiny, small, kernel, medium or large)

Definition at line 657 of file Module.cpp.

◆ setDarwinTargetVariantSDKVersion()

void Module::setDarwinTargetVariantSDKVersion ( VersionTuple Version)

Set the target variant version build SDK version metadata.

Definition at line 915 of file Module.cpp.

◆ setDarwinTargetVariantTriple()

void Module::setDarwinTargetVariantTriple ( StringRef T)

Set the target variant triple which is a string describing a variant of the target host platform.

Definition at line 906 of file Module.cpp.

◆ setDataLayout() [1/2]

void Module::setDataLayout ( const DataLayout & Other)

Definition at line 426 of file Module.cpp.

◆ setDataLayout() [2/2]

void Module::setDataLayout ( StringRef Desc)

Set the data layout.

Definition at line 424 of file Module.cpp.

◆ setDirectAccessExternalData()

void Module::setDirectAccessExternalData ( bool Value)

Definition at line 729 of file Module.cpp.

◆ setFramePointer()

void Module::setFramePointer ( FramePointerKind Kind)

Definition at line 749 of file Module.cpp.

◆ setLargeDataThreshold()

void Module::setLargeDataThreshold ( uint64_t Threshold)

Set the large data threshold.

Definition at line 675 of file Module.cpp.

◆ setMaterializer()

void Module::setMaterializer ( GVMaterializer * GVM)

Sets the GVMaterializer to GVM.

This module must not yet have a Materializer. To reset the materializer for a module that already has one, call materializeAll first. Destroying this module will destroy its materializer without materializing any more GlobalValues. Without destroying the Module, there is no way to detach or destroy a materializer without materializing all the GVs it controls, to avoid leaving orphan unmaterialized GVs.

Definition at line 460 of file Module.cpp.

◆ setModuleFlag() [1/3]

void Module::setModuleFlag ( ModFlagBehavior Behavior,
StringRef Key,
Constant * Val )

Definition at line 414 of file Module.cpp.

◆ setModuleFlag() [2/3]

void Module::setModuleFlag ( ModFlagBehavior Behavior,
StringRef Key,
Metadata * Val )

Like addModuleFlag but replaces the old module flag if it already exists.

Definition at line 402 of file Module.cpp.

◆ setModuleFlag() [3/3]

void Module::setModuleFlag ( ModFlagBehavior Behavior,
StringRef Key,
uint32_t Val )

Definition at line 418 of file Module.cpp.

◆ setModuleIdentifier()

void llvm::Module::setModuleIdentifier ( StringRef ID)
inline

Set the module identifier.

Definition at line 314 of file Module.h.

◆ setModuleInlineAsm()

void llvm::Module::setModuleInlineAsm ( StringRef Asm)
inline

Set the module-scope inline assembly blocks.

A trailing newline is added if the input doesn't have one.

Definition at line 328 of file Module.h.

◆ setOverrideStackAlignment()

void Module::setOverrideStackAlignment ( unsigned Align)

Definition at line 814 of file Module.cpp.

◆ setOwnedMemoryBuffer()

void Module::setOwnedMemoryBuffer ( std::unique_ptr< MemoryBuffer > MB)

Take ownership of the given memory buffer.

Definition at line 708 of file Module.cpp.

◆ setPartialSampleProfileRatio()

void Module::setPartialSampleProfileRatio ( const ModuleSummaryIndex & Index)

Set the partial sample profile ratio in the profile summary module flag, if applicable.

Definition at line 880 of file Module.cpp.

◆ setPICLevel()

void Module::setPICLevel ( PICLevel::Level PL)

Set the PIC level (small or large model)

Definition at line 627 of file Module.cpp.

◆ setPIELevel()

void Module::setPIELevel ( PIELevel::Level PL)

Set the PIE level (small or large model)

Definition at line 643 of file Module.cpp.

◆ setProfileSummary()

void Module::setProfileSummary ( Metadata * M,
ProfileSummary::Kind Kind )

Attach profile summary metadata to this module.

Definition at line 682 of file Module.cpp.

◆ setRtLibUseGOT()

void Module::setRtLibUseGOT ( )

Set that PLT should be avoid for RTLib calls.

Definition at line 717 of file Module.cpp.

◆ setSDKVersion()

void Module::setSDKVersion ( const VersionTuple & V)

Attach a build SDK version metadata to this module.

Definition at line 832 of file Module.cpp.

◆ setSemanticInterposition()

void Module::setSemanticInterposition ( bool SI)

Set whether semantic interposition is to be respected.

Definition at line 704 of file Module.cpp.

◆ setSourceFileName()

void llvm::Module::setSourceFileName ( StringRef Name)
inline

Set the module's original source file name.

Definition at line 317 of file Module.h.

◆ setStackProtectorGuard()

void Module::setStackProtectorGuard ( StringRef Kind)

Definition at line 760 of file Module.cpp.

◆ setStackProtectorGuardOffset()

void Module::setStackProtectorGuardOffset ( int Offset)

Definition at line 796 of file Module.cpp.

◆ setStackProtectorGuardReg()

void Module::setStackProtectorGuardReg ( StringRef Reg)

Definition at line 772 of file Module.cpp.

◆ setStackProtectorGuardSymbol()

void Module::setStackProtectorGuardSymbol ( StringRef Symbol)

Definition at line 784 of file Module.cpp.

◆ setTargetTriple()

void llvm::Module::setTargetTriple ( Triple T)
inline

Set the target triple.

Definition at line 324 of file Module.h.

References T.

Referenced by llvm::LTOModule::setTargetTriple().

◆ setUwtable()

void Module::setUwtable ( UWTableKind Kind)

Definition at line 739 of file Module.cpp.

◆ shouldEmitInstrCountChangedRemark()

bool llvm::Module::shouldEmitInstrCountChangedRemark ( )
inline

Return true if size-info optimization remark is enabled, false otherwise.

Definition at line 304 of file Module.h.

References getContext().

◆ size()

size_t llvm::Module::size ( ) const
inline

Definition at line 703 of file Module.h.

◆ Constant

friend class Constant
friend

Definition at line 212 of file Module.h.

References Constant, and removeDebugIntrinsicDeclarations().

Referenced by Constant.

◆ llvm::SymbolTableListTraits< llvm::GlobalAlias >

Definition at line 638 of file Module.h.

References Module().

◆ llvm::SymbolTableListTraits< llvm::GlobalIFunc >

Definition at line 648 of file Module.h.

References Module().

◆ llvm::SymbolTableListTraits< llvm::GlobalVariable >

Definition at line 589 of file Module.h.

References Module().


The documentation for this class was generated from the following files: