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]

identifying indirect references in a loop


Hi,

Im trying to identify all indirect references in a loop so that, after
this analysis, I have a list of tree_nodes of pointer_type that are
dereferenced in a loop along with their step size, if any.

E.g.
while(i++ < n)
{
   *(p+i);
}

I want to get the pointer_type_node for 'p' and identify the step size
as '1', since 'i' has a step size of 1.

I am able to identify 'INDIRECT_REF' nodes in the loop. But since
these are generally the expression_temporaries, I will not get the
tree_node for 'p'. But I believe INDIRECT_REF is an expression who's
arg0 is an SSA_NAME node  from which I will be able to use the
SSA_NAME_DEF_STMT to ultimately reach the tree_node for 'p'.

But I dont know how to get the SSA_NAME node from the given
INDIRECT_REF. Could someone please point out how to do this.

Also, I find it very difficult to know how the tree_nodes and types
are contained one within the other. Is there a general technique by
which I can know when a tree node will be nested within another and
how to retrieve them ?

Thanks,
Aravinda


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