[cfe-dev] Classify variables of a loop/compound statement/etc.
LUIS MIGUEL SANCHEZ GARCIA
luismiguel.sanchez at uc3m.es
Thu Jan 15 02:52:39 PST 2015
Alberto: Thanks for your help.
Maybe you can create a recursive visitor and use the VisitStmt method.
> Using a cast you can understand if it is an if statement and if yes you
> could call, for example,getThen() method or something similar.
Is there any example code to start?
> What you mean with read/write variables?
I'll explain with a sample:
std::vector<int> A(M);
std::vector<int> B(M);
....
/* Loop to analyze */
for (int i=0; i<M; ++i) {
A[i] = B[i];
}
I would like to get the following information:
Local: i (rw)
External: A(w),B (r), M(r)
where *r* means that the variable is read into the code, and *w* means that
the variable is modified (in someway)
Regards,
Luis.
2015-01-14 18:42 GMT+01:00 Alberto Barbaro <barbaro.alberto at gmail.com>:
> Luis,
> My 2 cents. Maybe you can create a recursive visitor and use the VisitStmt
> method. Using a cast you can understand if it is an if statement and if yes
> you could call, for example,getThen() method or something similar.
>
> What you mean with read/write variables?
>
> I think you can understand if it is global or not taking the declaration
> point using something like getDecl() on the DeclRefExpr.
>
> I'm sure that I said something wrong. Any better idea?
>
> Thanks,
> Alberto
> On 14 Jan 2015 15:44, "Luis Miguel Sanchez Garcia" <
> luismiguel.sanchez at uc3m.es> wrote:
>
>> Hi all,
>>
>> I would like to develop a tool that prints the variables of a concrete
>> loop/compount statement/etc. The information that I need to print for each
>> variable is:
>> - read variables, write variables and rw variables
>> - And if it is local or global variable.
>>
>> Any help to start?
>>
>> Regards,
>> Luis.
>> --
>> --
>> --------------------------------------------------
>> Luis Miguel Sánchez García
>> Computer Architecture and Technology Area.
>> Office 2.2.B08
>> Computer Science Department. UNIVERSIDAD CARLOS III DE MADRID
>> Universidad Carlos III de Madrid
>> Avda. de la Universidad, 30
>> 28911 Leganés - Madrid - Spain
>> e-mail: lmsan at arcos.inf.uc3m.es
>> luismiguel.sanchez at uc3m.es
>>
>> Phone: (+34) 91 624 5951
>>
>> Linked-In: http://es.linkedin.com/in/lmsan
>> Twitter: http://twitter.com/lmsanchezgarcia
>> --------------------------------------------------
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
--
--
--
--------------------------------------------------
Luis Miguel Sánchez García
Computer Architecture and Technology Area.
Office 2.2.B08
Computer Science Department. UNIVERSIDAD CARLOS III DE MADRID
Universidad Carlos III de Madrid
Avda. de la Universidad, 30
28911 Leganés - Madrid - Spain
e-mail: lmsan at arcos.inf.uc3m.es
luismiguel.sanchez at uc3m.es
Phone: (+34) 91 624 5951
Linked-In: http://es.linkedin.com/in/lmsan
Twitter: http://twitter.com/lmsanchezgarcia
--------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150115/d7187e76/attachment.html>
More information about the cfe-dev
mailing list