


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A university project for the compiler construction course in the fall 2006 semester. Students are required to implement various program optimizations, including dead-code elimination and others, using the results of dataflow analysis. The goal is to reduce instruction count and improve performance. The project should be done in groups or individually, with each optimization assigned a number of stars indicating difficulty.
Typology: Study Guides, Projects, Research
1 / 4
This page cannot be seen from the preview
Don't miss anything!



CS 553 Compiler Construction — Fall 2006 Project # Program Optimization Due November 3, 2005
In this assignment you will implement different program optimizations that use the results of data- flow analysis and compare the generated MIPS code in terms of the number of cycles required for execution. This assignment should be done with groups of two, but can be done individually if necessary. Each program optimization will be assigned a number of stars to estimate how difficult it will be to implement it. Groups will implement program optimizations that sum to four or more stars, whereas individuals need only reach a sum of two or more.
Program optimizations such as dead-code elimination, copy propagation, constant propagation, common subexpression elimination, code motion, and induction variable elimination are commonly applied to low-level intermediate representations to reduce the overall instruction count for a pro- gram. The reduction in instruction count resulting from these program optimizations typically results in a performance improvement as well. Also, higher-level transformations often assume various subsets of these optimizations for cleaning up the code after parts of the high-level trans- formation have been applied.
Your assignment is to implement dead-code elimination and one or more other program optimiza- tions in the MiniJava compiler.
For every extra star that you implement, test, and evaluate, you will receive 1 extra point for this assignment.
It should be possible to specify each optimization you implement on the command line. For example,
% java -jar MiniJavaCompiler.jar --copyprop file.java % java -jar MiniJavaCompiler.jar --copyprop --deadcode file.java ...
You should also have a “–fast” option that performs your optimizations in an order that you believe will provides the best possible performance in most cases.
NOTE: For this project, your compiler should not print out debug information. Instead the compiler should just print one line of output indicating each program optimization that is being applied. For example,
Applying constant propagation Applying dead-code elimination Applying copy propagation Applying dead-code elimination Applying register allocation via graph coloring
Your group will need to create at least two test input programs per optimization implemented. To check correctness, compare the output of the MIPS code running with SPIM to the output of the same program run with the JVM. Design your test cases so that they will break an incorrect implementation of the implemented program optimizations. Feel free to share such test cases with other groups in the class, but each group must submit their own two test cases. Individuals not working with a partner must also generate two test cases per optimization.
Your group will also need to create two benchmark input programs. The benchmark programs should be designed to show off one or more of your program optimization implementations. Indi- viduals not working with a partner must also generate two benchmarks. The benchmark programs from the whole class will be run through each submitted compiler using the “–fast” option. We will compare the results from each group in class.
Graph the results for each program optimization you implement, your “–fast” option, the MiniJava compiler provided for the register allocation project, and your version of the compiler that performs register allocation for both of your benchmark programs. Explain the results.
as with any scientific document, you should always cite your references and collaborations. You can either cite collaborations in footnotes or in a separate Acknowledgment section.
There’s no exact number of pages you should write, but if you’ve got between four and six then you’re in the right ballpark.
You should start this assignment early!! You have four weeks so it is tempting to put it off, but I would recommend spending a couple hours a day on the project starting now. Start writing your report as soon as you have dead-code elimination implemented. In fact, write the whole thing based on dead-code elimination and then add the other optimizations in as they are completed. A well-written report with some missing implementation guarantees a much higher grade than a poorly written report with all the implementation.
I can look at your code and help point you in the right direction, but the amount of help I can give may be inversely proportional to the amount of time until the due date. By no means should you spend several hours trying to figure out a weird bug; consult me for help. When e-mailing me about the project, send a copy of the relevant section of your code (not as an attachment; send it as text pasted into your message). Give a good description of the problem including information about the stack in a debugger.
Turn in a hard copy of the report and email a copy in pdf format to [email protected].
Create a jar file that includes all of the bytecode files, the source files, your test cases, and your benchmarks. The jar file should also include a README that gives specific command-lines for running the jar file on your provided test cases.
This assignment is due Friday November 3rd, at 2:10pm and is worth 15% of your final grade. Late assignments will be penalized 10% per day. You have the option of making this assignment worth 10% of your grade and making the register allocation assignment worth 15%. If you would like to switch their weights, please indicate so in your Project 3 report.