Modules

LLVM.ModuleType
LLVM.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.

source
Base.copyMethod
copy(mod::LLVM.Module)

Clone the given module.

This object needs to be disposed of using dispose.

source
LLVM.disposeMethod
dispose(mod::LLVM.Module)

Dispose of the given module, releasing all resources associated with it. The module should not be used after this operation.

source

Properties and operations

LLVM.contextMethod
context(mod::LLVM.Module)

Get the context in which the given module was created.

source
LLVM.nameMethod
name(mod::LLVM.Module)

Get the name of the given module.

source
LLVM.name!Method
name!(mod::LLVM.Module, name::String)

Set the name of the given module.

source
LLVM.tripleMethod
triple(mod::LLVM.Module)

Get the target triple of the given module.

source
LLVM.triple!Method
triple!(mod::LLVM.Module, triple::String)

Set the target triple of the given module.

source
LLVM.datalayout!Function
datalayout!(mod::LLVM.Module, layout)

Set the data layout of the given module. The layout can be a string or a DataLayout object.

source
LLVM.inline_asm!Function
inline_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.

source
LLVM.inline_asmFunction
inline_asm(mod::LLVM.Module) -> String

Get the module-level inline assembly of the given module.

source
LLVM.sdk_versionFunction
sdk_version!(mod::LLVM.Module, version::VersionNumber)

Set the SDK version of the given module.

source
LLVM.sdk_version!Function
sdk_version(mod::LLVM.Module)

Get the SDK version of the given module, if it has been set.

source
LLVM.set_used!Function
set_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.

source
LLVM.set_compiler_used!Function
set_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.

source

Textual representation

Base.parseMethod
parse(::Type{Module}, ir::String)

Parse the given LLVM IR string into a module.

source

Binary representation ("bitcode")

Base.parseMethod
parse(::Type{Module}, membuf::MemoryBuffer)

Parse bitcode from the given memory buffer into a module.

source
Base.parseMethod
parse(::Type{Module}, data::Vector)

Parse bitcode from the given byte vector into a module.

source
Base.convertMethod
convert(::Type{MemoryBuffer}, mod::Module)

Convert the given module to a memory buffer containing its bitcode.

source
Base.convertMethod
convert(::Type{Vector}, mod::Module)

Convert the given module to a byte vector containing its bitcode.

source
Base.writeMethod
write(io::IO, mod::Module)

Write bitcode of the given module to the given IO stream.

source

Contents

LLVM.globalsFunction
globals(mod::LLVM.Module)

Get an iterator over the global variables in the given module.

source
LLVM.prevglobalFunction
prevglobal(gv::LLVM.GlobalVariable)

Get the previous global variable in the module, or nothing if there is none.

See also: nextglobal.

source
LLVM.nextglobalFunction
nextglobal(gv::LLVM.GlobalVariable)

Get the next global variable in the module, or nothing if there is none.

See also: prevglobal.

source
LLVM.functionsMethod
functions(mod::LLVM.Module)

Get an iterator over the functions in the given module.

source
LLVM.prevfunFunction
prevfun(fun::LLVM.Function)

Get the previous function in the module, or nothing if there is none.

source
LLVM.nextfunFunction
nextfun(fun::LLVM.Function)

Get the next function in the module, or nothing if there is none.

source
LLVM.flagsMethod
flags(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!.

source

Linking

LLVM.link!Method
link!(dst::Module, src::Module)

Link the source module src into the destination module dst. The source module is destroyed in the process.

source