COS 320, Spring 2000. Programming Assignment
Back-end Module Implementation
Implement the following modules that are described in Chapters 6-12 of Modern Compiler Implementation.
- FindEscape
(Chapter 6).
- Translate
(Chapter 7); includes parts of Semant and Frame.
Also implement one of the following modules that are described in
Chapters 6-12 of Modern Compiler Implementation.
These modules are:
- Codegen
(Chapter 9).
- MakeGraph
(Chapter 10).
- Liveness
(Chapter 10).
- RegAlloc
(Chapter 11).
- Frame (Chapter 12).
The directory /u/cs320/chap6+ contains a number of
signatures and source fragments that serve as starting points. There
are a few changes with respect to the textbook:
- In the Frame module: Some functions have been
given slightly more descriptive names. In particular,
procEntryExit1 is now called
moveArgs, procEntryExit3 is called
entryExit. The functionality
procEntryExit2 is now implemented by a combination of
the new liveAtReturn function and an additional
argument to MakeGraph.instrs2graph.
- In the Frame module: The frame for a given
function should keep track of the largest number of arguments passed
at any call to other functions. This will enable
entryExit to calculate the correct framesize more
cleanly (see above, also see discussion on page 243). The function to
announce a call with a given number of arguments is call.
- In MakeGraph: The function
instrs2graph takes an additional argument of type
Temp.temp list. Here one should pass the value obtained from
Frame.liveAtReturn. Thus, there is no need for a fake
instruction that "uses" the variables that
are live upon return of a function. (See discussion on pages 196 and 197.)
- In Liveness, the function
interferenceGraph takes a
Flow.flowgraph as well as a Flow.Graph.node
list. The latter is the same list that was produced by
MakeGraph.instrs2graph -- the list of nodes in
the order that corresponds to the order of instructions.
Write dummy versions of your modules that ignore its input
and produce the output appropriate for a given sample program.
Write versions of your modules that mostly work. (Do
FindEscape, Translate, and one
other.) Verify that the dummy input given to you by other teams is
reasonable and correct.
Produce versions of your modules that you warrant as correct.
Prepare a beautifully documented version for your classmates
to read.
And, since warrantees aren't everything, fix the bugs reported to you
by your classmates.