LLVM API Documentation

Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends
llvm::Module Class Reference

The main container class for the LLVM Intermediate Representation. More...

#include <Module.h>

List of all members.

Classes

struct  ModuleFlagEntry

Public Types

typedef DenseMap< StructType
*, unsigned, DenseMapInfo
< StructType * > > 
NumeredTypesMapTy
Types And Enumerations
enum  ModFlagBehavior {
  Error = 1, Warning = 2, Require = 3, Override = 4,
  Append = 5, AppendUnique = 6
}
 This enumeration defines the supported behaviors of module flags. More...
typedef iplist< GlobalVariableGlobalListType
 The type for the list of global variables.
typedef iplist< FunctionFunctionListType
 The type for the list of functions.
typedef iplist< GlobalAliasAliasListType
 The type for the list of aliases.
typedef ilist< NamedMDNodeNamedMDListType
 The type for the list of named metadata.
typedef GlobalListType::iterator global_iterator
 The Global Variable iterator.
typedef
GlobalListType::const_iterator 
const_global_iterator
 The Global Variable constant iterator.
typedef FunctionListType::iterator iterator
 The Function iterators.
typedef
FunctionListType::const_iterator 
const_iterator
 The Function constant iterator.
typedef AliasListType::iterator alias_iterator
 The Global Alias iterators.
typedef
AliasListType::const_iterator 
const_alias_iterator
 The Global Alias constant iterator.
typedef NamedMDListType::iterator named_metadata_iterator
 The named metadata iterators.
typedef
NamedMDListType::const_iterator 
const_named_metadata_iterator
 The named metadata constant interators.

Public Member Functions

 Module (StringRef ModuleID, LLVMContext &C)
 ~Module ()
 The module destructor. This will dropAllReferences.
const std::string & getModuleIdentifier () const
const std::string & getDataLayoutStr () const
const DataLayoutgetDataLayout () const
 Get the data layout for the module's target platform.
const std::string & getTargetTriple () const
LLVMContextgetContext () const
const std::string & getModuleInlineAsm () const
void setModuleIdentifier (StringRef ID)
 Set the module identifier.
void setDataLayout (StringRef Desc)
 Set the data layout.
void setDataLayout (const DataLayout *Other)
void setTargetTriple (StringRef T)
 Set the target triple.
void setModuleInlineAsm (StringRef Asm)
 Set the module-scope inline assembly blocks.
void appendModuleInlineAsm (StringRef Asm)
GlobalValuegetNamedValue (StringRef Name) const
unsigned getMDKindID (StringRef Name) const
void getMDKindNames (SmallVectorImpl< StringRef > &Result) const
StructTypegetTypeByName (StringRef Name) const
ConstantgetOrInsertFunction (StringRef Name, FunctionType *T, AttributeSet AttributeList)
ConstantgetOrInsertFunction (StringRef Name, FunctionType *T)
ConstantgetOrInsertFunction (StringRef Name, AttributeSet AttributeList, Type *RetTy,...) END_WITH_NULL
ConstantgetOrInsertFunction (StringRef Name, Type *RetTy,...) END_WITH_NULL
 getOrInsertFunction - Same as above, but without the attributes.
FunctiongetFunction (StringRef Name) const
const GlobalVariablegetGlobalVariable (StringRef Name, bool AllowInternal=false) const
GlobalVariablegetGlobalVariable (StringRef Name, bool AllowInternal=false)
GlobalVariablegetNamedGlobal (StringRef Name)
const GlobalVariablegetNamedGlobal (StringRef Name) const
ConstantgetOrInsertGlobal (StringRef Name, Type *Ty)
GlobalAliasgetNamedAlias (StringRef Name) const
NamedMDNodegetNamedMetadata (const Twine &Name) const
NamedMDNodegetOrInsertNamedMetadata (StringRef Name)
void eraseNamedMetadata (NamedMDNode *NMD)
void getModuleFlagsMetadata (SmallVectorImpl< ModuleFlagEntry > &Flags) const
 getModuleFlagsMetadata - Returns the module flags in the provided vector.
ValuegetModuleFlag (StringRef Key) const
NamedMDNodegetModuleFlagsMetadata () const
NamedMDNodegetOrInsertModuleFlagsMetadata ()
void addModuleFlag (ModFlagBehavior Behavior, StringRef Key, Value *Val)
void addModuleFlag (ModFlagBehavior Behavior, StringRef Key, uint32_t Val)
void addModuleFlag (MDNode *Node)
void setMaterializer (GVMaterializer *GVM)
GVMaterializergetMaterializer () const
 getMaterializer - Retrieves the GVMaterializer, if any, for this Module.
bool isMaterializable (const GlobalValue *GV) const
bool isDematerializable (const GlobalValue *GV) const
bool Materialize (GlobalValue *GV, std::string *ErrInfo=nullptr)
void Dematerialize (GlobalValue *GV)
error_code materializeAll ()
 Make sure all GlobalValues in this Module are fully read.
error_code materializeAllPermanently ()
const GlobalListTypegetGlobalList () const
 Get the Module's list of global variables (constant).
GlobalListTypegetGlobalList ()
 Get the Module's list of global variables.
const FunctionListTypegetFunctionList () const
 Get the Module's list of functions (constant).
FunctionListTypegetFunctionList ()
 Get the Module's list of functions.
const AliasListTypegetAliasList () const
 Get the Module's list of aliases (constant).
AliasListTypegetAliasList ()
 Get the Module's list of aliases.
const NamedMDListTypegetNamedMDList () const
 Get the Module's list of named metadata (constant).
NamedMDListTypegetNamedMDList ()
 Get the Module's list of named metadata.
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.
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
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
size_t size () const
bool empty () const
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
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
void print (raw_ostream &OS, AssemblyAnnotationWriter *AAW) const
void dump () const
 Dump the module to stderr (for debugging).
void dropAllReferences ()
unsigned getDwarfVersion () const
 Returns the Dwarf Version by checking module flags.

Static Public Member Functions

static iplist< GlobalVariable >
Module::* 
getSublistAccess (GlobalVariable *)
static iplist< Function > Module::* getSublistAccess (Function *)
static iplist< GlobalAlias >
Module::* 
getSublistAccess (GlobalAlias *)
static ilist< NamedMDNode >
Module::* 
getSublistAccess (NamedMDNode *)

Friends

class Constant

Detailed Description

The main container class for the LLVM Intermediate Representation.

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.

Definition at line 114 of file Module.h.


Member Typedef Documentation

The Global Alias iterators.

Definition at line 138 of file Module.h.

The type for the list of aliases.

Definition at line 123 of file Module.h.

The Global Alias constant iterator.

Definition at line 140 of file Module.h.

The Global Variable constant iterator.

Definition at line 130 of file Module.h.

The Function constant iterator.

Definition at line 135 of file Module.h.

The named metadata constant interators.

Definition at line 145 of file Module.h.

The type for the list of functions.

Definition at line 121 of file Module.h.

The Global Variable iterator.

Definition at line 128 of file Module.h.

The type for the list of global variables.

Definition at line 119 of file Module.h.

The Function iterators.

Definition at line 133 of file Module.h.

The named metadata iterators.

Definition at line 143 of file Module.h.

The type for the list of named metadata.

Definition at line 125 of file Module.h.

Definition at line 293 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.

Definition at line 148 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 46 of file Module.cpp.

The module destructor. This will dropAllReferences.

Definition at line 53 of file Module.cpp.

References llvm::iplist< NodeTy, Traits >::clear(), and dropAllReferences().


Member Function Documentation

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

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

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

Referenced by addModuleFlag().

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

Definition at line 316 of file Module.cpp.

References addModuleFlag(), llvm::ConstantInt::get(), and llvm::Type::getInt32Ty().

void Module::addModuleFlag ( MDNode Node)

Definition at line 514 of file Module.h.

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

Definition at line 518 of file Module.h.

References llvm::iplist< NodeTy, Traits >::end().

Referenced by llvm::AssemblyWriter::printModule().

Definition at line 516 of file Module.h.

References llvm::iplist< NodeTy, Traits >::begin().

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

Definition at line 517 of file Module.h.

References llvm::iplist< NodeTy, Traits >::end().

Definition at line 520 of file Module.h.

References global_begin(), and global_end().

Definition at line 523 of file Module.h.

Append to the module-scope inline assembly blocks, automatically inserting a separating newline if necessary.

Definition at line 269 of file Module.h.

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

Definition at line 505 of file Module.h.

Dematerialize - If the GlobalValue is read in, and if the GVMaterializer supports it, release the memory for the function, and set it up to be materialized lazily. If !isDematerializable(), this method is a noop.

Definition at line 392 of file Module.cpp.

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

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

References alias_begin(), alias_end(), begin(), end(), global_begin(), global_end(), and I.

Referenced by ~Module().

void Module::dump ( ) const

Dump the module to stderr (for debugging).

Definition at line 2251 of file AsmWriter.cpp.

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

Referenced by llvm::DebugIR::runOnModule().

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

Definition at line 509 of file Module.h.

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

Definition at line 507 of file Module.h.

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

Definition at line 254 of file Module.cpp.

References llvm::iplist< NodeTy, Traits >::erase(), and llvm::NamedMDNode::getName().

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

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

Definition at line 469 of file Module.h.

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

Get the Module's list of aliases.

Definition at line 471 of file Module.h.

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

Definition at line 352 of file Module.cpp.

Referenced by llvm::CloneModule(), llvm::DataLayout::DataLayout(), and llvm::GlobalValue::getDataLayout().

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

Referenced by llvm::AssemblyWriter::printModule(), and WriteModuleInfo().

Returns the Dwarf Version by checking module flags.

Definition at line 434 of file Module.cpp.

References llvm::dwarf::DWARF_VERSION, and getModuleFlag().

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

getFunction - Look up the specified function in the module symbol table. If it does not exist, return null.

Definition at line 167 of file Module.cpp.

References getNamedValue().

Referenced by FindCXAAtExit(), llvm::MCJIT::findModuleForSymbol(), llvm::SparcTargetLowering::getSRetArgSize(), hasReturnsTwiceAttr(), and llvm::StripDebugInfo().

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

Definition at line 462 of file Module.h.

Referenced by llvm::Function::eraseFromParent(), llvm::Function::removeFromParent(), and llvm::CallGraph::removeFunctionFromModule().

Get the Module's list of functions.

Definition at line 464 of file Module.h.

Get the Module's list of global variables.

Definition at line 457 of file Module.h.

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

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

Referenced by llvm::MachineModuleInfo::AnalyzeModule(), llvm::collectUsedGlobalVariables(), llvm::MCJIT::findModuleForSymbol(), getNamedGlobal(), and StripSymbolNames().

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

References getNamedValue().

getMaterializer - Retrieves the GVMaterializer, if any, for this Module.

Definition at line 426 of file Module.h.

Referenced by llvm::parseBitcodeFile().

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

References llvm::LLVMContext::getMDKindID().

Referenced by llvm::UpgradeIntrinsicCall().

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

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

References llvm::LLVMContext::getMDKindNames().

Referenced by WriteModuleMetadataStore().

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

Definition at line 281 of file Module.cpp.

References getModuleFlagsMetadata().

Referenced by llvm::getDebugMetadataVersionFromModule(), and getDwarfVersion().

getModuleFlagsMetadata - Returns the module flags in the provided vector.

Definition at line 261 of file Module.cpp.

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

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

References getNamedMetadata().

Referenced by getModuleFlag(), and getModuleFlagsMetadata().

const std::string& llvm::Module::getModuleIdentifier ( ) const [inline]

Get the module identifier which is, essentially, the name of the module.

Returns:
the module identifier as a string

Definition at line 226 of file Module.h.

Referenced by llvm::CloneModule(), llvm::AsmPrinter::doInitialization(), EmitCamlGlobal(), llvm::SpecialCaseList::isIn(), llvm::LazyCallGraph::LazyCallGraph(), llvm::DiagnosticPrinterRawOStream::operator<<(), llvm::AssemblyWriter::printModule(), and llvm::LazyCallGraphPrinterPass::run().

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

Referenced by llvm::CloneModule(), llvm::AsmPrinter::doInitialization(), llvm::NVPTXAsmPrinter::doInitialization(), llvm::AssemblyWriter::printModule(), and WriteModuleInfo().

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

References getNamedValue().

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

Referenced by appendToGlobalArray(), and llvm::ExecutionEngine::runStaticConstructorsDestructors().

Definition at line 353 of file Module.h.

References getGlobalVariable().

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

Definition at line 476 of file Module.h.

Get the Module's list of named metadata.

Definition at line 478 of file Module.h.

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

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

Referenced by llvm::DwarfDebug::beginModule(), cacheAnnotationFromMD(), llvm::getFnSpecificMDNode(), getModuleFlagsMetadata(), hasDebugInfo(), llvm::DiagnosticInfoOptimizationRemark::isLocationAvailable(), llvm::DebugInfoFinder::processModule(), and llvm::WinCodeViewLineTables::WinCodeViewLineTables().

getNamedValue - Return the 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.

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

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

Referenced by forceRenaming(), getFunction(), getGlobalVariable(), getNamedAlias(), getOrInsertFunction(), getOrInsertGlobal(), and llvm::objcarc::ModuleHasARC().

getOrInsertFunction - 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 94 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< NodeTy, Traits >::push_back(), and llvm::Function::setAttributes().

Referenced by llvm::IntrinsicLowering::AddPrototypes(), createFree(), createMalloc(), llvm::EmitBinaryFloatFnCall(), 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::EmitStrNLen(), llvm::EmitUnaryFloatFnCall(), EnsureFunctionExists(), llvm::Intrinsic::getDeclaration(), getOrInsertFunction(), ReplaceCallWith(), and llvm::InstCombiner::visitFPTrunc().

Definition at line 117 of file Module.cpp.

References getOrInsertFunction().

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

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

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

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

getOrInsertFunction - Same as above, but without the attributes.

Definition at line 146 of file Module.cpp.

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

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

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

Referenced by CreatePrologue().

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

References getOrInsertNamedMetadata().

Referenced by addModuleFlag().

getOrInsertNamedMetadata - Return the 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.

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

References llvm::ilist< NodeTy >::push_back().

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

static iplist<GlobalVariable> Module::* llvm::Module::getSublistAccess ( GlobalVariable ) [inline, static]

Definition at line 458 of file Module.h.

static iplist<Function> Module::* llvm::Module::getSublistAccess ( Function ) [inline, static]

Definition at line 465 of file Module.h.

static iplist<GlobalAlias> Module::* llvm::Module::getSublistAccess ( GlobalAlias ) [inline, static]

Definition at line 472 of file Module.h.

static ilist<NamedMDNode> Module::* llvm::Module::getSublistAccess ( NamedMDNode ) [inline, static]

Definition at line 479 of file Module.h.

const std::string& llvm::Module::getTargetTriple ( ) const [inline]

Get the target triple which is a string describing the target host.

Returns:
a string containing the target triple.

Definition at line 237 of file Module.h.

Referenced by llvm::CloneModule(), llvm::EngineBuilder::create(), llvm::AssemblyWriter::printModule(), llvm::EngineBuilder::selectTarget(), llvm::WriteBitcodeToFile(), and WriteModuleInfo().

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

Definition at line 615 of file Type.cpp.

References getContext(), llvm::StringMap< ValueTy, AllocatorTy >::lookup(), llvm::LLVMContextImpl::NamedStructTypes, and llvm::LLVMContext::pImpl.

Get the symbol table of global variable and function identifiers.

Definition at line 483 of file Module.h.

Referenced by getNamedValue(), llvm::ValueEnumerator::ValueEnumerator(), and WriteModule().

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

Definition at line 485 of file Module.h.

Definition at line 490 of file Module.h.

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

Definition at line 493 of file Module.h.

Referenced by llvm::AssemblyWriter::printModule(), and WriteModuleInfo().

Definition at line 492 of file Module.h.

Definition at line 495 of file Module.h.

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

Definition at line 498 of file Module.h.

isDematerializable - Returns true if this GV was loaded from this Module's GVMaterializer and the GVMaterializer knows how to dematerialize the GV.

Definition at line 374 of file Module.cpp.

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

isMaterializable - True if the definition of GV has yet to be materialized from the GVMaterializer.

Definition at line 368 of file Module.cpp.

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

bool Module::Materialize ( GlobalValue GV,
std::string *  ErrInfo = nullptr 
)

Materialize - Make sure the GlobalValue is fully read. If the module is corrupt, this returns true and fills in the optional string with information about the problem. If successful, this returns false.

Definition at line 380 of file Module.cpp.

References llvm::error_code::message().

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

Make sure all GlobalValues in this Module are fully read.

Definition at line 397 of file Module.cpp.

References llvm::error_code::success().

Referenced by materializeAllPermanently().

Make sure all GlobalValues in this Module are fully read and clear the Materializer. If the module is corrupt, this DOES NOT clear the old Materializer.

Definition at line 403 of file Module.cpp.

References materializeAll(), and llvm::error_code::success().

Referenced by llvm::Interpreter::create(), and llvm::parseBitcodeFile().

Definition at line 542 of file Module.h.

References llvm::iplist< NodeTy, Traits >::begin().

Definition at line 546 of file Module.h.

References llvm::iplist< NodeTy, Traits >::end().

Definition at line 530 of file Module.h.

References llvm::iplist< NodeTy, Traits >::begin().

Definition at line 540 of file Module.h.

Referenced by llvm::AssemblyWriter::printModule().

Definition at line 535 of file Module.h.

References llvm::iplist< NodeTy, Traits >::end().

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

Definition at line 539 of file Module.h.

void Module::print ( raw_ostream OS,
AssemblyAnnotationWriter AAW 
) const

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

Definition at line 2141 of file AsmWriter.cpp.

References llvm::AssemblyWriter::printModule().

Referenced by dump(), and llvm::operator<<().

setMaterializer - 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 MaterializeAllPermanently 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 361 of file Module.cpp.

Referenced by llvm::getLazyBitcodeModule(), and llvm::getStreamedBitcodeModule().

Set the module identifier.

Definition at line 250 of file Module.h.

Set the module-scope inline assembly blocks.

Definition at line 260 of file Module.h.

Referenced by llvm::CloneModule().

Set the target triple.

Definition at line 257 of file Module.h.

Referenced by llvm::CloneModule().

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

Definition at line 508 of file Module.h.


Friends And Related Function Documentation

friend class Constant [friend]

Definition at line 212 of file Module.h.


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