Process-Scheduling
January 28, 2025Number-Systems
January 28, 2025GATE 2017 [Set-1]
|
Question 12
|
Consider the following intermediate program in three address code
p = a - b
q = p * c
p = u * v
q = p + q
Which of the following corresponds to a static single assignment form of the above code?
![]() |
|
![]() |
|
![]() |
|
![]() |
In Static Single Assignment form (SSA) each assignment to a variable should be specified with distinct names.
We use subscripts to distinguish each definition of variables.
In the given code segment, there are two assignments of the variable p
p = a-b
p = u*v
and two assignments of the variable q
q = p*c
q = p+q
So we use two variables p1, p2 for specifying distinct assignments of p and q1, q2 for
each assignment of q.
Static Single Assignment form(SSA) of the given code segment is:
p1 = a-b
q1 = p1 * c
p2 = u * v
q2 = p2 + q1
Note:
As per options, given in GATE 2017 answer is B.
p3 = a – b
q4 = p3 * c
p4 = u * v
q5 = p4 + q4
In Static Single Assignment form (SSA) each assignment to a variable should be specified with distinct names.
We use subscripts to distinguish each definition of variables.
In the given code segment, there are two assignments of the variable p
p = a-b
p = u*v
and two assignments of the variable q
q = p*c
q = p+q
So we use two variables p1, p2 for specifying distinct assignments of p and q1, q2 for
each assignment of q.
Static Single Assignment form(SSA) of the given code segment is:
p1 = a-b
q1 = p1 * c
p2 = u * v
q2 = p2 + q1
Note:
As per options, given in GATE 2017 answer is B.
p3 = a – b
q4 = p3 * c
p4 = u * v
q5 = p4 + q4
![GATE 2017 [Set-1]](https://solutionsadda.in/wp-content/uploads/2019/05/green-new-logo.png)



