in Compiler Design retagged by
1,443 views
1 vote
1 vote

Hi Everyone,

For this the Given Answer is 5, I got 4. I am now confused about how the 3 address code is generated here.

in Compiler Design retagged by
1.4k views

3 Comments

what is the meaning of statements here?
0
0
is it the number of variables? Number of variables Iā€™m getting as 5
0
0
No, it's number of statement, when you convert this code in 3 address form
0
0

1 Answer

3 votes
3 votes
Best answer
Three address code for this would be :

1: t = b+c

2: if a < t , Goto 4

3: Goto 5

4: a= a-c

5: c = b* c

Now, this three address code when converted to SSA, then whenever a variable would be updated in a statement, it would be assigned a temporary variable.

1: t1 = b+c

2: if a < t1, Goto 4

3: Goto 5

4: t2 = a- c

5: t3 = b*c

So, 5 statements are there in SSA, temporary variables = 3 and total variables= 6
selected by

Related questions

0 votes
0 votes
1 answer
1