CS 6013 - Modern Compilers, Theory and Practice

Assignment 4: Function Inlining.

This assignment is the fourth part of a multi part project to write an optimizing compiler for Minijava. We start with FunkyTACoJava (very similar to TACoJava) programs and after doing function inling, generate programs back in TACoJava programs.

Use JTB and JavaCC, to write in Java one or more visitors which implement function inlining (provided it is profitable). Your main file should be called P4.java, if P.java contains a program to be optimized in FunkyTACoJava form, then

java P4 < P.java > Pf.java

should create Pf.java in FunkyTACoJava2 form and is semantically equivalent to P.java with some function calls inlined (as specified in the input FunkyTACoJava program). Use the discussed CHA (class hierarchy analysis) to identify and inline the monorphic calls. Note, your program must take input program from standard input and write to standard output (so that we can use redirection).

Grading policy
Your homework will be graded for a total of 100 marks.