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

2010-11-17 Thread Joern Rennecke
Quoting Nathan Froyd : On Tue, Nov 16, 2010 at 10:22:00PM -0500, Joern Rennecke wrote: ... Does that mean you acknowledge that we shouldn't have CUMULATIVE_ARGS taking hooks in the global target vector? Maybe? I think the methods discussed in this thread would be better for when we do move

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

2010-11-17 Thread Nathan Froyd
On Tue, Nov 16, 2010 at 10:22:00PM -0500, Joern Rennecke wrote: > Quoting Nathan Froyd : > >I am admittedly a C++ newbie; the first thing I thought of was: > > > >class gcc::cumulative_args { > > virtual void advance (...) = 0; > > virtual rtx arg (...) = 0; > > virtual rtx incoming_arg (...) {

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

2010-11-16 Thread Joern Rennecke
Quoting Ian Lance Taylor : The scheme that Paolo describes avoids virtual functions. But for this usage I personally would prefer virtual functions, since there is no efficiency cost compared to a target hook. Well, actually, there is: you first fetch the object pointer, then you find the vta

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

2010-11-16 Thread Ian Lance Taylor
Nathan Froyd writes: > On Wed, Nov 17, 2010 at 03:40:39AM +0100, Paolo Bonzini wrote: >> True, but you can hide that cast in a base class. For example you >> can use a hierarchy >> >> Target // abstract base >> TargetImplBase // provides strong typing >>

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

2010-11-16 Thread Joern Rennecke
Quoting Nathan Froyd : I am admittedly a C++ newbie; the first thing I thought of was: class gcc::cumulative_args { virtual void advance (...) = 0; virtual rtx arg (...) = 0; virtual rtx incoming_arg (...) { return this->arg (...); }; virtual int arg_partial_bytes (...) = 0; // ...and

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

2010-11-16 Thread Nathan Froyd
On Wed, Nov 17, 2010 at 03:40:39AM +0100, Paolo Bonzini wrote: > True, but you can hide that cast in a base class. For example you > can use a hierarchy > > Target // abstract base > TargetImplBase // provides strong typing > TargetI386

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

2010-11-16 Thread Paolo Bonzini
On 11/17/2010 03:10 AM, Ian Lance Taylor wrote: Joern Rennecke writes: I don't see how going to a struct cumulative_args gets us closer to a viable solution for a multi-target executable, even if you threw in C++. Having the target describe a type, and shoe-horning this through a target hook i

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

2010-11-16 Thread Ian Lance Taylor
Joern Rennecke writes: > I don't see how going to a struct cumulative_args gets us closer to > a viable solution for a multi-target executable, even if you threw in > C++. Having the target describe a type, and shoe-horning this through > a target > hook interface that is decribed in supposedly

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

2010-11-16 Thread Joern Rennecke
Quoting Paolo Bonzini : 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. I don't see how going to a struct cumulative_args gets us closer to a viabl

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

2010-11-16 Thread Paolo Bonzini
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

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

2010-11-16 Thread Ian Lance Taylor
Joern Rennecke writes: > Quoting Ian Lance Taylor : > >> Joern Rennecke writes: >> >>> Before I go and make all these target changes & test them, is there at >>> least agreemwent that this is the right approach, i.e replacing >>> CUMULATIVE_ARG * >>> with void *, and splitting up x_rtl into two

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

2010-11-16 Thread Joern Rennecke
Quoting Ian Lance Taylor : Joern Rennecke writes: Before I go and make all these target changes & test them, is there at least agreemwent that this is the right approach, i.e replacing CUMULATIVE_ARG * with void *, and splitting up x_rtl into two variables. I don't know how we want to get t