in Compiler Design
692 views
0 votes
0 votes

Min number of register needed for this program without spilling ?

in Compiler Design
692 views

4 Comments

@Kabir5454

i think we can use labeling algo for such questions.

0
0
@pranav if u r getting 3reg as ans...can u post ur sol
0
0
I am also getting 2 registers only,

a = 1        //           R1 = a

b = a+ 2 //             R1 =a , R2 =b

c = a + b //            R1 = c , R2 = b

d = b + 5 //            R1 = c , R2 = d

e = 6       //           R1 = c , R2 = e

f = c + e  //           R1 = c , R2 = f

a = f + 7 //            R1 = a , R2 = f

c = a + f  //           R1 = a , R2 = c

e = a + c //           R1 = e , R2 = c

d = c +2 //            R1 = d
0
0

1 Answer

0 votes
0 votes
No. Of register is  3 ,4...Is Fine But my work done with 2 Register so why we use 3 register . That Why Minimum No. of Register Is 2