LLVM API Documentation
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 } |
| typedef iplist< GlobalVariable > | GlobalListType |
| The type for the list of global variables. | |
| typedef iplist< Function > | FunctionListType |
| The type for the list of functions. | |
| typedef iplist< GlobalAlias > | AliasListType |
| The type for the list of aliases. | |
| typedef ilist< NamedMDNode > | NamedMDListType |
| The type for the list of named metadata. | |
| typedef std::vector< std::string > | LibraryListType |
| The type for the list of dependent libraries. | |
| 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. | |
| typedef LibraryListType::const_iterator | lib_iterator |
| The Library list iterator. | |
Public Member Functions | |
Constructors | |
| Module (StringRef ModuleID, LLVMContext &C) | |
| ~Module () | |
| The module destructor. This will dropAllReferences. | |
Module Level Accessors | |
| const std::string & | getModuleIdentifier () const |
| const std::string & | getDataLayout () const |
| const std::string & | getTargetTriple () const |
| Endianness | getEndianness () const |
| Target endian information. | |
| PointerSize | getPointerSize () const |
| Target Pointer Size information. | |
| LLVMContext & | getContext () const |
| const std::string & | getModuleInlineAsm () const |
Module Level Mutators | |
| void | setModuleIdentifier (StringRef ID) |
| Set the module identifier. | |
| void | setDataLayout (StringRef DL) |
| Set the data layout. | |
| void | setTargetTriple (StringRef T) |
| Set the target triple. | |
| void | setModuleInlineAsm (StringRef Asm) |
| Set the module-scope inline assembly blocks. | |
| void | appendModuleInlineAsm (StringRef Asm) |
Function Accessors | |
| Constant * | getOrInsertFunction (StringRef Name, FunctionType *T, AttrListPtr AttributeList) |
| Constant * | getOrInsertFunction (StringRef Name, FunctionType *T) |
| Constant * | getOrInsertFunction (StringRef Name, AttrListPtr AttributeList, Type *RetTy,...) END_WITH_NULL |
| Constant * | getOrInsertFunction (StringRef Name, Type *RetTy,...) END_WITH_NULL |
| getOrInsertFunction - Same as above, but without the attributes. | |
| Constant * | getOrInsertTargetIntrinsic (StringRef Name, FunctionType *Ty, AttrListPtr AttributeList) |
| Function * | getFunction (StringRef Name) const |
Global Variable Accessors | |
| GlobalVariable * | getGlobalVariable (StringRef Name, bool AllowInternal=false) const |
| GlobalVariable * | getNamedGlobal (StringRef Name) const |
| Constant * | getOrInsertGlobal (StringRef Name, Type *Ty) |
Global Alias Accessors | |
| GlobalAlias * | getNamedAlias (StringRef Name) const |
Named Metadata Accessors | |
| NamedMDNode * | getNamedMetadata (const Twine &Name) const |
| NamedMDNode * | getOrInsertNamedMetadata (StringRef Name) |
| void | eraseNamedMetadata (NamedMDNode *NMD) |
Module Flags Accessors | |
| void | getModuleFlagsMetadata (SmallVectorImpl< ModuleFlagEntry > &Flags) const |
| getModuleFlagsMetadata - Returns the module flags in the provided vector. | |
| NamedMDNode * | getModuleFlagsMetadata () const |
| NamedMDNode * | getOrInsertModuleFlagsMetadata () |
| 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) |
| GVMaterializer * | getMaterializer () 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=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 |
Dependent Library Iteration | |
| lib_iterator | lib_begin () const |
| Get a constant iterator to beginning of dependent library list. | |
| lib_iterator | lib_end () const |
| Get a constant iterator to end of dependent library list. | |
| size_t | lib_size () const |
| Returns the number of items in the list of libraries. | |
| void | addLibrary (StringRef Lib) |
| Add a library to the list of dependent libraries. | |
| void | removeLibrary (StringRef Lib) |
| Remove a library from the list of dependent libraries. | |
| const LibraryListType & | getLibraries () const |
| Get all the libraries. | |
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). | |
| void | dropAllReferences () |
Member Variables | |
| class | Constant |
Generic Value Accessors | |
| typedef DenseMap< StructType *, unsigned, DenseMapInfo < StructType * > > | NumeredTypesMapTy |
| GlobalValue * | getNamedValue (StringRef Name) const |
| unsigned | getMDKindID (StringRef Name) const |
| void | getMDKindNames (SmallVectorImpl< StringRef > &Result) const |
| void | findUsedStructTypes (std::vector< StructType * > &StructTypes, bool OnlyNamed=false) const |
| StructType * | getTypeByName (StringRef Name) const |
Direct access to the globals list, functions list, and symbol table | |
| const GlobalListType & | getGlobalList () const |
| Get the Module's list of global variables (constant). | |
| GlobalListType & | getGlobalList () |
| Get the Module's list of global variables. | |
| const FunctionListType & | getFunctionList () const |
| Get the Module's list of functions (constant). | |
| FunctionListType & | getFunctionList () |
| Get the Module's list of functions. | |
| const AliasListType & | getAliasList () const |
| Get the Module's list of aliases (constant). | |
| AliasListType & | getAliasList () |
| Get the Module's list of aliases. | |
| const ValueSymbolTable & | getValueSymbolTable () const |
| Get the symbol table of global variable and function identifiers. | |
| ValueSymbolTable & | getValueSymbolTable () |
| Get the Module's symbol table of global variable and function identifiers. | |
| static iplist< GlobalVariable > Module::* | getSublistAccess (GlobalVariable *) |
| static iplist< Function > Module::* | getSublistAccess (Function *) |
| static iplist< GlobalAlias > Module::* | getSublistAccess (GlobalAlias *) |
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.
| typedef iplist<GlobalAlias> llvm::Module::AliasListType |
| typedef iplist<Function> llvm::Module::FunctionListType |
| typedef LibraryListType::const_iterator llvm::Module::lib_iterator |
| typedef std::vector<std::string> llvm::Module::LibraryListType |
| typedef DenseMap<StructType*, unsigned, DenseMapInfo<StructType*> > llvm::Module::NumeredTypesMapTy |
An enumeration for the supported behaviors of module flags. The following module flags behavior values are supported:
Value Behavior ----- -------- 1 Error Emits an error if two values disagree.
2 Warning Emits a warning if two values disagree.
3 Require Emits an error when the specified value is not present or doesn't have the specified value. It is an error for two (or more) llvm.module.flags with the same ID to have the Require behavior but different values. There may be multiple Require flags per ID.
4 Override Uses the specified value if the two values disagree. It is an error for two (or more) llvm.module.flags with the same ID to have the Override behavior but different values.
| 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().
| void Module::addLibrary | ( | StringRef | Lib | ) |
Add a library to the list of dependent libraries.
Definition at line 455 of file Module.cpp.
References llvm::ARM_PROC::I, lib_begin(), and lib_end().
Referenced by llvm::CloneModule().
| 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 364 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 372 of file Module.cpp.
References addModuleFlag(), llvm::ConstantInt::get(), and llvm::Type::getInt32Ty().
| void Module::addModuleFlag | ( | MDNode * | Node | ) |
Definition at line 377 of file Module.cpp.
References llvm::NamedMDNode::addOperand(), llvm::MDNode::getNumOperands(), llvm::MDNode::getOperand(), and getOrInsertModuleFlagsMetadata().
| alias_iterator llvm::Module::alias_begin | ( | ) | [inline] |
Definition at line 548 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
Referenced by llvm::CloneModule(), llvm::AsmPrinter::doFinalization(), dropAllReferences(), GetAllUndefinedSymbols(), getSymbols(), llvm::ValueEnumerator::ValueEnumerator(), WriteModuleInfo(), and WriteModuleUseLists().
| const_alias_iterator llvm::Module::alias_begin | ( | ) | const [inline] |
Definition at line 549 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
| bool llvm::Module::alias_empty | ( | ) | const [inline] |
Definition at line 553 of file Module.h.
References llvm::iplist< NodeTy, Traits >::empty().
| alias_iterator llvm::Module::alias_end | ( | ) | [inline] |
Definition at line 550 of file Module.h.
References llvm::iplist< NodeTy, Traits >::end().
Referenced by llvm::CloneModule(), llvm::AsmPrinter::doFinalization(), dropAllReferences(), GetAllUndefinedSymbols(), getSymbols(), llvm::ValueEnumerator::ValueEnumerator(), WriteModuleInfo(), and WriteModuleUseLists().
| const_alias_iterator llvm::Module::alias_end | ( | ) | const [inline] |
Definition at line 551 of file Module.h.
References llvm::iplist< NodeTy, Traits >::end().
| size_t llvm::Module::alias_size | ( | ) | const [inline] |
Definition at line 552 of file Module.h.
References llvm::iplist< NodeTy, Traits >::size().
| void llvm::Module::appendModuleInlineAsm | ( | StringRef | Asm | ) | [inline] |
| iterator llvm::Module::begin | ( | ) | [inline] |
Definition at line 520 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
Referenced by llvm::IntrinsicLowering::AddPrototypes(), llvm::ExecutionEngine::clearGlobalMappingsFromModule(), llvm::CloneModule(), llvm::AsmPrinter::doFinalization(), dropAllReferences(), llvm::X86AsmPrinter::EmitEndOfAsmFile(), llvm::PTXAsmPrinter::EmitStartOfAsmFile(), GetAllUndefinedSymbols(), getSymbols(), LLVMGetFirstFunction(), LLVMGetLastFunction(), LLVMGetPreviousFunction(), llvm::BitcodeReader::MaterializeModule(), llvm::DebugInfoFinder::processModule(), llvm::FindUsedTypes::runOnModule(), llvm::FPPassManager::runOnModule(), StripDebugInfo(), StripSymbolNames(), llvm::ValueEnumerator::ValueEnumerator(), WriteModule(), WriteModuleInfo(), and WriteModuleUseLists().
| const_iterator llvm::Module::begin | ( | ) | const [inline] |
Definition at line 521 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 414 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 444 of file Module.cpp.
References alias_begin(), alias_end(), begin(), end(), global_begin(), global_end(), and llvm::ARM_PROC::I.
Referenced by ~Module().
| void Module::dump | ( | ) | const |
Dump the module to stderr (for debugging).
Definition at line 2132 of file AsmWriter.cpp.
References llvm::dbgs(), and print().
| bool llvm::Module::empty | ( | ) | const [inline] |
Definition at line 525 of file Module.h.
References llvm::iplist< NodeTy, Traits >::empty().
| iterator llvm::Module::end | ( | ) | [inline] |
Definition at line 522 of file Module.h.
References llvm::iplist< NodeTy, Traits >::end().
Referenced by llvm::IntrinsicLowering::AddPrototypes(), llvm::ExecutionEngine::clearGlobalMappingsFromModule(), llvm::CloneModule(), llvm::AsmPrinter::doFinalization(), dropAllReferences(), llvm::X86AsmPrinter::EmitEndOfAsmFile(), llvm::PTXAsmPrinter::EmitStartOfAsmFile(), GetAllUndefinedSymbols(), getSymbols(), LLVMGetFirstFunction(), LLVMGetLastFunction(), LLVMGetNextFunction(), llvm::BitcodeReader::MaterializeModule(), llvm::DebugInfoFinder::processModule(), llvm::FindUsedTypes::runOnModule(), llvm::FPPassManager::runOnModule(), StripDebugInfo(), StripSymbolNames(), llvm::ValueEnumerator::ValueEnumerator(), WriteModule(), WriteModuleInfo(), and WriteModuleUseLists().
| const_iterator llvm::Module::end | ( | ) | const [inline] |
Definition at line 523 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 326 of file Module.cpp.
References llvm::iplist< NodeTy, Traits >::erase(), and llvm::NamedMDNode::getName().
Referenced by llvm::NamedMDNode::eraseFromParent().
| void Module::findUsedStructTypes | ( | std::vector< StructType * > & | StructTypes, |
| bool | OnlyNamed = false |
||
| ) | const |
findUsedStructTypes - Walk the entire module and find all of the struct types that are in use, returning them in a vector.
Definition at line 607 of file Module.cpp.
Referenced by StripTypeNames().
| const AliasListType& llvm::Module::getAliasList | ( | ) | const [inline] |
Get the Module's list of aliases (constant).
Definition at line 495 of file Module.h.
Referenced by llvm::GlobalAlias::eraseFromParent(), llvm::GlobalAlias::GlobalAlias(), and llvm::GlobalAlias::removeFromParent().
| AliasListType& llvm::Module::getAliasList | ( | ) | [inline] |
| LLVMContext& llvm::Module::getContext | ( | ) | const [inline] |
Get the global data context.
Definition at line 247 of file Module.h.
Referenced by llvm::IntrinsicLowering::AddPrototypes(), appendToGlobalArray(), llvm::CloneModule(), createFree(), createPrivateGlobalForString(), EnsureFPIntrinsicsExist(), llvm::MBlazeIntrinsicInfo::getDeclaration(), llvm::Intrinsic::getDeclaration(), getTypeByName(), llvm::InsertProfilingShutdownCall(), and llvm::NVPTXLowerAggrCopies::runOnFunction().
| 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.
Definition at line 231 of file Module.h.
Referenced by llvm::CloneModule(), llvm::TargetData::TargetData(), and WriteModuleInfo().
| Module::Endianness Module::getEndianness | ( | ) | const |
Target endian information.
Get the target endian information.
Definition at line 65 of file Module.cpp.
References AnyEndianness, BigEndian, llvm::StringRef::empty(), llvm::getToken(), and LittleEndian.
getFunction - Look up the specified function in the module symbol table. If it does not exist, return null.
Definition at line 240 of file Module.cpp.
References getNamedValue().
Referenced by llvm::AsmPrinter::doFinalization(), FindCXAAtExit(), GetAllUndefinedSymbols(), llvm::SparcTargetLowering::getSRetArgSize(), and StripDebugInfo().
| const FunctionListType& llvm::Module::getFunctionList | ( | ) | const [inline] |
Get the Module's list of functions (constant).
Definition at line 488 of file Module.h.
Referenced by llvm::Function::eraseFromParent(), llvm::Function::removeFromParent(), and llvm::CallGraph::removeFunctionFromModule().
| FunctionListType& llvm::Module::getFunctionList | ( | ) | [inline] |
| const GlobalListType& llvm::Module::getGlobalList | ( | ) | const [inline] |
Get the Module's list of global variables (constant).
Definition at line 481 of file Module.h.
Referenced by llvm::PTXAsmPrinter::doFinalization(), llvm::NVPTXAsmPrinter::doFinalization(), llvm::GlobalVariable::eraseFromParent(), llvm::GlobalVariable::GlobalVariable(), InstallGlobalCtors(), OptimizeGlobalAddressOfMalloc(), llvm::GlobalVariable::removeFromParent(), SRAGlobal(), and TryToShrinkGlobalToBoolean().
| GlobalListType& llvm::Module::getGlobalList | ( | ) | [inline] |
| GlobalVariable * Module::getGlobalVariable | ( | StringRef | Name, |
| bool | AllowLocal = false |
||
| ) | const |
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.
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 255 of file Module.cpp.
References getNamedValue().
Referenced by llvm::MachineModuleInfo::AnalyzeModule(), getNamedGlobal(), and StripSymbolNames().
| const LibraryListType& llvm::Module::getLibraries | ( | ) | const [inline] |
Get all the libraries.
Definition at line 542 of file Module.h.
Referenced by llvm::Linker::LinkInLibraries().
| GVMaterializer* llvm::Module::getMaterializer | ( | ) | const [inline] |
getMaterializer - Retrieves the GVMaterializer, if any, for this Module.
Definition at line 445 of file Module.h.
References llvm::OwningPtr< T >::get().
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 118 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 125 of file Module.cpp.
References llvm::LLVMContext::getMDKindNames().
Referenced by WriteModuleMetadataStore().
| void Module::getModuleFlagsMetadata | ( | SmallVectorImpl< ModuleFlagEntry > & | Flags | ) | const |
getModuleFlagsMetadata - Returns the module flags in the provided vector.
Definition at line 333 of file Module.cpp.
References getModuleFlagsMetadata(), llvm::NamedMDNode::getNumOperands(), llvm::MDNode::getOperand(), llvm::NamedMDNode::getOperand(), llvm::ConstantInt::getZExtValue(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by llvm::AsmPrinter::doFinalization().
| 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 350 of file Module.cpp.
References getNamedMetadata().
Referenced by getModuleFlagsMetadata().
| const std::string& llvm::Module::getModuleIdentifier | ( | ) | const [inline] |
Get the module identifier which is, essentially, the name of the module.
Definition at line 226 of file Module.h.
Referenced by llvm::CloneModule(), llvm::AsmPrinter::doInitialization(), EmitCamlGlobal(), llvm::Linker::LinkInArchive(), llvm::PassManagerPrettyStackEntry::print(), llvm::RenderMachineFunction::runOnMachineFunction(), and llvm::MPPassManager::runOnModule().
| const std::string& llvm::Module::getModuleInlineAsm | ( | ) | const [inline] |
Get any module-scope inline assembly blocks.
Definition at line 251 of file Module.h.
Referenced by llvm::CloneModule(), llvm::AsmPrinter::doInitialization(), 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 297 of file Module.cpp.
References getNamedValue().
| GlobalVariable* llvm::Module::getNamedGlobal | ( | StringRef | Name | ) | const [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 368 of file Module.h.
References getGlobalVariable().
Referenced by appendToGlobalArray(), llvm::InsertProfilingShutdownCall(), and llvm::ExecutionEngine::runStaticConstructorsDestructors().
| NamedMDNode * Module::getNamedMetadata | ( | const Twine & | Name | ) | const |
getNamedMetadata - Return the NamedMDNode in the module with the specified name. This method returns null if a NamedMDNode with the specified name is not found.
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 304 of file Module.cpp.
References lookup(), and llvm::Twine::toStringRef().
Referenced by llvm::DwarfDebug::beginModule(), cacheAnnotationFromMD(), llvm::DwarfDebug::collectInfoFromNamedMDNodes(), llvm::DwarfDebug::endModule(), findDbgGlobalDeclare(), findDbgSubprogramDeclare(), 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 112 of file Module.cpp.
References getValueSymbolTable(), and llvm::ValueSymbolTable::lookup().
Referenced by forceRenaming(), getFunction(), getGlobalVariable(), getNamedAlias(), getOrInsertFunction(), getOrInsertGlobal(), getOrInsertTargetIntrinsic(), and ModuleHasARC().
| Constant * Module::getOrInsertFunction | ( | StringRef | Name, |
| FunctionType * | T, | ||
| AttrListPtr | 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 139 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::EmitUnaryFloatFnCall(), EnsureFunctionExists(), llvm::MBlazeIntrinsicInfo::getDeclaration(), llvm::Intrinsic::getDeclaration(), getOrInsertFunction(), llvm::InsertProfilingInitCall(), ReplaceCallWith(), and llvm::InstCombiner::visitFPTrunc().
| Constant * Module::getOrInsertFunction | ( | StringRef | Name, |
| FunctionType * | T | ||
| ) |
Definition at line 189 of file Module.cpp.
References llvm::AttrListPtr::get(), and getOrInsertFunction().
| Constant * Module::getOrInsertFunction | ( | StringRef | Name, |
| AttrListPtr | 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 200 of file Module.cpp.
References llvm::FunctionType::get(), and getOrInsertFunction().
getOrInsertFunction - Same as above, but without the attributes.
Definition at line 219 of file Module.cpp.
References llvm::FunctionType::get(), llvm::AttrListPtr::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.
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 delclaration, return the existing global.
Definition at line 270 of file Module.cpp.
References llvm::GlobalValue::ExternalLinkage, llvm::ConstantExpr::getBitCast(), getNamedValue(), llvm::GlobalValue::getType(), and llvm::PointerType::getUnqual().
| 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 357 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 313 of file Module.cpp.
References llvm::ilist< NodeTy >::push_back().
Referenced by llvm::CloneModule(), llvm::DIBuilder::createCompileUnit(), llvm::getOrInsertFnSpecificMDNode(), and getOrInsertModuleFlagsMetadata().
| Constant * Module::getOrInsertTargetIntrinsic | ( | StringRef | Name, |
| FunctionType * | Ty, | ||
| AttrListPtr | AttributeList | ||
| ) |
Definition at line 172 of file Module.cpp.
References llvm::Function::Create(), llvm::GlobalValue::ExternalLinkage, F(), getNamedValue(), llvm::iplist< NodeTy, Traits >::push_back(), and llvm::Function::setAttributes().
| Module::PointerSize Module::getPointerSize | ( | ) | const |
Target Pointer Size information.
Get the target pointer size.
Definition at line 86 of file Module.cpp.
References AnyPointerSize, llvm::StringRef::empty(), llvm::getToken(), Pointer32, Pointer64, and size().
| static iplist<GlobalVariable> Module::* llvm::Module::getSublistAccess | ( | GlobalVariable * | ) | [inline, static] |
| static iplist<GlobalAlias> Module::* llvm::Module::getSublistAccess | ( | GlobalAlias * | ) | [inline, static] |
| const std::string& llvm::Module::getTargetTriple | ( | ) | const [inline] |
Get the target triple which is a string describing the target host.
Definition at line 235 of file Module.h.
Referenced by llvm::CloneModule(), llvm::EngineBuilder::create(), llvm::DwarfDebug::DwarfDebug(), 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 633 of file Type.cpp.
References llvm::StringMap< ValueTy, AllocatorTy >::find(), getContext(), llvm::ARM_PROC::I, 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 502 of file Module.h.
Referenced by getNamedValue(), llvm::ValueEnumerator::ValueEnumerator(), and WriteModule().
| ValueSymbolTable& llvm::Module::getValueSymbolTable | ( | ) | [inline] |
| global_iterator llvm::Module::global_begin | ( | ) | [inline] |
Definition at line 510 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
Referenced by llvm::ExecutionEngine::clearGlobalMappingsFromModule(), llvm::CloneModule(), llvm::AsmPrinter::doFinalization(), llvm::NVPTXAsmPrinter::doInitialization(), dropAllReferences(), llvm::X86AsmPrinter::EmitEndOfAsmFile(), llvm::ExecutionEngine::emitGlobals(), llvm::PTXAsmPrinter::EmitStartOfAsmFile(), GetAllUndefinedSymbols(), getSymbols(), LLVMGetFirstGlobal(), LLVMGetLastGlobal(), LLVMGetPreviousGlobal(), llvm::FindUsedTypes::runOnModule(), StripSymbolNames(), llvm::ValueEnumerator::ValueEnumerator(), WriteModuleInfo(), and WriteModuleUseLists().
| const_global_iterator llvm::Module::global_begin | ( | ) | const [inline] |
Definition at line 511 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
| bool llvm::Module::global_empty | ( | ) | const [inline] |
Definition at line 514 of file Module.h.
References llvm::iplist< NodeTy, Traits >::empty().
Referenced by WriteModuleInfo().
| global_iterator llvm::Module::global_end | ( | ) | [inline] |
Definition at line 512 of file Module.h.
References llvm::iplist< NodeTy, Traits >::end().
Referenced by llvm::ExecutionEngine::clearGlobalMappingsFromModule(), llvm::CloneModule(), llvm::AsmPrinter::doFinalization(), llvm::NVPTXAsmPrinter::doInitialization(), dropAllReferences(), llvm::X86AsmPrinter::EmitEndOfAsmFile(), llvm::ExecutionEngine::emitGlobals(), llvm::PTXAsmPrinter::EmitStartOfAsmFile(), GetAllUndefinedSymbols(), getSymbols(), LLVMGetFirstGlobal(), LLVMGetLastGlobal(), LLVMGetNextGlobal(), llvm::FindUsedTypes::runOnModule(), StripSymbolNames(), llvm::ValueEnumerator::ValueEnumerator(), WriteModuleInfo(), and WriteModuleUseLists().
| const_global_iterator llvm::Module::global_end | ( | ) | const [inline] |
Definition at line 513 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 402 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 396 of file Module.cpp.
Referenced by llvm::GlobalValue::isMaterializable().
| lib_iterator llvm::Module::lib_begin | ( | ) | const [inline] |
Get a constant iterator to beginning of dependent library list.
Definition at line 532 of file Module.h.
Referenced by addLibrary(), llvm::CloneModule(), llvm::Linker::LinkInItems(), and WriteModuleInfo().
| lib_iterator llvm::Module::lib_end | ( | ) | const [inline] |
Get a constant iterator to end of dependent library list.
Definition at line 534 of file Module.h.
Referenced by addLibrary(), llvm::CloneModule(), llvm::Linker::LinkInItems(), and WriteModuleInfo().
| size_t llvm::Module::lib_size | ( | ) | const [inline] |
| 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 408 of file Module.cpp.
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 419 of file Module.cpp.
Referenced by llvm::Linker::LinkInArchive(), and 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 425 of file Module.cpp.
References MaterializeAll(), and llvm::OwningPtr< T >::reset().
Referenced by llvm::Interpreter::create(), and llvm::ParseBitcodeFile().
| named_metadata_iterator llvm::Module::named_metadata_begin | ( | ) | [inline] |
Definition at line 560 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
Referenced by llvm::CloneModule(), StripDebugInfo(), and WriteModuleMetadata().
| const_named_metadata_iterator llvm::Module::named_metadata_begin | ( | ) | const [inline] |
Definition at line 561 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
| bool llvm::Module::named_metadata_empty | ( | ) | const [inline] |
Definition at line 571 of file Module.h.
References llvm::iplist< NodeTy, Traits >::empty().
| named_metadata_iterator llvm::Module::named_metadata_end | ( | ) | [inline] |
Definition at line 565 of file Module.h.
References llvm::iplist< NodeTy, Traits >::end().
Referenced by llvm::CloneModule(), StripDebugInfo(), and WriteModuleMetadata().
| const_named_metadata_iterator llvm::Module::named_metadata_end | ( | ) | const [inline] |
Definition at line 566 of file Module.h.
References llvm::iplist< NodeTy, Traits >::end().
| size_t llvm::Module::named_metadata_size | ( | ) | const [inline] |
Definition at line 570 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 2046 of file AsmWriter.cpp.
Referenced by dump(), and llvm::operator<<().
| void Module::removeLibrary | ( | StringRef | Lib | ) |
Remove a library from the list of dependent libraries.
Definition at line 462 of file Module.cpp.
References llvm::ARM_PROC::I.
| void llvm::Module::setDataLayout | ( | StringRef | DL | ) | [inline] |
| 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 389 of file Module.cpp.
References llvm::OwningPtr< T >::reset().
Referenced by llvm::getLazyBitcodeModule(), and llvm::getStreamedBitcodeModule().
| void llvm::Module::setModuleIdentifier | ( | StringRef | ID | ) | [inline] |
| void llvm::Module::setModuleInlineAsm | ( | StringRef | Asm | ) | [inline] |
Set the module-scope inline assembly blocks.
Definition at line 267 of file Module.h.
Referenced by llvm::CloneModule().
| void llvm::Module::setTargetTriple | ( | StringRef | T | ) | [inline] |
| size_t llvm::Module::size | ( | ) | const [inline] |
Definition at line 524 of file Module.h.
References llvm::iplist< NodeTy, Traits >::size().
Referenced by getPointerSize().