CS 75 Project 4: Optimizations

Due by 11:59pm May 2

As you enhance your compiler with optimizations remember that the two main concerns are safety and profitability. We only want to modify the code in ways that improve it while still maintaining its meaning. Therefore you should only include optimizations that you can guarantee will always be correct.

To get the starting point code for this project do update75.

Required Optimizations

Required command-line arguments

Your compiler should be implemented so that it can be invoked in the following ways.

Your pre-optimization phase should report how many passes through the abstract syntax tree have been made. Your post-optimization phase should report the reduction in the number of lines of mips code. For example, your compiler might output the following:
Compiling test.c--
   Output test.mips
   preOpt True
  postOpt True
Executing preOptimizations
Passes: 2
Executing postOptimizations
Reduction in lines of assembly code: 5

Testing optimizations

In your directory for this project, include a subdirectory called optTests. This directory should contain at least two test programs for each optimization that you implemented. Also include a file called TEST-SUMMARY that lists each test name and its purpose.

Optional features

Once you have successfully completed all required aspects of the C-- compiler (including optimizations), you can then attempt additional features for extra credit. An incomplete implementation of the required functionality plus an added feature will result in a lower grade than a complete implementation of the required functionality without any additional features.

Possible additional features include:

Project report

In your project directory you must include a text file called report.txt. Using at most two pages, give an overview of the design of your compiler. Explain the overall approach as well as each major component. You should describe the optimizations that you've included, as well as any additional features you've provided. If there are any aspects of your compiler that have not been fully implemented or are not working properly, your should discuss them here.


Run handin75 to turn in your complete compiler. Make sure that your cs75/projects/4 directory contains all of the code necessary to run your compiler.