Initialization and finalization
You only need to call these functions once per process invocation.
- llvmlite.binding.initialize()
Deprecated. Initialize the LLVM core.
This function is deprecated and will raise a
RuntimeErrorwhen called. LLVM initialization is now handled automatically and no longer requires explicit initialization calls. Remove calls to this function and check for other behavioral changes that may have occurred due to LLVM updates.For code that needs to support both older and newer versions of llvmlite, you can use version-conditional initialization:
import llvmlite import llvmlite.binding as llvm # Check llvmlite version to determine if initialization is needed version = [int(p) for p in llvmlite.__version__.split('.')[:2]] if version < [0, 45]: # Older versions require explicit initialization llvm.initialize() # No initialization needed for version 0.45+
- llvmlite.binding.initialize_all_asmprinters()
Initialize all code generators. Must be called before generating any assembly or machine code via the
TargetMachine.emit_object()andTargetMachine.emit_assembly()methods.
- llvmlite.binding.initialize_native_target()
Initialize the native—host—target. Must be called once before doing any code generation.
- llvmlite.binding.initialize_native_asmprinter()
Initialize the native assembly printer.
- llvmlite.binding.initialize_native_asmparser()
Initialize the native assembly parser. Must be called for inline assembly to work.
- llvmlite.binding.shutdown()
Shut down the LLVM core.
- llvmlite.binding.llvm_version_info
A 3-integer tuple representing the LLVM version number.
EXAMPLE:
(3, 7, 1)Since LLVM is statically linked into the
llvmliteDLL, this is guaranteed to represent the true LLVM version in use.