A lightweight LLVM python binding for writing JIT compilers
Python C++ Shell Batchfile LLVM CMake C
sklam Merge pull request #365 from alendit/type_printing
Add printing to the bound llvm type
Latest commit c6ab1ea Jul 30, 2018
Permalink
Failed to load latest commit information.
buildscripts/incremental This moves llvmlite to use LLVM 6.0.0 as its backend. Mar 23, 2018
conda-recipes Fix up broken patch selector Jul 6, 2018
docs Merge pull request #365 from alendit/type_printing Jul 30, 2018
examples Update notebook Aug 15, 2016
ffi Add information about being a pointer, pointee type and the name to t… Jul 30, 2018
llvmlite Add documentation to TypeRef Jul 30, 2018
.codeclimate.yml More tweaks May 2, 2016
.coveragerc Codecov tweaks Mar 9, 2016
.gitattributes Add versioneer Nov 13, 2014
.gitignore Add codecov integration Mar 9, 2016
.landscape.yml Reduce strictness level May 2, 2016
.scrutinizer.yml Exclude tests too Mar 9, 2016
.travis.yml fix whitespace Jul 17, 2018
AUTHORS Add myself to AUTHORS Mar 24, 2017
CHANGE_LOG Add further update to change log. Jul 6, 2018
LICENSE Add a setup.py and a LICENSE, and move the shared library file into l… Oct 23, 2014
MANIFEST.in MAINT: ensure no CMakeCache.txt file is included in sdist. Mar 9, 2016
README.rst This moves llvmlite to use LLVM 6.0.0 as its backend. Mar 23, 2018
appveyor.yml Fix Appveyor env vars Jul 27, 2016
bench.py Update example references to .get_pointer_to_global() Jul 22, 2015
codecov.yml Add comment to top of file May 2, 2016
requirements.txt add python version requirments Feb 24, 2017
run_coverage.py Codecov tweaks Mar 9, 2016
runtests.py gep issue test Jun 26, 2017
setup.py Add long description from readme Jul 5, 2018
versioneer.py Update versioneer for PEP 440 version strings Apr 28, 2015

README.rst

llvmlite

Travis CI Code Climate Coveralls.io Readthedocs.io

A lightweight LLVM python binding for writing JIT compilers

The old llvmpy binding exposes a lot of LLVM APIs but the mapping of C++-style memory management to Python is error prone. Numba and many JIT compilers do not need a full LLVM API. Only the IR builder, optimizer, and JIT compiler APIs are necessary.

llvmlite is a project originally tailored for Numba's needs, using the following approach:

  • A small C wrapper around the parts of the LLVM C++ API we need that are not already exposed by the LLVM C API.
  • A ctypes Python wrapper around the C API.
  • A pure Python implementation of the subset of the LLVM IR builder that we need for Numba.

Key Benefits

  • The IR builder is pure Python code and decoupled from LLVM's frequently-changing C++ APIs.
  • Materializing a LLVM module calls LLVM's IR parser which provides better error messages than step-by-step IR building through the C++ API (no more segfaults or process aborts).
  • Most of llvmlite uses the LLVM C API which is small but very stable (low maintenance when changing LLVM version).
  • The binding is not a Python C-extension, but a plain DLL accessed using ctypes (no need to wrestle with Python's compiler requirements and C++ 11 compatibility).
  • The Python binding layer has sane memory management.
  • llvmlite is quite faster than llvmpy's thanks to a much simpler architeture (the Numba test suite is twice faster than it was).

llvmpy Compatibility Layer

The llvmlite.llvmpy namespace provides a minimal llvmpy compatibility layer.

Compatibility

llvmlite works with Python 2.7 and Python 3.4 or greater.

As of version 0.23.0, llvmlite requires LLVM 6.0. It does not support earlier or later versions of LLVM.

Historical compatibility table:

llvmlite versions compatible LLVM versions
0.23.0 - ... 6.0.x
0.21.0 - 0.22.0 5.0.x
0.17.0 - 0.20.0 4.0.x
0.16.0 - 0.17.0 3.9.x
0.13.0 - 0.15.0 3.8.x
0.9.0 - 0.12.1 3.7.x
0.6.0 - 0.8.0 3.6.x
0.1.0 - 0.5.1 3.5.x

Documentation

You'll find the documentation at http://llvmlite.pydata.org

Pre-built binaries

We recommend you use the binaries provided by the Numba team for the Conda package manager. You can find them in Numba's anaconda.org channel. For example:

$ conda install --channel=numba llvmlite

(or, simply, the official llvmlite package provided in the Anaconda distribution)

Other build methods

If you don't want to use our pre-built packages, you can compile and install llvmlite yourself. The documentation will teach you how: http://llvmlite.pydata.org/en/latest/install/index.html