CMPUT 680 - Compiler Design and Optimization
1
CMPUT680 - Winter 2006
Topic0: IntroductionJosé Nelson Amaral
http://www.cs.ualberta.ca/~amaral/courses/680
CMPUT 680 - Compiler Design and Optimization
2
Instructor: Prof. Jose Nelson AmaralOffice ATH 342Phone 492-5411Office Hours: Anytime (appointment
suggested but not required) email: [email protected]:
http://www.cs.ualberta.ca/~amaral/courses/680
Admin. Information
CMPUT 680 - Compiler Design and Optimization
3
Some People You Want to be Friend With
Kit BartonPaul Berube StephenCurial
ZhuangGuo
CMPUT 680 - Compiler Design and Optimization
4
Mailing List
Important announcements will be made throughthe class mailing list (some only in the list).
I have created an alias for the students in CMPUT 680. If you have not received anemail from me, please send me an email.
CMPUT 680 - Compiler Design and Optimization
5
Bibliography1. A set of papers - to be assigned
2. Books: Randy Allen, Ken Kennedy, Optimizing Compilers for Modern Architectures: A Dependence-based Approach, Morgan Kauffman, 2001.
Andrew W. Appel : Modern Compiler Implementation in C
A. Aho, R. Sethi and J. Ullman, Compilers: Principles, Techniques and Tools (The Dragon Book), Addison Wesley, 1988
M. Wolfe, High Performance Compilers of Parallel Computing, Addison Wesley, 1995
S. Muchnick, Advanced Compiler Design and Implementation, Morgan Kaufman, 1997
CMPUT 680 - Compiler Design and Optimization
7
3. JournalsIEEE ComputerTransactions on ComputersConcurrencyTransactions on Parallel and Distributed SystemsACM TOPLAS - Transactions on Programming
Languages and SystemsTransaction on Computer SystemsJPDC Journal of Parallel and Distributed
computingJSC Journal of SupercomputingJPP International Journal of Parallel
ProgrammingPC Parallel Computing (North-Holland)JPL J. of Programming Languages
Bibliography
CMPUT 680 - Compiler Design and Optimization
8
4. Conference ProceedingsPLDI ACM Symposium on Programming Language Design and
ImplementationPOPL ACM Symposium on Principles of Programming LanguagesPPOPP ACM Symposium on Principles and Practice of Parallel ProgrammingICPP International Conference on Parallel ProcessingICS International Conference on SupercomputingLCPC Intern. WS. on Languages and Compilers for Parallel ComputingPACT Parallel Architectures and Compilation Techniques (since 1994)IPPS International Parallel Processing SymposiumEUROPAR European Parallel Processing ConferencesMICRO ACM/IEEE Symposium on MicroarchitecturesISCA ACM/IEEE International Symposium on Computer ArchitectureASPLOS ACM Symposium on Architecture Support for Program Languages and Operating Systems
Bibliography
DevelopmentCompiler
Source Code
ApplicationSource Code
ExpectedApplication
Output
ApplicationOutput
ResidentCompiler
DevelopmentCompiler
CompiledApplication
ApplicationOutputVerifier
ApplicationInput
Compiler Development Test Cycle
CMPUT 680 - Compiler Design and Optimization
10
Structure of an Optimizing Compiler
source code
intermediate code
compiler front-end
machine code
loop optimizationregister allocation
code generationcode scheduling
CMPUT 680 - Compiler Design and Optimization
11
Phases of a CompilerSource program
Lexical Analyzer (Scanner)
Tokens
Syntax Analyzer (Parser)
Parse tree
Semantic Analyzer
Abstract Syntax Tree w/ Attributes
Intermediate-code Optimizer
Optimized Intermediate Code
Target-code Generator
Target machine code
Intermediate-code Generator
Non-optimized Intermediate Code
Lexicalanalyzer
String of characters
String of tokens
Parser
Parse tree
Semanticanalyzer
Abstract syntax tree
Translator
Low-level intermediate code
Optimizer
Low-level intermediate code
Finalassembly
Relocatable object module orrunnable machine code
Lexicalanalyzer
String of characters
String of tokens
Parser
Parse tree
Semanticanalyzer
Abstract Syntax tree
Intermediate-codegenerator
Medium-level intermediate code
Optimizer
Medium-level intermediate code
Code generator
Low-level intermediate code
Postpassoptimizer
Relocatable object module orrunnable machine code
Two models of compiler structures(Muchnick, pp. 08)
Low-level Model Mixed-level Model
1. Introduction
2. Lexical Analysis 3. Parsing 4. Abstract
Syntax5. Semantic Analysis
6. Activation Records
7. Translation to Intermediate Code
8. Basic Blocks and traces
9. Instruction Selection
12. Putting it All Together
10. Liveness Analysis
11. Register Allocation
17. Dataflow Analysis
18. Loop Optimizations
19. Static Single- Assignment Form
20. Pipelining, Scheduling
21. Memory Hierarchies
15. Functional Languages
13. Garbage Collection
16. Polymorphic Types
14. Object-Oriented Languages
Course Teaching Sequence(Appel, pp. x)
1. Introduction
2. Lexical Analysis 3. Parsing 4. Abstract
Syntax5. Semantic Analysis
6. Activation Records
7. Translation to Intermediate Code
8. Basic Blocks and traces
9. Instruction Selection
12. Putting it All Together
10. Liveness Analysis
11. Register Allocation
17. Dataflow Analysis
18. Loop Optimizations
19. Static Single- Assignment Form
20. Pipelining, Scheduling
21. Memory Hierarchies
15. Functional Languages
13. Garbage Collection
16. Polymorphic Types
14. Object-Oriented Languages
Course Teaching Sequence(Appel, pp. x)
Lex
Sou
rce
Pro
gram
Parse
Tok
en ParsingActions
Red
uct
ion
s
SemanticAnalysis
Abs
trac
t Syn
tax
Tables
Environ-ments
Translate
Tra
nsl
ate
FrameFrameLayout
Canon-icalize
IR T
rees
InstructionSelection
IR T
rees
RegisterAllocation
Inte
rfer
ence
Gra
ph
CodeEmission
Reg
iste
r A
ssig
nm
ent
Assembler
Ass
embl
y L
angu
age
Linker
Rel
ocat
able
Obj
ect C
ode
Mac
hin
e L
angu
age
ControlFlow
AnalysisAss
em DataFlow
Analysis
Flo
w G
raph
Ass
em
Phases of a compiler, and interfaces between them
(Appel, pp. 4)