On Thu, 19 May 2011 09:52:11 -0500
Sebastian Pop <seb...@gmail.com> wrote:

> On Thu, May 19, 2011 at 09:21, Basile Starynkevitch
> <bas...@starynkevitch.net> wrote:
[...]
> > How should I find the induction variable?
> 
> What is your definition of induction variable?

The one which is used by graphite.

> My definitions are:
> - every variable defined in a loop is an induction variable,
> - an induction variable has a phi node with one of the
>   arguments defined in the loop.

I am not sure to understand what exactly you call an argument defined
in the loop and how to find one.

> 
> If you take one of these definitions your pattern matching is easy.
> 
> > I could loop at the internal name
> > of the variable, and check if it starts with graphite_IV.
> 
> I think this is a *very* bad idea, and unfortunately the graphite-opencl
> code uses this strcmp technique to detect reductions, and that's why
> the graphite-opencl code is broken right now.

I definitely agree that comparing string naming internal generated
variables is really aweful, and I would like to avoid it.

I believe that the cleanest way to avoid that would be to have graphite
invoke a plugin hook to signal the creation of that induction variable.
For instance, we could add, in the function graphite_create_new_loop
file gcc/graphite-clast-to-gimple.c (rev 172785 of the trunk), just
after the call (near line 783) add_referenced_var (ivvar); a
invoke_plugin_callbacks (PLUGIN_GRAPHITE_NEW_INDUCTION_VARIABLE, ivvar);
I really think that several plugins could profit of such a hook.

What do you think of such an idea?  More generally, I believe that
graphite is lacking of several plugin hooks (and by discussing with
some INRIA people, I understood -perhaps wrongly- that they would also
want them).

Do graphite folks want to add plugin hooks inside graphite before 4.7?

Regards.
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

Reply via email to