[pypy-dev] RE: LLVM backend

Armin Rigo arigo at tunes.org
Fri Feb 18 19:18:48 CET 2005


Hi Chris,

On Thu, Feb 17, 2005 at 10:50:12AM -0600, Chris Lattner wrote:
> So let me see if I understand correctly: you're writing the code you want 
> in C, compiling it with the LLVM C compiler, and using void*'s.  This 
> means you get things like "[100 x sbyte*]" instead of "[100 x 
> dictionary*]" as you would like.  To get back the correct type, you're 
> having the compiler "copy and paste" this code, inserting the correct 
> types as appropriate.
> 
> To me, I don't think it's worth doing this.  Instead, why not just compile 
> these function to LLVM bytecode and link them into the program as you need 
> them, inserting cases to/from sbyte* as appropriate?

At some point, I can imagine that we will need a wider choice than just "a
pointer".  For example, an array of integers would hold "int" instead of a
pointer.  I guess you can cast between ints and pointers, but that's only the
start of the trouble.  An array of tuples (int, int) would ideally be stored
as an array of struct { int a,b; }, and you can't fit such a struct into a
single void*. Conversely, an array of void* is wasteful to implement strings
as an array of characters...


Armin



More information about the Pypy-dev mailing list