LLVM: Modules (original) (raw)
Modules represent the top-level structure in an LLVM program. More...
| Functions | |
|---|---|
| LLVM_C_ABI | LLVM_ATTRIBUTE_C_DEPRECATED (LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID), "Use of the global context is deprecated, use " "LLVMModuleCreateWithNameInContext instead") |
| Create a new, empty module in the global context. | |
| LLVM_C_ABI LLVMModuleRef | LLVMModuleCreateWithNameInContext (const char *ModuleID, LLVMContextRef C) |
| Create a new, empty module in a specific context. | |
| LLVM_C_ABI LLVMModuleRef | LLVMCloneModule (LLVMModuleRef M) |
| Return an exact copy of the specified module. | |
| LLVM_C_ABI void | LLVMDisposeModule (LLVMModuleRef M) |
| Destroy a module instance. | |
| LLVM_C_ABI LLVMBool | LLVMIsNewDbgInfoFormat (LLVMModuleRef M) |
| Soon to be deprecated. | |
| LLVM_C_ABI void | LLVMSetIsNewDbgInfoFormat (LLVMModuleRef M, LLVMBool UseNewFormat) |
| Soon to be deprecated. | |
| LLVM_C_ABI const char * | LLVMGetModuleIdentifier (LLVMModuleRef M, size_t *Len) |
| Obtain the identifier of a module. | |
| LLVM_C_ABI void | LLVMSetModuleIdentifier (LLVMModuleRef M, const char *Ident, size_t Len) |
| Set the identifier of a module to a string Ident with length Len. | |
| LLVM_C_ABI const char * | LLVMGetSourceFileName (LLVMModuleRef M, size_t *Len) |
| Obtain the module's original source file name. | |
| LLVM_C_ABI void | LLVMSetSourceFileName (LLVMModuleRef M, const char *Name, size_t Len) |
| Set the original source file name of a module to a string Name with length Len. | |
| LLVM_C_ABI const char * | LLVMGetDataLayoutStr (LLVMModuleRef M) |
| Obtain the data layout for a module. | |
| LLVM_C_ABI const char * | LLVMGetDataLayout (LLVMModuleRef M) |
| LLVM_C_ABI void | LLVMSetDataLayout (LLVMModuleRef M, const char *DataLayoutStr) |
| Set the data layout for a module. | |
| LLVM_C_ABI const char * | LLVMGetTarget (LLVMModuleRef M) |
| Obtain the target triple for a module. | |
| LLVM_C_ABI void | LLVMSetTarget (LLVMModuleRef M, const char *Triple) |
| Set the target triple for a module. | |
| LLVM_C_ABI LLVMModuleFlagEntry * | LLVMCopyModuleFlagsMetadata (LLVMModuleRef M, size_t *Len) |
| Returns the module flags as an array of flag-key-value triples. | |
| LLVM_C_ABI void | LLVMDisposeModuleFlagsMetadata (LLVMModuleFlagEntry *Entries) |
| Destroys module flags metadata entries. | |
| LLVM_C_ABI LLVMModuleFlagBehavior | LLVMModuleFlagEntriesGetFlagBehavior (LLVMModuleFlagEntry *Entries, unsigned Index) |
| Returns the flag behavior for a module flag entry at a specific index. | |
| LLVM_C_ABI const char * | LLVMModuleFlagEntriesGetKey (LLVMModuleFlagEntry *Entries, unsigned Index, size_t *Len) |
| Returns the key for a module flag entry at a specific index. | |
| LLVM_C_ABI LLVMMetadataRef | LLVMModuleFlagEntriesGetMetadata (LLVMModuleFlagEntry *Entries, unsigned Index) |
| Returns the metadata for a module flag entry at a specific index. | |
| LLVM_C_ABI LLVMMetadataRef | LLVMGetModuleFlag (LLVMModuleRef M, const char *Key, size_t KeyLen) |
| Add a module-level flag to the module-level flags metadata if it doesn't already exist. | |
| LLVM_C_ABI void | LLVMAddModuleFlag (LLVMModuleRef M, LLVMModuleFlagBehavior Behavior, const char *Key, size_t KeyLen, LLVMMetadataRef Val) |
| Add a module-level flag to the module-level flags metadata if it doesn't already exist. | |
| LLVM_C_ABI void | LLVMDumpModule (LLVMModuleRef M) |
| Dump a representation of a module to stderr. | |
| LLVM_C_ABI LLVMBool | LLVMPrintModuleToFile (LLVMModuleRef M, const char *Filename, char **ErrorMessage) |
| Print a representation of a module to a file. | |
| LLVM_C_ABI char * | LLVMPrintModuleToString (LLVMModuleRef M) |
| Return a string representation of the module. | |
| LLVM_C_ABI const char * | LLVMGetModuleInlineAsm (LLVMModuleRef M, size_t *Len) |
| Get inline assembly for a module. | |
| LLVM_C_ABI void | LLVMSetModuleInlineAsm2 (LLVMModuleRef M, const char *Asm, size_t Len) |
| Set inline assembly for a module. | |
| LLVM_C_ABI void | LLVMAppendModuleInlineAsm (LLVMModuleRef M, const char *Asm, size_t Len) |
| Append inline assembly to a module. | |
| LLVM_C_ABI LLVMValueRef | LLVMGetInlineAsm (LLVMTypeRef Ty, const char *AsmString, size_t AsmStringSize, const char *Constraints, size_t ConstraintsSize, LLVMBool HasSideEffects, LLVMBool IsAlignStack, LLVMInlineAsmDialect Dialect, LLVMBool CanThrow) |
| Create the specified uniqued inline asm string. | |
| LLVM_C_ABI const char * | LLVMGetInlineAsmAsmString (LLVMValueRef InlineAsmVal, size_t *Len) |
| Get the template string used for an inline assembly snippet. | |
| LLVM_C_ABI const char * | LLVMGetInlineAsmConstraintString (LLVMValueRef InlineAsmVal, size_t *Len) |
| Get the raw constraint string for an inline assembly snippet. | |
| LLVM_C_ABI LLVMInlineAsmDialect | LLVMGetInlineAsmDialect (LLVMValueRef InlineAsmVal) |
| Get the dialect used by the inline asm snippet. | |
| LLVM_C_ABI LLVMTypeRef | LLVMGetInlineAsmFunctionType (LLVMValueRef InlineAsmVal) |
| Get the function type of the inline assembly snippet. | |
| LLVM_C_ABI LLVMBool | LLVMGetInlineAsmHasSideEffects (LLVMValueRef InlineAsmVal) |
| Get if the inline asm snippet has side effects. | |
| LLVM_C_ABI LLVMBool | LLVMGetInlineAsmNeedsAlignedStack (LLVMValueRef InlineAsmVal) |
| Get if the inline asm snippet needs an aligned stack. | |
| LLVM_C_ABI LLVMBool | LLVMGetInlineAsmCanUnwind (LLVMValueRef InlineAsmVal) |
| Get if the inline asm snippet may unwind the stack. | |
| LLVM_C_ABI LLVMContextRef | LLVMGetModuleContext (LLVMModuleRef M) |
| Obtain the context to which this module is associated. | |
| LLVM_C_ABI LLVMTypeRef | LLVMGetTypeByName (LLVMModuleRef M, const char *Name) |
| Deprecated: Use LLVMGetTypeByName2 instead. | |
| LLVM_C_ABI LLVMNamedMDNodeRef | LLVMGetFirstNamedMetadata (LLVMModuleRef M) |
| Obtain an iterator to the first NamedMDNode in a Module. | |
| LLVM_C_ABI LLVMNamedMDNodeRef | LLVMGetLastNamedMetadata (LLVMModuleRef M) |
| Obtain an iterator to the last NamedMDNode in a Module. | |
| LLVM_C_ABI LLVMNamedMDNodeRef | LLVMGetNextNamedMetadata (LLVMNamedMDNodeRef NamedMDNode) |
| Advance a NamedMDNode iterator to the next NamedMDNode. | |
| LLVM_C_ABI LLVMNamedMDNodeRef | LLVMGetPreviousNamedMetadata (LLVMNamedMDNodeRef NamedMDNode) |
| Decrement a NamedMDNode iterator to the previous NamedMDNode. | |
| LLVM_C_ABI LLVMNamedMDNodeRef | LLVMGetNamedMetadata (LLVMModuleRef M, const char *Name, size_t NameLen) |
| Retrieve a NamedMDNode with the given name, returning NULL if no such node exists. | |
| LLVM_C_ABI LLVMNamedMDNodeRef | LLVMGetOrInsertNamedMetadata (LLVMModuleRef M, const char *Name, size_t NameLen) |
| Retrieve a NamedMDNode with the given name, creating a new node if no such node exists. | |
| LLVM_C_ABI const char * | LLVMGetNamedMetadataName (LLVMNamedMDNodeRef NamedMD, size_t *NameLen) |
| Retrieve the name of a NamedMDNode. | |
| LLVM_C_ABI unsigned | LLVMGetNamedMetadataNumOperands (LLVMModuleRef M, const char *Name) |
| Obtain the number of operands for named metadata in a module. | |
| LLVM_C_ABI void | LLVMGetNamedMetadataOperands (LLVMModuleRef M, const char *Name, LLVMValueRef *Dest) |
| Obtain the named metadata operands for a module. | |
| LLVM_C_ABI void | LLVMAddNamedMetadataOperand (LLVMModuleRef M, const char *Name, LLVMValueRef Val) |
| Add an operand to named metadata. | |
| LLVM_C_ABI const char * | LLVMGetDebugLocDirectory (LLVMValueRef Val, unsigned *Length) |
| Return the directory of the debug location for this value, which must be an llvm::Instruction, llvm::GlobalVariable, or llvm::Function. | |
| LLVM_C_ABI const char * | LLVMGetDebugLocFilename (LLVMValueRef Val, unsigned *Length) |
| Return the filename of the debug location for this value, which must be an llvm::Instruction, llvm::GlobalVariable, or llvm::Function. | |
| LLVM_C_ABI unsigned | LLVMGetDebugLocLine (LLVMValueRef Val) |
| Return the line number of the debug location for this value, which must be an llvm::Instruction, llvm::GlobalVariable, or llvm::Function. | |
| LLVM_C_ABI unsigned | LLVMGetDebugLocColumn (LLVMValueRef Val) |
| Return the column number of the debug location for this value, which must be an llvm::Instruction. | |
| LLVM_C_ABI LLVMValueRef | LLVMAddFunction (LLVMModuleRef M, const char *Name, LLVMTypeRef FunctionTy) |
| Add a function to a module under a specified name. | |
| LLVM_C_ABI LLVMValueRef | LLVMGetOrInsertFunction (LLVMModuleRef M, const char *Name, size_t NameLen, LLVMTypeRef FunctionTy) |
| Obtain or insert a function into a module. | |
| LLVM_C_ABI LLVMValueRef | LLVMGetNamedFunction (LLVMModuleRef M, const char *Name) |
| Obtain a Function value from a Module by its name. | |
| LLVM_C_ABI LLVMValueRef | LLVMGetNamedFunctionWithLength (LLVMModuleRef M, const char *Name, size_t Length) |
| Obtain a Function value from a Module by its name. | |
| LLVM_C_ABI LLVMValueRef | LLVMGetFirstFunction (LLVMModuleRef M) |
| Obtain an iterator to the first Function in a Module. | |
| LLVM_C_ABI LLVMValueRef | LLVMGetLastFunction (LLVMModuleRef M) |
| Obtain an iterator to the last Function in a Module. | |
| LLVM_C_ABI LLVMValueRef | LLVMGetNextFunction (LLVMValueRef Fn) |
| Advance a Function iterator to the next Function. | |
| LLVM_C_ABI LLVMValueRef | LLVMGetPreviousFunction (LLVMValueRef Fn) |
| Decrement a Function iterator to the previous Function. | |
| LLVM_C_ABI void | LLVMSetModuleInlineAsm (LLVMModuleRef M, const char *Asm) |
| Deprecated: Use LLVMSetModuleInlineAsm2 instead. |
Modules represent the top-level structure in an LLVM program.
An LLVM module is effectively a translation unit or a collection of translation units merged together.
◆ LLVM_ATTRIBUTE_C_DEPRECATED()
| LLVM_C_ABI LLVM_ATTRIBUTE_C_DEPRECATED | ( | LLVMModuleRef | _LLVMModuleCreateWithName_const char *ModuleID, |
|---|---|---|---|
| "Use of the global context is | deprecated, | ||
| use " "LLVMModuleCreateWithNameInContext instead" | ) |
Create a new, empty module in the global context.
This is equivalent to calling LLVMModuleCreateWithNameInContext with LLVMGetGlobalContext() as the context parameter.
Every invocation should be paired with LLVMDisposeModule() or memory will be leaked.
References C(), and LLVM_C_ABI.
◆ LLVMAddFunction()
◆ LLVMAddModuleFlag()
◆ LLVMAddNamedMetadataOperand()
◆ LLVMAppendModuleInlineAsm()
Append inline assembly to a module.
See also
Module::appendModuleInlineAsm()
Definition at line 494 of file Core.cpp.
References llvm::unwrap().
◆ LLVMCloneModule()
◆ LLVMCopyModuleFlagsMetadata()
◆ LLVMDisposeModule()
Destroy a module instance.
This must be called for every created module or memory will be leaked.
Definition at line 289 of file Core.cpp.
References llvm::unwrap().
◆ LLVMDisposeModuleFlagsMetadata()
Destroys module flags metadata entries.
Definition at line 399 of file Core.cpp.
◆ LLVMDumpModule()
◆ LLVMGetDataLayout()
◆ LLVMGetDataLayoutStr()
Obtain the data layout for a module.
See also
Module::getDataLayoutStr()
LLVMGetDataLayout is DEPRECATED, as the name is not only incorrect, but match the name of another method on the module. Prefer the use of LLVMGetDataLayoutStr, which is not ambiguous.
Definition at line 314 of file Core.cpp.
References llvm::unwrap().
Referenced by LLVMGetDataLayout().
◆ LLVMGetDebugLocColumn()
◆ LLVMGetDebugLocDirectory()
Return the directory of the debug location for this value, which must be an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
See also
llvm::Instruction::getDebugLoc()
llvm::GlobalVariable::getDebugInfo()
llvm::Function::getSubprogram()
Definition at line 1462 of file Core.cpp.
References assert(), llvm::StringRef::data(), DL, llvm::dyn_cast(), F, I, llvm::Length, llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::StringRef::size(), and llvm::unwrap().
◆ LLVMGetDebugLocFilename()
Return the filename of the debug location for this value, which must be an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
See also
llvm::Instruction::getDebugLoc()
llvm::GlobalVariable::getDebugInfo()
llvm::Function::getSubprogram()
Definition at line 1486 of file Core.cpp.
References assert(), llvm::StringRef::data(), DL, llvm::dyn_cast(), F, I, llvm::Length, llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::StringRef::size(), and llvm::unwrap().
◆ LLVMGetDebugLocLine()
Return the line number of the debug location for this value, which must be an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
See also
llvm::Instruction::getDebugLoc()
llvm::GlobalVariable::getDebugInfo()
llvm::Function::getSubprogram()
Definition at line 1510 of file Core.cpp.
References assert(), DL, llvm::dyn_cast(), F, I, llvm::SmallVectorTemplateCommon< T, typename >::size(), and llvm::unwrap().
◆ LLVMGetFirstFunction()
◆ LLVMGetFirstNamedMetadata()
◆ LLVMGetInlineAsm()
◆ LLVMGetInlineAsmAsmString()
◆ LLVMGetInlineAsmCanUnwind()
◆ LLVMGetInlineAsmConstraintString()
◆ LLVMGetInlineAsmDialect()
◆ LLVMGetInlineAsmFunctionType()
Get the function type of the inline assembly snippet.
The same type that was passed into LLVMGetInlineAsm originally
See also
Definition at line 558 of file Core.cpp.
References llvm::cast(), and llvm::unwrap().
◆ LLVMGetInlineAsmHasSideEffects()
◆ LLVMGetInlineAsmNeedsAlignedStack()
◆ LLVMGetLastFunction()
◆ LLVMGetLastNamedMetadata()
◆ LLVMGetModuleContext()
◆ LLVMGetModuleFlag()
◆ LLVMGetModuleIdentifier()
Obtain the identifier of a module.
Parameters
| M | Module to obtain identifier of |
|---|---|
| Len | Out parameter which holds the length of the returned string. |
Returns
The identifier of M.
See also
Module::getModuleIdentifier()
Definition at line 293 of file Core.cpp.
References llvm::unwrap().
◆ LLVMGetModuleInlineAsm()
Get inline assembly for a module.
See also
Module::getModuleInlineAsm()
Definition at line 498 of file Core.cpp.
References llvm::unwrap().
◆ LLVMGetNamedFunction()
◆ LLVMGetNamedFunctionWithLength()
◆ LLVMGetNamedMetadata()
◆ LLVMGetNamedMetadataName()
◆ LLVMGetNamedMetadataNumOperands()
◆ LLVMGetNamedMetadataOperands()
◆ LLVMGetNextFunction()
Advance a Function iterator to the next Function.
Returns NULL if the iterator was already at the end and there are no more functions.
Definition at line 2453 of file Core.cpp.
References I, llvm::unwrap(), and llvm::wrap().
◆ LLVMGetNextNamedMetadata()
◆ LLVMGetOrInsertFunction()
◆ LLVMGetOrInsertNamedMetadata()
◆ LLVMGetPreviousFunction()
Decrement a Function iterator to the previous Function.
Returns NULL if the iterator was already at the beginning and there are no previous functions.
Definition at line 2461 of file Core.cpp.
References I, llvm::unwrap(), and llvm::wrap().
◆ LLVMGetPreviousNamedMetadata()
◆ LLVMGetSourceFileName()
Obtain the module's original source file name.
Parameters
| M | Module to obtain the name of |
|---|---|
| Len | Out parameter which holds the length of the returned string |
Returns
The original source file name of M
See also
Module::getSourceFileName()
Definition at line 303 of file Core.cpp.
References llvm::unwrap().
◆ LLVMGetTarget()
Obtain the target triple for a module.
See also
Module::getTargetTriple()
Definition at line 327 of file Core.cpp.
References llvm::unwrap().
◆ LLVMGetTypeByName()
◆ LLVMIsNewDbgInfoFormat()
◆ LLVMModuleCreateWithNameInContext()
◆ LLVMModuleFlagEntriesGetFlagBehavior()
◆ LLVMModuleFlagEntriesGetKey()
◆ LLVMModuleFlagEntriesGetMetadata()
◆ LLVMPrintModuleToFile()
◆ LLVMPrintModuleToString()
◆ LLVMSetDataLayout()
Set the data layout for a module.
See also
Module::setDataLayout()
Definition at line 322 of file Core.cpp.
References llvm::unwrap().
◆ LLVMSetIsNewDbgInfoFormat()
◆ LLVMSetModuleIdentifier()
Set the identifier of a module to a string Ident with length Len.
Parameters
| M | The module to set identifier |
|---|---|
| Ident | The string to set M's identifier to |
| Len | Length of Ident |
See also
Module::setModuleIdentifier()
Definition at line 299 of file Core.cpp.
References llvm::unwrap().
◆ LLVMSetModuleInlineAsm()
◆ LLVMSetModuleInlineAsm2()
Set inline assembly for a module.
See also
Module::setModuleInlineAsm()
Definition at line 486 of file Core.cpp.
References llvm::unwrap().
◆ LLVMSetSourceFileName()
Set the original source file name of a module to a string Name with length Len.
Parameters
| M | The module to set the source file name of |
|---|---|
| Name | The string to set M's source file name to |
| Len | Length of Name |
See also
Module::setSourceFileName()
Definition at line 309 of file Core.cpp.
References llvm::unwrap().
◆ LLVMSetTarget()
Set the target triple for a module.
See also
Module::setTargetTriple()
Definition at line 331 of file Core.cpp.
References llvm::unwrap().