[cfe-commits] [PATCH] CodeGen support for transparent_union

Eli Friedman eli.friedman at gmail.com
Thu Aug 9 15:49:32 PDT 2012


On Wed, Aug 8, 2012 at 11:52 PM, Stefan Kristiansson
<stefan.kristiansson at saunalahti.fi> wrote:
> Ping?

Quick review:

The changes to lib/CodeGen/CodeGenFunction.h and
lib/CodeGen/CodeGenTypes.cpp don't make sense; transparent_union
doesn't affect the representation of values of the given type, just
the calling convention.  What issue are you trying to fix with those
changes?

getFirstFieldInTransparentUnion is ugly, but transparent_union is
really an ABI thing, and there isn't any obvious alternative place to
handle that.

(BTW, you don't have to wait a whole month to send a ping; a few days
is usually appropriate.)

-Eli

> On Mon, Jul 9, 2012 at 6:28 AM, Stefan Kristiansson
> <stefan.kristiansson at saunalahti.fi> wrote:
>> Hi,
>>
>> This is a follow-up to the message I sent to cfe-dev about
>> unexpected behaviour on transparent unions [1].
>>
>> As I mentioned there, currently when unions marked with the transparent_union
>> attribute are used as function arguments, the declared function gets called
>> with the union instead of the calling convention of the first field in
>> the transparent union as is required by the description [2].
>>
>> Looking at the commit log, most of the current implementation of the
>> transparent_union attribute support origins from r70419, which actually
>> mentions the lack of proper CodeGen support [3].
>>
>> Attached is a patch that tries to improve the situation by converting the
>> type to the first field of the union, but there are a couple of things I am
>> not completely satisfied with, so feedback on this patch is most welcome.
>> The thing that bugs me most is the conversion in classifyArgument in
>> lib/CodeGen/TargetInfo.cpp. Since this is ABI specific, every ABI
>> has to do the conversion, which seems sub-optimal to me.
>>
>> Stefan
>>
>> [1] http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-July/022672.html
>> [2] http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html
>> [3] http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090427/016496.html
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list