in Compiler Design closed by
152 views
0 votes
0 votes
closed as a duplicate of: madeeasy testseries

in Compiler Design closed by
152 views

1 Answer

0 votes
0 votes

Static Single Assignment  is a means of structuring the Intermediate representation such that every variable is allotted a value only once and every variable is defined before it’s use. 

So the Static Single Assignment for above code is 

d = a+b

e = a-b

f = c+d

g = c-e

a = f+g

b = f-g

c = d+e

So total variables used are  7 

Short Trick : If any variable is repeating again in the LHS then assign a new variable for it. 

                   e.g : a = b+c

                           a = d-c

                           So the Static Single Assignment for above code is 

                           a = b+c

                           a1 = d-c

by

2 Comments

@Dadu I am confused in whether we have to consider right hand side variable also or not 

I mean here d=a+b and after few lines you write a=f+g so is that not mean that ‘a’ has now two values and SSA says one variable have only one value 

0
0
No because the defination says that the “every variable is allotted a value only once and every variable is defined before it’s use. ” So if variable is defined(RHS)  but not allocated the value(LHS) then we will not consider it for new variable allocation.
0
0

Related questions