CSE4251/CSE5251: Assignment 7

.

Incorporate canonicalization (Chapter 8), add the "maximal munch" algorithm "Chapter 9: Instruction Section," page 216. Your makefile should create an executable jar file called select.jar. The compiler is required to write a *.s file.

As usual, in all cases there must be a single line of output to the standard output stream of the following form:

filename=dir/Test.java, errors=0
The one line must contain exactly one comma, one space, two equals signs, and so on. Nothing must be written to the standard error stream unless there are errors detected by your compiler and the error messages are properly formatted.
dir/Test.java:001.011: some error message
dir/Test.java:034.014: another error message
In addition to correctly formatted output, it is important that your compiler does not fail for any reason. By "not failing" I mean the compiler always runs to completion quickly, terminates normally, and returns an exist status of zero.

All, or most, of the code for this phase could be in a one file. It could be placed in a package called sparc, since it is specific to the machine architecture.

Canon and Assem package

Revisions of the Java class files are found in the jar file support.jar. Two packages are used for the first time in this assignment. Use these two packages as-is without modifying any of the classes. Nothing needs to be added to these packages. The source and class files for these packages are in the support.jar file (among other things).

The (revised) canon package has a method in the class Main that encapulates all the work of chapter 8.

public static List<Stm> transform (Stm s) {
   final List<Stm> stms = Canon.linearize (s);
   final List<List<Stm>> bb = BasicBlocks.makeBlocks (stms);
   final List<Stm> traces = TraceSchedule.trace(bb);
   return traces;
}

Output

Any debug/verbose output should be written to another file and could show the IR trees after linearization. There is less need for debug/verbose output, because now the output file .s should now be written. Though the output file is not real SPARC assembly code (yet), a printable form of the instructions can be printed out. This is necesary to debug instruction selection.

Turning it in

Turn in the source code for the project using the submission server. The submit project tag for this assignment is . For your convenience, here is a submission form for this assignment.