20.04.2013 Views

Spring 2011 CSCI 565 - Compiler Design

Spring 2011 CSCI 565 - Compiler Design

Spring 2011 CSCI 565 - Compiler Design

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Pedro Diniz<br />

pedro@isi.edu<br />

x = a * b + c * d - e * f;<br />

S<br />

id =<br />

x<br />

E * E<br />

id<br />

a<br />

id<br />

b<br />

<strong>CSCI</strong> <strong>565</strong> - <strong>Compiler</strong> <strong>Design</strong><br />

Assignment: Example<br />

E<br />

id<br />

c<br />

E<br />

E + E<br />

E<br />

*<br />

id<br />

d<br />

E<br />

-<br />

E<br />

E * E<br />

id<br />

e<br />

id<br />

f<br />

<strong>Spring</strong> <strong>2011</strong><br />

// c = 0<br />

t1 = e * f; // c = 1<br />

t2 = c * d; // c = 2<br />

t1 = t2 - t1; // c = 1<br />

t2 = a * b; // c = 2<br />

t1 = t2 + t1; // c = 1<br />

x = t1; // c = 0<br />

• Only 2 Temporary Variables and<br />

hence only 2 registers are Needed

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

Saved successfully!

Ooh no, something went wrong!