|
LLVM
3.7.0
|
A Module instance is used to store all the information related to an LLVM module. More...
#include <Module.h>
Classes | |
| struct | ModuleFlagEntry |
Public Member Functions | |
Constructors | |
| Module (StringRef ModuleID, LLVMContext &C) | |
| The Module constructor. More... | |
| ~Module () | |
| The module destructor. This will dropAllReferences. More... | |
Module Level Accessors | |
| const std::string & | getModuleIdentifier () const |
| Get the module identifier which is, essentially, the name of the module. More... | |
| StringRef | getName () const |
| Get a short "name" for the module. More... | |
| const std::string & | getDataLayoutStr () const |
| Get the data layout string for the module's target platform. More... | |
| const DataLayout & | getDataLayout () const |
| Get the data layout for the module's target platform. More... | |
| const std::string & | getTargetTriple () const |
| Get the target triple which is a string describing the target host. More... | |
| LLVMContext & | getContext () const |
| Get the global data context. More... | |
| const std::string & | getModuleInlineAsm () const |
| Get any module-scope inline assembly blocks. More... | |
| RandomNumberGenerator * | createRNG (const Pass *P) const |
| Get a RandomNumberGenerator salted for use with this module. More... | |
Module Level Mutators | |
| void | setModuleIdentifier (StringRef ID) |
| Set the module identifier. More... | |
| void | setDataLayout (StringRef Desc) |
| Set the data layout. More... | |
| void | setDataLayout (const DataLayout &Other) |
| void | setTargetTriple (StringRef T) |
| Set the target triple. More... | |
| void | setModuleInlineAsm (StringRef Asm) |
| Set the module-scope inline assembly blocks. More... | |
| void | appendModuleInlineAsm (StringRef Asm) |
| Append to the module-scope inline assembly blocks. More... | |
Generic Value Accessors | |
| GlobalValue * | getNamedValue (StringRef Name) const |
| Return the global value in the module with the specified name, of arbitrary type. More... | |
| unsigned | getMDKindID (StringRef Name) const |
| Return a unique non-zero ID for the specified metadata kind. More... | |
| void | getMDKindNames (SmallVectorImpl< StringRef > &Result) const |
| Populate client supplied SmallVector with the name for custom metadata IDs registered in this LLVMContext. More... | |
| StructType * | getTypeByName (StringRef Name) const |
| Return the type with the specified name, or null if there is none by that name. More... | |
| std::vector< StructType * > | getIdentifiedStructTypes () const |
Function Accessors | |
| Constant * | getOrInsertFunction (StringRef Name, FunctionType *T, AttributeSet AttributeList) |
| Look up the specified function in the module symbol table. More... | |
| Constant * | getOrInsertFunction (StringRef Name, FunctionType *T) |
| Constant * | getOrInsertFunction (StringRef Name, AttributeSet AttributeList, Type *RetTy,...) LLVM_END_WITH_NULL |
| Look up the specified function in the module symbol table. More... | |
| Constant * | getOrInsertFunction (StringRef Name, Type *RetTy,...) LLVM_END_WITH_NULL |
| Same as above, but without the attributes. More... | |
| Function * | getFunction (StringRef Name) const |
| Look up the specified function in the module symbol table. More... | |
Global Variable Accessors | |
| GlobalVariable * | getGlobalVariable (StringRef Name) const |
| Look up the specified global variable in the module symbol table. More... | |
| GlobalVariable * | getGlobalVariable (StringRef Name, bool AllowInternal) const |
| GlobalVariable * | getGlobalVariable (StringRef Name, bool AllowInternal=false) |
| getGlobalVariable - Look up the specified global variable in the module symbol table. More... | |
| GlobalVariable * | getNamedGlobal (StringRef Name) |
| Return the global variable in the module with the specified name, of arbitrary type. More... | |
| const GlobalVariable * | getNamedGlobal (StringRef Name) const |
| Constant * | getOrInsertGlobal (StringRef Name, Type *Ty) |
| Look up the specified global in the module symbol table. More... | |
Global Alias Accessors | |
| GlobalAlias * | getNamedAlias (StringRef Name) const |
| Return the global alias in the module with the specified name, of arbitrary type. More... | |
Named Metadata Accessors | |
| NamedMDNode * | getNamedMetadata (const Twine &Name) const |
| Return the first NamedMDNode in the module with the specified name. More... | |
| NamedMDNode * | getOrInsertNamedMetadata (StringRef Name) |
| Return the named MDNode in the module with the specified name. More... | |
| void | eraseNamedMetadata (NamedMDNode *NMD) |
| Remove the given NamedMDNode from this module and delete it. More... | |
Comdat Accessors | |
| Comdat * | getOrInsertComdat (StringRef Name) |
| Return the Comdat in the module with the specified name. More... | |
Module Flags Accessors | |
| void | getModuleFlagsMetadata (SmallVectorImpl< ModuleFlagEntry > &Flags) const |
| Returns the module flags in the provided vector. More... | |
| Metadata * | getModuleFlag (StringRef Key) const |
| Return the corresponding value if Key appears in module flags, otherwise return null. More... | |
| NamedMDNode * | getModuleFlagsMetadata () const |
| Returns the NamedMDNode in the module that represents module-level flags. More... | |
| NamedMDNode * | getOrInsertModuleFlagsMetadata () |
| Returns the NamedMDNode in the module that represents module-level flags. More... | |
| void | addModuleFlag (ModFlagBehavior Behavior, StringRef Key, Metadata *Val) |
| Add a module-level flag to the module-level flags metadata. More... | |
| void | addModuleFlag (ModFlagBehavior Behavior, StringRef Key, Constant *Val) |
| void | addModuleFlag (ModFlagBehavior Behavior, StringRef Key, uint32_t Val) |
| void | addModuleFlag (MDNode *Node) |
Materialization | |
| void | setMaterializer (GVMaterializer *GVM) |
| Sets the GVMaterializer to GVM. More... | |
| GVMaterializer * | getMaterializer () const |
| Retrieves the GVMaterializer, if any, for this Module. More... | |
| bool | isDematerializable (const GlobalValue *GV) const |
| Returns true if this GV was loaded from this Module's GVMaterializer and the GVMaterializer knows how to dematerialize the GV. More... | |
| std::error_code | materialize (GlobalValue *GV) |
| Make sure the GlobalValue is fully read. More... | |
| void | dematerialize (GlobalValue *GV) |
| 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. More... | |
| std::error_code | materializeAll () |
| Make sure all GlobalValues in this Module are fully read. More... | |
| std::error_code | materializeAllPermanently () |
| Make sure all GlobalValues in this Module are fully read and clear the Materializer. More... | |
| std::error_code | materializeMetadata () |
Global Variable Iteration | |
| global_iterator | global_begin () |
| const_global_iterator | global_begin () const |
| global_iterator | global_end () |
| const_global_iterator | global_end () const |
| bool | global_empty () const |
| iterator_range< global_iterator > | globals () |
| iterator_range < const_global_iterator > | globals () const |
Function Iteration | |
| iterator | begin () |
| const_iterator | begin () const |
| iterator | end () |
| const_iterator | end () const |
| reverse_iterator | rbegin () |
| const_reverse_iterator | rbegin () const |
| reverse_iterator | rend () |
| const_reverse_iterator | rend () const |
| size_t | size () const |
| bool | empty () const |
| iterator_range< iterator > | functions () |
| iterator_range< const_iterator > | functions () const |
Alias Iteration | |
| alias_iterator | alias_begin () |
| const_alias_iterator | alias_begin () const |
| alias_iterator | alias_end () |
| const_alias_iterator | alias_end () const |
| size_t | alias_size () const |
| bool | alias_empty () const |
| iterator_range< alias_iterator > | aliases () |
| iterator_range < const_alias_iterator > | aliases () const |
Named Metadata Iteration | |
| named_metadata_iterator | named_metadata_begin () |
| const_named_metadata_iterator | named_metadata_begin () const |
| named_metadata_iterator | named_metadata_end () |
| const_named_metadata_iterator | named_metadata_end () const |
| size_t | named_metadata_size () const |
| bool | named_metadata_empty () const |
| iterator_range < named_metadata_iterator > | named_metadata () |
| iterator_range < const_named_metadata_iterator > | named_metadata () const |
| void | dropTriviallyDeadConstantArrays () |
| Destroy ConstantArrays in LLVMContext if they are not used. More... | |
Utility functions for printing and dumping Module objects | |
| void | print (raw_ostream &OS, AssemblyAnnotationWriter *AAW, bool ShouldPreserveUseListOrder=false) const |
| Print the module to an output stream with an optional AssemblyAnnotationWriter. More... | |
| void | dump () const |
| Dump the module to stderr (for debugging). More... | |
| void | dropAllReferences () |
| This function causes all the subinstructions to "let go" of all references that they are maintaining. More... | |
Utility functions for querying Debug information. | |
| unsigned | getDwarfVersion () const |
| Returns the Dwarf Version by checking module flags. More... | |
Utility functions for querying and setting PIC level | |
| PICLevel::Level | getPICLevel () const |
| Returns the PIC level (small or large model) More... | |
| void | setPICLevel (PICLevel::Level PL) |
| Set the PIC level (small or large model) More... | |
Types And Enumerations | |
| enum | ModFlagBehavior { Error = 1, Warning = 2, Require = 3, Override = 4, Append = 5, AppendUnique = 6, ModFlagBehaviorFirstVal = Error, ModFlagBehaviorLastVal = AppendUnique } |
| This enumeration defines the supported behaviors of module flags. More... | |
| typedef iplist< GlobalVariable > | GlobalListType |
| The type for the list of global variables. More... | |
| typedef iplist< Function > | FunctionListType |
| The type for the list of functions. More... | |
| typedef iplist< GlobalAlias > | AliasListType |
| The type for the list of aliases. More... | |
| typedef ilist< NamedMDNode > | NamedMDListType |
| The type for the list of named metadata. More... | |
| typedef StringMap< Comdat > | ComdatSymTabType |
| The type of the comdat "symbol" table. More... | |
| typedef GlobalListType::iterator | global_iterator |
| The Global Variable iterator. More... | |
| typedef GlobalListType::const_iterator | const_global_iterator |
| The Global Variable constant iterator. More... | |
| typedef FunctionListType::iterator | iterator |
| The Function iterators. More... | |
| typedef FunctionListType::const_iterator | const_iterator |
| The Function constant iterator. More... | |
| typedef FunctionListType::reverse_iterator | reverse_iterator |
| The Function reverse iterator. More... | |
| typedef FunctionListType::const_reverse_iterator | const_reverse_iterator |
| The Function constant reverse iterator. More... | |
| typedef AliasListType::iterator | alias_iterator |
| The Global Alias iterators. More... | |
| typedef AliasListType::const_iterator | const_alias_iterator |
| The Global Alias constant iterator. More... | |
| typedef NamedMDListType::iterator | named_metadata_iterator |
| The named metadata iterators. More... | |
| typedef NamedMDListType::const_iterator | const_named_metadata_iterator |
| The named metadata constant iterators. More... | |
| static bool | isValidModFlagBehavior (Metadata *MD, ModFlagBehavior &MFB) |
| Checks if Metadata represents a valid ModFlagBehavior, and stores the converted result in MFB. More... | |
Member Variables | |
| class | Constant |
Direct access to the globals list, functions list, and symbol table | |
| static GlobalListType Module::* | getSublistAccess (GlobalVariable *) |
| static FunctionListType Module::* | getSublistAccess (Function *) |
| static AliasListType Module::* | getSublistAccess (GlobalAlias *) |
| static NamedMDListType Module::* | getSublistAccess (NamedMDNode *) |
| const GlobalListType & | getGlobalList () const |
| Get the Module's list of global variables (constant). More... | |
| GlobalListType & | getGlobalList () |
| Get the Module's list of global variables. More... | |
| const FunctionListType & | getFunctionList () const |
| Get the Module's list of functions (constant). More... | |
| FunctionListType & | getFunctionList () |
| Get the Module's list of functions. More... | |
| const AliasListType & | getAliasList () const |
| Get the Module's list of aliases (constant). More... | |
| AliasListType & | getAliasList () |
| Get the Module's list of aliases. More... | |
| const NamedMDListType & | getNamedMDList () const |
| Get the Module's list of named metadata (constant). More... | |
| NamedMDListType & | getNamedMDList () |
| Get the Module's list of named metadata. More... | |
| const ValueSymbolTable & | getValueSymbolTable () const |
| Get the symbol table of global variable and function identifiers. More... | |
| ValueSymbolTable & | getValueSymbolTable () |
| Get the Module's symbol table of global variable and function identifiers. More... | |
| const ComdatSymTabType & | getComdatSymbolTable () const |
| Get the Module's symbol table for COMDATs (constant). More... | |
| ComdatSymTabType & | getComdatSymbolTable () |
| Get the Module's symbol table for COMDATs. More... | |
A Module instance is used to store all the information related to an LLVM module.
Modules are the top level container of all other LLVM Intermediate Representation (IR) objects. Each module directly contains a list of globals variables, a list of functions, a list of libraries (or other modules) this module depends on, a symbol table, and various data about the target's characteristics.
A module maintains a GlobalValRefMap object that is used to hold all constant references to global variables in the module. When a global variable is destroyed, it should have no entries in the GlobalValueRefMap. The main container class for the LLVM Intermediate Representation.
| typedef iplist<GlobalAlias> llvm::Module::AliasListType |
| typedef iplist<Function> llvm::Module::FunctionListType |
This enumeration defines the supported behaviors of module flags.
|
explicit |
The Module constructor.
Note that there is no default constructor. You must provide a name for the module upon construction.
Definition at line 48 of file Module.cpp.
References llvm::DL.
| Module::~Module | ( | ) |
The module destructor. This will dropAllReferences.
Definition at line 55 of file Module.cpp.
References llvm::iplist< NodeTy, Traits >::clear(), and dropAllReferences().
| void Module::addModuleFlag | ( | ModFlagBehavior | Behavior, |
| StringRef | Key, | ||
| Metadata * | Val | ||
| ) |
Add a module-level flag to the module-level flags metadata.
addModuleFlag - Add a module-level flag to the module-level flags metadata.
It will create the module-level flags named metadata if it doesn't already exist.
Definition at line 340 of file Module.cpp.
References llvm::NamedMDNode::addOperand(), llvm::ConstantInt::get(), llvm::ConstantAsMetadata::get(), llvm::MDString::get(), llvm::MDNode::get(), llvm::Type::getInt32Ty(), and getOrInsertModuleFlagsMetadata().
Referenced by addModuleFlag(), and setPICLevel().
| void Module::addModuleFlag | ( | ModFlagBehavior | Behavior, |
| StringRef | Key, | ||
| Constant * | Val | ||
| ) |
Definition at line 348 of file Module.cpp.
References addModuleFlag(), and llvm::ConstantAsMetadata::get().
| void Module::addModuleFlag | ( | ModFlagBehavior | Behavior, |
| StringRef | Key, | ||
| uint32_t | Val | ||
| ) |
Definition at line 352 of file Module.cpp.
References addModuleFlag(), llvm::ConstantInt::get(), and llvm::Type::getInt32Ty().
| void Module::addModuleFlag | ( | MDNode * | Node | ) |
Definition at line 357 of file Module.cpp.
References llvm::NamedMDNode::addOperand(), llvm::MDNode::getNumOperands(), llvm::MDNode::getOperand(), and getOrInsertModuleFlagsMetadata().
|
inline |
Definition at line 591 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
Referenced by aliases(), llvm::CloneModule(), and llvm::TypeFinder::run().
|
inline |
Definition at line 592 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
|
inline |
Definition at line 596 of file Module.h.
References llvm::iplist< NodeTy, Traits >::empty().
|
inline |
Definition at line 593 of file Module.h.
References llvm::iplist< NodeTy, Traits >::end().
Referenced by aliases(), llvm::CloneModule(), llvm::TypeFinder::run(), and skipEmpty().
|
inline |
Definition at line 594 of file Module.h.
References llvm::iplist< NodeTy, Traits >::end().
|
inline |
Definition at line 595 of file Module.h.
References llvm::iplist< NodeTy, Traits >::size().
|
inline |
Definition at line 598 of file Module.h.
References alias_begin(), and alias_end().
Referenced by dropAllReferences(), and orderModule().
|
inline |
Definition at line 601 of file Module.h.
References alias_begin(), and alias_end().
|
inline |
Append to the module-scope inline assembly blocks.
A trailing newline is added if the input doesn't have one.
Definition at line 307 of file Module.h.
References llvm::HexStyle::Asm.
Referenced by llvm::orc::OrcX86_64::insertCompileCallbackTrampolines(), and llvm::orc::OrcX86_64::insertResolverBlock().
|
inline |
Definition at line 569 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
Referenced by llvm::IntrinsicLowering::AddPrototypes(), llvm::ExecutionEngine::clearGlobalMappingsFromModule(), llvm::CloneModule(), functions(), LLVMGetFirstFunction(), LLVMGetLastFunction(), LLVMGetPreviousFunction(), llvm::TypeFinder::run(), StripSymbolNames(), llvm::object::IRObjectFile::symbol_begin_impl(), llvm::verifyModule(), llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit(), and WriteModule().
|
inline |
Definition at line 570 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
| RandomNumberGenerator * Module::createRNG | ( | const Pass * | P | ) | const |
Get a RandomNumberGenerator salted for use with this module.
The RNG can be seeded via -rng-seed=<uint64> and is salted with the ModuleID and the provided pass salt. The returned RNG should not be shared across threads or passes.
A unique RNG per pass ensures a reproducible random stream even when other randomness consuming passes are added or removed. In addition, the random stream will be reproducible across LLVM versions when the pass does not change.
Definition at line 66 of file Module.cpp.
References llvm::sys::path::filename(), getModuleIdentifier(), and llvm::Pass::getPassName().
| void Module::dematerialize | ( | GlobalValue * | GV | ) |
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 no-op.
Definition at line 397 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 447 of file Module.cpp.
References aliases(), llvm::Function::dropAllReferences(), F(), and globals().
Referenced by ~Module().
| void Module::dropTriviallyDeadConstantArrays | ( | ) |
Destroy ConstantArrays in LLVMContext if they are not used.
ConstantArrays constructed during linking can cause quadratic memory explosion. Releasing all unused constants can cause a 20% LTO compile-time slowdown for a large application.
NOTE: Constants are currently owned by LLVMContext. This can then only be called where all uses of the LLVMContext are understood.
Definition at line 183 of file LLVMContextImpl.cpp.
References llvm::LLVMContextImpl::dropTriviallyDeadConstantArrays(), and llvm::LLVMContext::pImpl.
| LLVM_DUMP_METHOD void Module::dump | ( | ) | const |
Dump the module to stderr (for debugging).
Definition at line 3361 of file AsmWriter.cpp.
References llvm::dbgs(), and print().
|
inline |
Definition at line 578 of file Module.h.
References llvm::iplist< NodeTy, Traits >::empty().
|
inline |
Definition at line 571 of file Module.h.
References llvm::iplist< NodeTy, Traits >::end().
Referenced by llvm::IntrinsicLowering::AddPrototypes(), llvm::ExecutionEngine::clearGlobalMappingsFromModule(), llvm::CloneModule(), functions(), LLVMGetFirstFunction(), LLVMGetLastFunction(), LLVMGetNextFunction(), llvm::TypeFinder::run(), StripSymbolNames(), llvm::verifyModule(), llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >::visit(), and WriteModule().
|
inline |
Definition at line 572 of file Module.h.
References llvm::iplist< NodeTy, Traits >::end().
| void Module::eraseNamedMetadata | ( | NamedMDNode * | NMD | ) |
Remove the given NamedMDNode from this module and delete it.
eraseNamedMetadata - Remove the given NamedMDNode from this module and delete it.
Definition at line 275 of file Module.cpp.
References llvm::iplist< NodeTy, Traits >::erase(), and llvm::NamedMDNode::getName().
Referenced by llvm::NamedMDNode::eraseFromParent().
|
inline |
Definition at line 580 of file Module.h.
References begin(), and end().
Referenced by llvm::AsmPrinter::doInitialization().
|
inline |
|
inline |
Get the Module's list of aliases (constant).
Definition at line 526 of file Module.h.
Referenced by llvm::GlobalAlias::eraseFromParent(), and llvm::GlobalAlias::removeFromParent().
|
inline |
|
inline |
Get the Module's symbol table for COMDATs (constant).
Definition at line 544 of file Module.h.
Referenced by rewriteComdat().
|
inline |
|
inline |
Get the global data context.
Definition at line 265 of file Module.h.
Referenced by llvm::LTOCodeGenerator::addModule(), llvm::IntrinsicLowering::AddPrototypes(), appendToGlobalArray(), assureFPCallStub(), llvm::CloneModule(), createFPFnStub(), createFree(), CreateGCRelocates(), createPrivateGlobalForSourceLoc(), createPrivateGlobalForString(), createPrivateNonConstGlobalForString(), llvm::createSanitizerCtorAndInitFunctions(), llvm::EmitFPutC(), llvm::EmitFPutS(), llvm::EmitFWrite(), EmitGCCInlineAsmStr(), llvm::AArch64TargetLowering::emitLoadLinked(), llvm::ARMTargetLowering::emitLoadLinked(), llvm::EmitMemChr(), llvm::EmitMemCmp(), llvm::EmitMemCpyChk(), EmitMSInlineAsmStr(), llvm::EmitPutS(), llvm::HexagonTargetLowering::emitStoreConditional(), llvm::AArch64TargetLowering::emitStoreConditional(), llvm::ARMTargetLowering::emitStoreConditional(), llvm::EmitStrChr(), llvm::EmitStrCpy(), llvm::EmitStrLen(), llvm::EmitStrNCmp(), llvm::EmitStrNCpy(), llvm::EmitStrNLen(), EnsureFPIntrinsicsExist(), findBasePointer(), fixupFPReturnAndCall(), llvm::objcarc::ARCMDKindCache::get(), llvm::Intrinsic::getDeclaration(), getTypeByName(), InsertSafepointPoll(), insertUseHolderAfter(), llvm::Linker::Linker(), llvm::legacy::PassManagerImpl::run(), llvm::LTOCodeGenerator::setModule(), SwitchToLookupTable(), and llvm::UpgradeDebugInfo().
| const DataLayout & Module::getDataLayout | ( | ) | const |
Get the data layout for the module's target platform.
Definition at line 372 of file Module.cpp.
Referenced by AddAlignmentAssumptions(), llvm::IVUsers::AddUsersImpl(), AllCallersPassInValidPointerForArgument(), AnalyzeLoadFromClobberingStore(), llvm::objcarc::CanAlterRefCount(), llvm::objcarc::CanUse(), checkStringCopyLibFuncSignature(), llvm::CloneModule(), combineInstructionsOverFunction(), EmitCamlGlobal(), llvm::LazyValueInfo::eraseBlock(), llvm::FindAvailableLoadedValue(), llvm::MemoryLocation::get(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::MachineFunction::getDataLayout(), llvm::ScalarEvolution::getEffectiveSCEVType(), llvm::getGEPInductionOperand(), llvm::MemoryDependenceAnalysis::getLoadLoadClobberFullWidthSize(), GetLoadValueForLoad(), llvm::ExecutionEngine::getMangledName(), llvm::Mangler::getNameWithPrefix(), llvm::ScalarEvolution::getOffsetOfExpr(), llvm::MemoryDependenceAnalysis::getPointerDependencyFrom(), llvm::LazyValueInfo::getPredicateAt(), llvm::LazyValueInfo::getPredicateOnEdge(), llvm::NVPTXTargetLowering::getPrototype(), llvm::ScalarEvolution::getSizeOfExpr(), llvm::MipsTargetMachine::getTargetIRAnalysis(), llvm::AMDGPUTargetMachine::getTargetIRAnalysis(), llvm::TargetMachine::getTargetIRAnalysis(), llvm::AArch64TargetLowering::getTgtMemIntrinsic(), llvm::ARMTargetLowering::getTgtMemIntrinsic(), llvm::NVPTXTargetLowering::getTgtMemIntrinsic(), llvm::ScalarEvolution::getTypeSizeInBits(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleByValArgument(), HandleByValArgumentInit(), llvm::hoistRegion(), llvm::DataLayout::init(), InlineCallIfPossible(), llvm::InlineFunction(), llvm::isInductionPHI(), isLoadLoadClobberIfExtendedToFullWidth(), llvm::AArch64TargetLowering::isProfitableToHoist(), isSafePHIToSpeculate(), isSafeSelectToSpeculate(), llvm::isSafeToLoadUnconditionally(), llvm::isSafeToSpeculativelyExecute(), IsSmallObject(), llvm::AArch64TargetLowering::lowerInterleavedLoad(), llvm::ARMTargetLowering::lowerInterleavedLoad(), llvm::AArch64TargetLowering::lowerInterleavedStore(), llvm::ARMTargetLowering::lowerInterleavedStore(), replaceAndRecursivelySimplifyImpl(), llvm::returnTypeIsEligibleForTailCall(), llvm::LibCallAliasAnalysis::runOnFunction(), llvm::LazyValueInfo::runOnFunction(), llvm::FunctionLoweringInfo::set(), llvm::SimplifyCFG(), llvm::LazyValueInfo::threadEdge(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopProlog(), and visitIVCast().
|
inline |
Get the data layout string for the module's target platform.
This is equivalent to getDataLayout()->getStringRepresentation().
Definition at line 252 of file Module.h.
References llvm::DataLayout::getStringRepresentation().
Referenced by WriteModuleInfo().
| unsigned Module::getDwarfVersion | ( | ) | const |
Returns the Dwarf Version by checking module flags.
Definition at line 458 of file Module.cpp.
References llvm::dwarf::DWARF_VERSION, and getModuleFlag().
Referenced by llvm::DwarfDebug::DwarfDebug().
Look up the specified function in the module symbol table.
If it does not exist, return null.
Definition at line 188 of file Module.cpp.
References getNamedValue().
Referenced by assureFPCallStub(), FindCXAAtExit(), llvm::MCJIT::findModuleForSymbol(), llvm::SparcTargetLowering::getSRetArgSize(), llvm::MachineModuleInfo::getWinEHParent(), hasReturnsTwiceAttr(), InsertSafepointPoll(), llvm::MIRParserImpl::parseMachineFunction(), llvm::MachineInstr::print(), and llvm::StripDebugInfo().
|
inline |
Get the Module's list of functions (constant).
Definition at line 519 of file Module.h.
Referenced by llvm::Function::eraseFromParent(), llvm::Function::removeFromParent(), and llvm::CallGraph::removeFunctionFromModule().
|
inline |
|
inline |
Get the Module's list of global variables (constant).
Definition at line 512 of file Module.h.
Referenced by llvm::NVPTXAsmPrinter::doFinalization(), llvm::GlobalVariable::eraseFromParent(), llvm::GlobalVariable::GlobalVariable(), OptimizeGlobalAddressOfMalloc(), llvm::GlobalVariable::removeFromParent(), SRAGlobal(), and TryToShrinkGlobalToBoolean().
|
inline |
|
inline |
Look up the specified global variable in the module symbol table.
If it does not exist, return null. If AllowInternal is set to true, this function will return types that have InternalLinkage. By default, these types are not returned.
Definition at line 381 of file Module.h.
Referenced by llvm::collectUsedGlobalVariables(), llvm::MCJIT::findModuleForSymbol(), getGlobalVariable(), getNamedGlobal(), and StripSymbolNames().
|
inline |
Definition at line 385 of file Module.h.
References getGlobalVariable().
| GlobalVariable * Module::getGlobalVariable | ( | StringRef | Name, |
| bool | AllowLocal = false |
||
| ) |
getGlobalVariable - Look up the specified global variable in the module symbol table.
If it does not exist, return null. The type argument should be the underlying type of the global, i.e., it should not have the top-level PointerType, which represents the address of the global. If AllowLocal is set to true, this function will return types that have an local. By default, these types are not returned.
Definition at line 203 of file Module.cpp.
References getNamedValue().
| std::vector< StructType * > Module::getIdentifiedStructTypes | ( | ) | const |
Definition at line 426 of file Module.cpp.
References llvm::TypeFinder::begin(), llvm::TypeFinder::end(), llvm::MipsISD::Ret, and llvm::TypeFinder::run().
|
inline |
Retrieves the GVMaterializer, if any, for this Module.
Return a unique non-zero ID for the specified metadata kind.
getMDKindID - Return a unique non-zero ID for the specified metadata kind.
This ID is uniqued across modules in the current LLVMContext.
Definition at line 94 of file Module.cpp.
References llvm::LLVMContext::getMDKindID().
Referenced by llvm::UpgradeIntrinsicCall().
| void Module::getMDKindNames | ( | SmallVectorImpl< StringRef > & | Result | ) | const |
Populate client supplied SmallVector with the name for custom metadata IDs registered in this LLVMContext.
getMDKindNames - Populate client supplied SmallVector with the name for custom metadata IDs registered in this LLVMContext.
ID #0 is not used, so it is filled in as an empty string.
Definition at line 101 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 313 of file Module.cpp.
References getModuleFlagsMetadata().
Referenced by llvm::getDebugMetadataVersionFromModule(), getDwarfVersion(), and getPICLevel().
| void Module::getModuleFlagsMetadata | ( | SmallVectorImpl< ModuleFlagEntry > & | Flags | ) | const |
Returns the module flags in the provided vector.
getModuleFlagsMetadata - Returns the module flags in the provided vector.
Definition at line 293 of file Module.cpp.
References getModuleFlagsMetadata(), isValidModFlagBehavior(), llvm::NamedMDNode::operands(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
| NamedMDNode * Module::getModuleFlagsMetadata | ( | ) | const |
Returns the NamedMDNode in the module that represents module-level flags.
getModuleFlagsMetadata - Returns the NamedMDNode in the module that represents module-level flags.
This method returns null if there are no module-level flags.
Definition at line 326 of file Module.cpp.
References getNamedMetadata().
Referenced by getModuleFlag(), and getModuleFlagsMetadata().
|
inline |
Get the module identifier which is, essentially, the name of the module.
Definition at line 242 of file Module.h.
Referenced by llvm::CloneModule(), createRNG(), llvm::AsmPrinter::doInitialization(), EmitCamlGlobal(), llvm::LazyCallGraph::LazyCallGraph(), llvm::DiagnosticPrinterRawOStream::operator<<(), and llvm::LazyCallGraphPrinterPass::run().
|
inline |
Get any module-scope inline assembly blocks.
Definition at line 269 of file Module.h.
Referenced by llvm::CloneModule(), llvm::AsmPrinter::doInitialization(), llvm::NVPTXAsmPrinter::doInitialization(), llvm::ARMAsmPrinter::EmitStartOfAsmFile(), and WriteModuleInfo().
|
inline |
Get a short "name" for the module.
This is useful for debugging or logging. It is essentially a convenience wrapper around getModuleIdentifier().
| GlobalAlias * Module::getNamedAlias | ( | StringRef | Name | ) | const |
Return the global alias in the module with the specified name, of arbitrary type.
This method returns null if a global with the specified name is not found.
Definition at line 246 of file Module.cpp.
References getNamedValue().
|
inline |
Return the global variable in the module with the specified name, of arbitrary type.
This method returns null if a global with the specified name is not found.
Definition at line 394 of file Module.h.
References getGlobalVariable().
Referenced by appendToGlobalArray(), llvm::orc::getConstructors(), llvm::orc::getDestructors(), getNamedGlobal(), and llvm::ExecutionEngine::runStaticConstructorsDestructors().
|
inline |
Definition at line 397 of file Module.h.
References getNamedGlobal().
|
inline |
|
inline |
| NamedMDNode * Module::getNamedMetadata | ( | const Twine & | Name | ) | const |
Return the first NamedMDNode in the module with the specified name.
getNamedMetadata - Return the first NamedMDNode in the module with the specified name.
This method returns null if a NamedMDNode with the specified name is not found.
Definition at line 253 of file Module.cpp.
References lookup(), and llvm::Twine::toStringRef().
Referenced by llvm::DwarfDebug::beginModule(), cacheAnnotationFromMD(), getModuleFlagsMetadata(), hasDebugInfo(), llvm::makeSubprogramMap(), llvm::DebugInfoFinder::processModule(), and llvm::WinCodeViewLineTables::WinCodeViewLineTables().
| GlobalValue * Module::getNamedValue | ( | StringRef | Name | ) | const |
Return the global value in the module with the specified name, of arbitrary type.
getNamedValue - Return the first global value in the module with the specified name, of arbitrary type.
This method returns null if a global with the specified name is not found.
Definition at line 88 of file Module.cpp.
References getValueSymbolTable(), and llvm::ValueSymbolTable::lookup().
Referenced by forceRenaming(), getComdatGVForCOFF(), getFunction(), getGlobalVariable(), getNamedAlias(), getOrInsertFunction(), getOrInsertGlobal(), and llvm::objcarc::ModuleHasARC().
Return the Comdat in the module with the specified name.
It is created if it didn't already exist.
Definition at line 465 of file Module.cpp.
References llvm::StringMap< ValueTy, AllocatorTy >::insert().
Referenced by rewriteComdat().
| Constant * Module::getOrInsertFunction | ( | StringRef | Name, |
| FunctionType * | T, | ||
| AttributeSet | AttributeList | ||
| ) |
Look up the specified function in the module symbol table.
Four possibilities:
Definition at line 115 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::createSanitizerCtorAndInitFunctions(), 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(), fixupFPReturnAndCall(), llvm::Intrinsic::getDeclaration(), getOrInsertFunction(), insertSinCosCall(), insertUseHolderAfter(), and ReplaceCallWith().
| Constant * Module::getOrInsertFunction | ( | StringRef | Name, |
| FunctionType * | T | ||
| ) |
Definition at line 138 of file Module.cpp.
References getOrInsertFunction().
| Constant * Module::getOrInsertFunction | ( | StringRef | Name, |
| AttributeSet | AttributeList, | ||
| Type * | RetTy, | ||
| ... | |||
| ) |
Look up the specified function in the module symbol table.
If it does not exist, add a prototype for the function and return it. This function guarantees to return a constant of pointer to the specified function type or a ConstantExpr BitCast of that type if the named function has a different type. This version of the method takes a null terminated list of function arguments, which makes it easier for clients to use.
Definition at line 148 of file Module.cpp.
References llvm::FunctionType::get(), and getOrInsertFunction().
Same as above, but without the attributes.
Definition at line 167 of file Module.cpp.
References llvm::FunctionType::get(), and getOrInsertFunction().
Look up the specified global in the module symbol table.
getOrInsertGlobal - Look up the specified global in the module symbol table.
Definition at line 217 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 | ( | ) |
Returns the NamedMDNode in the module that represents module-level flags.
getOrInsertModuleFlagsMetadata - Returns the NamedMDNode in the module that represents module-level flags.
If module-level flags aren't found, it creates the named metadata that contains them.
Definition at line 333 of file Module.cpp.
References getOrInsertNamedMetadata().
Referenced by addModuleFlag().
| NamedMDNode * Module::getOrInsertNamedMetadata | ( | StringRef | Name | ) |
Return the named MDNode in the module with the specified name.
getOrInsertNamedMetadata - Return the first named MDNode in the module with the specified name.
This method returns a new NamedMDNode if a NamedMDNode with the specified name is not found.
Definition at line 262 of file Module.cpp.
References llvm::ilist< NodeTy >::push_back().
Referenced by llvm::CloneModule(), llvm::DIBuilder::createCompileUnit(), and getOrInsertModuleFlagsMetadata().
| PICLevel::Level Module::getPICLevel | ( | ) | const |
Returns the PIC level (small or large model)
Definition at line 471 of file Module.cpp.
References llvm::PICLevel::Default, and getModuleFlag().
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inline |
Get the target triple which is a string describing the target host.
Definition at line 261 of file Module.h.
Referenced by llvm::CloneModule(), llvm::LTOModule::getTargetTriple(), llvm::orc::OrcX86_64::insertCompileCallbackTrampolines(), llvm::orc::OrcX86_64::insertResolverBlock(), insertSinCosCall(), llvm::TargetLibraryAnalysis::run(), llvm::WriteBitcodeToFile(), and WriteModuleInfo().
| StructType * Module::getTypeByName | ( | StringRef | Name | ) | const |
Return the type with the specified name, or null if there is none by that name.
getTypeByName - Return the type with the specified name, or null if there is none by that name.
Definition at line 625 of file Type.cpp.
References getContext(), llvm::LLVMContextImpl::NamedStructTypes, and llvm::LLVMContext::pImpl.
|
inline |
Get the symbol table of global variable and function identifiers.
Definition at line 540 of file Module.h.
Referenced by getNamedValue(), and WriteModule().
|
inline |
|
inline |
Definition at line 552 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
Referenced by llvm::ExecutionEngine::clearGlobalMappingsFromModule(), llvm::CloneModule(), globals(), LLVMGetFirstGlobal(), LLVMGetLastGlobal(), LLVMGetPreviousGlobal(), llvm::TypeFinder::run(), and StripSymbolNames().
|
inline |
Definition at line 553 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
|
inline |
Definition at line 556 of file Module.h.
References llvm::iplist< NodeTy, Traits >::empty().
|
inline |
Definition at line 554 of file Module.h.
References llvm::iplist< NodeTy, Traits >::end().
Referenced by llvm::ExecutionEngine::clearGlobalMappingsFromModule(), llvm::CloneModule(), globals(), LLVMGetFirstGlobal(), LLVMGetLastGlobal(), LLVMGetNextGlobal(), llvm::TypeFinder::run(), and StripSymbolNames().
|
inline |
Definition at line 555 of file Module.h.
References llvm::iplist< NodeTy, Traits >::end().
|
inline |
Definition at line 558 of file Module.h.
References global_begin(), and global_end().
Referenced by llvm::AsmPrinter::computeGlobalGOTEquivs(), llvm::AsmPrinter::doFinalization(), dropAllReferences(), llvm::ExecutionEngine::emitGlobals(), orderModule(), predictUseListOrder(), llvm::ValueEnumerator::ValueEnumerator(), and WriteModuleInfo().
|
inline |
Definition at line 561 of file Module.h.
References global_begin(), and global_end().
| bool Module::isDematerializable | ( | const GlobalValue * | GV | ) | const |
Returns true if this GV was loaded from this Module's GVMaterializer and the GVMaterializer knows how to dematerialize the GV.
Definition at line 384 of file Module.cpp.
Referenced by llvm::GlobalValue::isDematerializable().
|
static |
Checks if Metadata represents a valid ModFlagBehavior, and stores the converted result in MFB.
Definition at line 280 of file Module.cpp.
References ModFlagBehaviorFirstVal, and ModFlagBehaviorLastVal.
Referenced by getModuleFlagsMetadata().
| std::error_code Module::materialize | ( | GlobalValue * | GV | ) |
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 390 of file Module.cpp.
Referenced by llvm::GlobalValue::materialize().
| std::error_code Module::materializeAll | ( | ) |
Make sure all GlobalValues in this Module are fully read.
Definition at line 402 of file Module.cpp.
Referenced by materializeAllPermanently().
| std::error_code Module::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 408 of file Module.cpp.
References materializeAll().
| std::error_code Module::materializeMetadata | ( | ) |
Definition at line 416 of file Module.cpp.
|
inline |
Definition at line 622 of file Module.h.
References named_metadata_begin(), and named_metadata_end().
Referenced by WriteModuleMetadata().
|
inline |
Definition at line 626 of file Module.h.
References named_metadata_begin(), and named_metadata_end().
|
inline |
Definition at line 609 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
Referenced by llvm::CloneModule(), named_metadata(), llvm::TypeFinder::run(), and llvm::StripDebugInfo().
|
inline |
Definition at line 610 of file Module.h.
References llvm::iplist< NodeTy, Traits >::begin().
|
inline |
Definition at line 620 of file Module.h.
References llvm::iplist< NodeTy, Traits >::empty().
Referenced by WriteModuleMetadata().
|
inline |
Definition at line 614 of file Module.h.
References llvm::iplist< NodeTy, Traits >::end().
Referenced by llvm::CloneModule(), named_metadata(), llvm::TypeFinder::run(), and llvm::StripDebugInfo().
|
inline |
Definition at line 615 of file Module.h.
References llvm::iplist< NodeTy, Traits >::end().
|
inline |
Definition at line 619 of file Module.h.
References llvm::iplist< NodeTy, Traits >::size().
| void Module::print | ( | raw_ostream & | OS, |
| AssemblyAnnotationWriter * | AAW, | ||
| bool | ShouldPreserveUseListOrder = false |
||
| ) | const |
Print the module to an output stream with an optional AssemblyAnnotationWriter.
If ShouldPreserveUseListOrder, then include uselistorder directives so that use-lists can be recreated when reading the assembly.
Definition at line 3146 of file AsmWriter.cpp.
Referenced by dump(), llvm::operator<<(), llvm::yaml::BlockScalarTraits< Module >::output(), and llvm::PrintModulePass::run().
|
inline |
Definition at line 573 of file Module.h.
References llvm::iplist< NodeTy, Traits >::rbegin().
Referenced by predictUseListOrder().
|
inline |
Definition at line 574 of file Module.h.
References llvm::iplist< NodeTy, Traits >::rbegin().
|
inline |
Definition at line 575 of file Module.h.
References llvm::iplist< NodeTy, Traits >::rend().
Referenced by predictUseListOrder().
|
inline |
Definition at line 576 of file Module.h.
References llvm::iplist< NodeTy, Traits >::rend().
| void Module::setDataLayout | ( | StringRef | Desc | ) |
Set the data layout.
Definition at line 366 of file Module.cpp.
References llvm::DataLayout::reset().
Referenced by llvm::CloneModule(), llvm::MCJIT::generateCodeForModule(), LLVMTargetMachineEmit(), and llvm::LTOCodeGenerator::optimize().
| void Module::setDataLayout | ( | const DataLayout & | Other | ) |
Definition at line 370 of file Module.cpp.
References Other.
| void Module::setMaterializer | ( | GVMaterializer * | GVM | ) |
Sets the GVMaterializer to GVM.
This module must not yet have a Materializer. To reset the materializer for a module that already has one, call 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 377 of file Module.cpp.
Referenced by getBitcodeModuleImpl().
|
inline |
|
inline |
Set the module-scope inline assembly blocks.
A trailing newline is added if the input doesn't have one.
Definition at line 298 of file Module.h.
References llvm::HexStyle::Asm.
Referenced by llvm::CloneModule().
| void Module::setPICLevel | ( | PICLevel::Level | PL | ) |
Set the PIC level (small or large model)
Definition at line 481 of file Module.cpp.
References addModuleFlag(), and llvm::lltok::Error.
|
inline |
Set the target triple.
Definition at line 294 of file Module.h.
References T.
Referenced by llvm::CloneModule(), and llvm::LTOModule::setTargetTriple().
|
inline |
Definition at line 577 of file Module.h.
References llvm::iplist< NodeTy, Traits >::size().
1.8.6