CS 6013 - Modern Compilers, Theory and Practice

Assignment 4: Loop Transformations.

This assignment is the fourth part of a multi part project to write an optimizing compiler for Minijava. We start with LoopyTACoJava2 programs and do analysis that will help in loop transformations. specified transformation only if it is "safe" to do so.

Use JTB and JavaCC, to write in Java one or more visitors which perform analyses required for loop transformations. Your main file should be called P4.java, if P.java contains a program to be optimized in LoopyTACoJava2 form, then

java P4 < P.java

should generate a series of Yes or No answers to the questions (in the form of annotations) present in P.java. Note: Each loop may have an optional annotation, giving the details of the requested loop property (e.g., are the iterations independent). Similarly, an assignment statement inside a loop may have an optional annotation that checks if the expression statement (full statement, not just the expression just the RHS) is loop invariant.

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.