[pypy-dev] python & llvm

Simon Burton simon at arrowtheory.com
Fri Oct 28 02:59:56 CEST 2005


I'd like to use llvm from python to generate dynamically:

1) llvm functions from python expressions, eg. an "apply" operation on a c-array of floats
2) callback functions
3) calls to an external dynamic loaded c-library

I've looked at the llvm python wrappers
but the size of the .so module is just too massive (120Mb).
However, I don't think it is actually necessary for what I want to do,
as I can just generate llvm code and send that to the llvm compiler (at runtime).

This is what the pypy guys do. They mentioned maybe using the llvm-API, what for ?
All that jazz is for people writing optimizing compilers, no ? Wouldn't it make
more sense to do all that biz on the python level ?

I did a preliminary test of calling a trivial c-function (in a dynamic lib) from llvm, by
hardcoding the function address, and it seemed to work ok.

So my main question is: am I on the right path; is this a reasonably cross-platform strategy ?

Also i wanted to post to the pypy developers: there seems to be some
mutual gravity here. Where I work we do heavy duty
numeric processing with python (machine learning) [1]. Maybe I will get a
chance to work on/with/steal from, pypy. (The guys here are absolutely obsessed with

I just found out that the python AST branch
has been merged, so i'll be investigating this aswell.

bye for now,


[1] https://lineal.developer.nicta.com.au/lineal

Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Ph. 61 02 6249 6940

More information about the Pypy-dev mailing list