search
Log In
0 votes
254 views
# of temporary variable required to create 3 address code in static single assignment form for the expression P+Q*R-S/(Q*R).
in Compiler Design 254 views
0
2?
0
given is 4 but i think it5

1 Answer

2 votes

Is it 4 ? 

0
here q*r is used 2 times rt so why u used same variable ?
1
I think it's because in static single assignment you cannot reassign something twice , but you can reuse it again if needed in RHS like t1 . Here you are not reassigning t1 again,  but using it again . Thanks.
0
yes true
0

@ In general Static Single Assignment means for each and every variable and for every computation of the program,we should assign a temporary variable right?

So then total temporary variables should be 8 right?

Related questions

3 votes
0 answers
3
588 views
Consider the following code segment: $c=b+a$ $e=c-a$ $f=c*e$ $h=c+a$ $i=h+f$ The minimum number of temporary variable required to convert the above code segment to static single assignment form is ________. Doubt : Are we allowed to do minimizations in SSA? if YES then is it always the case, if NO when do we have to do it. Please clarify.
asked Dec 26, 2018 in Compiler Design shreyansh jain 588 views
1 vote
1 answer
4
256 views
X = A / b Y = C + D Y = Y - X X = D + Y Z = F + Y Z = Z + A MInimum number of total variables needed to convert above TAC to Static Single Assignment Answer given ==>11 My apporach X1 = A / b Y1 = C + D Y2 = Y1 - X1 X2 = D + Y2 Z1 = F + Y2 Z2 = Z1 + A Is above code in SSA ??
asked Nov 23, 2018 in Compiler Design jatin khachane 1 256 views
...