[LLVMdev] [RFC] Resurrecting the C back-end

Cameron Zwarich zwarich at apple.com
Mon Aug 27 23:50:45 PDT 2012


On Aug 27, 2012, at 11:26 PM, Philipp Klaus Krause <pkk at spth.de> wrote:

> The last point is what I meant by "have the C backend emit
> machine-independent code (i.e. C code that does not rely on
> implementation-defined behaviour)". And I do not see how
> implementation-defined behaviour included in LLVM-IR would prevent that.


Without even getting too interesting:

- If your original C program uses uintptr_t (even within the bounds allowed by the standard), that will get turned into some concrete integer type in LLVM IR. But that type might not be large enough to fit a pointer on your target, e.g. if your implementation of C uses fat pointers.

- LLVM assumes that all pointers have the same width (inside of the same address space), but C does not require this.

- LLVM assumes that null pointers are represented with a zero bit pattern, but C does not require this.

Cameron



More information about the llvm-dev mailing list