uci > ics > franz > teaching > fall 2009 > cs 241

CS 241 — Advanced Compiler Construction

Course Goals

This is a graduate course on advanced compiler construction.

Two developments are driving the need for new techniques of programming language implementation:

  • New hardware architectures (such as RISC and VLIW) require more complex optimizations than their predecessors. We discuss essential optimization techniques such as redundancy elimination, register allocation, and instruction scheduling.
  • New programming languages (such as Java and C#) provide novel features that need to be implemented efficiently. We examine advanced language-implementation topics such as type-directed dispatch, garbage collection, dynamic linking, and just-in-time code generation.

These topics will be introduced in class alongside a programming project, in which students have the opportunity of applying their new knowledge in practice.

Prerequisites

No specific knowledge is assumed for this course. In the first week, we will briefly cover all prerequisites that are typically taught in an undergraduate compiler course. However, all students in this course are expected to be expert programmers in Java, C++ or similar languages. If you haven't programmed in Java before, you will be expected to learn this quickly on your own during the first three weeks of the quarter.

Logistics

  • Class meets Monday and Wednesday 5pm – 6.50pm in ICF 101. Note that the class session is 30 minutes longer than would be considered normal for a 4-unit class. The extra time is used to compensate the instructor's absence due to conference travel. There will be no class on October 28th, November 2nd, 4th, 9th, and 25th.
  • Last day to drop class: Friday, October 16th, at noon (no exceptions).
  • Instructor's office hours: Wednesdays, 3.30pm – 4.30pm in CS1 suite 444.
  • Final project presentations must be completed by Friday, December 4th.
  • No incomplete grades will be given.
  • Read your ICS email! All email sent to your ICS account will be considered read after 3 working days.
  • Project assignments must be submitted in a format that is compatible with the “moss” plagiarism detector from UC Berkeley; specific instructions will be provided later

Topical Outline

  • everything an undergraduate ever needs to know about compilers (a crash repeat course in the first week)
  • intermediate representations, control flow analysis, dataflow analysis
  • value numbering and the Static Single Assignment form
  • redundancy elimination
  • register allocation
  • instruction scheduling
  • loop optimization and procedure optimization
  • type-bound dispatch, run-time typing, garbage collection, functional languages
  • separate compilation and dynamic linking, just-in time compilation (overview)
  • optimizing object-oriented and parallel constructs (overview)

Grading and Course Requirements

In a substantial programming project, students will apply their new knowledge by constructing essential parts of an optimizing compiler. Students may elect to work in pairs.

Students outside the Systems area (classification at the instructor's discretion, if in doubt, ask at the beginning of the course — but in general, you will qualify if your advisor is outside of the Systems division) may elect the S/U or P/N option and complete the course by researching a topic relevant to the course and then presenting it in class (20 minutes total). If you do only the presentation, you will not be given a letter grade.

If you complete both presentation and project, you have the choice between a letter grade and an S/U grade and only need to make that choice when you turn in your project.

Textbook

This class does not use a textbook, and buying one of the many available textbooks on compiler construction is not likely to help you much. Instead, come to the class well rested and alert and simply try to absorb the material as it is being presented in class.

Research Papers To Read

Dominator Trees

efficient generation of the dominator tree for a given control flow graph
T. Lengauer and R. E. Tarjan; "A Fast Algorithm for Finding Dominators in a Flowgraph"; ACM Transactions on Programming Languages and Systems, 1:1, 121-141; 1979.

Static Single Assignment Form

an early paper documenting IBM’s PL.8 compiler (no mention of SSA yet)
M. Auslander and M. Hopkins; "An Overview of the PL.8 Compiler"; Proceedings of the ACM SIGPLAN '82 Symposium on Compiler Construction, Boston, Massachusetts, published as Sigplan Notices, 17:6, 22-31; 1982.

first mention of SSA in the literature (two papers published simultaneously)
B. Alpern, M. N. Wegman and F. K. Zadeck; "Detecting Equality of Variables in Programs"; Proceedings of the Fifteenth Annual ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, San Diego, California, 1-11; 1988.

B. K. Rosen, M. N. Wegman and F. K. Zadeck; "Global Value Numbers and Redundant Computations"; Proceedings of the Fifteenth Annual ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, San Diego, California, 12-27; 1988.

efficient generation of SSA
R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman and F. K. Zadeck; "Efficiently Computing Static Single Assignment Form and the Control Dependence Graph"; ACM Transactions on Programming Languages and Systems, 13:4, 451-490; 1991.

M. M. Brandis and H. Mössenböck; "Single-Pass Generation of Static Single-Assignment Form for Structured Languages"; ACM Transactions on Programming Languages and Systems, 16:6, 1684-1698; 1994.

Register Allocation

Chaitin's original algorithm:
G.J. Chaitin, M. A. Auslander, A. K. Chandra, J. Cocke, M. E. Hopkins and P. W. Markstein; "Register Allocation Via Coloring"; Computer Languages, 6:1, pp. 47-57; 1981.

but this is easier to track down:
G. J. Chaitin; "Register Allocation and Spilling Via Graph Coloring"; Proceedings of ACM SIGPLAN Symposium on Compiler Construction, published as SIGPLAN Notices, 17:6, pp. 98-105; 1982.

the 'other' graph coloring algorithm, rival to Chaitin:
F. C. Chow and J. Hennessy; "The Priority-Based-Coloring Approach to Register Allocation"; ACM Transactions on Programming Languages and Systems, 12:4, pp. 501-536; 1990.

cost functions:
T. A. Proebsting and C. N. Fischer; "Demand-Driven Register Allocation"; ACM Transactions on Programming Languages and Systems, 18:6, pp.683-710; 1996.

almost classic now:
P. Briggs, K. D. Cooper, L. Torczon; "Improvements to Graph Coloring Register Allocation"; ACM Transactions on Programming Languages and Systems, 16: 3, pp. 428-455; 1994.

for a later improvement to Briggs’ algorithm, as well as an SSA based description of it:
L. George and A. Appel; "Iterated Register Coalescing"; ACM Transactions on Programming Languages and Systems, 18:3, pp. 300-324; 1996.

linear-scan register allocation:
O. Traub, G. Holloway, and M. D. Smith; "Quality and Speed in Linear Scan Register Allocation"; Proceedings of the ACM SIGPLAN '98 Conference on Programming Language Design and Implementation (PLDI 1998), pp. 142-151; 1998.

M. Poletto and V. Sarkar; "Linear Scan Register Allocation"; ACM Transactions on Programming Languages and Systems, 21:5, pp. 895-913; 1999.

register allocation via the control-flow hierarchy:
D. Callahan and B. Koblenz; "Register Allocation via Hierarchical Graph Coloring"; Proceedings of the ACM SIGPLAN '91 Conference on Programming Language Design and Implementation (PLDI 1991), pp. 192ff; 1991.

C. Norris and L. L. Pollock; "Register Allocation over the Program Dependence Graph"; Proceedings of the ACM SIGPLAN '94 Conference on Programming Language Design and Implementation (PLDI 1994), pp. 266ff; 1994.

 

last update: 22nd October 2009 - franz@uci.edu