[LLVMdev] LLVM IR is a compiler IR

Óscar Fuentes ofv at wanadoo.es
Tue Oct 4 17:48:43 PDT 2011

Dan Gohman <gohman at apple.com> writes:

Great post, Dan. Some comments follow.


>  * Target-specific ABI code. In order to interoperate with native
>    C ABIs, LLVM requires front-ends to emit target-specific IR.
>    Pretty much everyone around here has run into this.

There are places where compatibility with the native C ABI is taken too
far. For instance, time ago I noted that what the user sets through
Module::setDataLayout is simply ignored. LLVM uses the data layout
required by the native C ABI, which is hardcoded into LLVM's source
code. So I asked: pass the value setted by Module::setDataLayout to the
layers that are interested on it, as any user would expect. The response
I got was, in essence, "As you are not working on C/C++, I couldn't care
less about your language's requirements." So I have a two-line patch on
my LLVM local copy, which has the effect of making the IR code generated
by my compiler portable across Linux/x86 and Windows/x86 (although that
was not the reason I wanted the change.)

So it is true that LLVM IR has portability limitations, but not all of
them are intrinsic to the LLVM IR nature.


More information about the llvm-dev mailing list