Status of Python bindings?

Hello all,

I am involved in a compiler project for Transport
Triggered Architectures (think VLIW and you are
pretty close), and we are considering using LLVM.
Browsing the list archives, I noticed an announcement
of Python bindings for LLVM 1.5. Does anyone know the
current status of the bindings?

Hi,

The person that developed the bindings is Jarno Seppänen , he sent me the code a few weeks ago. They were build with Boost.Python. The latest version was for LLVM 1.6 and the bindings seem to be unmaintained at the moment. From what I could tell they are very clean and probably easy to maintain/update to LLVM 1.7. From what I could tell from the email archive they were not far from being ‘integrated’ in the LLVM codebase. I have no idea why that never happened. (probably just because it never happened). It would be nice if someone (you?) could adopt his code.

I asked Jarno if I could redistribute his code and he was positive about that so I will mail you the zip file privately.

There is another thing happening in this area. I am working on the LLVM backend for the PyPy project (see: http://codespeak.net/pypy ) . For this I also want python bindings. However they need to be bindings for a C library so Python’s ctypes ffi library can handle them. LLVM currently is a C++ only library, so I am writing a tool to be able to specify the (LLVM) class layout in a boost-like way. The tools will then generate the C API and ctypes compatible bindings. (I was thinking of writing a ctypes backend for SWIG but that was one more codebase and my brain wouldn’t handle that). It would probably be straightforward to generate a SWIG interface file (llvm.i) with my tool. This would (in a rather indirect way) create binding for many languages.

Please note that at this time I am note sure if I will create bindings for just what I need for PyPy or if I will try to support most of the C++ API.

If you want some Python LLVM bindings to play with today I would suggest you have a look at what I created ‘by hand’ (to get a feeling of the issues involved) in the llvmcapi and pyllvm subdirectories of http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/

have fun!
Eric

Eric van Riet Paap wrote:

From what I could tell from the email archive they were not far from being 'integrated' in the LLVM codebase. I have no idea why that never happened. (probably just because it never happened). It would be nice if someone (you?) could adopt his code.

It very much looks like it would be in my interests to get
the bindings integrated in the codebase. So if we decide to
proceed with LLVM, I would be happy to do it. Since the 1.7
release seems to imminent, it would probably make sense to
update the bindings for it.

I asked Jarno if I could redistribute his code and he was positive about that so I will mail you the zip file privately.

Got it, thanks!