+1 vote
366 views

Consider the following code segment:

The minimum number of temporary variable required to convert the above code segment to static single assignment form is ________.

edited | 366 views
0
5 ???
+1
Given answer is 4, but i got 5.5 variables on LHS is needed.I dont think we can do any minimization here?
0
minimization can be done actually because 'e' is same as 'b'.

if we assign no variable for 'e' then it will be 4
0
Can we do minimization here in static single assignment ?
+1
I think it is 0.

As in static single assignment form a variable can be assigned only once. Here there are no repeated assignment of same variable.
0

rahul Sharma 5  I myself have this doubt.

0
4.......................
+3

In SSA, we need that each variable be assigned value only once. And use temporary variables if required.

Here the given code is already in SSA. And we don't need any extra variables, or to say any "temporary" variables. So answer should be 0.

In case if it asked for total numer of variables, then the answer should be non-zero.

Right?

0
I also think the same!
0

Yes, @Rishabh Gupta 2 .

Given 3-Address Code is Already in SSA Form, hence, we need No temp variable to convert it into SSA.

0
yeah, you are right the code is itself in SSA form, as there are no variable with multiple assignment.

I guess answer would be 0, because the above code is already in Static single assignment form.

https://www.cs.cmu.edu/~fp/courses/15411-f08/lectures/09-ssa.pdf

https://www.geeksforgeeks.org/gate-gate-cs-2016-set-1-question-29/

by Junior (515 points)
4 should be ans
by (339 points) 1 flag:
✌ Low quality (Hira Thakur)
0

Why are people saying that answer is 0 in the above comments ? I am getting answer as 4.

In the below mentioned GATE 2016 question, the answer is 10 including the temporary variables. My doubt is if the number of temporary variables had to be considered as then the answer should have been 5 right and not 10 considering the fact that we have to convert this code segment in to SSA form.

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 ?

Somebody please provide a clear understanding on this.

+1 vote