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: > > I am coding a pass in MELT which should ideally transform some OpenCL things > > into Gimple > > I think you mean Gimple to OpenCL. Yes > > > > How should I find the induction variable? > > What is your definition of induction variable? > 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. > > 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 using the generated name to guess the property of some variable is aweful. However, my question is becoming then: what characterize the (probably SSA) variables named graphite_IV? When exactly are they generated? what is the proper to get them or to find them? would it be possible, during generation of that variable (inside some graphite pass!), to attach some special property to them; so that finding them later is easier and more robust than a string name match? Cheers. -- 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} ***