Difference between revisions of "LLVM"
m (→llvmpy) |
m |
||
Line 15: | Line 15: | ||
set of Python-contexts you can use to write C-like constructs in Python which generates llvmpy code directly. |
set of Python-contexts you can use to write C-like constructs in Python which generates llvmpy code directly. |
||
<br>Similar to llpython it allows you to build llvm IR without using the llvmpy interface directly. |
<br>Similar to llpython it allows you to build llvm IR without using the llvmpy interface directly. |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
==Numba== |
==Numba== |
||
Numba is a NumPy aware dynamic compiler for Python. It creates LLVM bit-code from Python syntax and then creates a wrapper around that bitcode to call from Python. |
Numba is a NumPy aware dynamic compiler for Python. It creates LLVM bit-code from Python syntax and then creates a wrapper around that bitcode to call from Python. |
||
Line 32: | Line 42: | ||
export('multc c16(c16, c16)'))(mult) |
export('multc c16(c16, c16)'))(mult) |
||
</source> |
</source> |
||
− | ==llpython== |
||
− | Part of llvmpy |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
− | |||
⚫ | |||
==Pyston== |
==Pyston== |
||
by Dropbox |
by Dropbox |
Revision as of 10:38, 20 May 2014
LLVM
with Python
llvmpy
virtualenv llvmpy.env
. llvmpy.env/bin/activate
git clone git@github.com:llvmpy/llvmpy.git llvmpy.git
cd llvmpy.git
git checkout 0.12.5
LLVM_CONFIG_PATH=/path/to/llvm-install/bin/llvm-config python setup.py install
cd ..
python -c "import llvm; llvm.test()"
llvm_cbuilder
set of Python-contexts you can use to write C-like constructs in Python which generates llvmpy code directly.
Similar to llpython it allows you to build llvm IR without using the llvmpy interface directly.
llpython
The primary goal of the llpython package is to provide a Python dialect/subset that maps directly to LLVM code.
LLPython differs from its originating LLVM translator, Numba, in the following aspects:
- LLPython code is not intended to work in Python if not translated and wrapped.
- The LLPython translator only uses LLVM types.
- LLPython is explicitly typed, and does not support type inference. LLPython does not support implicit casts, all casts must be explicit.
- LLPython supports code that directly calls the C API, the Python C API, and the llvm.core.Builder methods.
We developed LLPython with the initial goal of simplifying writing LLVM code.
TODO not clear yet from the doc how to use it...
Numba
Numba is a NumPy aware dynamic compiler for Python. It creates LLVM bit-code from Python syntax and then creates a wrapper around that bitcode to call from Python.
pycc allows users to compile Numba functions into a shared library. The user writes the functions, exports them and the compiler will import the module, collect the exported functions and compile them to a shared library. Below is an example:
from numba import *
def mult(a, b):
return a * b
export('mult f8(f8, f8)'))(mult)
export(['multf f4(f4, f4)', 'multi i4(i4, i4)'])(mult)
export('multc c16(c16, c16)'))(mult)
Pyston
by Dropbox
Not mature yet