CS980-01
Advanced Compiler Design
Fall 2007
Mon/Wed 1:40-3:00pm, Kingsbury N141


Instructor: P. Hatcher
Office: Kingsbury N229/N221D
Phone: 862-2678
E-mail: hatcher@unh.edu
Office Hours: MW 10:30-11:30am, or by appointment (send e-mail to request an appointment).

This course will study compiler back-ends. We will begin with an intermediate representation of a program and examine how to translate that intermediate form to efficient assembly language for a given target machine. We will also discuss issues in constructing run-time support libraries.

Topics to be covered include: compiler intermediate forms, instruction selection, register allocation, dataflow analysis, optimization, and garbage collection.

The course will be project-based. The project will concern the construction of a back-end for C. We will start with a front-end for C, which was constructed by prior CS712/CS812 classes. The bulk of the project will follow Chaitin's classic paper ( Chaitin, "Register Allocation and Spilling via Graph Coloring", ACM/SIGPLAN 1982 Symposium on Compiler Construction) on using graph coloring to do register allocation.

The prerequisite for this course is CS520. or the equivalent. You do NOT need CS712/CS812 to take this course. We will begin the course with a discussion of compiler intermediate forms. (You may want to later take CS712/CS812 to learn about compiler front-ends: how to translate programs in text form to an intermediate form.) Please contact me if you have any questions about your preparedness for this course.

Undergraduates who are seniors and who have a strong record (GPA at least 3.2) are encouraged to petition to take this course. The course will count as a Computer Science elective. Please contact me for more information.

For graduate students, this course is considered "implementation intensive".

Grading

The major portion (90%) of your course grade will be based upon the course project. The project will consist of six phases:

  1. Simple port to 64-bit architecture - due September 24 (15%).

  2. Generate code utilizing pseudo registers - due October 8 (15%).

  3. Build control-flow graphs - due October 22 (15%).

  4. Calculate live ranges - due November 5 (15%).

  5. Build interference graphs - due November 19 (15%).

  6. Color the interference graphs to allocate registers - due December 17 (15%).

Project assignments may be turned in up to two days late with no penalty. Assignments may NOT be turned in beyond two days late without prior approval by me. To be on-time a project assignment should be turned in before 1:30pm on the due date. The two-day grace period expires at 1:30pm two days after the due date.

Please note that the project is accumulative. You cannot skip any of the assignments! Since the project is accumulative, I will in essence re-grade the earlier project assignments when grading the later assignments. Through this re-grading, you can re-gain up to 50% of the points deducted from the original grading of the immediate prior or second immediate prior assignment.

WARNING: All students are expected to do their own work on all assignments, unless otherwise explicitly approved by me.

WARNING: To get full credit on a project assignment, your code should be adequately documented and structured. If I can't easily read and understand your code, you will lose points!

A small portion (10%) of your course grade will be determined by your attendance and active participation in class. In particular, we will be having a number of programming project design sessions during class. I expect all students to be active participants in these sessions, as well as the rest of the classes.

In summary, your course grade will be determined in the following way:

Students receiving at least 75% of the course points are guaranteed at least a B-. Students receiving at least 85% of the course points are guaranteed at least an A-.

Textbook

There is no required textbook for this course.

On reserve in the Kingsbury library:

I do not think you need to purchase this book. Access to the copy on reserve in the library should be sufficient.

Other Reading

We will need access to details about the 32-bit and 64-bit Intel architectures. Intel maintains a webpage about their manuals for these architectures. I think these three will be the most useful:

You may also want to consult:

The manual for the GNU assembler will also be useful. (In particular, be aware that the syntax used by Intel differs from that used by default by the GNU assembler. See the relevant section of the GNU assembler manual.)

Also, you may need to use gdb to debug both the compiler and the output of the compiler. The GNU manual for gdb is here. To debug at the assembly language level, read about the stepi/nexti commands, how to display registers, and the break *address command.

Computing Resource

The UNH CIS server gauss.unh.edu is the primary computing resource for this course. This machine has Intel's 64-bit quad-core CPUs, which is the architecture we are targeting in the programming project. You should automatically have an account on this machine. During the semester you may use any other machines that you have access to, but for grading purposes your assignments must execute on gauss.unh.edu.


Last modified on September 3, 2007.

Comments and questions should be directed to hatcher@unh.edu