[cfe-dev] How to know whether expression is derived from induction variable?

Gabor Kozar kozargabor at gmail.com
Thu Sep 26 06:07:28 PDT 2013


The simplest probably would be finding all relevant loop nodes, i.e.
ForExpr-s, identifying the loop induction variable, i.e. the VarDecl-s
(if any), and finally running a RecursiveASTVisitor on its body,
looking for a DeclRefExpr referring to any of the VarDecl-s you
identified in the previous step.



--
Gábor Kozár -- ShdNx
kozargabor at gmail.com





On Thu, Sep 26, 2013, at 15:00, Madhur Amilkanthwar wrote:

Hi,
I am interested in knowing if an expression is derived from loop
induction variable or not. As of now, I am able to inspect every
expression after locating "if" statement in the code.
Assume following code:
for(int i=0;i<32;i++)
  i=i+2;

in above code, I am able to get access to the expression "i+2" but how
should I analyze its LHS and RHS for induction variable?

Any help appreciated.

--
Thank You.
Madhur D. Amilkanthwar
RISE lab,
IIT Madras.

_______________________________________________

cfe-dev mailing list

[1]cfe-dev at cs.uiuc.edu

[2]http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

References

1. mailto:cfe-dev at cs.uiuc.edu
2. http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130926/99c3b055/attachment.html>


More information about the cfe-dev mailing list