[Soot-list] Why create temp$xx variables?
Peng Du
imdupeng at gmail.com
Tue Apr 21 02:32:06 EDT 2009
Hello, experts
I have a newbie question about SOOT's IRs. Specifically, I have a simple
test program
on which I want to do some forward analysis via the Shimple IR. But I found
SOOT
would generate many temporary variables named "temp$XX", for each number
literal (e.g. 2, 3), and intermediate results. This was the case for both
Jimple and
Shimple. I know Jimple is 3-address based, but all the expressions involve
AT MOST
three variables as you can see in the program.
I wonder: Why is that? Why we need those temp$ stuff? Can I eliminate that
without
turning on any optimizations or transformations? (I don't need them) If
yes, how?
Thank you for looking.
Peng Du
Test program:
===========================================================
public static int foo(boolean flag){
int x, y, z;
if (flag){
x = 2; y = 3;
}
else {
x = 3; y = 2;
}
z = x + y;
return z;
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Jimple
===========================================================
public static int foo(boolean)
{
boolean flag;
int x, y, z, temp$0, temp$1, temp$2, temp$3, temp$4, temp$5;
flag := @parameter0: boolean;
if flag == 0 goto label1;
goto label0;
label0:
nop;
temp$0 = 2;
x = temp$0;
temp$1 = 3;
y = temp$1;
goto label2;
label1:
nop;
temp$2 = 3;
x = temp$2;
temp$3 = 2;
y = temp$3;
label2:
nop;
temp$4 = x;
temp$5 = temp$4 + y;
z = temp$5;
return z;
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20090421/f1f158ae/attachment.html
More information about the Soot-list
mailing list