CS 5363: TL07 Compiler Project, Extra Credit #2

Deadline: 1pm, Wednesday, November 21, 2007

Second Extra Credit Assignment, Optimizations

Extra credit can be earned by adding some or all of the following machine-independent optimization passes after translation into SSA before translation back from SSA:

dead-code elimination
Add a pass to your compiler that detects and removes instructions that are useless or unreachable using the algorithm in Section 10.3.1 of your text book. It is not necessary to implement the removal of useless control flow. If you do implement the removal of useless control flow, then you may need to update φ-functions to maintain the proper relation between φ-function operands and the CFG. If you do not implement the removal of useless control flow, you will need to treat branch instructions as "critical".
redundancy elimination
Add a pass to your compiler that detects redundant expressions using the domination-based value numbering algorithm described in Section 8.5.2 of your text book. Pseudocode for this algorithm can be found in Figure 4 of Briggs, Cooper, and Simpson's paper on Value Number.
constant propagation
Add a pass to your compiler that uses the sparse simple constant propagation algorithm found in Section 10.3.3 of your text book.

Include a command-line switch for disabling/enabling individual optimization passes, and a mechanism for outputting the CFG before and after each optimization pass.

Deliverables and Submission

You should include these optimizations with the October 31 and/or November 21 submission. Please, include the following additional information in the cover letter for that assignment:

  1. which optimizations you implemented
  2. how to activate/deactivate them in your compiler
  3. the order of your optimization passes and rationale for choosing that order

Also make sure that your included test cases demonstrate and test your optimizations.

Grading Criteria

You may implement some or all of the 3 optimizations listed above. Up to four points can be earned for implmenting one of the optimizations. Up to seven points can be earned for implementing any two of the optimizations. Up to ten points can be earned for implementing all three of the optimizations. Grading within those ranges will be done on the basis of the correctness of the implemented optimizations.

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.