Advanced Compiler Construction

Last update: 2026-02-24

339.406 Marr 2KV Tue 13:45 - 15:15 Room: T405 Start: 3.3.2026

The course continues the course Compilerbau (Compiler Construction) from the Bachelor's program. It focuses on code generation for register machines and on code optimizations based on intermediate program representations. The lectures run only until the beginning of June. The rest of the semester is reserved for an optional project in which you will build a small compiler that focuses either on producing code for a register machine or implements optimizations on an IR.

Prerequisite: Compilerbau (or a similar compiler construction course)

Note that Advanced Compiler Construction will be offered only every second year.

This course is taught in person. If you missed a lecture, you can refer to recordings from previous years though, the course evolves over time and the content keeps changing. Moodle may have recordings of this year's lectures, too, but they may be incomplete. Therefore, we strongly recommend that you attend the lectures and benefit from the interactive environment.

Contents

  1. Compilation: The Why, What, and When
    - ahead of time, just in time
    - compilation units
    - metacompilation
    - recap: symbol table

  2. Code generation for register machines
    - Intel IA-32 architecture
    - Design considerations
    - Code buffer management
    - Register allocation
    - Operands during code generation
    - Emitting machine instructions
    - Loading values and addresses
    - Code generation for expressions
    - Code generation for statements
    - Jumps
    - Code generation for control structures
    - Short-circuit evaluation of boolean expressions
    - Code generation for procedures
    - Contents of the object file

  3. Intermediate representations
    - Abstract syntax tree
    - Control-flow graph
    - Def-Use information
    - Dominator tree
    - Static Single Assignment Form (SSA form)

  4. Optimizations
    - Motivation
    - Simple optimizations
    - Copy Propagation
    - Common Subexpression Elimination
    - Dead Code Elimination
    - Procedure optimizations
    - Loop optimizations
    - Instruction Scheduling
    - Peephole optimization

  5. Register allocation
    - Simple register management
    - Register variables
    - Graph Coloring
    - Elimination of Phi instructions
    - Saving and restoring registers

Handouts

The slides and other material are available on Moodle.

Literature

  • Aho A.V., Lam M., Sethi R., Ullman J.D.: Compilers—Principles, Techniques, & Tools. 2nd edition, Addison Wesley, 2012
  • Cooper, K.D., Torczon, L.: Engineering a Compiler. 2nd edition, Morgan Kaufmann, 2012
  • Appel A. W.: Modern Compiler Implementation in Java. 2nd edition, Addison-Wesley, 2007
  • Muchnick, S.: Advanced Compiler Design and Implementation. Morgan Kaufmann, 2003
  • Wirth N.: Grundlagen und Techniken des Compilerbaus. Oldenbourg, 2008

Exam

The written exam will be on Tuesday, June 16, 2026, 13:45-15:15 (closed book). Since this is a combined course (KV), without a project, the best overall mark that can be achieved on this course is 2 (good).

Project

The project is optional. But since without the project the best overall mark is 2 (good), anyone aiming for a 1 (very good), will need to submit one of the projects below.

Please note that you will need to work on the project already before the exam, since we will not be able to mark the exam before the project deadline.

There are two options to chose from to supplement the exam. If you submit and present a good project and have at least 40 out of 90 points in the exam your overall mark will be the exam mark raised by 1.

The project briefs will be released throughout the semester, after having covered enough of the relevant material.

Project Submission: June 22, 2026 on Moodle
Project Presentation: June 23, 2026 between 10:00 and 18:00 (TBC)