CS 6013 - Modern Compilers, Theory and Practice

Assignment 6: Register allocation

This assignment is the fifth part of a multi part project to write an optimizing compiler for Minijava. In this assignment, we start with programs in (miniIR) format and translate them to (miniRA).

Use JTB and JavaCC and write in Java one or more visitors which translate miniIR programs to MiniRA form. Your main file should be called RegAlloc.java, if P.miniIR contains a program to be register allocated then

java RegAlloc < P.miniIR > P.RA

should create P.RA in miniRA form and is semantically equivalent to P.miniIR. Note, your program must take input from standard input and write to standard output (so that we can use redirection).

To check that a program is in miniRA form, you could tie the miniRA.jj and Main.java to build a parser. To ensure that your miniRA program is semantically equivalent to the MiniIR program, you can use the interpreter of miniRA (download) to compare the output of P.miniIR with the output of the miniRA program generated by RegAlloc; say the generated miniRA code is stored in P.miniRA, then to invoke the interpreter use: java -jar kgi.jar < P.miniRA ]. A sample Main.java can be found here.

Grading policy
Your homework will be graded for a total of 100 marks. 20 marks for the contributed testcases and 80 marks for the TAs testcases. Students can get upto 10 bonus points by contributing good testcases. Details can be found here.
[ under development ]