This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Index Variables ..


On May  4, 2001, AJ <jadeja@cyberspace.org> wrote:

> 	I need to find the variable name that maps to a particular
> register. Is there any way for me to do that?

You have to get into the debugging information of the binary file, if
there is any debugging info.

> 	I would like to find a list of all the statements in a loop that
> are used to manipulate ONLY the index variable. Also need to take care of
> nested loops. What place in the core compiler would be the best for me to
> add code for doing that or is there some code I could reuse?

You could have a look at the induction variable detection code in
loop.c and unroll.c.  But note that, with strength reduction and other
loop transformations, it's perfectly possible that the index variable
doesn't make it to the generated code.  Besides, these transformations
occur long before the pseudo that represents the index variable is
assigned to a hardware register or stack slot.

> 	Would just checking if the register used for index computation is
> being used as the destination be sufficient? Do I need to worry about
> anything else.

Think of pre/post-inc/decrement loads and stores too, and parallels.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]