[pypy-dev] llvm backend
Eric van Riet Paap
eric at vanrietpaap.nl
Wed May 24 10:02:30 CEST 2006
llvm-gcc is used to compile the external function C code (that
genllvm shares with genc) to a .ll file.
The code in llvm/demo does not seem to work at the moment, sorry for
that :( It looks like a circular dependency issue.
You assumption about running the files in ..../demo with regular
python is correct, however the run.py is respronsible for the
invokation of genc/genllvm in this case so you would have to do
something like: "python bpnn.py".
About your other mail about genllvm:
We indeed explored the usage of llvm's jit feature with
ExecutionEngine.ParseAssemblyString but the use of this is currently
limited to pypy/jit/codegen/llvm , where genllvm generates .ll code
that gets added to the llvm jit with the execution engine.
The steps the genllvm follows are:
- (when necessary) create a .ll file out of genc's external function
c code (one day to be replaced by (r)ctypes code)
- generate and attach our source file
- run llvm-as to convert the .ll to a .bc file
- run opt to optimize with llvm's transformation
- generate (a) assembly with llvm's native (x86) backend or (b) c
code again with llvm's c backend
- in case of b we run this code through gcc to further (profile
based) optimize and create the final executable.
I can image this information is a bit to dense so if you have any
more questions please ask them here. It's good for us to know what
people require for getting a better overview.
On May 24, 2006, at 6:02 AM, Simon Burton wrote:
> I'm exploring the llvm backend of pypy. Does it work without llvm-
> gcc ?
> I tried the example at doc/getting-started.html and it seems to first
> compile to c code then invoke llvm-gcc.
>>>> f = t.compile_llvm()
> (calls to llvm-gcc)
> But I'm also looking at the source for the llvm translator and
> there is
> code there for generating llva directly.
> Now I'm trying to run the demos in pypy/translator/llvm/demo.
> I assume I can use my regular python to run these.. somehow..
> $ python run.py
> Traceback (most recent call last):
> File "/mnt/hda9/simonb/local/pypy-svn/pypy/annotation/
> bookkeeper.py", line 16, in ?
> from pypy.annotation.listdef import ListDef, MOST_GENERAL_LISTDEF
> ImportError: cannot import name ListDef
> Simon Burton, B.Sc.
> Licensed PO Box 8066
> ANU Canberra 2601
> Ph. 61 02 6249 6940
> pypy-dev at codespeak.net
More information about the Pypy-dev