[cfe-dev] Passing StructType arguments directly

David Meyer pdox at google.com
Mon Sep 19 00:36:44 PDT 2011


John,

>
> byval is required for correct execution of bitcode even when prototypes
> match, and zext/sext are important for correctness under "compatible"
> prototypes.  LLVM calls do not seem to incorporate C's undefined
> behavior rules about calling something with the wrong prototype,
> which is good, because the various C/C++ frontends do not always
> agree about how to lower a C prototype into IR.

byval.. because of the hidden copy?

Now that you mention it, enforcing prototypes for PNaCl might be a
good idea, since the behavior is not guaranteed to be portable.

>
>> X86-64's ABI is daunting, but I'm not convinced it is impossible to
>> lower this correctly given a few tweaks to the LLVM type system. (for
>> example, by adding union and complex types).
>
> See, this is exactly what I'm worried about.  I don't want to take
> patches that add complexity to clang based on an untested hypothesis
> that they'll be useful if you subsequently add an unknown amount of
> complexity to LLVM.  That's particularly true when you haven't
> actually validated that those LLVM changes will be welcome.

I intend to validate any major changes before they are made.

In either case, PNaCl will definitely be using direct struct passing,
whether or not we can make the result match the platform ABI, so
there's no controversy over the code written so far.

- pdox




More information about the cfe-dev mailing list