[LLVMdev] Python bindings for LLVM API

"Jarno Seppänen" js.nospam at wolke7.net
Thu Feb 24 22:36:16 PST 2005


Hi,

Vikram wrote:
> This looks like it could be very valuable - thanks for making it  
> available.  Just out of curiosity, do you have any specific uses in  
> mind for which you created these bindings?

Well, obviously the Python interface can be used to experiment with the
JITter in Python.  I was thinking that you could even write passes in Python
someday -- I had some success with hello_pass.py (also included).

As to the motivation for writing the bindings, I simply chose that as a
means to teach myself about the LLVM API and also about Boost.Python. 
However, I noticed that this is no gentle learning approach since the API
must be understood quite thoroughly in order to be able to create Python
bindings that don't crash due to memory ownership problems.  Fortunately
Boost.Python allows sophisticated annotation of ownership policies on a
function-by-function basis.

Cheers,
Jarno

> On Feb 23, 2005, at 5:21 PM, Jarno Seppänen wrote:
> 
> > Hi,
> >
> > I would like to share my experimental LLVM API Python bindings with  
> > the LLVM
> > enthusiasts.  I have created Boost.Python wrappers largely for the  
> > VMCore
> > interface and other selected interfaces (e.g. ExecutionEngine).  The
> > bindings provide direct runtime access to the LLVM bytecode and JIT
> > execution features from Python.
> >
> > The bindings are complete enough so that one can e.g. run the  
> > Fibonacci JIT
> > demo in Python (see fibonacci.py in the package).  Other than this, the
> > bindings have seen very little testing: caveat emptor!
> >
> > Quick start:
> > - make sure you have Python and Boost.Python installed
> > - extract Python.tgz (attached) into $LLVM/lib/Python
> > - cd $LLVM/lib/Python
> > - make
> > - export PYTHONPATH=$PYTHONPATH:$LLVM/Debug/bin
> > - python fibonacci.py
> >
> > More details are provided in the README.txt within Python.tgz.
> >
> > BR, Jarno
> >
> > --  
> > Lassen Sie Ihren Gedanken freien Lauf... z.B. per FreeSMS
> > GMX bietet bis zu 100 FreeSMS/Monat:  
> > http://www.gmx.net/de/go/ 
> > mail<Python.tgz>_______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
> 
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
> 

-- 
DSL Komplett von GMX +++ Supergünstig und stressfrei einsteigen!
AKTION "Kein Einrichtungspreis" nutzen: http://www.gmx.net/de/go/dsl




More information about the llvm-dev mailing list