05.10.2013 Views

1 Code Generation Code generator phase ... - VTU e-Learning

1 Code Generation Code generator phase ... - VTU e-Learning

1 Code Generation Code generator phase ... - VTU e-Learning

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

for i =1 to n do<br />

C[i, j] = 0;<br />

Three address code generated will be as follows<br />

1) i = 0<br />

2) if i < n go to 4<br />

3) go to 15<br />

4) j = 1<br />

5) if j < n go to 7<br />

6) go to 13<br />

7) t1 = i * 10<br />

8) t2 = t1 + j<br />

9) t3 = 4 * t2<br />

10) C[t3] = 0<br />

11) j = j + 1<br />

12) go to 5<br />

13) i = i + 1<br />

14) go to 2<br />

15)<br />

Basic blocks will be as follows<br />

Stmt no Header Three address code Block no<br />

1 H i = 0 B1<br />

2 H if i < n go to 4 B2<br />

3 H go to 15 B3<br />

4 H j = 1 B4<br />

5 H if j < n go to 7 B5<br />

14

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!