[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-dev
Subject:    Re: [LLVMdev] Status of Python bindings?
From:       Eric van Riet Paap <eric () vanrietpaap ! nl>
Date:       2006-04-12 16:23:01
Message-ID: C1E8C195-96F3-4661-81FB-B32A15179DCC () vanrietpaap ! nl
[Download RAW message or body]

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



On Apr 12, 2006, at 3:52 PM, Pertti Kellomäki wrote:

> 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?
> -- 
> Pertti
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev@cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


[Attachment #3 (unknown)]

<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: \
after-white-space; ">Hi,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>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.</DIV><DIV><BR \
class="khtml-block-placeholder"></DIV><DIV>I asked Jarno if I could redistribute his \
code and he was positive about that so I will mail you the zip file \
privately.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>There is another \
thing happening in this area. I am working on the LLVM backend for the PyPy project \
(see: <A href="http://codespeak.net/pypy">http://codespeak.net/pypy</A> ) . 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.</DIV><DIV><BR \
class="khtml-block-placeholder"></DIV><DIV>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.</DIV><DIV><BR \
class="khtml-block-placeholder"></DIV><DIV>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 <FONT \
class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: \
12px;"><A href="http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/">http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/</A></SPAN></FONT></DIV><DIV><FONT \
class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: \
12px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV><FONT \
class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: \
12px;">have fun!</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" \
size="3"><SPAN class="Apple-style-span" style="font-size: \
12px;">Eric</SPAN></FONT></DIV><DIV><BR \
class="khtml-block-placeholder"></DIV><DIV><BR \
class="khtml-block-placeholder"></DIV><DIV><BR><DIV><DIV>On Apr 12, 2006, at 3:52 PM, \
Pertti Kellomäki wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE \
type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; \
margin-left: 0px; ">Hello all,</DIV><DIV style="margin-top: 0px; margin-right: 0px; \
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I \
am involved in a compiler project for Transport</DIV><DIV style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Triggered Architectures \
(think VLIW and you are</DIV><DIV style="margin-top: 0px; margin-right: 0px; \
margin-bottom: 0px; margin-left: 0px; ">pretty close), and we are considering using \
LLVM.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; \
margin-left: 0px; ">Browsing the list archives, I noticed an announcement</DIV><DIV \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">of \
Python bindings for LLVM 1.5. Does anyone know the</DIV><DIV style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">current status of the \
bindings?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; \
margin-left: 0px; ">--<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
">Pertti</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; \
margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
">_______________________________________________</DIV><DIV style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">LLVM Developers mailing \
list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; \
margin-left: 0px; "><A href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</A> \
<SPAN class="Apple-converted-space">        </SPAN><A \
href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</A></DIV><DIV \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A \
href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</A></DIV> \
</BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic