edited by
27,553 views
69 votes
69 votes

Consider the following code segment.

x = u - t;
y = x * v; 
x = y + w;
y = t - z; 
y = x * y;

The minimum number of total variables required to convert the above code segment to static single assignment form is __________.

edited by

12 Answers

0 votes
0 votes

x1 = u - t;
y1 = x1 * v;
x2 = y1 + w;
y2 = t - z;
y3 = x2 * y2;

Total 10 variables.

0 votes
0 votes
In SSA, each variable used must be assigned exactly once and declared before use.

 

$u = \text{some_val;}$
$t = \text{some_val;}$
$x = u -t;$

$v = \text{some_val;}$
$y = x * v;$

$w = \text{some_val;}$
$x_2 = y + w;$

$z = \text{some_val;}$
$y_2 = t – z;$

$y_3 = x_2 * y_2;$

 

$\text{Total Variables required in SSA} = 10$
Answer:

Related questions

35 votes
35 votes
4 answers
1
Sandeep Singh asked Feb 12, 2016
10,162 views
The attribute of three arithmetic operators in some programming language are given below.$$\begin{array}{|c|l|}\hline \textbf{OPERATOR} & \textbf{PRECEDENCE} & \textbf{...
80 votes
80 votes
7 answers
2
makhdoom ghaya asked Feb 13, 2015
29,044 views
The least number of temporary variables required to create a three-address code in static single assignment form for the expression $q + r / 3 + s - t * 5 + u * v/w$ is_...