{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

12-More-Code-Generation

# 12-More-Code-Generation - CS 421 Lecture 12 More code...

This preview shows pages 1–6. Sign up to view the full content.

CS 421 Lecture 12: More code generation square4 Announcements square4 MP5 posted square4 Compass issues square4 Midterm pre-review square4 Lecture outline square4 Compiling in context square4 Assignment square4 Break statements square4 Short-circuit evaluation of boolean expressions square4 Switch statements square4 Arrays square4 Code optimization 6/25/2009 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Announcements square4 MP5 posted square4 Parser for MiniJava square4 Due 1:00pm Wed, July 1 square4 Compass issues square4 Midterm pre-review square4 Next Tuesday: midterm review session square4 Past exams and sample questions posted later today square4 See the “Exams” section of the web site square4 Submit your questions on the class newsgroup square4 In the “Midterm review questions” topic 6/25/2009 2
Review: compiler back-end Generate intermediate representation IR Machine- independent optimization SymTable AST 6/25/2009 3 Machine language Code generation IR

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Notation square4 Old: square4 [ S ] = generated code for S square4 [ e ] = generated code for e square4 New: square4 Use subscripts on brackets for additional arguments square4 [ S ] is compiled code for S, assuming S occurs within a switch L statement labeled L. square4 [ e ] x is compiled code for e, assigned to variable x 6/25/2009 4
Assignment statements square4 Old scheme: [ x=e ] = let (I,t) = [ e ] in I; x = t square4 Can give poor resuts: [ x=3 ] = t = 3; x = t [ x=x+1 ] = t 1 = 1; t 2 = x + t 1 ; x = t 2 square4 Compile expressions in context

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 23

12-More-Code-Generation - CS 421 Lecture 12 More code...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online