15 #ifndef LLVM_IR_MODULE_H
16 #define LLVM_IR_MODULE_H
24 #include "llvm/Support/DataTypes.h"
32 template<
typename T>
struct DenseMapInfo;
33 template<
typename KeyT,
typename ValueT,
typename KeyInfoT>
class DenseMap;
41 return static_cast<Function*
>(&Sentinel);
202 std::string GlobalScopeAsm;
205 std::string ModuleID;
206 std::string TargetTriple;
270 GlobalScopeAsm =
Asm;
271 if (!GlobalScopeAsm.empty() &&
272 GlobalScopeAsm[GlobalScopeAsm.size()-1] !=
'\n')
273 GlobalScopeAsm +=
'\n';
279 GlobalScopeAsm +=
Asm;
280 if (!GlobalScopeAsm.empty() &&
281 GlobalScopeAsm[GlobalScopeAsm.size()-1] !=
'\n')
282 GlobalScopeAsm +=
'\n';
337 Type *RetTy, ...) END_WITH_NULL;
356 bool AllowInternal =
false)
const {
489 return &Module::GlobalList;
496 return &Module::FunctionList;
503 return &Module::AliasList;
510 return &Module::NamedMDList;
535 size_t size()
const {
return FunctionList.
size(); }
556 return NamedMDList.
begin();
561 return NamedMDList.
end();
602 return reinterpret_cast<Module*
>(MP);
PointerSize getPointerSize() const
Target Pointer Size information.
const ValueSymbolTable & getValueSymbolTable() const
Get the symbol table of global variable and function identifiers.
void setDataLayout(StringRef DL)
Set the data layout.
NamedMDNode * createSentinel() const
ValueSymbolTable & getValueSymbolTable()
Get the Module's symbol table of global variable and function identifiers.
const_alias_iterator alias_begin() const
Function * provideInitialHead() const
iplist< NamedMDNode >::iterator iterator
The main container class for the LLVM Intermediate Representation.
void setModuleIdentifier(StringRef ID)
Set the module identifier.
const GlobalListType & getGlobalList() const
Get the Module's list of global variables (constant).
static void noteHead(Function *, Function *)
void setMaterializer(GVMaterializer *GVM)
named_metadata_iterator named_metadata_end()
static void destroySentinel(NamedMDNode *)
Endianness
An enumeration for describing the endianess of the target machine.
NamedMDNode * getOrInsertNamedMetadata(StringRef Name)
static ilist< NamedMDNode > Module::* getSublistAccess(NamedMDNode *)
FunctionListType::const_iterator const_iterator
The Function constant iterator.
MDNode - a tuple of other values.
LLVMContext ** unwrap(LLVMContextRef *Tys)
void addNodeToList(NamedMDNode *)
const AliasListType & getAliasList() const
Get the Module's list of aliases (constant).
const std::string & getTargetTriple() const
StructType * getTypeByName(StringRef Name) const
const GlobalVariable * getGlobalVariable(StringRef Name, bool AllowInternal=false) const
static void destroySentinel(Function *)
Appends the two values, which are required to be metadata nodes.
void getMDKindNames(SmallVectorImpl< StringRef > &Result) const
GlobalVariable * createSentinel() const
AliasListType::const_iterator const_alias_iterator
The Global Alias constant iterator.
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
static iplist< GlobalVariable > Module::* getSublistAccess(GlobalVariable *)
void eraseNamedMetadata(NamedMDNode *NMD)
const GlobalVariable * getNamedGlobal(StringRef Name) const
iplist< GlobalAlias > AliasListType
The type for the list of aliases.
GVMaterializer * getMaterializer() const
getMaterializer - Retrieves the GVMaterializer, if any, for this Module.
ilist< NamedMDNode > NamedMDListType
The type for the list of named metadata.
const NamedMDListType & getNamedMDList() const
Get the Module's list of named metadata (constant).
void setModuleInlineAsm(StringRef Asm)
Set the module-scope inline assembly blocks.
const_alias_iterator alias_end() const
ID
LLVM Calling Convention Representation.
const std::string & getModuleIdentifier() const
void removeNodeFromList(NamedMDNode *)
bool Materialize(GlobalValue *GV, std::string *ErrInfo=0)
global_iterator global_begin()
struct LLVMOpaqueModuleProvider * LLVMModuleProviderRef
NamedMDListType & getNamedMDList()
Get the Module's list of named metadata.
iplist< Function > FunctionListType
The type for the list of functions.
bool named_metadata_empty() const
bool MaterializeAllPermanently(std::string *ErrInfo=0)
Function * getFunction(StringRef Name) const
bool global_empty() const
const_global_iterator global_end() const
Module(StringRef ModuleID, LLVMContext &C)
const_named_metadata_iterator named_metadata_begin() const
bool MaterializeAll(std::string *ErrInfo=0)
static iplist< GlobalAlias > Module::* getSublistAccess(GlobalAlias *)
GlobalVariable * ensureHead(GlobalVariable *) const
alias_iterator alias_end()
Function * createSentinel() const
bool isDematerializable(const GlobalValue *GV) const
Constant * getOrInsertFunction(StringRef Name, FunctionType *T, AttributeSet AttributeList)
AliasListType & getAliasList()
Get the Module's list of aliases.
Constant * getOrInsertGlobal(StringRef Name, Type *Ty)
GlobalAlias * ensureHead(GlobalAlias *) const
size_type LLVM_ATTRIBUTE_UNUSED_RESULT size() const
NamedMDNode * getModuleFlagsMetadata() const
LLVM Constant Representation.
GlobalListType::const_iterator const_global_iterator
The Global Variable constant iterator.
ModFlagBehavior
This enumeration defines the supported behaviors of module flags.
const_iterator begin() const
PointerSize
An enumeration for describing the size of a pointer on the target machine.
const_global_iterator global_begin() const
NamedMDNode * ensureHead(NamedMDNode *) const
const_iterator end() const
ModuleFlagEntry(ModFlagBehavior B, MDString *K, Value *V)
GlobalAlias * createSentinel() const
static void noteHead(GlobalVariable *, GlobalVariable *)
static void destroySentinel(GlobalVariable *)
AliasListType::iterator alias_iterator
The Global Alias iterators.
void Dematerialize(GlobalValue *GV)
void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW) const
const std::string & getModuleInlineAsm() const
global_iterator global_end()
const FunctionListType & getFunctionList() const
Get the Module's list of functions (constant).
GlobalListType::iterator global_iterator
The Global Variable iterator.
GlobalListType & getGlobalList()
Get the Module's list of global variables.
const std::string & getDataLayout() const
Function * ensureHead(Function *) const
GlobalVariable * getNamedGlobal(StringRef Name)
size_t named_metadata_size() const
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
NamedMDNode * provideInitialHead() const
NamedMDNode * getOrInsertModuleFlagsMetadata()
alias_iterator alias_begin()
static void destroySentinel(GlobalAlias *)
NamedMDListType::const_iterator const_named_metadata_iterator
The named metadata constant interators.
iplist< GlobalVariable > GlobalListType
The type for the list of global variables.
GlobalAlias * getNamedAlias(StringRef Name) const
FunctionListType & getFunctionList()
Get the Module's list of functions.
Value * getModuleFlag(StringRef Key) const
static void noteHead(GlobalAlias *, GlobalAlias *)
NamedMDNode * getNamedMetadata(const Twine &Name) const
static void noteHead(NamedMDNode *, NamedMDNode *)
Endianness getEndianness() const
Target endian information.
void appendModuleInlineAsm(StringRef Asm)
size_t alias_size() const
FunctionListType::iterator iterator
The Function iterators.
bool isMaterializable(const GlobalValue *GV) const
void setTargetTriple(StringRef T)
Set the target triple.
~Module()
The module destructor. This will dropAllReferences.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
struct LLVMOpaqueModule * LLVMModuleRef
static NodeTy * createSentinel()
createSentinel - create the dynamic sentinel
GlobalVariable * provideInitialHead() const
NamedMDListType::iterator named_metadata_iterator
The named metadata iterators.
GlobalAlias * provideInitialHead() const
LLVM Value Representation.
const_named_metadata_iterator named_metadata_end() const
DenseMap< StructType *, unsigned, DenseMapInfo< StructType * > > NumeredTypesMapTy
unsigned getMDKindID(StringRef Name) const
void dump() const
Dump the module to stderr (for debugging).
GlobalValue * getNamedValue(StringRef Name) const
void addModuleFlag(ModFlagBehavior Behavior, StringRef Key, Value *Val)
named_metadata_iterator named_metadata_begin()
LLVMContext & getContext() const
static iplist< Function > Module::* getSublistAccess(Function *)