Modules
LLVM.Module
— TypeLLVM.Module
Modules are the top level container of all other LLVM 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.
Base.copy
— MethodLLVM.dispose
— Methoddispose(mod::LLVM.Module)
Dispose of the given module, releasing all resources associated with it. The module should not be used after this operation.
Properties and operations
LLVM.context
— Methodcontext(mod::LLVM.Module)
Get the context in which the given module was created.
LLVM.name
— Methodname(mod::LLVM.Module)
Get the name of the given module.
LLVM.name!
— Methodname!(mod::LLVM.Module, name::String)
Set the name of the given module.
LLVM.triple
— Methodtriple(mod::LLVM.Module)
Get the target triple of the given module.
LLVM.triple!
— Methodtriple!(mod::LLVM.Module, triple::String)
Set the target triple of the given module.
LLVM.datalayout
— Functiondatalayout(mod::LLVM.Module)
Get the data layout of the given module.
LLVM.datalayout!
— Functiondatalayout!(mod::LLVM.Module, layout)
Set the data layout of the given module. The layout can be a string or a DataLayout
object.
LLVM.inline_asm!
— Functioninline_asm!(mod::LLVM.Module, asm::String; overwrite::Bool=false)
Add module-level inline assembly to the given module. If overwrite
is true
, the existing inline assembly is replaced, otherwise the new assembly is appended.
LLVM.inline_asm
— Functioninline_asm(mod::LLVM.Module) -> String
Get the module-level inline assembly of the given module.
LLVM.sdk_version
— Functionsdk_version!(mod::LLVM.Module, version::VersionNumber)
Set the SDK version of the given module.
LLVM.sdk_version!
— Functionsdk_version(mod::LLVM.Module)
Get the SDK version of the given module, if it has been set.
LLVM.set_used!
— Functionset_used!(mod::LLVM.Module, values::GlobalVariable...)
Mark the given global variables as used in the given module by appending them to the llvm.used
metadata node.
LLVM.set_compiler_used!
— Functionset_compiler_used!(mod::LLVM.Module, values::GlobalVariable...)
Mark the given global variables as used by the compiler in the given module by appending them to the llvm.compiler.used
metadata node. As opposed to set_used!
, this still allows the linker to remove the variable if it is not actually used.
Textual representation
Base.parse
— Methodparse(::Type{Module}, ir::String)
Parse the given LLVM IR string into a module.
Base.string
— Methodstring(mod::Module)
Convert the given module to a string.
Binary representation ("bitcode")
Base.parse
— Methodparse(::Type{Module}, membuf::MemoryBuffer)
Parse bitcode from the given memory buffer into a module.
Base.parse
— Methodparse(::Type{Module}, data::Vector)
Parse bitcode from the given byte vector into a module.
Base.convert
— Methodconvert(::Type{MemoryBuffer}, mod::Module)
Convert the given module to a memory buffer containing its bitcode.
Base.convert
— Methodconvert(::Type{Vector}, mod::Module)
Convert the given module to a byte vector containing its bitcode.
Base.write
— Methodwrite(io::IO, mod::Module)
Write bitcode of the given module to the given IO stream.
Contents
LLVM.globals
— Functionglobals(mod::LLVM.Module)
Get an iterator over the global variables in the given module.
LLVM.prevglobal
— Functionprevglobal(gv::LLVM.GlobalVariable)
Get the previous global variable in the module, or nothing
if there is none.
See also: nextglobal
.
LLVM.nextglobal
— Functionnextglobal(gv::LLVM.GlobalVariable)
Get the next global variable in the module, or nothing
if there is none.
See also: prevglobal
.
LLVM.functions
— Methodfunctions(mod::LLVM.Module)
Get an iterator over the functions in the given module.
LLVM.prevfun
— Functionprevfun(fun::LLVM.Function)
Get the previous function in the module, or nothing
if there is none.
LLVM.nextfun
— Functionnextfun(fun::LLVM.Function)
Get the next function in the module, or nothing
if there is none.
LLVM.flags
— Methodflags(mod::LLVM.Module)
Get a dictionary-like object representing the module flags of the given module.
This object can be used to get and set module flags, by calling getindex
and setindex!
.
Linking
LLVM.link!
— Methodlink!(dst::Module, src::Module)
Link the source module src
into the destination module dst
. The source module is destroyed in the process.