[cfe-dev] Passing StructType arguments directly

Tom Prince tom.prince at ualberta.net
Tue Sep 20 00:49:13 PDT 2011


On Mon, 19 Sep 2011 22:34:35 -0700, David Meyer <pdox at google.com> wrote:
> Devang,
> 
> The immediate benefits:
> 
> * Front-ends would no longer need to implement the ABIs for each
> target architecture to get full ABI compliance. They would generate
> high-level bitcode, and the ABI lowering knowledge would be contained
> in LLVM.
> 
> * Bitcode-level ABI compatibility between different front-ends (for
> LTO), since there would be a unique lowering from C signatures to
> high-level bitcode.
> 
> * The high-level format could become the wire format for portable
> applications (e.g. PNaCl)

Let me just mention that even though C code compiled against system
headers contains target-specific information that couldn't be captured
in this high-level bitcode format doesn't make it useless.

Even if the types in function signature are target dependent, being
able to specify the function in terms of those types, rather than the
ABI represantation of those types is a win for the front-end writer.

The example typically given is that C complexes have special rules for
passing them around. But a language implementor doesn't want to know how
exactly to represent the ABI requirements of all the platforms they want
to target to LLVM.

In code that doesn't handle complexes, if LLVM was aware of all the
ABI details, all the lots of code would need that is target dependent
is the size of various integer types. (This is assuming the high-level
format abstracted structure packing, arguments and return values).

  Tom



More information about the cfe-dev mailing list