[LLVMdev] Byte code portability (was Re: libstdc++ as bytecode, and compiling C++ to C)
Reid Spencer
rspencer at reidspencer.com
Fri Nov 24 13:02:39 PST 2006
On Fri, 2006-11-24 at 21:13 +0100, Philipp Klaus Krause wrote:
> Reid Spencer schrieb:
> Hmm the problem was a bit different. I just reproduced it.
>
> I used this input file:
>
> #include <stdint.h>
>
> uint32_t test(uint32_t t)
> {
> return(t + 42);
> }
>
> and got the following code:
>
> unsigned test(unsigned ltmp_0_1) {
> return (ltmp_0_1 + 42u);
> }
>
> unsigned is 16 bit on my target platform.
Sure, but what is it on the target that llvm-gcc is configured for? If
you're running llvm-gcc on a 32-bit platform without configuring it as a
cross-compiler then the above is correct. 32-bit unsigned is what is
expected on the target you're compiling for. This is exactly why its
important to configure llvm-gcc as a cross-compiler for your target. If
you do, I'm sure that you'll find it will generate:
unsigned long test (unsigned long ltmp_0_1) {
return (ltmp_0_1 + 42ul);
}
assuming that "unsigned long" is a 32-bit unsigned long on your target.
Reid.
>
> Philipp
> _______________________________________________
> 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