[pypy-dev] llvm and externs

Chris Lattner sabre at nondot.org
Thu Oct 27 18:39:43 CEST 2005


On Thu, 27 Oct 2005, Eric van Riet Paap wrote:
> On Thursday 27 October 2005 07:21, Chris Lattner wrote:
>> On Thu, 27 Oct 2005, Richard Emslie wrote:
>>> Ooops - sorry about the horrible subject in last mail (it's late)
>> Which externs do you need?  Are these for system prototypes or pypy
>> functions?
>
> With externs in this context we mean functions we need to call from the O.S.
> (libc). Plus a little wrapper code to make it compatible with Python.
> (Sometimes raise an exception instead of returning an errorcode, etc.)

Using the C front-end to parse C headers is a pretty big hammer for this 
problem.  In particular:

> Now listdir() uses opaque (dont know if you introduced this or someone 
> else) - and llvm doesnt have proper support for opaque types... yet. So 
> we cannot compile pypy right now.

I'm not sure is considered to be "proper support" for opaque types, but we 
certainly do support them.  I'm not sure what the prototype for listdir is 
supposed to be, but you should always be able to use something like this 
(assuming it takes a pointer to some structure type):

declare void %listdir(opaque*)

or:

declare void %listdir(sbyte*)

LLVM cares that it is a pointer, but as long as you're not directly 
accessing any of the members of the struct, it doesn't care what it is a 
pointer to.

-Chris

>>>> cc 'ing pypy-dev, since I cant get to #pypy these days.
>>>>
>>>> On Tue, 25 Oct 2005, Christian Tismer wrote:
>>>>> Richard Emslie wrote:
>>>>>> Did see ll_osdefs.h breaks llvm in horrible ways...
>>>>>
>>>>> Aaahrrrgggg!!!
>>>>>
>>>>> Why that at all?
>>>>> Just a brave part of the inclues, taken from CPython  ( *gulp* )
>>>>> how can this hurt so much ?
>>>>>
>>>> :-)  Yes arrrggghhhh!!  But no fault of yours - just that we use a
>>>>
>>>> (llvm) C compiler for externs.  If a local compiler is not available,
>>>> we go to a remote machine to generate llvm code.  So local includes are
>>>> not possible - hence in genllvm we manually include C files from
>>>> #include statements. :-(
>>>>
>>>> Now listdir() uses opaque (dont know if you introduced this or someone
>>>> else) - and llvm doesnt have proper support for opaque types... yet.
>>>> So we cannot compile pypy right now.
>>>>
>>>>>> will try to fix, but it is becoming more of a hassle trying to
>>>>>> maintain llvm backend when it is not really giving much back.
>>>>
>>>> Sorry for the negativeness.  It would be interesting however to have
>>>> the core developers opinion(s) about backends in general and whether it
>>>> is believed maintaining it (the llvm one) is a worthwhile goal.
>>>>
>>>>> Sorry about that.I tried to make my live easier when I had to port
>>>>> this listdir() mess, which does not fit winnows at all :-)
>>>>
>>>> No need to apologize - the include fix was minor and opaque types are
>>>> part of rpython and cannot be avoided. :-)
>>>>
>>>> Cheers & good nite,
>>>> Richard
>>>
>>> _______________________________________________
>>> pypy-dev at codespeak.net
>>> http://codespeak.net/mailman/listinfo/pypy-dev
>>
>> -Chris
> _______________________________________________
> pypy-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/pypy-dev
>

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the Pypy-dev mailing list