LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | List of all members
llvm::Module Class Reference

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

#include <Module.h>

Classes

struct  ModuleFlagEntry
 

Public Types

Types And Enumerations
enum  Endianness { AnyEndianness, LittleEndian, BigEndian }
 An enumeration for describing the endianess of the target machine. More...
 
enum  PointerSize { AnyPointerSize, Pointer32, Pointer64 }
 An enumeration for describing the size of a pointer on the target machine. More...
 
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. More...
 
typedef iplist< FunctionFunctionListType
 The type for the list of functions. More...
 
typedef iplist< GlobalAliasAliasListType
 The type for the list of aliases. More...
 
typedef ilist< NamedMDNodeNamedMDListType
 The type for the list of named metadata. 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 AliasListType::iterator alias_iterator
 The Global Alias iterators. More...
 
typedef
AliasListType::const_iterator 
const_alias_iterator
 The Global Alias 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 interators. More...
 

Public Member Functions

Constructors
 Module (StringRef ModuleID, LLVMContext &C)
 
 ~Module ()
 The module destructor. This will dropAllReferences. More...
 
Module Level Accessors
const std::string & getModuleIdentifier () const
 
const std::string & getDataLayout () const
 
const std::string & getTargetTriple () const
 
Endianness getEndianness () const
 Target endian information. More...
 
PointerSize getPointerSize () const
 Target Pointer Size information. More...
 
LLVMContextgetContext () const
 
const std::string & getModuleInlineAsm () const
 
Module Level Mutators
void setModuleIdentifier (StringRef ID)
 Set the module identifier. More...
 
void setDataLayout (StringRef DL)
 Set the data layout. More...
 
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)
 
Function Accessors
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. More...
 
FunctiongetFunction (StringRef Name) const
 
Global Variable Accessors
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)
 
Global Alias Accessors
GlobalAliasgetNamedAlias (StringRef Name) const
 
Named Metadata Accessors
NamedMDNodegetNamedMetadata (const Twine &Name) const
 
NamedMDNodegetOrInsertNamedMetadata (StringRef Name)
 
void eraseNamedMetadata (NamedMDNode *NMD)
 
Module Flags Accessors
void getModuleFlagsMetadata (SmallVectorImpl< ModuleFlagEntry > &Flags) const
 getModuleFlagsMetadata - Returns the module flags in the provided vector. More...
 
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)
 
Materialization
void setMaterializer (GVMaterializer *GVM)
 
GVMaterializergetMaterializer () const
 getMaterializer - Retrieves the GVMaterializer, if any, for this Module. More...
 
bool isMaterializable (const GlobalValue *GV) const
 
bool isDematerializable (const GlobalValue *GV) const
 
bool Materialize (GlobalValue *GV, std::string *ErrInfo=0)
 
void Dematerialize (GlobalValue *GV)
 
bool MaterializeAll (std::string *ErrInfo=0)
 
bool MaterializeAllPermanently (std::string *ErrInfo=0)
 
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
 
Function Iteration
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
size_t size () const
 
bool empty () 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
 
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
 
Utility functions for printing and dumping Module objects
void print (raw_ostream &OS, AssemblyAnnotationWriter *AAW) const
 
void dump () const
 Dump the module to stderr (for debugging). More...
 
void dropAllReferences ()
 

Member Variables

class Constant
 

Generic Value Accessors

typedef DenseMap< StructType
*, unsigned, DenseMapInfo
< StructType * > > 
NumeredTypesMapTy
 
GlobalValuegetNamedValue (StringRef Name) const
 
unsigned getMDKindID (StringRef Name) const
 
void getMDKindNames (SmallVectorImpl< StringRef > &Result) const
 
StructTypegetTypeByName (StringRef Name) const
 

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

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 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...
 
static iplist< GlobalVariable >
Module::* 
getSublistAccess (GlobalVariable *)
 
static iplist< Function > Module::* getSublistAccess (Function *)
 
static iplist< GlobalAlias >
Module::* 
getSublistAccess (GlobalAlias *)
 
static ilist< NamedMDNode >
Module::* 
getSublistAccess (NamedMDNode *)
 

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

Member Typedef Documentation

The Global Alias iterators.

Definition at line 136 of file Module.h.

The type for the list of aliases.

Definition at line 121 of file Module.h.

The Global Alias constant iterator.

Definition at line 138 of file Module.h.

The Global Variable constant iterator.

Definition at line 128 of file Module.h.

The Function constant iterator.

Definition at line 133 of file Module.h.

The named metadata constant interators.

Definition at line 143 of file Module.h.

The type for the list of functions.

Definition at line 119 of file Module.h.

The Global Variable iterator.

Definition at line 126 of file Module.h.

The type for the list of global variables.

Definition at line 117 of file Module.h.

The Function iterators.

Definition at line 131 of file Module.h.

The named metadata iterators.

Definition at line 141 of file Module.h.

The type for the list of named metadata.

Definition at line 123 of file Module.h.

Definition at line 304 of file Module.h.

Member Enumeration Documentation

An enumeration for describing the endianess of the target machine.

Enumerator
AnyEndianness 
LittleEndian 
BigEndian 

Definition at line 146 of file Module.h.

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

An enumeration for describing the size of a pointer on the target machine.

Enumerator
AnyPointerSize 
Pointer32 
Pointer64 

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

Module::~Module ( )

The module destructor. This will dropAllReferences.

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

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

Referenced by addModuleFlag().

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

Definition at line 543 of file Module.h.

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

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

Definition at line 547 of file Module.h.

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

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

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

Definition at line 545 of file Module.h.

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

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

Definition at line 546 of file Module.h.

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

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

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

Definition at line 278 of file Module.h.

References llvm::HexStyle::Asm.

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

Definition at line 532 of file Module.h.

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

void Module::Dematerialize ( GlobalValue GV)

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

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

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

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

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

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

Definition at line 536 of file Module.h.

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

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

Definition at line 534 of file Module.h.

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

void Module::eraseNamedMetadata ( NamedMDNode NMD)

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

Definition at line 308 of file Module.cpp.

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

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

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

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

Definition at line 499 of file Module.h.

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

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

Get the Module's list of aliases.

Definition at line 501 of file Module.h.

LLVMContext& llvm::Module::getContext ( ) const
inline
const std::string& llvm::Module::getDataLayout ( ) const
inline

Get the data layout string for the module's target platform. This encodes the type sizes and alignments expected by this module.

Returns
the data layout as a string

Definition at line 233 of file Module.h.

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

Module::Endianness Module::getEndianness ( ) const

Target endian information.

Get the target endian information.

Returns
Endianess - an enumeration for the endianess of the target

Definition at line 64 of file Module.cpp.

References AnyEndianness, BigEndian, llvm::StringRef::empty(), llvm::getToken(), LittleEndian, and P.

Function * Module::getFunction ( StringRef  Name) const

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

Definition at line 221 of file Module.cpp.

References getNamedValue().

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

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

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

Definition at line 492 of file Module.h.

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

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

Get the Module's list of functions.

Definition at line 494 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 487 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 355 of file Module.h.

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

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

References getNamedValue().

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

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

Definition at line 449 of file Module.h.

Referenced by llvm::ParseBitcodeFile().

unsigned Module::getMDKindID ( StringRef  Name) const

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

References llvm::LLVMContext::getMDKindNames().

Referenced by WriteModuleMetadataStore().

Value * Module::getModuleFlag ( StringRef  Key) const

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

Definition at line 331 of file Module.cpp.

References getModuleFlagsMetadata(), llvm::MDString::getString(), I, llvm::Module::ModuleFlagEntry::Key, llvm::SmallVectorTemplateCommon< T >::size(), and llvm::Module::ModuleFlagEntry::Val.

Referenced by getDwarfVersionFromModule().

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

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

Referenced by llvm::CloneModule(), llvm::AsmPrinter::doInitialization(), EmitCamlGlobal(), llvm::SpecialCaseList::isIn(), and llvm::AssemblyWriter::printModule().

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

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

GlobalAlias * Module::getNamedAlias ( StringRef  Name) const

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

References getNamedValue().

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

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

References getGlobalVariable().

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

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

Definition at line 368 of file Module.h.

References getNamedGlobal().

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

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

Definition at line 506 of file Module.h.

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

Get the Module's list of named metadata.

Definition at line 508 of file Module.h.

NamedMDNode * Module::getNamedMetadata ( const Twine Name) const

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

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

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

GlobalValue * Module::getNamedValue ( StringRef  Name) const

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

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

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

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

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

References llvm::Function::Create(), llvm::GlobalValue::ExternalLinkage, F(), llvm::ConstantExpr::getBitCast(), getNamedValue(), llvm::GlobalValue::getType(), llvm::PointerType::getUnqual(), llvm::GlobalValue::hasLocalLinkage(), llvm::Function::isIntrinsic(), llvm::iplist< NodeTy, Traits >::push_back(), llvm::Function::setAttributes(), and llvm::Value::setName().

Referenced by llvm::IntrinsicLowering::AddPrototypes(), createFree(), createMalloc(), 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(), fixupFPReturnAndCall(), GenerateARCBBEntranceAnnotation(), GenerateARCBBTerminatorAnnotation(), llvm::Intrinsic::getDeclaration(), getOrInsertFunction(), ReplaceCallWith(), and llvm::InstCombiner::visitFPTrunc().

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

Definition at line 171 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 181 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 200 of file Module.cpp.

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

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

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 250 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().

NamedMDNode * Module::getOrInsertModuleFlagsMetadata ( )

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

References getOrInsertNamedMetadata().

Referenced by addModuleFlag().

NamedMDNode * Module::getOrInsertNamedMetadata ( StringRef  Name)

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

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

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

Module::PointerSize Module::getPointerSize ( ) const

Target Pointer Size information.

Get the target pointer size.

Returns
PointerSize - an enumeration for the size of the target's pointer

Definition at line 85 of file Module.cpp.

References AnyPointerSize, llvm::StringRef::empty(), llvm::getToken(), Pointer32, Pointer64, and size().

static iplist<GlobalVariable> Module::* llvm::Module::getSublistAccess ( GlobalVariable )
inlinestatic

Definition at line 488 of file Module.h.

static iplist<Function> Module::* llvm::Module::getSublistAccess ( Function )
inlinestatic

Definition at line 495 of file Module.h.

static iplist<GlobalAlias> Module::* llvm::Module::getSublistAccess ( GlobalAlias )
inlinestatic

Definition at line 502 of file Module.h.

static ilist<NamedMDNode> Module::* llvm::Module::getSublistAccess ( NamedMDNode )
inlinestatic

Definition at line 509 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(), LTOModule::getTargetTriple(), llvm::AssemblyWriter::printModule(), llvm::EngineBuilder::selectTarget(), llvm::WriteBitcodeToFile(), and WriteModuleInfo().

StructType * Module::getTypeByName ( StringRef  Name) const

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

Definition at line 618 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 513 of file Module.h.

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

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

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

Definition at line 515 of file Module.h.

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

Definition at line 522 of file Module.h.

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

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

Definition at line 524 of file Module.h.

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

bool Module::isDematerializable ( const GlobalValue GV) const

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

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

bool Module::isMaterializable ( const GlobalValue GV) const

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

Definition at line 391 of file Module.cpp.

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

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

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

References llvm::error_code::message().

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

bool Module::MaterializeAll ( std::string *  ErrInfo = 0)

MaterializeAll - Make sure all GlobalValues in this Module are 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 420 of file Module.cpp.

References llvm::error_code::message().

Referenced by MaterializeAllPermanently().

bool Module::MaterializeAllPermanently ( std::string *  ErrInfo = 0)

MaterializeAllPermanently - Make sure all GlobalValues in this Module are fully read and clear the Materializer. If the module is corrupt, this returns true, fills in the optional string with information about the problem, and DOES NOT clear the old Materializer. If successful, this returns false.

Definition at line 431 of file Module.cpp.

References MaterializeAll().

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

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

Definition at line 555 of file Module.h.

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

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

Definition at line 565 of file Module.h.

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

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

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

Definition at line 560 of file Module.h.

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

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

Definition at line 564 of file Module.h.

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

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

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

Definition at line 2132 of file AsmWriter.cpp.

References llvm::AssemblyWriter::printModule().

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

void llvm::Module::setDataLayout ( StringRef  DL)
inline

Set the data layout.

Definition at line 263 of file Module.h.

Referenced by llvm::CloneModule().

void Module::setMaterializer ( GVMaterializer GVM)

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

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

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

Set the module identifier.

Definition at line 260 of file Module.h.

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

Set the module-scope inline assembly blocks.

Definition at line 269 of file Module.h.

References llvm::HexStyle::Asm.

Referenced by llvm::CloneModule().

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

Set the target triple.

Definition at line 266 of file Module.h.

References T.

Referenced by llvm::CloneModule(), and LTOModule::setTargetTriple().

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

Friends And Related Function Documentation

friend class Constant
friend

Definition at line 210 of file Module.h.


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