The Gateway to Computer Science Excellence
+1 vote
323 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 ________.

in Compiler Design by Boss (25.2k points)
edited by | 323 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.......................
+2

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.

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.

1 Answer

0 votes

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

Refer to this links.

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 (299 points)

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,654 questions
56,166 answers
193,872 comments
94,261 users