Metadata

LLVM.MDStringMethod
MDString(val::String)

Create a new string metadata node from the given Julia string.

source
Base.convertMethod
convert(String, md::MDString)

Get the string value of the given string metadata node.

source
LLVM.MDNodeType
MDNode

Abstract supertype for metadata nodes that can have operands.

See also: MDTuple for a concrete subtype.

source
LLVM.MDNodeMethod
MDNode(vals::Vector) -> MDTuple

Create a new tuple metadata node from the given operands.

Passing nothing as a value will result in a null operand.

source

Metadata <-> Value

LLVM.MetadataMethod
Metadata(val::Value)

Wrap the given value as metadata, for use in APIs that expect a LLVM.Metadata.

When the value is already metadata wrapped as a value, this will simply return the original metadata.

source
LLVM.ValueMethod
Value(md::Metadata)

Wrap the given metadata as a value, for use in APIs that expect a LLVM.Value.

When the metadata is already a value wrapped as metadata, this will simply return the original value.

source

Inspecting and attaching

LLVM.metadataMethod
metadata(inst::Instruction)
metadata(inst::GlobalObject)

Iterate over the metadata of the given instruction or global object.

These iterators are mutable, and implement setindex! and delete! to modify the metadata.

source
LLVM.NamedMDNodeType
NamedMDNode

A named metadata node, which is a collection of metadata nodes with a name.

source
LLVM.metadataMethod
metadata(mod)

Fetch the module-level named metadata. This can be inspected using a Dict-like interface. Mutation is different: There is no setindex! method, as named metadata is append-only. Instead, fetch the named metadata node using getindex, and push! to it.

source
LLVM.nameMethod
name(node::NamedMDNode)

Get the name of the given named metadata node.

source
LLVM.operandsMethod
operands(node::NamedMDNode)

Get the operands of the given named metadata node.

source
Base.push!Method
push!(node::NamedMDNode, val::MDNode)

Add a metadata node to the given named metadata node.

source

Debug information

LLVM.tagMethod
tag(node::DINode)

Get the DWARF tag of the given node, or 0 if none. Requires LLVM 17+.

source

Builder

LLVM.DIBuilderType
DIBuilder

A builder for constructing debug information metadata.

This object needs to be disposed of using dispose, which also finalizes the debug info. Call finalize! explicitly only if you need to use the finalized debug info (e.g. emit code) before disposing of the builder.

source
LLVM.DIBuilderMethod
DIBuilder(mod::Module; allow_unresolved::Bool=true)

Create a new debug info builder that emits metadata into mod.

When allow_unresolved is true (the default), the builder collects unresolved metadata nodes attached to the module so that cycles can be resolved during dispose. When false, the builder errors on unresolved nodes instead.

source
LLVM.disposeMethod
dispose(builder::DIBuilder)

Finalize the debug info and dispose of the builder. Finalization populates the compile unit's enum/retained-type/global/imported-entity/macro arrays, seals each subprogram's retained-nodes list, and resolves remaining cycles. If no compile unit was registered with the builder, or the debug info was already finalized through finalize!, finalization is skipped: DIBuilder::finalize is not idempotent (e.g., re-finalizing accesses already-deleted temporary macro files).

source
LLVM.finalize!Method
finalize!(builder::DIBuilder)

Resolve any unresolved metadata nodes and mark all compile units finalized. Called automatically by dispose; call explicitly only if the DI-enriched module must be consumed (e.g. for code emission) before the builder is disposed of. Skipped if no compile unit has been registered, or if the debug info has already been finalized.

source
LLVM.finalize_subprogram!Function
finalize_subprogram!(builder::DIBuilder, sp::DISubProgram)

Finalize a single subprogram early, sealing its retained-nodes list. After this, no more local variables can be added to sp. A no-op if sp was not tracked by builder (e.g. created elsewhere or already finalized).

Calling this is never required for correctness — dispose / finalize! finalize every tracked subprogram automatically. Use it only when streaming many subprograms through the builder and wanting to release their bookkeeping early.

source

Location information

LLVM.lineMethod
line(location::DILocation)

Get the line number of this debug location.

source
LLVM.columnFunction
column(location::DILocation)

Get the column number of this debug location.

source
LLVM.scopeMethod
scope(location::DILocation)

Get the local scope associated with this debug location.

source
LLVM.inlined_atFunction
inlined_at(location::DILocation)

Get the "inline at" location associated with this debug location.

source

Variables

LLVM.fileMethod
file(var::DIVariable)

Get the file of the given variable.

source
LLVM.scopeMethod
scope(var::DIVariable)

Get the scope of the given variable.

source
LLVM.lineMethod
line(var::DIVariable)

Get the line number of the given variable.

source

Scopes

LLVM.DIScopeType
DIScope

Abstract supertype for lexical scopes and types (which are also declaration contexts).

source
LLVM.fileMethod
file(scope::DIScope)

Get the metadata of the file associated with a given scope.

source
LLVM.nameMethod
name(scope::DIScope)

Get the name of the given scope.

source

File

LLVM.sourceFunction
source(file::DIFile)

Get the source of the given file, or nothing if the source is not available.

source
LLVM.file!Function
file!(builder::DIBuilder, filename::AbstractString, directory::AbstractString) -> DIFile

Create a new DIFile describing the given source file.

source

Lexical Block

LLVM.DILexicalBlockType
DILexicalBlock

A lexical block (a nested scope, typically a compound statement) in the source code.

source
LLVM.lexical_block!Function
lexical_block!(builder::DIBuilder, scope::DIScope, file::DIFile,
              line::Integer, column::Integer) -> DILexicalBlock

Create a new DILexicalBlock describing a nested source scope.

source
LLVM.lexical_block_file!Function
lexical_block_file!(builder::DIBuilder, scope::DIScope, file::DIFile,
                  discriminator::Integer=0) -> DILexicalBlockFile

Create a new DILexicalBlockFile for tracking source-file changes within a lexical scope.

source

Module

LLVM.DIModuleType
DIModule

A module in the source code (Clang modules / Fortran modules / Swift modules).

source
LLVM.dimodule!Function
dimodule!(builder::DIBuilder, parent_scope::DIScope, name::AbstractString;
          config_macros::AbstractString="", include_path::AbstractString="",
          api_notes_file::AbstractString="") -> DIModule

Create a new DIModule describing a module in the source code.

source

Namespace

LLVM.namespace!Function
namespace!(builder::DIBuilder, parent_scope::DIScope, name::AbstractString;
           export_symbols::Bool=false) -> DINamespace

Create a new DINamespace describing a namespace in the source code.

source

Type

Base.sizeofMethod
sizeof(typ::DIType)

Get the size in bits of the given type.

source
LLVM.offsetMethod
offset(typ::DIType)

Get the offset in bits of the given type.

source
LLVM.lineMethod
line(typ::DIType)

Get the line number of the given type.

source
LLVM.alignFunction
align(typ::DIType)

Get the alignment in bits of the given type.

source

Built-in factories for primitive types:

LLVM.basic_type!Function
basic_type!(builder::DIBuilder, name::AbstractString, size_in_bits::Integer,
           encoding::Integer; flags=API.LLVMDIFlagZero) -> DIBasicType

Create a new DIBasicType, such as an integer or floating-point type. encoding is a DW_ATE_* value (see the DWARF standard).

source
LLVM.unspecified_type!Function
unspecified_type!(builder::DIBuilder, name::AbstractString) -> DIBasicType

Create a new unspecified type (DW_TAG_unspecified_type), e.g. a C++ decltype(nullptr).

source
LLVM.nullptr_type!Function
nullptr_type!(builder::DIBuilder) -> DIBasicType

Create a new type representing a null pointer.

source

Derived types (pointers, qualifiers, members, inheritance, ...):

LLVM.pointer_type!Function
pointer_type!(builder::DIBuilder, pointee_type::DIType, size_in_bits::Integer;
             align_in_bits::Integer=0, address_space::Integer=0,
             name::AbstractString="") -> DIDerivedType

Create a new pointer type.

source
LLVM.reference_type!Function
reference_type!(builder::DIBuilder, tag::Integer, type::DIType) -> DIDerivedType

Create a new reference type (C++ T& / T&&), with the given DWARF tag (e.g. DW_TAG_reference_type or DW_TAG_rvalue_reference_type).

source
LLVM.lvalue_reference_type!Function
lvalue_reference_type!(builder::DIBuilder, type::DIType) -> DIDerivedType

Create a C++ T& reference type. Shorthand for reference_type!(builder, DW_TAG_reference_type, type).

source
LLVM.rvalue_reference_type!Function
rvalue_reference_type!(builder::DIBuilder, type::DIType) -> DIDerivedType

Create a C++ T&& rvalue-reference type. Shorthand for reference_type!(builder, DW_TAG_rvalue_reference_type, type).

source
LLVM.typedef_type!Function
typedef_type!(builder::DIBuilder, type::DIType, name::AbstractString,
             file::DIFile, line::Integer, scope::DIScope;
             align_in_bits::Integer=0) -> DIDerivedType

Create a new typedef type.

source
LLVM.qualified_type!Function
qualified_type!(builder::DIBuilder, tag::Integer, type::DIType) -> DIDerivedType

Create a new qualified type, such as const T (DW_TAG_const_type) or volatile T (DW_TAG_volatile_type). See also the named convenience wrappers const_type! and volatile_type!.

source
LLVM.const_type!Function
const_type!(builder::DIBuilder, type::DIType) -> DIDerivedType

Create a const-qualified type. Shorthand for qualified_type!(builder, DW_TAG_const_type, type).

source
LLVM.volatile_type!Function
volatile_type!(builder::DIBuilder, type::DIType) -> DIDerivedType

Create a volatile-qualified type. Shorthand for qualified_type!(builder, DW_TAG_volatile_type, type).

source
LLVM.artificial_type!Function
artificial_type!(builder::DIBuilder, type::DIType) -> DIType

Create a new artificial type (DI_FLAG_ARTIFICIAL), e.g. an implicit this. The concrete subtype matches the input (e.g. a DIBasicType stays a DIBasicType).

source
LLVM.object_pointer_type!Function
object_pointer_type!(builder::DIBuilder, type::DIType;
                    implicit::Bool=true) -> DIType

Create a new type identifying an object pointer (DI_FLAG_OBJECT_POINTER). The concrete subtype matches the input. On LLVM 20+ an implicit::Bool keyword is accepted: when true (the default, matching LLVM ≤ 19 behavior) the clone also sets DI_FLAG_ARTIFICIAL.

source
LLVM.member_type!Function
member_type!(builder::DIBuilder, scope::DIScope, name::AbstractString,
            file::DIFile, line::Integer, size_in_bits::Integer,
            align_in_bits::Integer, offset_in_bits::Integer,
            type::DIType; flags=API.LLVMDIFlagZero) -> DIDerivedType

Create a new member (field) of a composite type.

source
LLVM.bitfield_member_type!Function
bitfield_member_type!(builder::DIBuilder, scope::DIScope, name::AbstractString,
                    file::DIFile, line::Integer, size_in_bits::Integer,
                    offset_in_bits::Integer, storage_offset_in_bits::Integer,
                    type::DIType; flags=API.LLVMDIFlagZero) -> DIDerivedType

Create a new bit-field member of a composite type.

source
LLVM.static_member_type!Function
static_member_type!(builder::DIBuilder, scope::DIScope, name::AbstractString,
                  file::DIFile, line::Integer, type::DIType,
                  constant_val::Constant;
                  flags=API.LLVMDIFlagZero,
                  align_in_bits::Integer=0) -> DIDerivedType

Create a new static member of a composite type. constant_val is required: the underlying C entry point unconditionally cast<Constant>s it and crashes on null.

source
LLVM.member_pointer_type!Function
member_pointer_type!(builder::DIBuilder, pointee_type::DIType, class_type::DIType,
                   size_in_bits::Integer;
                   align_in_bits::Integer=0,
                   flags=API.LLVMDIFlagZero) -> DIDerivedType

Create a new pointer-to-member type for C++.

source
LLVM.inheritance!Function
inheritance!(builder::DIBuilder, derived::DIType, base::DIType,
             base_offset::Integer, vbptr_offset::Integer=0;
             flags=API.LLVMDIFlagZero) -> DIDerivedType

Create a new inheritance relationship from derived to base.

source

Composite types:

LLVM.struct_type!Function
struct_type!(builder::DIBuilder, scope::DIScope, name::AbstractString,
            file::DIFile, line::Integer, size_in_bits::Integer,
            align_in_bits::Integer, elements::Vector{<:Metadata};
            flags=API.LLVMDIFlagZero, derived_from=nothing,
            runtime_lang::Integer=0, vtable_holder=nothing,
            unique_id::AbstractString="") -> DICompositeType

Create a new struct type.

source
LLVM.union_type!Function
union_type!(builder::DIBuilder, scope::DIScope, name::AbstractString,
           file::DIFile, line::Integer, size_in_bits::Integer,
           align_in_bits::Integer, elements::Vector{<:Metadata};
           flags=API.LLVMDIFlagZero, runtime_lang::Integer=0,
           unique_id::AbstractString="") -> DICompositeType

Create a new union type.

source
LLVM.class_type!Function
class_type!(builder::DIBuilder, scope::DIScope, name::AbstractString,
           file::DIFile, line::Integer, size_in_bits::Integer,
           align_in_bits::Integer, offset_in_bits::Integer,
           elements::Vector{<:Metadata};
           flags=API.LLVMDIFlagZero, derived_from=nothing,
           vtable_holder=nothing, template_params=nothing,
           unique_id::AbstractString="") -> DICompositeType

Create a new C++ class type.

source
LLVM.array_type!Function
array_type!(builder::DIBuilder, size::Integer, align_in_bits::Integer,
           element_type::DIType, subscripts::Vector{<:Metadata}) -> DICompositeType

Create a new array type. Subscripts are typically built with get_or_create_subrange!.

source
LLVM.vector_type!Function
vector_type!(builder::DIBuilder, size::Integer, align_in_bits::Integer,
            element_type::DIType, subscripts::Vector{<:Metadata}) -> DICompositeType

Create a new vector type. Subscripts are typically built with get_or_create_subrange!.

source
LLVM.enumerator!Function
enumerator!(builder::DIBuilder, name::AbstractString, value::Integer;
            unsigned::Bool=false) -> DIEnumerator

Create a new enumerator for use inside an enumeration type.

source
LLVM.enumeration_type!Function
enumeration_type!(builder::DIBuilder, scope::DIScope, name::AbstractString,
                 file::DIFile, line::Integer, size_in_bits::Integer,
                 align_in_bits::Integer, elements::Vector{<:Metadata};
                 class_ty=nothing) -> DICompositeType

Create a new enumeration type. elements should be a vector of DIEnumerator metadata nodes.

source
LLVM.forward_decl!Function
forward_decl!(builder::DIBuilder, tag::Integer, name::AbstractString,
             scope::DIScope, file::DIFile, line::Integer;
             runtime_lang::Integer=0, size_in_bits::Integer=0,
             align_in_bits::Integer=0,
             unique_id::AbstractString="") -> DICompositeType

Create a new forward declaration to a composite type.

source
LLVM.replaceable_composite_type!Function
replaceable_composite_type!(builder::DIBuilder, tag::Integer,
                          name::AbstractString, scope::DIScope,
                          file::DIFile, line::Integer;
                          runtime_lang::Integer=0, size_in_bits::Integer=0,
                          align_in_bits::Integer=0,
                          flags=API.LLVMDIFlagZero,
                          unique_id::AbstractString="") -> DICompositeType

Create a new replaceable composite type forward declaration.

source
LLVM.get_or_create_subrange!Function
get_or_create_subrange!(builder::DIBuilder, lower_bound::Integer, count::Integer)

Get or create a subrange metadata node, describing one dimension of an array or vector type.

source

Subroutine types:

LLVM.subroutine_type!Function
subroutine_type!(builder::DIBuilder, file::DIFile,
                return_type::Union{DIType,Nothing},
                parameter_types::Vector{<:Metadata}=Metadata[];
                flags=API.LLVMDIFlagZero) -> DISubroutineType

Create a new subroutine type with the given return and parameter types. Pass nothing for return_type to describe a void-returning subroutine.

source

Array-node helpers:

LLVM.get_or_create_array!Function
get_or_create_array!(builder::DIBuilder, elements::Vector{<:Metadata})

Get or create a generic metadata array node, used for lists such as elements fields of composite types.

source
LLVM.get_or_create_type_array!Function
get_or_create_type_array!(builder::DIBuilder, types::Vector{<:Metadata})

Get or create a metadata node for a type array, used for e.g. template parameter lists.

source

Objective-C:

LLVM.objc_ivar!Function
objc_ivar!(builder::DIBuilder, name::AbstractString, file::DIFile,
          line::Integer, size_in_bits::Integer, align_in_bits::Integer,
          offset_in_bits::Integer, type::DIType, property_node::Metadata;
          flags=API.LLVMDIFlagZero) -> DIDerivedType

Create a new Objective-C instance variable.

source
LLVM.objc_property!Function
objc_property!(builder::DIBuilder, name::AbstractString, file::DIFile,
              line::Integer, getter::AbstractString, setter::AbstractString,
              attributes::Integer, type::DIType) -> DIObjCProperty

Create a new Objective-C @property descriptor.

source

Subprogram

LLVM.lineMethod
line(subprogram::DISubProgram)

Get the line number of the given subprogram.

source
LLVM.subprogram!Method
subprogram!(builder::DIBuilder, scope::DIScope, name::AbstractString,
            file::DIFile, line::Integer, type::DISubroutineType;
            linkage_name::AbstractString="", scope_line::Integer=line,
            is_local_to_unit::Bool=false, is_definition::Bool=true,
            flags=API.LLVMDIFlagZero,
            is_optimized::Bool=false) -> DISubProgram

Create a new DISubProgram describing a function. When linkage_name is empty, LLVM falls back to name. scope_line defaults to the function's line, which is the usual case.

source

Variables

Factories for local variables and parameters:

LLVM.auto_variable!Function
auto_variable!(builder::DIBuilder, scope::DIScope, name::AbstractString,
              file::DIFile, line::Integer, type::DIType;
              always_preserve::Bool=false, flags=API.LLVMDIFlagZero,
              align_in_bits::Integer=0) -> DILocalVariable

Create a new local variable descriptor (for a compiler-introduced automatic variable).

source
LLVM.parameter_variable!Function
parameter_variable!(builder::DIBuilder, scope::DIScope, name::AbstractString,
                   arg_no::Integer, file::DIFile, line::Integer, type::DIType;
                   always_preserve::Bool=false,
                   flags=API.LLVMDIFlagZero) -> DILocalVariable

Create a new descriptor for a function parameter variable. arg_no is the 1-based parameter index.

source

Expressions

LLVM.DIExpressionType
DIExpression

A DWARF expression that modifies how a variable's value is expressed at runtime.

source
LLVM.expression!Function
expression!(builder::DIBuilder,
            addr::Vector{UInt64}=UInt64[]) -> DIExpression

Create a new DIExpression from the given array of opcodes (encoding a DWARF expression such as DW_OP_plus_uconst).

source
LLVM.variableFunction
variable(gve::DIGlobalVariableExpression)

Get the debug info global variable associated with the given expression.

source
LLVM.expressionFunction
expression(gve::DIGlobalVariableExpression)

Get the debug info expression associated with the given global-variable pair.

source
LLVM.global_variable_expression!Function
global_variable_expression!(builder::DIBuilder, scope::DIScope,
                          name::AbstractString, linkage::AbstractString,
                          file::DIFile, line::Integer, type::DIType,
                          local_to_unit::Bool, expression::DIExpression;
                          declaration=nothing,
                          align_in_bits::Integer=0) -> DIGlobalVariableExpression

Create a new global variable descriptor paired with a DWARF expression.

source
LLVM.temp_global_variable_fwd_decl!Function
temp_global_variable_fwd_decl!(builder::DIBuilder, scope::DIScope,
                           name::AbstractString, linkage::AbstractString,
                           file::DIFile, line::Integer, type::DIType,
                           local_to_unit::Bool;
                           declaration=nothing,
                           align_in_bits::Integer=0) -> DIGlobalVariable

Create a new temporary forward declaration for a global variable.

source

Imported entities

LLVM.imported_module_from_namespace!Function
imported_module_from_namespace!(builder::DIBuilder, scope::DIScope,
                             ns::DINamespace, file::DIFile,
                             line::Integer) -> DIImportedEntity

Create a new DIImportedEntity from a namespace.

source
LLVM.imported_module_from_alias!Function
imported_module_from_alias!(builder::DIBuilder, scope::DIScope,
                         imported::DIImportedEntity, file::DIFile,
                         line::Integer,
                         elements::Vector{<:Metadata}=Metadata[]) -> DIImportedEntity

Create a new DIImportedEntity from an alias.

source
LLVM.imported_module_from_module!Function
imported_module_from_module!(builder::DIBuilder, scope::DIScope,
                          mod::DIModule, file::DIFile, line::Integer,
                          elements::Vector{<:Metadata}=Metadata[]) -> DIImportedEntity

Create a new DIImportedEntity from a module.

source
LLVM.imported_declaration!Function
imported_declaration!(builder::DIBuilder, scope::DIScope, decl::Metadata,
                    file::DIFile, line::Integer, name::AbstractString,
                    elements::Vector{<:Metadata}=Metadata[]) -> DIImportedEntity

Create a new DIImportedEntity from a declaration.

source

Macros

LLVM.DIMacroFileType
DIMacroFile

A collection of macro records corresponding to a single source file.

source
LLVM.macro!Function
macro!(builder::DIBuilder, parent_macrofile::Union{DIMacroFile,Nothing},
       line::Integer, record_type, name::AbstractString,
       value::AbstractString) -> DIMacro

Create a new DIMacro. record_type is a LLVMDWARFMacinfoRecordType value (e.g. LLVM.API.LLVMDWARFMacinfoRecordTypeDefine).

source
LLVM.temp_macro_file!Function
temp_macro_file!(builder::DIBuilder,
               parent_macrofile::Union{DIMacroFile,Nothing},
               line::Integer, file::DIFile) -> DIMacroFile

Create a new (temporary) DIMacroFile.

source

Instruction-level insertion

The declare_*! / value_*! methods return an Instruction on LLVM ≤ 18 (legacy llvm.dbg.* intrinsics) and a LLVM.DbgRecord on LLVM ≥ 19 (the new #dbg_* record format).

LLVM.declare_before!Function
declare_before!(builder::DIBuilder, storage::Value, var::DILocalVariable,
                expr::DIExpression, debugloc::DILocation,
                instr::Instruction)

Insert a new dbg-declare describing storage as the runtime location of var, immediately before instr. Returns a DbgRecord on LLVM ≥ 19, or the legacy llvm.dbg.declare call Instruction on LLVM < 19.

source
LLVM.declare_at_end!Function
declare_at_end!(builder::DIBuilder, storage::Value, var::DILocalVariable,
                expr::DIExpression, debugloc::DILocation,
                block::BasicBlock)

Insert a new dbg-declare at the end of block. Returns a DbgRecord on LLVM ≥ 19, or the legacy llvm.dbg.declare call Instruction on LLVM < 19.

source
LLVM.value_before!Function
value_before!(builder::DIBuilder, val::Value, var::DILocalVariable,
              expr::DIExpression, debugloc::DILocation,
              instr::Instruction)

Insert a new dbg-value describing val as the value of var, immediately before instr. Returns a DbgRecord on LLVM ≥ 19, or the legacy llvm.dbg.value call Instruction on LLVM < 19.

source
LLVM.value_at_end!Function
value_at_end!(builder::DIBuilder, val::Value, var::DILocalVariable,
              expr::DIExpression, debugloc::DILocation,
              block::BasicBlock)

Insert a new dbg-value at the end of block. Returns a DbgRecord on LLVM ≥ 19, or the legacy llvm.dbg.value call Instruction on LLVM < 19.

source
LLVM.debuglocationMethod
debuglocation(inst::Instruction) -> Union{DILocation,Nothing}

Get the debug location attached to the given instruction, or nothing.

source
LLVM.debuglocation!Method
debuglocation!(inst::Instruction, loc::DILocation)

Set the debug location of the given instruction.

source

Compile Unit

LLVM.compile_unit!Function
compile_unit!(builder::DIBuilder, lang, file::DIFile, producer::AbstractString;
             optimized::Bool=true, cmdline::AbstractString="",
             runtime_version::Integer=0,
             split_name::Union{AbstractString,Nothing}=nothing,
             emission_kind=API.LLVMDWARFEmissionFull,
             dwo_id::Integer=0,
             split_debug_inlining::Bool=true,
             debug_info_for_profiling::Bool=false,
             sysroot::AbstractString="", sdk::AbstractString="") -> DICompileUnit

Create a new DICompileUnit. lang is a LLVMDWARFSourceLanguage value (e.g. LLVM.API.LLVMDWARFSourceLanguageJulia). cmdline is a command-line string embedded verbatim in the emitted debug info.

source

Mutation helpers

LLVM.temporary_mdnodeFunction
temporary_mdnode(operands::Vector{<:Metadata}=Metadata[]) -> MDNode

Create a temporary metadata node in the task-local context with the given operands. Temporary nodes are useful for constructing cycles and must be either replaced via replace_uses! or disposed of via dispose_temporary.

source
LLVM.replace_uses!Method
replace_uses!(temp::Metadata, replacement::Metadata)

Replace all uses of temporary metadata temp with replacement, and dispose of temp. Method on the existing replace_uses! for Value.

source

Other

LLVM.debug_metadata_versionFunction
debug_metadata_version(mod::Module)

Get the debug info version number emitted in the given module, or 0 if none is attached.

source
LLVM.subprogramMethod
subprogram(func::Function) -> DISubProgram

Get the subprogram of the given function, or nothing if the function has no subprogram.

source
LLVM.subprogram!Function
subprogram!(builder::DIBuilder, scope::DIScope, name::AbstractString,
            file::DIFile, line::Integer, type::DISubroutineType;
            linkage_name::AbstractString="", scope_line::Integer=line,
            is_local_to_unit::Bool=false, is_definition::Bool=true,
            flags=API.LLVMDIFlagZero,
            is_optimized::Bool=false) -> DISubProgram

Create a new DISubProgram describing a function. When linkage_name is empty, LLVM falls back to name. scope_line defaults to the function's line, which is the usual case.

source
subprogram!(func::Function, sp::DISubProgram)

Set the subprogram of the given function.

source