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

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

View Full Document Right Arrow Icon
CS 421 Lecture 12: More code generation s Announcements s MP5 posted s Compass issues s Midterm pre-review s Lecture outline s Compiling in context s Assignment s Break statements s Short-circuit evaluation of boolean expressions s Switch statements s Arrays s Code optimization 6/25/2009 1
Background image of page 1

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

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

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

View Full DocumentRight Arrow Icon
Notation s Old: s [ S ] = generated code for S s [ e ] = generated code for e s New: s Use subscripts on brackets for additional arguments s [ S ] L is compiled code for S, assuming S occurs within a switch statement labeled L. s [ e ] x is compiled code for e, assigned to variable x 6/25/2009 4
Background image of page 4
Assignment statements s Old scheme: [ x=e ] = let (I,t) = [ e ] in I; x = t s Can give poor resuts: [ x=3 ] = t = 3; x = t [ x=x+1 ] = t 1 = 1; t 2 = x + t 1 ; x = t 2 s Compile expressions in context of target location: [ e ] x = code to calculate value of e and store it in x [ e ] x : instructruction list 6/25/2009 5
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/01/2009 for the course CS CS421 taught by Professor Kirillmechitov during the Summer '09 term at University of Illinois, Urbana Champaign.

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 Right Arrow Icon
Ask a homework question - tutors are online