CUMULATIVE_ARGS in hooks (Was: RFC: semi-automatic hookization)

Paolo Bonzini bonzini@gnu.org
Wed Nov 17 03:04:00 GMT 2010


On 11/16/2010 10:17 PM, Ian Lance Taylor wrote:
>>> I don't know how we want to get there, but it seems to me that the place
>>> we want to end up is with the target hooks defined to take an argument
>>> of type struct cumulative_args * (or a better name if we can think of
>>> one).
>>
>> Actually, this doesn't work, because then different target vectors have
>> different types.  You might get away with it now, but LTO on a multi-target
>> compiler would fail.
>
> Good point.
>
>> I think we should just
>> typedef void *cumulative_args_t;
>>
>> and use that for our hooks.
>
> Another area where we can do something much nicer when we move to C++.

This something could be something like target_i386::cumulative_args, 
implemented e.g. using the curiously recurring template pattern 
(http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern).

I think a multi-target executable would be just too ugly in C due to 
issues such as this.  I don't think it's worthwhile to sacrifice type 
safety now, so a struct cumulative_args is preferrable.

Paolo



More information about the Gcc mailing list