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

Philipp Klaus Krause pkk at spth.de
Fri Nov 24 12:13:25 PST 2006


Reid Spencer schrieb:
> Hi Philipp,
> 
> On Fri, 2006-11-24 at 20:09 +0100, Philipp Klaus Krause wrote:
>> Reid Spencer schrieb:
>>
>>> 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).
>> I had explicitly specified the size in the input code using a uint32_t
>> type, the resulting C code used short, which is smaller on my target
>> platform.
> 
> One would think that it should result in a 32-bit unsigned type but its
> hard to say without something concrete. Can you supply a small,
> pre-processed example of some code that results in a CBE short for an
> input C/C++ uint32_t ?

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.

Philipp



More information about the llvm-dev mailing list