Monday 4 February 2013

Compiler Design

Intro
  • Slides: [ppt |                      pdf
  • Slides about budget: [ppt |              pdf
  • Slides: [ppt |                      pdf
Program Analysis
  • Slides: [ppt |                      pdf
  • Slides: [ppt |                      pdf
  • Slides: [ppt |                      pdf 
  • Slides: [ppt |                      pdf]
Program Representations
  • Slides: [ppt |                      pdf]
  • Slides: [ppt |                      pdf]
  • Slides: [ppt |                      pdf]
Interprocedural Analysis/Optimizations
  • Slides: [ppt |                      pdf]
  • Slides: [ppt |                      pdf]
  • Slides: [ppt |                      pdf]
Pointer Analysis
  • Slides: [ppt |                      pdf]
  • Slides: [ppt |                      pdf]
  • Slides: [ppt |                      pdf]
Constraint-based analyses
  • Slides: [ppt |                      pdf]

Compilers: Principles, Techniques, and Tools, by Aho, Sethi, and Ullman, Addison-Wesley PPT SLIDES



Course Title: Advanced Compiler Design

Branch: Computer science and Engineering

Text Books Required:  
Compilers: Principles, Techniques, and Tools, by Aho, Sethi, and Ullman, Addison-Wesley,
Course Description:

Download Slides here:


TopicChapter
1.Organization. Overview of Compilation.  l11, 2
2.Lexical Analysis: Regular Expression & Definitions  l3, l43.1-3.3
3. Lexical Analysis: RE<->NFA<->DFA  l4, l5,  Javacc 1 2 3 4 5 6 7 8 9 103.4-3.6
4.Grammars, Recursive Descent Parsing.  l6, l74.4
5.LL Parsing.   l8, l94.4
6.Bottom-up Parsing,   l104.5
7.LR Parsers,   l114.7
8.Item set construction, 1 2 3 4 SLR, LR, LALR,   l124.7
9.Attributes,   l16, l174.9
10.Syntax-Directed Translation,   l15, att5.1
11.Symbol Tables,   l13, st7.6
12.Name Resolution,    l14, l15
13.Abstract Syntax Trees l18, ast5.2
16.Review for Mid-Term Exam
16.Types: type checking expressions and operations l196.1, 6.2
17.Types & Equivalences l20 TypeChecking.ppt6.3, 6.4
18.Types in OO-languages: method resolution l216.5
19.Intermediate code generation: languages, expressions  l22, l248.1-8.4
20.Runtime storage organization l23, pCall7.2, 7.3
21.Intermediate code generation: statements. Optimizations  l25, l268.4-8.7, 9.4
22.Control-Flow Analysis CFA): blocks, flow-graphs, loops l27.5-9.ppt,9.4,10.1,10.4
23.CFA:  l28.15-24.ppt
24.Data-Flow Analysis (DFA):   l29.25-34.ppt
25.DFA: dags, bbOpt.  Global DFA:paths, reaching defs, struct Progs,  p35-47.ppt









 '


Advanced Compiler Design and Implementation,Morgan Kaufmann PDF NOTES

Course Title: Advanced Compiler Design

Branch: Computer science and Engineering

Text Books Required:

  1. Steven Muchnick, Advanced Compiler Design & Implementation, Morgan Kaufmann, August 1997.

  2. Keith Cooper and Linda Torczon, Engineering a Compiler, Morgan Kaufmann, October 2003.

Course Description:

Download Slides here:

NumTopics CoveredRead
1Introduction to Optimizing CompilersSlides; Ch. 1; Ch. 8.1,8.2,8.4
2The HiPE Compiler: An OverviewSlides; Paper 1
3Foundations of Data-Flow Analysis
Introduction to Abstract Interpretation
Slides; Ch. 7.1-7.5,8.1-8.5
4Using Dataflow Analysis for Global OptimizationSlides; Ch. 9.1,9.2
5Static Single Assignment FormSlides; Ch. 8.11; Ch. 9.3
6SSA-based Dead Code Elimination &
Sparse Conditional Constant Propagation
Slides; Ch. 12.6; Ch. 10.3,10.4.1
7Loop OptimizationsSlides; Ch. 13.2, 14.1
8Global Register AllocationSlides; Ch. 16; Ch. 13.1-13.5
9Code SchedulingSlides; Ch. 17.1-17.5; Ch. 12
10Compiler Development & Testing
11Automatic Memory Management (1)Slides; Paper 2
12Automatic Memory Management (2)see slides of previous lecture
13Functional Programming Implementation: Some IssuesSlides
14Virtual Machines and Interpretation TechniquesSlides; Paper 3
15Just-In-Time and Dynamic CompilationSlides; Paper 4


Compiler Construction

Instructor : Hal Perkins
Textbook : Modern Compiler Implementation in Java by Andrew Appel

  1.  Overview (ppt, pdf); regular expressions and scanners (ppt, pdf).
  2.  Grammars (ppt, pdf); LR parsing (ppt, pdf)
  3.  LR parser construction (ppt, pdf)
  4.  LL parsing (ppt, pdf); intermediate representations (ppt, pdf); abstract syntax trees and visitors (ppt, pdf)
  5.  Visitors (concl.); Static semantics (incl. symbol tables and types) (ppt, pdf);
  6. . (Election Day!) Static semantics (concl); x86 overview (ppt, pdf)
  7. Code shape I (statements) (ppt, pdf); Running MiniJava (ppt, pdf);
    (Thursday) Exam 6:30 - 8:00 or so.
  8.  Code shape II (objects and method dispatch) (ppt, pdf); Instruction selection (ppt, pdf);
  9.  Instruction scheduling (ppt, pdf); Register allocation (ppt, pdf)
  10. Optimization overview (ppt, pdf); Dataflow analysis (ppt, pdf); Optimization transformations (ppt, pdf)




Compiler Construction

Instructor: Hal Perkins

Texts :

There are three good, recent compiler textbooks available, none of which clearly dominates the others. Lectures and course materials will draw on all three (among other sources). The current edition of the Dragon Book was picked as the "recommended" text for the course, since it seems to have the best overall balance of material, but any of these books would have been suitable as the choice, and you can use any of them that you'd like:
  • Compilers: Principles, Techniques, & Tools, Aho, Lam, Sethi, & Ullman (Addison-Wesley, 2nd ed., 2007). The "Dragon Book". This is the updated edition of the classic compiler textbook. The coverage of grammars, parsing and optimization is very strong (and has the best theoretical treatment - well beyond what we will do); but the material on semantics and type checking is mixed up with intermediate code generation (something we will deal with), and there is very little about SSA representations of programs (which we'll only touch on lightly). If you already have a copy of the first edition, that will be fine for this course.
  • Modern Compiler Implementation in Java, Appel (Cambridge University Press, 2nd edition, 2002). This book is oriented around a mini-java project that is the basis of our course project, but it has some idiosyncrasies because of the author's background in compilers for functional languages. Probably the most succinct of the three books, and we have used it successfully as the text for this course in the past.
  • Engineering a Compiler, Cooper and Torczon (Morgan-Kaufman, 2004). This book is particularly good on the design tradeoffs needed to build real compilers. Lecture organization and examples will follow this book to some extent. This is currently used as the textbook in the undergrad compiler course (CSE 401), so used copies might be more readily available.

Lecture Slides
Here are links to the PDF and PowerPoint lecture slides.
Title
PDF
PowerPoint
Slides with lecture annotations
Overview and Administrivia
Languages, Automata, Regular Expressions & Scanners
Parsing & Context-Free Grammars
LR Parsing
LR Parser Construction
LL and Recursive-Descent Parsing
Intermediate Representations
Implementing ASTs
Static Semantics
x86 Lite for Compiler Writers
Code Shape I –Basic Constructs
Code Shape II –Objects & Classes
Running MiniJava - Basic Code Generation and Bootstrapping
Instruction Selection
Instruction Scheduling
Register Allocation
Introduction to Optimization
Dataflow Analysis
Optimizing Transformations
Lecture 7 Whiteboards
Analysis & Optimizations & Loops
SSA
Exam Topics
Java Implementation –JVMs, JITs etc.
Memory Management & Garbage Collection
Logistics
 

Audio and Video Archives
On the day after the lecture, video archives will be posted here. If you are running Windows, we recommend that you install WebViewer. WebViewer permits viewing of specially prepared Windows Media live streams and archives with instructor slides and Tablet PC annotations. To use the WebViewer archives, install, then click on links in the WebViewer column below.
Lecture
Video Archive
Windows Media
MP4
Video with slides instead of talking head
(for mobile devices)
WebViewer
Download WebViewer Archive
Lecture 1: Overview, Administrivia, Languages, Automata, Regular Expressions
Lecture 2: Parsing & Context-Free Grammars, LR Parsing, LR Parser Construction
Lecture 3: LL and Recursive-Descent Parsing, Intermediate Representations, and Implementing ASTs
Lecture 4: Static Semantics, x86 Lite for Compiler Writers, Code Shape: Basic Constructs, Objects & Classes
Lecture 5: Code Shape II –Objects & Classes, Running MiniJava - Basic Code Generation and Bootstrapping, Instruction Selection
Lecture 6: Instruction Selection, Instruction Scheduling, Register Allocation, Introduction to Optimization
Lecture 7: Introduction to Optimization, Dataflow Analysis, Optimizing Transformations
Lecture 8: Analysis & Optimizations & Loops
Lecture 9: SSA, Exam Topics
Lecture 10: Java Implementation –JVMs, JITs etc., Memory Management & Garbage Collection, Logistics


Compiler Construction
Instructor : David Notkin
Textbook : Engineering a Compiler Cooper and Torczon ,
Download slides from here

(lexing)
(error handling)
(final topics)



Introduction to Compiler Construction
Instructor : Hal Perkins
Textbook : Introduction to Compiler Construction
Download slides from here
1. Course introduction. slides
S1. no section
2. Intro & history (concl.)
3. Regular expressions and scanners (intro). Read ch. 1, secs. 2.1-2.4. slides
4. Scanners (concl.)
S2. Project, scanners and regular expressions
5. Intro to parsing. Read sec. 3.1-3.2. slides
6. LR (bottom-up) parsing start. Read sec. 3.4. slides
7. LR parsing (cont.)
S3. Parsing
8. LR parsing (concl.);
9. LR conflicts and table construction. Read Sec. 3.5 and computation of First and Follow sets in Sec. 3.3.4. slides
10. LR construction extended example
S4. First/follow sets, parsers
11. IRs slides; AST and visitor pattern slides
12. AST and visitor pattern slides;
13. Visitor pattern (damage control from Monday); LL parsing & recursive descent. slides
S5. No sections this week.
14. LL grammars and parsing
15. Static semantics and type checking slides
16. Attribute gramars; symbol tables (cont.)
16. Midterm review
18. Types, semantics wrapup.
19. x86 overview slides
21. x86 function calling conventions
22 Code shape I - basic constructs. slides
S7. No sections today - Football Thursday. Extra office hours in lab during section times.
23. Code shape
24. Code shape II - objects and dynamic dispatch slides
25. Class canceled - snow happened in Seattle
X. No section or lecture. Many turkeys meet their demise.
26. Running minijava - project details slides
27. Running minijava; Backend overview  slides
S8. Project, misc. topics.
28. Instruction selection and scheduling
29. Register allocation by graph coloring
30. Optimization survey   slides
S9. Wrapup and review
32. Compiling dynamic langauges  slides


Compiler Optimisation

Lecture Notes


The following are powerpoint slides (and associated code) from the lectures.
Lecture 1
Lecture 2
Lecture 3
  • Answers to Assignment #2. Review pattern matching, recursion, and use of let for local variables. Librearies,  References, While Loops, Accumulating parameter functions.  Regular Expressions as programs. RE to NFA
  • Power Point Slides
  • Code from the notes
Lecture 4
Lecture 5
Lecture 6
Lecture 7
  • Grammars, Top down parsing, Transition Diagrams, Ambiguity, Left recursion, Refactoring by adding levels, Recursive descent parsing, Predictive Parsers, First and Follow, Parsing tables.
  • Power Point Slides
  • Code from the notes
Lecture 8
  •  Shift-reduce parsing, Shift-reduce and reduce-reduce conflicts, Precedence parsing,  LR parser , LR parsers and FSAs,               LR parsing Tables, Sets of Items construction.
  • Power Point Slides
Lecture 9
Lecture 10
  • Modified sets of item construction,  Rules for building LR parse tables,  The Action rules, The GOTO rules, Conflicts and ambiguity, Shift-reduce and reduce-reduce conflicts, Parser generators and ambiguity, Ambiguous expression grammar, Ambiguous if-then-else grammar, Ml-yacc.
  • Power Point Slides
  • A directory of Ambiguous Examples in ml-yacc.
Lecture 11
  • ml-Yacc, Actions when reducing, Making ml-yacc work with ml-lex, Boiler plate.
  • Power Point Slides
Lecture 12
  • Basic Types, Constructed Types, Representing types as data,  Describing type systems as rules, Type rules for ML, Type equality,Type coercions, Sub typing. Purpose of type systems, Kinds of type systems, Primitive types, Constructed types, Type checking, Attribute grammars, Inherited attributes, Synthesized attributes, Adding attributes to trees, Programs for computing attribute computations.
  • Power Point Slides
Lecture 13
Lecture 14 (Guest Lecturer by Jim Hook, Feb 28, 2007)
  • Writing type-checkers in ML, Role of type rules,  Representing types, Representing programs, Handling errors,                Guessing types, Declarations, Let expressions .
  • Power Point Slides
  • Code from the notes.
Lecture 15
  • Judgments for mini-Java,   Multiple type environments,  Class Hierarchy, Setting up an ML typechecker for mini-Java,               Subtyping, Rules for Java, Declarations as functions over environments.
  • Power Point Slides
Lecture 16
Lecture 17
  • Procedure Abstraction,   Name Spaces, Scoping Rules,  Activation Records, Object Oriented Languages, Parameter Passing,      Returning Values.
  • Power Point Slides
Lecture 18
  • Syntax directed translations,  Meanings of programs,  Rules for writing a compiler, Intermediate code Pascal-like language               Run-time environments Calling sequence Variable references.
  • Power Point Slides
  • Code from the notes.

  • Additional notes to be posted here as lectures are given.
Lecture 19
Lecture 20
  • Displays, Memory Layout, Heap Allocation, Garbage Collection, Translating Mini Java.
  • Power Point Slides



Optimizing Compilers


Professor John Cavazos

   Lecture (Tenative Outline)                         Slides                            Papers / Resources / Notes

2/10 Course OverviewSlides (PPT)
2/12 Overview of Compilers and JikesRVMSlides (PPT)Read Compiler Wikipedia Page   and JikesRVM (formerly known as Jalapeno) Paper.



2/17 Control Flow and Project IdeasSlides (PPT)Read the following Wikipedia pages (section)
Graph Theory (Basics)
Basic   Blocks
Control Flow Graphs



2/19 More Control FlowSlides (PPT)Read the following Wikipedia page   (section) Graph Theory (Dominance)



2/24 Overview of JikesRVM, Phase I, and Data FlowTA Slides (PPT) Slides (PPT)T.J. Marlowe and B.G. Ryder   Properties of Data Flow Frameworks, pp. 121-163, ACTA Informatica, 28, 1990. Paper Here



2/26 Data FlowSlides (PPT)Engineering a Compiler, Chapter 8,   Sections 8.3, 8.4, 8.6



3/03 More Data FlowSlides (PPT)Compilers: Principles, Techniques,   & Tools. 2nd edition (Dragon Book), Chapter 9, Sections 9.2,9.3, 9.4



3/05 Yet More Data Flow and Intelligent CompilationSlides (PPT) Slides (PPT)Compilers: Principles, Techniques,   & Tools. 2nd edition (Dragon Book), Chapter 9, Sections 9.2,9.3, 9.4 and Intelligent Compilation Paper



3/10 ILP, Memory, and Syncronization Slides (PPT)Guest Lecture: Joseph Manzano



3/12 Optimization Tradeoffs Slides (PDF)Guest Lecture: Xiaoming Li



3/17 Static Single Assignment ISlides (PPT)Efficiently computing static   single assignment form and the control dependence graph, Cytron et al. Paper   Here



3/19 Static Single Assignment IISlides (PPT)Engineering a Compiler, Chap. 9   (Sections on SSA)



3/24 Midterm




4/7 Dynamic Compilation ISlides (PPT)Adaptive optimization in the   Jalapeno JVM, Arnold et al. Paper   HERE



4/9 Dynamic Compilation IISlides (PPT)Adaptive optimization in the   Jalapeno JVM, Arnold et al. Paper   HERE



4/14 Method ProfilingSlides (PPT)



4/16 Feedback Directed CompilationSlides (PPT)



4/21 Register Allocation ISlides (PPT)Read the following Wikipedia pages   (section)
Register Allocation



4/23 Register Allocation IISlides (PPT)Advanced Compiler Design and   Implementation, by Stephen Muchnick (pgs 482-486, 494-520)



4/28 Instruction Scheduling ISlides (PPT)Read the following Wikipedia pages   (section)
Instruction Scheduling



4/30 Class Cancelled




5/5 Instruction Scheduling IISlides (PPT)Read the following Wikipedia pages   (section)
Instruction Scheduling



5/7 Loop Transformations ISlides (PPT)Read the following Wikipedia pages   (section)
Loop Optimizations



5/12 Loop Transformations IISlides (PPT)Read the following Wikipedia pages   (section)
Loop Optimizations



5/14 ETI Architecture and Compiler




5/18 Future Parallel LanguagesSlides (PPT)





Download Slides here:
  1. Introduction
  2. Lexical Analysis
  3. Parsing #1
  4. Parsing #2
  5. Abstract Syntax
  6. Semantic Analysis
  7. Run-time Storage Organization
  8. Intermediate Representation
  9. Instruction Selection
  10. Liveness Analysis and Register Allocation
  11. Storage Allocation
  12. Functional Languages and Higher-Order Functions
 




Compiler Design

Lecture Notes
Slides
  • Course Introduction PDF
  • Overview of Compiler PDF
  • Lexical Analysis PDF
  • Add'l Lexical Analysis Notes PDF
  • Context-Free Grammars and Parsing PDF
  • Syntax-directed translation PDF
  • Types PDF
  • Type Checking PDF TXT
  • Evaluation and Runtime Environments PDF
    • Variables, bindings, storage allocation TXT
    • Symbol Table PDF TXT
    • Expression evaluation and basic control-flow TXT
    • Parameter passing TXT
    • Object-oriented languages TXT
  • Exceptions, memory management PDF
  • Intermediate code generation PDF
  • Optimization and Program analysis PDF
  • Machine code generation PDF
  • Review/Summary PDF


Programming Languages
and Compilers

Download :

Class
Topic
Lecture slides (pdf)
1
Introduction to course; intro to OCaml
2
Ocaml - tuples and lists
3
OCaml - type definitions, abstract syntax
4
Language implementation overview
5
Lexical analysis
6
Regular expressions, Ocamllex
7
Parsing - context-free grammars, recursive descent parsing
lecture 7(lecture 7 ann) (Code from lecture: 1, 2, 3,1b, 2b, 3b, 3c)
8
Top-down parsing
9
Bottom-up (shift/reduce) parsing
10
LR parsing - conflict resolution

Review for midterm 1 (optional)

Midterm 1 - 180 Bevier Hall, 7-8:30PM
11
Code generation
12
Code generation (cont.)
13
Garbage collection; run-time systems for dynamic languages
14
History of programming languages
15
APL
16
Functional programming: higher-order functions
17
More higher-order functions

Spring break

18
Even more higher-order functions
19
Functional programming in o-o languages
20
Review for midterm 2 (optional)

Midterm 2 - 151 Everitt Lab, 7-8:30PM
21
Inference systems; formalizing operational semantics
22
Type systems
23
Operational semantics
24
Hoare logic for imperative languages
25
Hoare logic for imperative languages
26
Advanced topics: Lazy evaluation; lambda-calculus
27
Advanced topics: functional programming for parallelism
28
Wrap-up; review for final; preview of follow-up courses

No comments:

Post a Comment