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

Reid Spencer rspencer at reidspencer.com
Thu Nov 23 13:08:38 PST 2006


On Thu, 2006-11-23 at 21:09 +0100, Philipp Klaus Krause wrote:
> Reid Spencer schrieb:
> > It generates C99. Its portability is no better or worse than any other
> > backend.
> 
> Does that mean that I will have to configure llvm as a cross-compiler
> even when using the C backend?

LLVM doesn't need to be configured as a cross compiler. It can generate
code for a variety of platforms on any platform. What you do need to do
is configure your front end to be a cross compiler. Then it will
generate the correct LLVM input for that platform (and consequently LLVM
will generate code for that platform) regardless of the platform on
which either LLVM or your front end are running.

> I want to use LLVM to translate C++ into C and compile the resulting C
> code using sdcc.

I'm not familiar with that compiler, but it should be fine as long as it
can handle C99. Simply target llvm-gcc for platform you want to compile
for and the resulting code should be suitable for compilation by sdcc on
that platform.

> I already noticed some problems (resulting C code uses different data
> types than input).

Note that C and LLVM types are *not* the same things (despite the
similar names). We are in the process of making this abundantly clear.
The LLVM IR will soon use names like i8, i16, i32, and i64 (signless
integer quantities of specific sizes, regardless of platform).

> Philipp

Hope that helps, Phillip.

Reid.
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list