pcc3 is a compiler for nearly all of ANSI 1989 C. (Two major features that are missing are old-style functions and bitfields.) This compiler was constructed by UNH students working over many years in both CS712 and in individual projects. The version of the compiler you will be working on was completed by the Spring 2003 CS712 class. This version of the compiler targets the Intel IA-32 architecture and also assumes that the compiler itself is running on the IA-32 architecture. The compiler generates very simple stack-based code.
The concrete goal for this assignment is to port pcc3 to the Intel EM64T architecture. The EM64T architecture is compatible with the AMD x86-64 architecture and simply extends the IA-32 architecture. You may assume the compiler will both run on the EM64T architecture and will generate code for the EM64T architecture. You should continue to generate very simple stack-based code.
The more abstract learning goal for the assignment is to learn about abstract syntax trees, a form of an intermediate representation for programs, and to investigate the challenges in writing portable compilers. How well was pcc3 designed for portability?
The class will cooperate on this assignment. We will hold design meetings during class, starting on Monday September 10. We will attempt to divide the work up and distribute it among the students. You will be responsible for integrating other students' contributions into your own copy of the compiler, which will be submitted to me when everything is done.
The compiler comes with a validation suite, which will allow us to validate the EM64T compiler against the IA-32 compiler. In addition, we should be able to compile most of the compiler with itself.
Start by picking up the pcc3 distribution. You will want to begin by looking at the following files:
Do not worry if this code does not make a lot of sense to you when you first look at it. We will be discussing this code in class, starting on Wednesday September 5.
To submit this assignment you should tar and gzip up all the necessary modifications to pcc3 and e-mail me the resulting file.
This assignment is due at 1:30pm on Monday September 24. However, these is a two-day grace period that ends at 1:30pm on Wednesday September 26. No assignments may be submitted after this time without my prior approval.
Comments and questions should be directed to hatcher@unh.edu