The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+1 vote
66 views

asked in Compiler Design by Active (1.1k points) | 66 views
0
0
7 is correct only

2 Answers

+2 votes

Ans is 7

This can be converted to SSA as

a1 = b + c

c1 = a1 + x

d1 = b + c1

b1 = a1 + x

so total count of variables is 7

answered by (127 points)
0
shouldn't the answer be 5 as the b+c,a1+x is repeated
0
No, if variable is repeated on LHS then it is replaced with new variable.
0
according to ME solution the answer is 6, the are using DAG as there solution.
0 votes
Static single assignment means assignment to register can be done only one time-

a(temp3) = b(temp1) + c(temp2);

c(temp5) = a + x(temp4);

d(temp6) = b + c;

b(temp7) = a + x;

total 7 variables are required.
answered by Loyal (8.4k points)
0
temp5 and temp7 are same. Do they need separate register allocation?
0
@MiNiPanda,Shouldn't be assignment of each variable unique? In SSA every definition gets its own version.
0
but answer given is 6

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
48,720 questions
52,821 answers
183,476 comments
68,569 users