...
Question 6876 – Software-Engineering
December 10, 2023
Question 10028 – Database-Management-System
December 10, 2023
Question 6876 – Software-Engineering
December 10, 2023
Question 10028 – Database-Management-System
December 10, 2023

Question 8056 – Compiler-Design

Consider the following code segment.
x = u – t;
y = x * v;
x = y + w;
y = t – z;
y = x * y;
The minimum number of  variables required to convert the above code segment to static single assignment form is ________.

Correct Answer: A

Question 15 Explanation: 
In Static Single Assignment form (SSA) each assignment to a variable should be specified with distinct names.
Generally, subscripts are used to distinguish each definition of variables.
In the given code segment, there are two assignments of the variable x
x = u – t;
x = y + w;
and three assignments of the variable y.
y = x * v;
y = t – z;
y = x * y
Hence, two variables viz x1, x2 should be used for specifying distinct assignments of x
and for y it is named as y1, y2 and y3 for each assignment of y.
Hence, total number of variables is 10 (x1, x2, y1, y2, y3, t, u, v, w, z), and there are 5 temporary variables.
Static Single Assignment form (SSA) of the given code segment is:
x1 = u – t;
y1 = x1 * v;
x2 = y1 + w;
y2 = t – z;
y3 = x2 * y2;

A
10
B
11
C
12
D
13
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!