Re: Commit: RL78: Include tree-pass.h

2012-08-09 Thread DJ Delorie

> The issue is that using the plugin interface makes breakage only
> detectable when you are able to test a target, not by merely
> building it.

You just described *most* of the bugs I have to deal with.


Re: Commit: RL78: Include tree-pass.h

2012-08-09 Thread Richard Guenther
On Wed, Aug 8, 2012 at 5:29 PM, Richard Henderson  wrote:
> On 08/08/2012 07:19 AM, Ian Lance Taylor wrote:
>>> > I was suggesting to for example register a 2nd mdreorg-like pass and
>>> > add a 2nd target hook.  regstack should get the same treatment.
>> If the mechanism is a proliferation of mdreorg passes in every place
>> we want a target-specific pass, that is fine with me.
>
> I think it makes much more sense to edit the pass ordering from
> the backend, rather than hooks upon hooks upon hooks.
>
> Since the plugin interface exists, we might as well use it.

The issue is that using the plugin interface makes breakage only detectable
when you are able to test a target, not by merely building it.  That's bad
(of course only for those weirdo targets).  We should _at least_ provide
an interface to internals that for example use the address of the pass
structure for pass placement instead of just the dump file name.

Richard.

>
> r~


Re: Commit: RL78: Include tree-pass.h

2012-08-08 Thread DJ Delorie

> But we should definitely have a way to register machine dependent
> passes, and what's wrong with the plugin interface?

IIRC I asked about how to schedule that pass when I wrote it, and "use
the plugin API" was the recommendation.

Some background...

The RL78 devirtualization pass is *not* a reorg pass, it has to happen
after reload but before debug info is set up.  The RL78 does not have
a consistent register set or addressing scheme, GCC cannot practically
support it.  So RL78 uses a virtual register set and machine
description until after reload, then copy data in and out of the
virtual registers to physical registers depending on the operations
required.  The only way to get decent performance and reasonable
debugging is to do that pass as soon after reload as possible, so the
remaining optimizations can work with real registers.

Basically, after the RL78 devirtualization pass, the RL78 is a
completely different target machine.


Re: Commit: RL78: Include tree-pass.h

2012-08-08 Thread Richard Henderson
On 08/08/2012 07:19 AM, Ian Lance Taylor wrote:
>> > I was suggesting to for example register a 2nd mdreorg-like pass and
>> > add a 2nd target hook.  regstack should get the same treatment.
> If the mechanism is a proliferation of mdreorg passes in every place
> we want a target-specific pass, that is fine with me.

I think it makes much more sense to edit the pass ordering from
the backend, rather than hooks upon hooks upon hooks.

Since the plugin interface exists, we might as well use it.


r~


Re: Commit: RL78: Include tree-pass.h

2012-08-08 Thread Ian Lance Taylor
On Wed, Aug 8, 2012 at 7:11 AM, Richard Guenther
 wrote:
> On Wed, Aug 8, 2012 at 4:06 PM, Ian Lance Taylor  wrote:
>> On Wed, Aug 8, 2012 at 7:03 AM, Richard Guenther
>>  wrote:
>>
>>> I don't think we really want that (machine dependent passes).  It seems
>>> we cannot get away with it (so we have mdreorg).  Allowing (some) 
>>> flexibility
>>> where to put mdreorg is ok, using two different mechanisms (mdreorg and
>>> a "plugin") sounds odd and is IMHO bad for consistency.
>>
>> I think we definitely want machine dependent passes.  E.g., reg-stack
>> should be one.  The passes should live by normal rules, they shouldn't
>> be like mdreorg.
>
> What is "like mdreorg"?  That it is a pass centrally registered,
> called "mdreorg"
> that calls a target hook which happens to implement the pass?  regstack
> is controlled by a target macro and is centrally registered, too.
>
>> I don't really care about the mechanism as long as it exists.
>
> I was suggesting to for example register a 2nd mdreorg-like pass and
> add a 2nd target hook.  regstack should get the same treatment.

If the mechanism is a proliferation of mdreorg passes in every place
we want a target-specific pass, that is fine with me.

Ian


Re: Commit: RL78: Include tree-pass.h

2012-08-08 Thread Richard Guenther
On Wed, Aug 8, 2012 at 4:06 PM, Ian Lance Taylor  wrote:
> On Wed, Aug 8, 2012 at 7:03 AM, Richard Guenther
>  wrote:
>
>> I don't think we really want that (machine dependent passes).  It seems
>> we cannot get away with it (so we have mdreorg).  Allowing (some) flexibility
>> where to put mdreorg is ok, using two different mechanisms (mdreorg and
>> a "plugin") sounds odd and is IMHO bad for consistency.
>
> I think we definitely want machine dependent passes.  E.g., reg-stack
> should be one.  The passes should live by normal rules, they shouldn't
> be like mdreorg.

What is "like mdreorg"?  That it is a pass centrally registered,
called "mdreorg"
that calls a target hook which happens to implement the pass?  regstack
is controlled by a target macro and is centrally registered, too.

> I don't really care about the mechanism as long as it exists.

I was suggesting to for example register a 2nd mdreorg-like pass and
add a 2nd target hook.  regstack should get the same treatment.

Exposing machine-dependent passes in the global pass schedule makes
it easier to figure what you break - as I saw the RL78 use I wondered when
I ever grepped for the pass dump-file name in arch specific dirs when
changing that ... (never).

Richard.

> Ian


Re: Commit: RL78: Include tree-pass.h

2012-08-08 Thread Ian Lance Taylor
On Wed, Aug 8, 2012 at 7:03 AM, Richard Guenther
 wrote:

> I don't think we really want that (machine dependent passes).  It seems
> we cannot get away with it (so we have mdreorg).  Allowing (some) flexibility
> where to put mdreorg is ok, using two different mechanisms (mdreorg and
> a "plugin") sounds odd and is IMHO bad for consistency.

I think we definitely want machine dependent passes.  E.g., reg-stack
should be one.  The passes should live by normal rules, they shouldn't
be like mdreorg.

I don't really care about the mechanism as long as it exists.

Ian


Re: Commit: RL78: Include tree-pass.h

2012-08-08 Thread Richard Guenther
On Wed, Aug 8, 2012 at 3:35 PM, Ian Lance Taylor  wrote:
> On Wed, Aug 8, 2012 at 1:45 AM, Richard Guenther
>  wrote:
>> On Wed, Aug 8, 2012 at 10:28 AM, Nick Clifton  wrote:
>>> Hi DJ,
>>>
>>>   I am applying the following patch to the gcc mainline as an obvious
>>>   fix for the following problem building the RL78 backend:
>>>
>>> gcc/config/rl78/rl78.c:151:3: error: 'PASS_POS_INSERT_BEFORE' 
>>> undeclared here (not in a function)
>>
>> Err - you are inside the compiler and should not use plugin stuff to
>> register your machine dependent pass.
>
> But we should definitely have a way to register machine dependent
> passes, and what's wrong with the plugin interface?

I don't think we really want that (machine dependent passes).  It seems
we cannot get away with it (so we have mdreorg).  Allowing (some) flexibility
where to put mdreorg is ok, using two different mechanisms (mdreorg and
a "plugin") sounds odd and is IMHO bad for consistency.

Richard.

> Ian


Re: Commit: RL78: Include tree-pass.h

2012-08-08 Thread Ian Lance Taylor
On Wed, Aug 8, 2012 at 1:45 AM, Richard Guenther
 wrote:
> On Wed, Aug 8, 2012 at 10:28 AM, Nick Clifton  wrote:
>> Hi DJ,
>>
>>   I am applying the following patch to the gcc mainline as an obvious
>>   fix for the following problem building the RL78 backend:
>>
>> gcc/config/rl78/rl78.c:151:3: error: 'PASS_POS_INSERT_BEFORE' undeclared 
>> here (not in a function)
>
> Err - you are inside the compiler and should not use plugin stuff to
> register your machine dependent pass.

But we should definitely have a way to register machine dependent
passes, and what's wrong with the plugin interface?

Ian


Re: Commit: RL78: Include tree-pass.h

2012-08-08 Thread Richard Guenther
On Wed, Aug 8, 2012 at 11:02 AM, nick clifton  wrote:
> Hi Richard,
>
>
>> Err - you are inside the compiler and should not use plugin stuff to
>> register your machine dependent pass.
>
>
> Umm, OK, what is the correct method for registering target specific passes ?
> (Ones that need to run at times other than TARGET_MACHINE_DEPENDENT_REORG).

Have two machine_reorg passes with different target hooks.  Or schedule it twice
and have a target hook that specifies at which position it should actually run.

Richard.

> Cheers
>   Nick
>
>


Re: Commit: RL78: Include tree-pass.h

2012-08-08 Thread nick clifton

Hi Richard,


Err - you are inside the compiler and should not use plugin stuff to
register your machine dependent pass.


Umm, OK, what is the correct method for registering target specific 
passes ?  (Ones that need to run at times other than 
TARGET_MACHINE_DEPENDENT_REORG).


Cheers
  Nick




Re: Commit: RL78: Include tree-pass.h

2012-08-08 Thread Richard Guenther
On Wed, Aug 8, 2012 at 10:28 AM, Nick Clifton  wrote:
> Hi DJ,
>
>   I am applying the following patch to the gcc mainline as an obvious
>   fix for the following problem building the RL78 backend:
>
> gcc/config/rl78/rl78.c:151:3: error: 'PASS_POS_INSERT_BEFORE' undeclared 
> here (not in a function)

Err - you are inside the compiler and should not use plugin stuff to
register your machine dependent pass.

> Cheers
>   Nick
>
> gcc/ChangeLog
> 2012-08-08  Nick Clifton  
>
> * config/rl78/rl78.c: Include tree-pass.h.
>
> Index: gcc/config/rl78/rl78.c
> ===
> --- gcc/config/rl78/rl78.c  (revision 190223)
> +++ gcc/config/rl78/rl78.c  (working copy)
> @@ -48,6 +48,7 @@
>  #include "langhooks.h"
>  #include "rl78-protos.h"
>  #include "dumpfile.h"
> +#include "tree-pass.h"
>
>  static inline bool is_interrupt_func (const_tree decl);
>  static inline bool is_brk_interrupt_func (const_tree decl);