[Soot-list] data flow problem (Quentin Sabah)
yangbo at sei.buaa.edu.cn
yangbo at sei.buaa.edu.cn
Mon Jul 15 06:54:40 EDT 2013
Hello
This is a draft of the testing code I wrote to get the def and use var of a local
variable in a method.
public void Test(int a[], int N){
int R0,R1,R2,R3;
R0 = 0;
R1 = 0;
R2 = 0;
R3 = 0;
while(R1 < N){
R0 = a[R1];
R2 = R1 + 2;
R3 = R1;
while(R2 < N){
if(a[R2] > R0){
R0 = a[R2];
R3 = R2;
}
R2 = R2 + 1;
}
R2 = a[R1];
(1)
a[R1]=R0;
a[R3]=R2; (2)
R1=R1+1;
}
}
here are two statements (1) and (2)
(1)
R2 = a[R1];
(2) a[R3]=R2;
I will get the def var “a” and “R1″ in statement (1) with “private HashSet defsOf( Local l )” method in SmartLocalDefs. Maybe def var is R2 in (1), and use var are
“a” and “R1″ in (1).
I will get the use var “a” and “R3″ in statement (2) with SmartLocalDefs
This is modified defsOf method in SmartLocalDefs. just add printlf statements.
public static HashSet<Unit> defsOf(Local l) {
HashSet<Unit> ret = localToDefs.get(l);
if (ret == null){
localToDefs.put(l, ret = new HashSet<Unit>());
}else{
Iterator defTemp = ret.iterator();
while(defTemp.hasNext()){
Unit temp = (Unit) defTemp.next();
System.out.println("Local:"+l.getName()+" defsOfLocal:"+temp.toString());
}
}
return ret;
}
Best Regard.
Bo Yang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20130715/a8ad6e26/attachment-0001.html
More information about the Soot-list
mailing list