org.jikesrvm.compilers.opt.driver
Class OptimizationPlanElement

java.lang.Object
  extended by org.jikesrvm.compilers.opt.driver.OptimizationPlanElement
Direct Known Subclasses:
OptimizationPlanAtomicElement, OptimizationPlanCompositeElement

public abstract class OptimizationPlanElement
extends Object

An element in the opt compiler's optimization plan.

NOTE: Instances of subclasses of this class are held in OptimizationPlanner.masterPlan and thus represent global state. It is therefore incorrect for any per-compilation state to be stored in an instance field of one of these objects.

TODO: refactor the optimization plan elements and compiler phases


Constructor Summary
OptimizationPlanElement()
           
 
Method Summary
abstract  double elapsedTime()
          Report the elapsed time spent in the PlanElement
abstract  String getName()
           
abstract  void initializeForMeasureCompilation()
          This method is called to initialize the optimization plan support measuring compilation.
abstract  void perform(IR ir)
          Do the work represented by this element in the optimization plan.
protected  void prettyPrintTime(double time, double totalTime)
          Helper function for reportStats
abstract  void reportStats(int indent, int timeCol, double totalTime)
          Generate (to the sysWrite stream) a report of the time spent performing this element of the optimization plan.
abstract  boolean shouldPerform(OptOptions options)
          Determine, possibly by consulting the passed options object, if this optimization plan element should be performed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptimizationPlanElement

public OptimizationPlanElement()
Method Detail

shouldPerform

public abstract boolean shouldPerform(OptOptions options)
Determine, possibly by consulting the passed options object, if this optimization plan element should be performed.

Parameters:
options - The Options object for the current compilation.
Returns:
true if the plan element should be performed.

perform

public abstract void perform(IR ir)
Do the work represented by this element in the optimization plan. The assumption is that the work will modify the IR in some way.

Parameters:
ir - The IR object to work with.

getName

public abstract String getName()
Returns:
a String which is the name of the phase.

initializeForMeasureCompilation

public abstract void initializeForMeasureCompilation()
This method is called to initialize the optimization plan support measuring compilation.


reportStats

public abstract void reportStats(int indent,
                                 int timeCol,
                                 double totalTime)
Generate (to the sysWrite stream) a report of the time spent performing this element of the optimization plan.

Parameters:
indent - Number of spaces to indent report.
timeCol - Column number of time portion of report.
totalTime - Total opt compilation time in seconds.

elapsedTime

public abstract double elapsedTime()
Report the elapsed time spent in the PlanElement

Returns:
time spend in the plan (in ms)

prettyPrintTime

protected void prettyPrintTime(double time,
                               double totalTime)
Helper function for reportStats