[LLVMdev] Byte code portability (was Re: libstdc++ as bytecode, and compiling C++ to C)

Reid Spencer rspencer at reidspencer.com
Thu Nov 23 07:18:12 PST 2006


On Thu, 2006-11-23 at 16:51 +0200, Pertti Kellomäki wrote:
> Chris Lattner wrote:
> > Many aspects of the target compiler can leak through.
> 
> So if one wants to use the LLVM system as a cross compiler, one
> has to configure llvm-gcc as a cross compiler? Fair enough, I guess.

Yes.

> 
> > One trivial example is:
> > 
> > int X = sizeof(long);
> 
> So I assume this also means that while getelementptr insulates
> llvm byte code from the details of target specific address calculations,
> the target back end has to agree with gcc on how much space values
> of each data type consume.

They agree through the llvm IR. LLVM integer and floating point types
are fixed in size. The front end compiler must use the appropriate type
to get the size that it wants. The only difference might be in structure
layout as LLVM doesn't support alignment attributes in structures. 

Reid.




More information about the llvm-dev mailing list