On Mon, Jul 27, 2015 at 09:05:08PM +0100, Richard Sandiford wrote:
> Jeff Law <l...@redhat.com> writes:
> > On 07/27/2015 03:17 AM, Richard Biener wrote:
> >> On Mon, Jul 27, 2015 at 5:10 AM,  <tbsaunde+...@tbsaunde.org> wrote:
> >>> From: Trevor Saunders <tbsaunde+...@tbsaunde.org>
> >>>
> >>> Hi,
> >>>
> >>> $subject.
> >>>
> >>> patches individually bootstrapped + regtested on x86_64-linux-gnu, and run
> >>> through config-list.mk with more patches removing usage of the macro.  Ok?
> >>
> >> With POINTER_SIZE now being expensive (target hook) you might consider
> >> moving most users to use pointer_sized_int_node or some other global
> >> derived from POINTER_SIZE.
> >>
> >> Which of course raises the question of why we are hookizing this...  if 
> >> you'd
> >> want a truly switchable target you'd have to switch all global trees as 
> >> well
> >> (or hookize them individually).
> > Not sure -- it doesn't remove any conditionally compiled code...
> >
> > One could easily argue that it's just another step on the path towards a 
> > switchable target -- which in and of itself is a reasonable design goal.
> >
> > Trevor, maybe a quick note on the motivation would help here...
> 
> I think at least we should use data hooks rather than function hooks,
> since this value should a constant within a subtarget.  It should only
> change for target_reinit.

I agree in principal, but I wasn't sure where all I might need to change
the values of the hooks, and of course I wondered if there might be some
crazy target where that's not good enough.

> Alternatively we could have a new target_globals structure that is
> initialised with the result of calling the hook.  If we do that though,
> it might make sense to consolidate the hooks rather than have one for
> every value.  E.g. having one function for UNITS_PER_WORD, one for
> POINTER_SIZE, one for Pmode, etc., would lead to some very verbose
> target code.

so something like

struct target_types
{
  unsigned long pointer_size;
  ...
};

const target_types &targetm.get_type_data ()

? that seems pretty reasonable, and I wouldn't expect too many ordering
issues, but who knows.  Its too bad nobody has taken on the big job of
turning targetm into a class so we can hope for some devirt help from
the compiler.

thanks!

Trev

> 
> Perhaps the main problem with these approaches is ensuring that the
> value is set up early enough.
> 
> Thanks,
> Richard

Reply via email to