This is the mail archive of the gcc@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]
Other format: [Raw text]

GCC loop structure question


I have a question about the GCC loop structure.  I am trying to identify the
induction variable for a for loop and I don't see how to do that.

For example, if I have:

    int foo(int *a, int *b, int *c, int *d, int *e, int *f, int n)
    {
	int i;
	for (i = 0; i < n; i++) {
	    a[i] = b[i] + c[i];
	    d[i] = e[i] * f[i];
	}
    }

I basically want to identify 'i' as the IV and look at its uses inside the
loop.

I can look at the control_ivs in the loop structure and I see:

base is:
 <integer_cst 0x7f1d0d29d090 type <integer_type 0x7f1d0d2985e8 int> constant 1>
step is:
 <integer_cst 0x7f1d0d29d090 type <integer_type 0x7f1d0d2985e8 int> constant 1>

But it doesn't say what is being set to base or what is being increased by
step in each loop iteration.  (I am also not sure why base is 1 and not 0.)

Does this refer to a psuedo-IV or something instead of a real SSA variable
that appears in the tree?   How would I identify 'i' as the IV for this
loop?  Do I need to look at the loop header and latch and see what the
header sets and what the latch checks to identify the variable?

Steve Ellcey
sellcey@cavium.com


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