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".
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-.
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.
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.
Comments and questions should be directed to hatcher@unh.edu