Code generation
Targets
LLVM.Target
— TypeTarget
A structure exposing target-specific information.
LLVM.name
— Methodname(target::Target)
Get the name of the given target.
LLVM.description
— Methoddescription(target::Target)
Get a short description of the given target.
LLVM.hasjit
— Methodhasjit(target::Target)
Check if this targets supports the just-in-time compilation.
LLVM.hastargetmachine
— Methodhastargetmachine(target::Target)
Check if this target supports code generation.
LLVM.hasasmparser
— Methodhasasmparser(target::Target)
Check if this target supports assembly parsing.
LLVM.targets
— Functiontargets()
Get an iterator over the available targets.
Target machines
LLVM.TargetMachine
— TypeTargetMachine
Primary interface to the complete machine description for the target machine.
All target-specific information should be accessible through this interface.
LLVM.dispose
— Methoddispose(tm::TargetMachine)
Dispose of the given target machine.
LLVM.target
— Methodtarget(tm::TargetMachine)
Get the target of the given target machine.
LLVM.triple
— Methodtriple(tm::TargetMachine)
Get the triple of the given target machine.
LLVM.triple
— Methodtriple()
Get the default target triple.
LLVM.normalize
— Methodnormalize(triple::String)
Normalize the given target triple.
LLVM.cpu
— Methodcpu(tm::TargetMachine)
Get the CPU of the given target machine.
LLVM.features
— Methodfeatures(tm::TargetMachine)
Get the feature string of the given target machine.
LLVM.asm_verbosity!
— Functionasm_verbosity!(tm::TargetMachine, verbose::Bool)
Set the verbosity of the target machine's assembly output.
LLVM.emit
— Functionemit(tm::TargetMachine, mod::Module, filetype::LLVMCodeGenFileType) -> UInt8[]
Generate code for the given module using the target machine, returning the binary data. If assembly code was requested, the binary data can be converted back using String
.
emit(tm::TargetMachine, mod::Module, filetype::LLVMCodeGenFileType, path::String)
Generate code for the given module using the target machine, writing it to the given file.
LLVM.add_transform_info!
— Functionadd_transform_info!(pm::PassManager, [tm::TargetMachine])
Add target-specific analysis passes to the given pass manager.
LLVM.add_library_info!
— Functionadd_library_info!(pm::PassManager, triple::String)
Add target-specific library information to the given pass manager.
LLVM.JITTargetMachine
— FunctionJITTargetMachine(; triple=LLVM.triple(), cpu="", features="",
optlevel=API.LLVMCodeGenLevelDefault)
Create a target machine suitable for JIT compilation with the ORC JIT.
Data layout
LLVM.DataLayout
— TypeDataLayout
A parsed version of the target data layout string in and methods for querying it.
The target data layout string is specified by the target - a frontend generating LLVM IR is required to generate the right target data for the target being codegen'd to.
LLVM.dispose
— Methoddispose(data::DataLayout)
Dispose of the given target data layout.
LLVM.byteorder
— Functionbyteorder(data::DataLayout)
Get the byte order of the target data layout.
LLVM.pointersize
— Functionpointersize(data::DataLayout, [addrspace::Integer])
Get the pointer size of the target data layout.
LLVM.intptr
— Functionintptr(data::DataLayout, [addrspace::Integer])
Get the integer type that is the same size as a pointer for the target data layout.
Base.sizeof
— Methodsizeof(data::DataLayout, typ::LLVMType)
Get the size of the given type in bytes for the target data layout.
LLVM.storage_size
— Functionstorage_size(data::DataLayout, typ::LLVMType)
Get the storage size of the given type in bytes for the target data layout.
LLVM.abi_size
— Functionabi_size(data::DataLayout, typ::LLVMType)
Get the ABI size of the given type in bytes for the target data layout.
LLVM.abi_alignment
— Functionabi_alignment(data::DataLayout, typ::LLVMType)
Get the ABI alignment of the given type in bytes for the target data layout.
LLVM.frame_alignment
— Functionframe_alignment(data::DataLayout, typ::LLVMType)
Get the call frame alignment of the given type in bytes for the target data layout.
LLVM.preferred_alignment
— Functionpreferred_alignment(data::DataLayout, typ::LLVMType)
preferred_alignment(data::DataLayout, var::GlobalVariable)
Get the preferred alignment of the given type or global variable in bytes for the target data layout.
LLVM.element_at
— Functionelement_at(data::DataLayout, typ::StructType, offset::Integer)
Get the element at the given offset in a struct type for the target data layout.
See also: offsetof
.
LLVM.offsetof
— Functionoffsetof(data::DataLayout, typ::StructType, element::Integer)
Get the offset of the given element in a struct type for the target data layout.
See also: element_at
.