opt
Class Optimizer

java.lang.Object
  extended by opt.Optimizer

public class Optimizer
extends java.lang.Object

The Optimizer class optimizes the program. It first converts the AST into a control flow graph of basic blocks containing three address code. It then performs data-flow analyses on the CFG and uses these analyses to transform the CFG. Finally, it converts the CFG to assembly code. This class is incomplete and will need to be implemented by the student.


Constructor Summary
Optimizer(ClassTreeNode root, int optLevel, boolean debug)
          Optimizer constructor
 
Method Summary
 void optimize()
          Optimize the program In particular, will need to do the following: 0 - build any data structures needed like an ordered class list (which is needed by print) 1 - build the control flow graph (cfg) (a) if opt level > 1 then perform high-level transformations as building cfg 2 - if opt level > 2 then perform low-level opt.
 void print()
          Print out program
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Optimizer

public Optimizer(ClassTreeNode root,
                 int optLevel,
                 boolean debug)
Optimizer constructor

Parameters:
root - root of the class hierarchy tree
optLevel - level of optimization
debug - boolean indicating whether debugging is enabled
Method Detail

optimize

public void optimize()
Optimize the program In particular, will need to do the following: 0 - build any data structures needed like an ordered class list (which is needed by print) 1 - build the control flow graph (cfg) (a) if opt level > 1 then perform high-level transformations as building cfg 2 - if opt level > 2 then perform low-level opt. See the lab manual for the details.


print

public void print()
Print out program