[LLVMdev] Question about SPARC target status
Peter Shugalev
peter at shugalev.com
Tue Nov 11 18:24:28 PST 2008
Hi,
Chris Lattner wrote:
> Yes, not to mention stuff like:
>
> #ifdef __i386__
>
> or:
> case sizeof(foo):
>
> This is addressed here:
> http://llvm.org/docs/tutorial/LangImpl8.html#targetindep
>
> Note that this doesn't affect cross compilation: you just need to
> configure llvm-gcc as a proper cross compiler. This just means that
> llvm won't magically make your C code portable for you. Real portable
> languages don't suffer from these problems.
I'm not looking for magic, I'm just disappointed that sometimes LLVM
turns portable C/C++ code into non-portable one.
The workaround is not easy.
#define SIZE_OF(T) ((char *)((T*)0 + 1) - (char *)0))
works but it is not constant expression anymore.
"Lazy" calculation of sizeof expression would be great though I have to
admit it would introduce many complexities to the bytecode including
storing and calculation of arbitrary complex constant expressions.
Bytecode-level uintptr_t/intptr_t data types are needed too.
--
Best Regards
Peter Shugalev
More information about the llvm-dev
mailing list