Defines a bytecode based LLVM translator for llpython code.

class llpython.byte_translator.LLVMTranslator(llvm_module=None, *args, **kws)

Transformer responsible for visiting a set of bytecode flow trees, emitting LLVM code.

Unlike other translators in llpython, this incorporates the full transformation chain, starting with llpython.byte_flow.BytecodeFlowBuilder, then llpython.byte_control.ControlFlowBuilder, and then llpython.phi_injector.PhiInjector.

translate(function, llvm_type=None, llvm_function=None, env=None)

Translate a function to the given LLVM function type.

If no type is given, then assume the function is of LLVM type “void ()”.

The optional env parameter allows extension of the global environment.

llpython.byte_translator.llpython(lltype, llvm_module=None, **kws)

Decorator version of translate_function().

llpython.byte_translator.translate_function(func, lltype, llvm_module=None, **kws)

Given a function and an LLVM function type, emit LLVM code for that function using a new LLVMTranslator instance.

Previous topic


Next topic