The Gateway to Computer Science Excellence
+1 vote

Consider the following code segment:

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

in Compiler Design by Boss (25.6k points)
edited by | 386 views
5 ???
Given answer is 4, but i got 5.5 variables on LHS is needed.I dont think we can do any minimization here?
minimization can be done actually because 'e' is same as 'b'.

if we assign no variable for 'e' then it will be 4
Can we do minimization here in static single assignment ?
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.

rahul Sharma 5  I myself have this doubt.


Please someone clear my doubt.

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.


I also think the same!

Yes, @Rishabh Gupta 2 . 

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

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

2 Answers

0 votes

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

Refer to this links.

by Junior (547 points)
0 votes
4 should be ans
by (357 points) 1 flag:
✌ Low quality (Hira Thakur)

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. 

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,833 questions
57,713 answers
107,684 users