Redirected
2,818 views
1 votes
1 votes
Consider the following code generation:

a=b+c;

c=a+x;

d=b+c;

b=a+x;

The minimum no. of total variables required to convert the above code to static single assignment form is______

5 Answers

5 votes
5 votes
IN SSA RHS OF THE OPERATION CAN USE THE PREVIOUSLY USED VARIABLE ,BUT LHS IN SSA MUST BE UNIQUE.

SOLVING

a1=b1+c1;

c2=a1+x1;

d1=b1+c2;

b2=a1+x1;

the variable are a1,b1,c1,d1,x1,b2,c2 answer 7
2 votes
2 votes

Ans is 7

This can be converted to SSA as

a1 = b + c

c1 = a1 + x

d1 = b + c1

b1 = a1 + x

so total count of variables is 7

2 votes
2 votes
In $SSA$ when we assign the values, the variable to which the values is being assigned should be unique.

RHS of the operation can use the previously used variables, but the LHS in SSA must always be unique.

$R1=b+c;$

$R2=R1+x;$

$R3=R1;$

$R4=R2;$

So total variables =$7$
0 votes
0 votes
Static single assignment means assignment to register can be done only one time-

a(temp3) = b(temp1) + c(temp2);

c(temp5) = a + x(temp4);

d(temp6) = b + c;

b(temp7) = a + x;

total 7 variables are required.

Related questions

0 votes
0 votes
1 answer
2
minal asked Jan 22, 2019
893 views
# of temporary variable required to create 3 address code in static single assignment form for the expression P+Q*R-S/(Q*R).
1 votes
1 votes
2 answers
4
A_i_$_h asked Sep 7, 2017
575 views
Consider the following code segmenta= b - cd = a + da = d + ed = c * fd = a * dthe min number of total variables required to convert the above code segment to static sing...