LLVM  4.0.0
Classes | Public Member Functions | List of all members
llvm::Module Class Reference

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

#include <Module.h>

Classes

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

Public Member Functions

void dropTriviallyDeadConstantArrays ()
 Destroy ConstantArrays in LLVMContext if they are not used. More...
 
void setOwnedMemoryBuffer (std::unique_ptr< MemoryBuffer > MB)
 Take ownership of the given memory buffer. More...
 
Constructors
 Module (StringRef ModuleID, LLVMContext &C)
 The Module constructor. More...
 
 ~Module ()
 The module destructor. This will dropAllReferences. More...
 
Module Level Accessors
const std::string & getModuleIdentifier () const
 Get the module identifier which is, essentially, the name of the module. More...
 
const std::string & getSourceFileName () const
 Get the module's original source file name. More...
 
StringRef getName () const
 Get a short "name" for the module. More...
 
const std::string & getDataLayoutStr () const
 Get the data layout string for the module's target platform. More...
 
const DataLayoutgetDataLayout () const
 Get the data layout for the module's target platform. More...
 
const std::string & getTargetTriple () const
 Get the target triple which is a string describing the target host. More...
 
LLVMContextgetContext () const
 Get the global data context. More...
 
const std::string & getModuleInlineAsm () const
 Get any module-scope inline assembly blocks. More...
 
RandomNumberGeneratorcreateRNG (const Pass *P) const
 Get a RandomNumberGenerator salted for use with this module. More...
 
Module Level Mutators
void setModuleIdentifier (StringRef ID)
 Set the module identifier. More...
 
void setSourceFileName (StringRef Name)
 Set the module's original source file name. More...
 
void setDataLayout (StringRef Desc)
 Set the data layout. More...
 
void setDataLayout (const DataLayout &Other)
 
void setTargetTriple (StringRef T)
 Set the target triple. More...
 
void setModuleInlineAsm (StringRef Asm)
 Set the module-scope inline assembly blocks. More...
 
void appendModuleInlineAsm (StringRef Asm)
 Append to the module-scope inline assembly blocks. More...
 
Generic Value Accessors
GlobalValuegetNamedValue (StringRef Name) const
 Return the global value in the module with the specified name, of arbitrary type. More...
 
unsigned getMDKindID (StringRef Name) const
 Return a unique non-zero ID for the specified metadata kind. More...
 
void getMDKindNames (SmallVectorImpl< StringRef > &Result) const
 Populate client supplied SmallVector with the name for custom metadata IDs registered in this LLVMContext. More...
 
void getOperandBundleTags (SmallVectorImpl< StringRef > &Result) const
 Populate client supplied SmallVector with the bundle tags registered in this LLVMContext. More...
 
StructTypegetTypeByName (StringRef Name) const
 Return the type with the specified name, or null if there is none by that name. More...
 
std::vector< StructType * > getIdentifiedStructTypes () const
 
Function Accessors
ConstantgetOrInsertFunction (StringRef Name, FunctionType *T, AttributeSet AttributeList)
 Look up the specified function in the module symbol table. More...
 
ConstantgetOrInsertFunction (StringRef Name, FunctionType *T)
 
ConstantgetOrInsertFunction (StringRef Name, AttributeSet AttributeList, Type *RetTy,...) LLVM_END_WITH_NULL
 Look up the specified function in the module symbol table. More...
 
ConstantgetOrInsertFunction (StringRef Name, Type *RetTy,...) LLVM_END_WITH_NULL
 Same as above, but without the attributes. More...
 
FunctiongetFunction (StringRef Name) const
 Look up the specified function in the module symbol table. More...
 
Global Variable Accessors
GlobalVariablegetGlobalVariable (StringRef Name) const
 Look up the specified global variable in the module symbol table. More...
 
GlobalVariablegetGlobalVariable (StringRef Name, bool AllowInternal) const
 
GlobalVariablegetGlobalVariable (StringRef Name, bool AllowInternal=false)
 getGlobalVariable - Look up the specified global variable in the module symbol table. More...
 
GlobalVariablegetNamedGlobal (StringRef Name)
 Return the global variable in the module with the specified name, of arbitrary type. More...
 
const GlobalVariablegetNamedGlobal (StringRef Name) const
 
ConstantgetOrInsertGlobal (StringRef Name, Type *Ty)
 Look up the specified global in the module symbol table. More...
 
Global Alias Accessors
GlobalAliasgetNamedAlias (StringRef Name) const
 Return the global alias in the module with the specified name, of arbitrary type. More...
 
Global IFunc Accessors
GlobalIFuncgetNamedIFunc (StringRef Name) const
 Return the global ifunc in the module with the specified name, of arbitrary type. More...
 
Named Metadata Accessors
NamedMDNodegetNamedMetadata (const Twine &Name) const
 Return the first NamedMDNode in the module with the specified name. More...
 
NamedMDNodegetOrInsertNamedMetadata (StringRef Name)
 Return the named MDNode in the module with the specified name. More...
 
void eraseNamedMetadata (NamedMDNode *NMD)
 Remove the given NamedMDNode from this module and delete it. More...
 
Comdat Accessors
ComdatgetOrInsertComdat (StringRef Name)
 Return the Comdat in the module with the specified name. More...
 
Module Flags Accessors
void getModuleFlagsMetadata (SmallVectorImpl< ModuleFlagEntry > &Flags) const
 Returns the module flags in the provided vector. More...
 
MetadatagetModuleFlag (StringRef Key) const
 Return the corresponding value if Key appears in module flags, otherwise return null. More...
 
NamedMDNodegetModuleFlagsMetadata () const
 Returns the NamedMDNode in the module that represents module-level flags. More...
 
NamedMDNodegetOrInsertModuleFlagsMetadata ()
 Returns the NamedMDNode in the module that represents module-level flags. More...
 
void addModuleFlag (ModFlagBehavior Behavior, StringRef Key, Metadata *Val)
 Add a module-level flag to the module-level flags metadata. More...
 
void addModuleFlag (ModFlagBehavior Behavior, StringRef Key, Constant *Val)
 
void addModuleFlag (ModFlagBehavior Behavior, StringRef Key, uint32_t Val)
 
void addModuleFlag (MDNode *Node)
 
Materialization
void setMaterializer (GVMaterializer *GVM)
 Sets the GVMaterializer to GVM. More...
 
GVMaterializergetMaterializer () const
 Retrieves the GVMaterializer, if any, for this Module. More...
 
bool isMaterialized () const
 
llvm::Error materialize (GlobalValue *GV)
 Make sure the GlobalValue is fully read. More...
 
llvm::Error materializeAll ()
 Make sure all GlobalValues in this Module are fully read and clear the Materializer. More...
 
llvm::Error materializeMetadata ()
 
Global Variable Iteration
global_iterator global_begin ()
 
const_global_iterator global_begin () const
 
global_iterator global_end ()
 
const_global_iterator global_end () const
 
bool global_empty () const
 
iterator_range< global_iteratorglobals ()
 
iterator_range
< const_global_iterator
globals () 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_iterator
aliases () 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_iterator
ifuncs () 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_iterator
named_metadata ()
 
iterator_range
< const_named_metadata_iterator
named_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_iterator
debug_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. More...
 
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. More...
 
void dump () const
 Dump the module to stderr (for debugging). More...
 
void dropAllReferences ()
 This function causes all the subinstructions to "let go" of all references that they are maintaining. More...
 
Utility functions for querying Debug information.
unsigned getDwarfVersion () const
 Returns the Dwarf Version by checking module flags. More...
 
unsigned getCodeViewFlag () const
 Returns the CodeView Version by checking module flags. More...
 
Utility functions for querying and setting PIC level
PICLevel::Level getPICLevel () const
 Returns the PIC level (small or large model) More...
 
void setPICLevel (PICLevel::Level PL)
 Set the PIC level (small or large model) More...
 
Utility functions for querying and setting PIE level
PIELevel::Level getPIELevel () const
 Returns the PIE level (small or large model) More...
 
void setPIELevel (PIELevel::Level PL)
 Set the PIE level (small or large model) More...
 
Utility functions for querying and setting PGO summary
void setProfileSummary (Metadata *M)
 Attach profile summary metadata to this module. More...
 
MetadatagetProfileSummary ()
 Returns profile summary metadata. More...
 

Types And Enumerations

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

Member Variables

class Constant
 

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

static GlobalListType Module::* getSublistAccess (GlobalVariable *)
 
static FunctionListType Module::* getSublistAccess (Function *)
 
static AliasListType Module::* getSublistAccess (GlobalAlias *)
 
static IFuncListType Module::* getSublistAccess (GlobalIFunc *)
 
static NamedMDListType Module::* getSublistAccess (NamedMDNode *)
 
const GlobalListTypegetGlobalList () const
 Get the Module's list of global variables (constant). More...
 
GlobalListTypegetGlobalList ()
 Get the Module's list of global variables. More...
 
const FunctionListTypegetFunctionList () const
 Get the Module's list of functions (constant). More...
 
FunctionListTypegetFunctionList ()
 Get the Module's list of functions. More...
 
const AliasListTypegetAliasList () const
 Get the Module's list of aliases (constant). More...
 
AliasListTypegetAliasList ()
 Get the Module's list of aliases. More...
 
const IFuncListTypegetIFuncList () const
 Get the Module's list of ifuncs (constant). More...
 
IFuncListTypegetIFuncList ()
 Get the Module's list of ifuncs. More...
 
const NamedMDListTypegetNamedMDList () const
 Get the Module's list of named metadata (constant). More...
 
NamedMDListTypegetNamedMDList ()
 Get the Module's list of named metadata. More...
 
const ValueSymbolTablegetValueSymbolTable () const
 Get the symbol table of global variable and function identifiers. More...
 
ValueSymbolTablegetValueSymbolTable ()
 Get the Module's symbol table of global variable and function identifiers. More...
 
const ComdatSymTabTypegetComdatSymbolTable () const
 Get the Module's symbol table for COMDATs (constant). More...
 
ComdatSymTabTypegetComdatSymbolTable ()
 Get the Module's symbol table for COMDATs. More...
 

Convenience iterators

typedef concat_iterator
< GlobalObject, iterator,
global_iterator
global_object_iterator
 
typedef concat_iterator< const
GlobalObject, const_iterator,
const_global_iterator
const_global_object_iterator
 
iterator_range
< global_object_iterator
global_objects ()
 
iterator_range
< const_global_object_iterator
global_objects () const
 
global_object_iterator global_object_begin ()
 
global_object_iterator global_object_end ()
 
const_global_object_iterator global_object_begin () const
 
const_global_object_iterator global_object_end () const
 

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 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. The main container class for the LLVM Intermediate Representation.

Definition at line 52 of file Module.h.

Member Typedef Documentation

The Global Alias iterators.

Definition at line 85 of file Module.h.

The type for the list of aliases.

Definition at line 61 of file Module.h.

The type of the comdat "symbol" table.

Definition at line 67 of file Module.h.

The Global Alias constant iterator.

Definition at line 87 of file Module.h.

The Global Variable constant iterator.

Definition at line 72 of file Module.h.

Definition at line 597 of file Module.h.

The Global IFunc constant iterator.

Definition at line 92 of file Module.h.

The Function constant iterator.

Definition at line 77 of file Module.h.

The named metadata constant iterators.

Definition at line 97 of file Module.h.

The Function constant reverse iterator.

Definition at line 82 of file Module.h.

The type for the list of functions.

Definition at line 59 of file Module.h.

The Global Variable iterator.

Definition at line 70 of file Module.h.

Definition at line 594 of file Module.h.

The type for the list of global variables.

Definition at line 57 of file Module.h.

The Global IFunc iterators.

Definition at line 90 of file Module.h.

The type for the list of ifuncs.

Definition at line 63 of file Module.h.

The Function iterators.

Definition at line 75 of file Module.h.

The named metadata iterators.

Definition at line 95 of file Module.h.

The type for the list of named metadata.

Definition at line 65 of file Module.h.

The Function reverse iterator.

Definition at line 80 of file Module.h.

Member Enumeration Documentation

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.

ModFlagBehaviorFirstVal 
ModFlagBehaviorLastVal 

Definition at line 100 of file Module.h.

Constructor & Destructor Documentation

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 53 of file Module.cpp.

Module::~Module ( )

The module destructor. This will dropAllReferences.

Definition at line 60 of file Module.cpp.

References llvm::iplist_impl< IntrusiveListT, TraitsT >::clear(), and dropAllReferences().

Member Function Documentation

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 352 of file Module.cpp.

References llvm::NamedMDNode::addOperand(), llvm::ConstantInt::get(), llvm::ConstantAsMetadata::get(), llvm::MDString::get(), llvm::MDNode::get(), llvm::Type::getInt32Ty(), getOrInsertModuleFlagsMetadata(), and Int32Ty.

Referenced by addModuleFlag(), llvm::orc::cloneModuleFlagsMetadata(), setPICLevel(), setPIELevel(), setProfileSummary(), and llvm::UpgradeModuleFlags().

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

Definition at line 360 of file Module.cpp.

References addModuleFlag(), and llvm::ConstantAsMetadata::get().

void Module::addModuleFlag ( ModFlagBehavior  Behavior,
StringRef  Key,
uint32_t  Val 
)
void Module::addModuleFlag ( MDNode Node)
alias_iterator llvm::Module::alias_begin ( )
inline

Definition at line 557 of file Module.h.

Referenced by aliases(), findPartitions(), OptimizeGlobalAliases(), and llvm::TypeFinder::run().

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

Definition at line 558 of file Module.h.

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

Definition at line 562 of file Module.h.

alias_iterator llvm::Module::alias_end ( )
inline

Definition at line 559 of file Module.h.

Referenced by aliases(), findPartitions(), OptimizeGlobalAliases(), and llvm::TypeFinder::run().

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

Definition at line 560 of file Module.h.

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

Definition at line 561 of file Module.h.

Referenced by llvm::NVPTXAsmPrinter::doInitialization().

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

Definition at line 567 of file Module.h.

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

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 266 of file Module.h.

References llvm::HexStyle::Asm.

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

Definition at line 536 of file Module.h.

RandomNumberGenerator * Module::createRNG ( const Pass P) 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 72 of file Module.cpp.

References llvm::sys::path::filename(), getModuleIdentifier(), and llvm::Pass::getPassName().

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 686 of file Module.h.

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

Referenced by llvm::DwarfDebug::beginModule(), and llvm::DebugInfoFinder::processModule().

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

Definition at line 673 of file Module.h.

References getNamedMetadata().

Referenced by llvm::DwarfDebug::beginModule().

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

Definition at line 678 of file Module.h.

References getNamedMetadata().

Referenced by llvm::DwarfDebug::beginModule().

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 454 of file Module.cpp.

References aliases(), llvm::Function::dropAllReferences(), F, globals(), and ifuncs().

Referenced by ~Module().

void Module::dropTriviallyDeadConstantArrays ( )

Destroy ConstantArrays in LLVMContext if they are not used.

ConstantArrays constructed during linking can cause quadratic memory explosion. Releasing all unused constants can cause a 20% LTO compile-time slowdown for a large application.

NOTE: Constants are currently owned by LLVMContext. This can then only be called where all uses of the LLVMContext are understood.

Definition at line 162 of file LLVMContextImpl.cpp.

References Context, llvm::LLVMContextImpl::dropTriviallyDeadConstantArrays(), and llvm::LLVMContext::pImpl.

Referenced by llvm::IRMover::move().

LLVM_DUMP_METHOD void Module::dump ( ) const

Dump the module to stderr (for debugging).

Definition at line 3548 of file AsmWriter.cpp.

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

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

Definition at line 544 of file Module.h.

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

Definition at line 538 of file Module.h.

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 287 of file Module.cpp.

References llvm::iplist_impl< IntrusiveListT, TraitsT >::erase(), llvm::ilist_node_impl< OptionsT >::getIterator(), and llvm::NamedMDNode::getName().

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

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

Definition at line 549 of file Module.h.

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

const AliasListType& llvm::Module::getAliasList ( ) const
inline

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

Definition at line 485 of file Module.h.

Referenced by llvm::GlobalAlias::eraseFromParent(), OptimizeGlobalAliases(), and llvm::GlobalAlias::removeFromParent().

AliasListType& llvm::Module::getAliasList ( )
inline

Get the Module's list of aliases.

Definition at line 487 of file Module.h.

unsigned Module::getCodeViewFlag ( ) const

Returns the CodeView Version by checking module flags.

Returns zero if not present in module.

Definition at line 475 of file Module.cpp.

References getModuleFlag().

Referenced by llvm::AsmPrinter::doInitialization().

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

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

Definition at line 510 of file Module.h.

Referenced by llvm::InternalizePass::internalizeModule(), and rewriteComdat().

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

Get the Module's symbol table for COMDATs.

Definition at line 512 of file Module.h.

LLVMContext& llvm::Module::getContext ( ) const
inline

Get the global data context.

Returns
LLVMContext - a container for LLVM's global information

Definition at line 222 of file Module.h.

References Context.

Referenced by llvm::LTOCodeGenerator::addModule(), llvm::IntrinsicLowering::AddPrototypes(), annotateAllFunctions(), llvm::annotateValueSite(), appendToGlobalArray(), appendToUsedList(), assureFPCallStub(), llvm::CloneModule(), createDevirtTriggerFunc(), createFPFnStub(), createFree(), CreateGCRelocates(), createIRLevelProfileFlagVariable(), llvm::createPGOFuncNameVar(), createPrivateGlobalForSourceLoc(), createPrivateGlobalForString(), createPrivateNonConstGlobalForString(), llvm::createSanitizerCtorAndInitFunctions(), CreateWrapper(), doImportingForModule(), EmitGCCInlineAsmStr(), llvm::AArch64TargetLowering::emitLoadLinked(), llvm::ARMTargetLowering::emitLoadLinked(), llvm::emitMemCpyChk(), EmitMSInlineAsmStr(), llvm::HexagonTargetLowering::emitStoreConditional(), llvm::AArch64TargetLowering::emitStoreConditional(), llvm::ARMTargetLowering::emitStoreConditional(), EnsureFPIntrinsicsExist(), llvm::SanitizerStatReport::finish(), fixupFPReturnAndCall(), llvm::objcarc::ARCMDKindCache::get(), llvm::AMDGPUIntrinsicInfo::getDeclaration(), llvm::Intrinsic::getDeclaration(), getDefaultPersonalityFn(), llvm::TargetLoweringBase::getDefaultSafeStackPointerLocation(), llvm::TargetLoweringBase::getIRStackGuard(), getOrInsertValueProfilingCall(), llvm::TargetLoweringBase::getSafeStackPointerLocation(), llvm::InstrProfIncrementInst::getStep(), getTypeByName(), llvm::FunctionImporter::importFunctions(), InsertSafepointPoll(), llvm::X86TargetLowering::insertSSPDeclarations(), llvm::TargetLoweringBase::insertSSPDeclarations(), insertUseHolderAfter(), llvm::VerifierPass::run(), llvm::legacy::PassManagerImpl::run(), llvm::Float2IntPass::runImpl(), llvm::SanitizerStatReport::SanitizerStatReport(), llvm::ModulePass::skipModule(), llvm::CallGraphSCCPass::skipSCC(), llvm::stripNonLineTableDebugInfo(), SwitchToLookupTable(), llvm::lto::thinBackend(), llvm::UpgradeDebugInfo(), and llvm::SelectionDAGBuilder::visitSPDescriptorParent().

const DataLayout & Module::getDataLayout ( ) const

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

Definition at line 384 of file Module.cpp.

Referenced by llvm::AliasSetTracker::add(), AddAlignmentAssumptions(), llvm::OrcCBindingsStack::addIRModule(), llvm::IVUsers::AddUsersImpl(), AllCallersPassInValidPointerForArgument(), AnalyzeLoadFromClobberingStore(), llvm::GlobalsAAResult::analyzeModule(), llvm::AAResults::callCapturesBefore(), llvm::objcarc::CanAlterRefCount(), llvm::canSinkOrHoistInst(), llvm::objcarc::CanUse(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneModule(), llvm::FunctionComparator::cmpTypes(), combineInstructionsOverFunction(), llvm::ComputeLegalValueVTs(), llvm::JumpThreadingPass::ComputeValueKnownInPredecessors(), llvm::ConstantFoldCall(), llvm::ConvertDebugDeclareToDebugValue(), llvm::SanitizerStatReport::create(), llvm::createLegacyPMBasicAAResult(), createMaskInstrs(), llvm::DependenceInfo::depends(), llvm::objcarc::ObjCARCAAWrapperPass::doInitialization(), llvm::JumpThreadingPass::DuplicateCondBranchOnPHIIntoPred(), eliminateDeadStores(), eliminateTailRecursion(), llvm::AsmPrinter::EmitAlignment(), emitCalloc(), EmitCamlGlobal(), llvm::AsmPrinter::EmitGlobalVariable(), llvm::TargetLoweringObjectFileCOFF::emitLinkerFlagsForGlobal(), llvm::AsmPrinter::EmitSpecialLLVMGlobal(), llvm::LazyValueInfo::eraseBlock(), llvm::FindAvailableLoadedValue(), findLoadCallsAtConstantOffset(), llvm::MCJIT::generateCodeForModule(), llvm::MemoryLocation::get(), getAlignment(), llvm::lto::InputFile::Symbol::getCommonSize(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::LazyValueInfo::getConstantRange(), llvm::AsmPrinter::getDataLayout(), llvm::MachineFunction::getDataLayout(), llvm::DemandedBits::getDemandedBits(), llvm::getGEPInductionOperand(), llvm::TargetLoweringObjectFileMachO::getIndirectSymViaGOTPCRel(), llvm::TargetLibraryInfoImpl::getLibFunc(), llvm::MemoryDependenceResults::getLoadLoadClobberFullWidthSize(), GetLoadValueForLoad(), llvm::ExecutionEngine::getMangledName(), llvm::Mangler::getNameWithPrefix(), llvm::LazyValueInfo::getPredicateAt(), llvm::LazyValueInfo::getPredicateOnEdge(), llvm::NVPTXTargetLowering::getPrototype(), getRuntimeMDForKernel(), llvm::TargetLoweringObjectFile::getSectionForJumpTable(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::DependenceInfo::getSplitIteration(), llvm::TargetLoweringObjectFile::getSymbolWithGlobalValueBase(), llvm::MipsTargetMachine::getTargetIRAnalysis(), llvm::TargetMachine::getTargetIRAnalysis(), llvm::AArch64TargetLowering::getTgtMemIntrinsic(), llvm::ARMTargetLowering::getTgtMemIntrinsic(), llvm::NVPTXTargetLowering::getTgtMemIntrinsic(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), llvm::CallLowering::handleAssignments(), HandleByValArgument(), HandleByValArgumentInit(), handleEndBlock(), handleFree(), llvm::hoistRegion(), llvm::DataLayout::init(), llvm::MIRParserImpl::initializeConstantPool(), llvm::InlineFunction(), llvm::InductionDescriptor::isInductionPHI(), isObjectDereferencedInBlock(), isPointerValueDeadOnEntryToFunction(), llvm::AArch64TargetLowering::isProfitableToHoist(), isSafePHIToSpeculate(), isSafeSelectToSpeculate(), llvm::isSafeToSpeculativelyExecute(), IsSmallObject(), llvm::AArch64CallLowering::lowerCall(), llvm::CallLowering::lowerCall(), llvm::AArch64CallLowering::lowerFormalArguments(), llvm::AArch64TargetLowering::lowerInterleavedLoad(), llvm::ARMTargetLowering::lowerInterleavedLoad(), llvm::AArch64TargetLowering::lowerInterleavedStore(), llvm::ARMTargetLowering::lowerInterleavedStore(), llvm::AArch64CallLowering::lowerReturn(), llvm::gvn::AvailableValue::MaterializeAdjustedValue(), mergeInlinedArrayAllocas(), OptimizeGlobalVars(), llvm::JumpThreadingPass::ProcessBlock(), llvm::JumpThreadingPass::ProcessImpliedCondition(), processInternalGlobal(), processPHI(), PromoteArguments(), llvm::promoteLoopAccessesToScalars(), replaceAndRecursivelySimplifyImpl(), replaceFrameSize(), llvm::returnTypeIsEligibleForTailCall(), llvm::IndVarSimplifyPass::run(), llvm::GlobalOptPass::run(), llvm::IPSCCPPass::run(), llvm::SCCPPass::run(), llvm::objcarc::ObjCARCAA::run(), llvm::BasicAA::run(), NewGVN::runGVN(), runImpl(), llvm::SLPVectorizerPass::runImpl(), llvm::NaryReassociatePass::runImpl(), llvm::LazyValueInfoWrapperPass::runOnFunction(), llvm::BasicAAWrapperPass::runOnFunction(), llvm::IRTranslator::runOnMachineFunction(), selectELFSectionForGlobal(), llvm::XCoreTargetObjectFile::SelectSectionForGlobal(), llvm::TargetLoweringObjectFileMachO::SelectSectionForGlobal(), llvm::HexagonTargetLowering::shouldExpandAtomicCmpXchgInIR(), llvm::SimplifyCFG(), llvm::SimplifyInstructionsInBlock(), llvm::LazyValueInfo::threadEdge(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), llvm::orc::CompileOnDemandLayer< CompileLayerT, CompileCallbackMgr >::updatePointer(), llvm::LoopVersioning::versionLoop(), and visitIVCast().

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 209 of file Module.h.

References llvm::DataLayout::getStringRepresentation().

unsigned Module::getDwarfVersion ( ) const

Returns the Dwarf Version by checking module flags.

Definition at line 468 of file Module.cpp.

References getModuleFlag().

Referenced by llvm::AsmPrinter::doInitialization(), and llvm::DwarfDebug::DwarfDebug().

Function * Module::getFunction ( StringRef  Name) const
const FunctionListType& llvm::Module::getFunctionList ( ) const
inline
FunctionListType& llvm::Module::getFunctionList ( )
inline

Get the Module's list of functions.

Definition at line 480 of file Module.h.

const GlobalListType& llvm::Module::getGlobalList ( ) const
inline
GlobalListType& llvm::Module::getGlobalList ( )
inline

Get the Module's list of global variables.

Definition at line 473 of file Module.h.

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 344 of file Module.h.

Referenced by appendToUsedList(), llvm::collectUsedGlobalVariables(), llvm::MCJIT::findModuleForSymbol(), getGlobalVariable(), getNamedGlobal(), llvm::X86TargetLowering::getSDagStackGuard(), llvm::TargetLoweringBase::getSDagStackGuard(), mergeConstants(), and StripSymbolNames().

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

Definition at line 348 of file Module.h.

References getGlobalVariable().

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

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 211 of file Module.cpp.

References getNamedValue().

std::vector< StructType * > Module::getIdentifiedStructTypes ( ) const
const IFuncListType& llvm::Module::getIFuncList ( ) const
inline

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

Definition at line 492 of file Module.h.

Referenced by llvm::GlobalIFunc::eraseFromParent(), and llvm::GlobalIFunc::removeFromParent().

IFuncListType& llvm::Module::getIFuncList ( )
inline

Get the Module's list of ifuncs.

Definition at line 494 of file Module.h.

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

Retrieves the GVMaterializer, if any, for this Module.

Definition at line 454 of file Module.h.

Referenced by isMaterialized().

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 99 of file Module.cpp.

References llvm::LLVMContext::getMDKindID().

Referenced by llvm::UpgradeIntrinsicCall().

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 106 of file Module.cpp.

References llvm::LLVMContext::getMDKindNames().

Metadata * Module::getModuleFlag ( StringRef  Key) const

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

Definition at line 325 of file Module.cpp.

References getModuleFlagsMetadata().

Referenced by getCodeViewFlag(), llvm::getDebugMetadataVersionFromModule(), getDwarfVersion(), getPICLevel(), getPIELevel(), and getProfileSummary().

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 305 of file Module.cpp.

References getModuleFlagsMetadata(), isValidModFlagBehavior(), llvm::NamedMDNode::operands(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().

Referenced by llvm::orc::cloneModuleFlagsMetadata(), and llvm::UpgradeModuleFlags().

NamedMDNode * Module::getModuleFlagsMetadata ( ) const

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

getModuleFlagsMetadata - 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 338 of file Module.cpp.

References getNamedMetadata().

Referenced by getModuleFlag(), and getModuleFlagsMetadata().

const std::string& llvm::Module::getModuleIdentifier ( ) const
inline
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 226 of file Module.h.

Referenced by llvm::CloneModule(), llvm::AsmPrinter::doInitialization(), llvm::NVPTXAsmPrinter::doInitialization(), llvm::ARMAsmPrinter::EmitStartOfAsmFile(), llvm::X86AsmPrinter::EmitStartOfAsmFile(), handleAsmUndefinedRefs(), and llvm::thinLTOInternalizeModule().

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 205 of file Module.h.

Referenced by getDescription(), llvm::getPGOFuncName(), llvm::ProfileSummaryPrinterPass::run(), and llvm::ImportedFunctionsInliningStatistics::setModuleInfo().

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 254 of file Module.cpp.

References getNamedValue().

GlobalVariable* llvm::Module::getNamedGlobal ( StringRef  Name)
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 357 of file Module.h.

References getGlobalVariable().

Referenced by appendToGlobalArray(), createGlobalValueName(), llvm::NVPTXAsmPrinter::doInitialization(), llvm::orc::getConstructors(), llvm::orc::getDestructors(), getNamedGlobal(), llvm::isIRPGOFlagSet(), llvm::TargetLowering::LowerToTLSEmulatedModel(), and llvm::ExecutionEngine::runStaticConstructorsDestructors().

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

Definition at line 360 of file Module.h.

References getNamedGlobal().

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 258 of file Module.cpp.

References getNamedValue().

const NamedMDListType& llvm::Module::getNamedMDList ( ) const
inline

Get the Module's list of named metadata (constant).

Definition at line 499 of file Module.h.

NamedMDListType& llvm::Module::getNamedMDList ( )
inline

Get the Module's list of named metadata.

Definition at line 501 of file Module.h.

NamedMDNode * Module::getNamedMetadata ( const Twine 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 265 of file Module.cpp.

References lookup(), and llvm::Twine::toStringRef().

Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), llvm::cacheAnnotationFromMD(), llvm::CodeViewDebug::CodeViewDebug(), debug_compile_units(), debug_compile_units_begin(), debug_compile_units_end(), getModuleFlagsMetadata(), getRuntimeMDForKernel(), and llvm::getRuntimeMDYAMLString().

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 93 of file Module.cpp.

References getValueSymbolTable(), and llvm::ValueSymbolTable::lookup().

Referenced by llvm::coro::declaresIntrinsics(), forceRenaming(), getComdatGVForCOFF(), llvm::TargetLoweringBase::getDefaultSafeStackPointerLocation(), getFunction(), getGlobalVariable(), getNamedAlias(), getNamedIFunc(), getOrInsertFunction(), getOrInsertGlobal(), and llvm::objcarc::ModuleHasARC().

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 110 of file Module.cpp.

References llvm::LLVMContext::getOperandBundleTags().

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 482 of file Module.cpp.

References llvm::StringMap< ValueTy, AllocatorTy >::insert().

Referenced by createIRLevelProfileFlagVariable(), getOrCreateProfileComdat(), and rewriteComdat().

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

Look up the specified function in the module symbol table.

Four possibilities:

  1. If it does not exist, add a prototype for the function and return it.
  2. If it exists, and has a local linkage, the existing function is renamed and a new one is inserted.
  3. Otherwise, if the existing function has the correct prototype, return the existing function.
  4. Finally, the function exists but has the wrong prototype: return the function with a constantexpr cast to the right prototype.

Definition at line 123 of file Module.cpp.

References llvm::Function::Create(), llvm::GlobalValue::ExternalLinkage, F, llvm::ConstantExpr::getBitCast(), getNamedValue(), llvm::GlobalValue::getType(), llvm::PointerType::getUnqual(), llvm::Function::isIntrinsic(), llvm::iplist_impl< IntrusiveListT, TraitsT >::push_back(), and llvm::Function::setAttributes().

Referenced by llvm::SanitizerStatReport::create(), createFree(), createMalloc(), llvm::createSanitizerCtorAndInitFunctions(), llvm::emitBinaryFloatFnCall(), emitCalloc(), llvm::emitFPutC(), llvm::emitFPutS(), llvm::emitFWrite(), llvm::emitMemChr(), llvm::emitMemCmp(), llvm::emitMemCpyChk(), llvm::emitPutChar(), llvm::emitPutS(), llvm::emitStrChr(), llvm::emitStrCpy(), llvm::emitStrLen(), llvm::emitStrNCmp(), llvm::emitStrNCpy(), llvm::emitUnaryFloatFnCall(), EnsureFunctionExists(), llvm::SanitizerStatReport::finish(), fixupFPReturnAndCall(), llvm::AMDGPUIntrinsicInfo::getDeclaration(), llvm::Intrinsic::getDeclaration(), getDefaultPersonalityFn(), getOrInsertFunction(), getOrInsertValueProfilingCall(), llvm::TargetLoweringBase::getSafeStackPointerLocation(), insertSinCosCall(), llvm::X86TargetLowering::insertSSPDeclarations(), insertUseHolderAfter(), and ReplaceCallWith().

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

Definition at line 146 of file Module.cpp.

References getOrInsertFunction().

Constant * Module::getOrInsertFunction ( StringRef  Name,
AttributeSet  AttributeList,
Type RetTy,
  ... 
)

Look up the specified function in the module symbol table.

If it does not exist, add a prototype for the function and return it. This function guarantees to return a constant of pointer to the specified function type or a ConstantExpr BitCast of that type if the named function has a different type. This version of the method takes a null terminated list of function arguments, which makes it easier for clients to use.

Definition at line 156 of file Module.cpp.

References AMDGPU::RuntimeMD::KeyName::Args, llvm::FunctionType::get(), and getOrInsertFunction().

Constant * Module::getOrInsertFunction ( StringRef  Name,
Type RetTy,
  ... 
)

Same as above, but without the attributes.

Definition at line 175 of file Module.cpp.

References AMDGPU::RuntimeMD::KeyName::Args, llvm::FunctionType::get(), and getOrInsertFunction().

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

Look up the specified global in the module symbol table.

getOrInsertGlobal - 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.

Definition at line 225 of file Module.cpp.

References llvm::GlobalValue::ExternalLinkage, llvm::PointerType::get(), llvm::ConstantExpr::getBitCast(), getNamedValue(), llvm::Type::getPointerAddressSpace(), and llvm::GlobalValue::getType().

Referenced by llvm::TargetLoweringBase::getIRStackGuard(), llvm::X86TargetLowering::insertSSPDeclarations(), and llvm::TargetLoweringBase::insertSSPDeclarations().

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 345 of file Module.cpp.

References getOrInsertNamedMetadata().

Referenced by addModuleFlag().

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 274 of file Module.cpp.

References llvm::iplist_impl< IntrusiveListT, TraitsT >::push_back().

Referenced by llvm::DIBuilder::createCompileUnit(), and getOrInsertModuleFlagsMetadata().

PICLevel::Level Module::getPICLevel ( ) const

Returns the PIC level (small or large model)

Definition at line 488 of file Module.cpp.

References getModuleFlag(), and llvm::PICLevel::NotPIC.

PIELevel::Level Module::getPIELevel ( ) const

Returns the PIE level (small or large model)

Definition at line 502 of file Module.cpp.

References llvm::PIELevel::Default, and getModuleFlag().

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

Metadata * Module::getProfileSummary ( )

Returns profile summary metadata.

Definition at line 520 of file Module.cpp.

References getModuleFlag().

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 199 of file Module.h.

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

static GlobalListType Module::* llvm::Module::getSublistAccess ( GlobalVariable )
inlinestatic

Definition at line 474 of file Module.h.

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

Definition at line 481 of file Module.h.

static AliasListType Module::* llvm::Module::getSublistAccess ( GlobalAlias )
inlinestatic

Definition at line 488 of file Module.h.

static IFuncListType Module::* llvm::Module::getSublistAccess ( GlobalIFunc )
inlinestatic

Definition at line 495 of file Module.h.

static NamedMDListType Module::* llvm::Module::getSublistAccess ( NamedMDNode )
inlinestatic

Definition at line 502 of file Module.h.

const std::string& llvm::Module::getTargetTriple ( ) const
inline
StructType * Module::getTypeByName ( StringRef  Name) const

Return the type with the specified name, or null if there is none by that name.

Definition at line 545 of file Type.cpp.

References getContext(), llvm::LLVMContextImpl::NamedStructTypes, and llvm::LLVMContext::pImpl.

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

Get the symbol table of global variable and function identifiers.

Definition at line 506 of file Module.h.

Referenced by getNamedValue().

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

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

Definition at line 508 of file Module.h.

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

Definition at line 519 of file Module.h.

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

Definition at line 522 of file Module.h.

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

Definition at line 521 of file Module.h.

global_object_iterator llvm::Module::global_object_begin ( )
inline

Definition at line 606 of file Module.h.

References global_objects().

const_global_object_iterator llvm::Module::global_object_begin ( ) const
inline

Definition at line 611 of file Module.h.

References global_objects().

global_object_iterator llvm::Module::global_object_end ( )
inline

Definition at line 609 of file Module.h.

References global_objects().

const_global_object_iterator llvm::Module::global_object_end ( ) const
inline

Definition at line 614 of file Module.h.

References global_objects().

iterator_range<global_object_iterator> llvm::Module::global_objects ( )
inline
iterator_range<const_global_object_iterator> llvm::Module::global_objects ( ) const
inline

Definition at line 602 of file Module.h.

References functions(), and globals().

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

Definition at line 527 of file Module.h.

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

ifunc_iterator llvm::Module::ifunc_begin ( )
inline

Definition at line 575 of file Module.h.

Referenced by ifuncs().

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

Definition at line 576 of file Module.h.

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

Definition at line 580 of file Module.h.

ifunc_iterator llvm::Module::ifunc_end ( )
inline

Definition at line 577 of file Module.h.

Referenced by ifuncs().

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

Definition at line 578 of file Module.h.

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

Definition at line 579 of file Module.h.

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

Definition at line 582 of file Module.h.

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

Referenced by dropAllReferences(), and orderModule().

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

Definition at line 585 of file Module.h.

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

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

Definition at line 455 of file Module.h.

References getMaterializer().

Referenced by llvm::Value::assertModuleIsMaterialized().

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 292 of file Module.cpp.

References ModFlagBehaviorFirstVal, and ModFlagBehaviorLastVal.

Referenced by getModuleFlagsMetadata().

Error Module::materialize ( GlobalValue GV)

Make sure the GlobalValue is fully read.

Definition at line 409 of file Module.cpp.

References llvm::Error::success().

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

Error Module::materializeAll ( )

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

Definition at line 416 of file Module.cpp.

References llvm::Error::success().

Error Module::materializeMetadata ( )

Definition at line 423 of file Module.cpp.

References llvm::Error::success().

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

Definition at line 635 of file Module.h.

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

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

Definition at line 638 of file Module.h.

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

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

Definition at line 623 of file Module.h.

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

Definition at line 633 of file Module.h.

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

Definition at line 628 of file Module.h.

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

Definition at line 632 of file Module.h.

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 3311 of file AsmWriter.cpp.

Referenced by dump(), llvm::operator<<(), llvm::yaml::BlockScalarTraits< Module >::output(), and llvm::PrintModulePass::run().

reverse_iterator llvm::Module::rbegin ( )
inline

Definition at line 539 of file Module.h.

Referenced by predictUseListOrder().

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

Definition at line 540 of file Module.h.

reverse_iterator llvm::Module::rend ( )
inline

Definition at line 541 of file Module.h.

Referenced by predictUseListOrder().

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

Definition at line 542 of file Module.h.

void Module::setDataLayout ( StringRef  Desc)

Set the data layout.

Definition at line 378 of file Module.cpp.

References llvm::DataLayout::reset().

Referenced by llvm::OrcCBindingsStack::addIRModule(), and LLVMTargetMachineEmit().

void Module::setDataLayout ( const DataLayout Other)

Definition at line 382 of file Module.cpp.

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 402 of file Module.cpp.

References assert().

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

Set the module identifier.

Definition at line 244 of file Module.h.

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 258 of file Module.h.

References llvm::HexStyle::Asm.

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

Take ownership of the given memory buffer.

Definition at line 524 of file Module.cpp.

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

Set the PIC level (small or large model)

Definition at line 498 of file Module.cpp.

References addModuleFlag(), and llvm::lltok::Error.

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

Set the PIE level (small or large model)

Definition at line 512 of file Module.cpp.

References addModuleFlag(), and llvm::lltok::Error.

void Module::setProfileSummary ( Metadata M)

Attach profile summary metadata to this module.

Definition at line 516 of file Module.cpp.

References addModuleFlag(), and llvm::lltok::Error.

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

Set the module's original source file name.

Definition at line 247 of file Module.h.

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

Set the target triple.

Definition at line 254 of file Module.h.

References T.

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

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

Definition at line 543 of file Module.h.

Referenced by llvm::PhysicalRegisterUsageInfo::doInitialization(), and findPartitions().

Friends And Related Function Documentation

friend class Constant
friend

Definition at line 175 of file Module.h.


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