11-Code-Generation - CS 421 Lecture 11: Code generation...

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

View Full Document Right Arrow Icon
CS 421 Lecture 11: Code generation s Lecture outline s Compiler structure s Run-time environment s Execution of static languages s Code optimization – why? s Code generation s Code optimization – how? 6/23/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
Compiler structure s For traditional (static) languages: ource Front AST Back Machine 6/23/2009 2 Source end Symbol table end language
Background image of page 2
Review: front end Source Lexer Token file Scanner Tokenizer 6/23/2009 3 AST Parser Symbol table Type checking
Background image of page 3

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

View Full DocumentRight Arrow Icon
Back end Generate intermediate representation IR Machine- independent optimization SymTable AST s Intermediate representation (IR) is simpler to operate on than machine language 6/23/2009 4 Machine language Code generation IR
Background image of page 4
Run-time environment s Once we have the program in machine code, how do we run it? s Instructions executed directly on HW s OS calls? s Variables? s Function/procedure calls? s Memory architecture s Information about the program 6/23/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
Run-time environment s Memory layout: 6/23/2009 6
Background image of page 6
s Stack structure: Local variables Stack before calling a routine FP P Stack after calling a routine
Background image of page 7

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

View Full DocumentRight Arrow Icon
Image of page 8
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 / 22

11-Code-Generation - CS 421 Lecture 11: Code generation...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online