Project #6: Instruction Selection
Submit: Turn in your entire Project6 directory
using the turnin command
on morbius.mscsnet.mu.edu or one of the
other Systems
Lab machines.
Work may be completed in teams of up to three students.
Be certain to include all team members' names in the file.
Include a comment block at the very top of each file that
contains the following:
/**
* COSC 4400 - Project #
* Explain briefly the functionality of the program.
* @authors [your names]
* Instructor [your instructor]
* TA-BOT:MAILTO [your email addresses]
*/
The Translator
Implement a Instruction Selector for our dialect of the MiniJava programming language, as detailed below.
-
Read Chapter 8 and 9 of Appel.
-
Implement a translator that converts our
Project 5 Intermediate Representation (IR) trees into
MIPS assembly language with an infinite pool of temporaries.
-
Run the reference implementation of the instruction selector on Morbius
with the command:
~brylow/cosc4400/Projects/assem < program.java
-
Create your instruction selector in a package called "Assem" with a main
program in class "Main". My grading protocol will assume that your
project can be compiled and run with the following command line: cd
Project6; make; java Assem.Main < inputfile
-
Build a decent set of MiniJava testcases. Several exist in the book,
and on the web. Having a good set of test inputs will be critical to
your success in later phases of the project. The majority of project
points will be assigned by running diff to compare your output
against mine.
-
Debug until done.
Specification
-
To adapt your intermediate representation trees to the next
phase, you will need to add kids() and build()
methods to work with the Canonicalization code.
(Refer to Appel chapters 8 and 9 for more information.)
-
Add a CodeVisitor class to your Tree< package
that returns a Temp.Temp for the visit methods of each IR
tree node that has an interlocking pattern; the others may return
void. The Mips.Codegen visitor should extend this interface,
and will produce the instruction tilings.
-
I have included complete tarballs for the Assem package
and the Canon package in the project directory.
Hints
My instruction selector uses these
MIPS Patterns to drive instruction selection.
Note that the reference implementation for this project includes
various command-line options for producing more output at various
substages.
I have also provided a register allocator and a Xinu-based MIPS
Playground for you to run your final output on a target backend.
[back]
[Revised 2020 Nov 18 13:39 DWB]