CS 5363: Compiler Project, Part #3
Submission Deadlines:
- First Draft: 5pm, October 18, 2005
- Graded Submission: 5pm, November 1, 2005
Project Overview
In this class, you will be writing an optimizing compiler for a
toy programming language, which we will call, TL05 (and targeting the
SPIM MIPS Simulator.)
You may choose C, C++, or Java to implement your compiler, but it must
compile and run on the machines in the Computer Science Department's
Linux lab. (If you choose C or C++, you will also need to create a makefile
that will build an executable from your source files.) The entire compiler
must be your own, independent work, and each assignment will build on the
work of the previous assignments.
Third Assignment
The third assignment is to complete the compiler front-end by adding
an additional phase that translates your TL05 Abstract Syntax Tree
into basic blocks of three-address code instructions (Section 5.4.2 of your
textbook) with he following properties:
- Each basic block ends in a conditional or unconditional branch
(a.k.a., jump). (As in your textbook.)
- The instructions are in Static Single Assignment Form. (i.e.,
there is only one instruction that assigns to each IR variable,
and φ-functions are used to alternative original program
variable definitions reaching join nodes. (See Section 5.5 of your
textbook.)
In addition, you should provide a mechanism to output the control flow
graph (with the nodes corresponding to basic blocks and labeled with
the appropriate IR instructions).
It is recommended, that...
- ... you base your three-address code on ILOC. (C.f., Appendix A of your
textbook.)
- ... you get the CFG output working as early as possible to aid in your
debugging.
- ... you represent instructions with quadruples and connect the
instructions within a basic block using a linked list. (C.f.
Section 5.4.3 of your text book.)
- ... you use Brandis and Mössenböck's
Single-Pass SSA
Generation algorithm in conjunction with a tree-walk approach to code
generation (c.f., Section 7.3.1 of your text book). But it is
also permissible to first generate non-SSA three-address code and
then use another SSA-generation algorithm, such as Aycock and Horspool's,
or the one on Section 9.3 of your text book. (If you're really
adventurous, there's a
new SSA generation
algorithm that was just published in the May issue of TOPLAS.)
- ... you implement support for arrays after you've completed and tested
everything else. Array accesses and updates should be expanded to actual
memory accesses (see section 7.5). The single-assignment property
of SSA should apply to the temporaries involved in the address
computations, but it is not necessary that it apply to the individual
array-elements.
You may find it useful to refer to the new
informal semantics of the TL05 language.
Deliverables and Submission
When you have completed your assignment, you should create a tar
archive or zip file containing your source files (with the correct
package-based directory structure if you're using Java), the makefile
(if your compiler is in C or C++), and your test cases. These should
be attached to an email to vonronne@cs.utsa.edu. The subject of this
email should containing the text "CS 5363 Submission #3", and the
body should contain a "cover letter". This "cover letter" must contain:
- Your name.
- A statement that the attached source files are your own work.
- A statement of approximately how many hours it took to complete the
assignment.
- Instructions for compiling and running your submission.
- A description of any known limitations of the implementation
being turned in (e.g., incomplete features, test cases that
don't run)
- A list of deficiencies that were in the parser, type checker, etc.
when part #2 was submitted, but our now fixed.
- Anything else you think I should know while grading your assignment
Grading Criteria
This assignment has two due dates. You are required to turn in the current
state of your compiler by the first due date, at which time you will be given
suggestions for further improvements. Your first submission will not, however,
be graded until the second deadline. If you wish to implement optimizations
in your compiler (which will be extra credit), you should attempt to finish
this part by the first due date.
As a matter of policy, late work will not be accepted. Partially
completed assignments will, however, be evaluated for partial credit.
This assignment depends on the parser working correctly, so the
correctness or incorrectness of the scanner/parser may be considered
when grading this assignment. Projects will be evaluated using a
rubric similar to the following:
- 75% - implementation
- 15% - data structure design
- 20% - code generation for statements
- 20% - code generation for expressions
- 20% - SSA generation
- 10% - output
- 10% - quality of test cases
- 5% - cover letter
In addition, extra credit will be given for deficiencies in the parser
and type checker that have been remedied, since part #2 was turned in.
A penalty of up to 50% may be deducted if the program doesn't compile
and run on the machines in the department's Linux lab.
Errata
There may need to be corrections, clarifications, or other modifications
to these instructions, you are responsible for monitoring the class web
site, monitoring your CS account mailboxes, and listening during lecture
for announcements related to this assignment.
- 10/8/2005: Changed the cover letter instructions to state that
the list of corrected deficiencies should be relative to part #2.