org.jikesrvm.compilers.opt.driver
Class OptimizationPlanCompositeElement

java.lang.Object
  extended by org.jikesrvm.compilers.opt.driver.OptimizationPlanElement
      extended by org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement
Direct Known Subclasses:
ConvertLIRtoMIR, ConvertMIRtoMC, GCP, LinearScan, LiveRangeSplitting, LoadElimination, RedundantBranchElimination, RegisterAllocator, SSATuneUp

public class OptimizationPlanCompositeElement
extends OptimizationPlanElement

An element in the opt compiler's optimization plan that aggregates together other OptimizationPlan elements.

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.


Field Summary
private  OptimizationPlanElement[] myElements
          Ordered list of elements that together comprise this element.
private  String myName
          Name of this element.
 
Constructor Summary
OptimizationPlanCompositeElement(String n, Object[] e)
          Compose together the argument elements into a composite element of an optimization plan.
OptimizationPlanCompositeElement(String n, OptimizationPlanElement[] e)
          Compose together the argument elements into a composite element of an optimization plan.
 
Method Summary
static OptimizationPlanCompositeElement compose(String name, Object[] elems)
          Compose together the argument elements into a composite element of an optimization plan.
 double elapsedTime()
          Report the elapsed time spent in the PlanElement
 String getName()
           
 void initializeForMeasureCompilation()
          This method is called to initialize the optimization plan support measuring compilation.
 void perform(IR ir)
          Do the work represented by this element in the optimization plan.
 boolean printingEnabled(OptOptions options, boolean before)
          Returns true if the phase wants the IR dumped before and/or after it runs.
 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.
 boolean shouldPerform(OptOptions options)
          Determine, possibly by consulting the passed options object, if this optimization plan element should be performed.
 
Methods inherited from class org.jikesrvm.compilers.opt.driver.OptimizationPlanElement
prettyPrintTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myName

private final String myName
Name of this element.


myElements

private final OptimizationPlanElement[] myElements
Ordered list of elements that together comprise this element.

Constructor Detail

OptimizationPlanCompositeElement

public OptimizationPlanCompositeElement(String n,
                                        OptimizationPlanElement[] e)
Compose together the argument elements into a composite element of an optimization plan.

Parameters:
n - The name for this phase
e - The elements to compose

OptimizationPlanCompositeElement

public OptimizationPlanCompositeElement(String n,
                                        Object[] e)
Compose together the argument elements into a composite element of an optimization plan.

Parameters:
n - The name for this phase
e - The elements to compose
Method Detail

initializeForMeasureCompilation

public void initializeForMeasureCompilation()
Description copied from class: OptimizationPlanElement
This method is called to initialize the optimization plan support measuring compilation.

Specified by:
initializeForMeasureCompilation in class OptimizationPlanElement

compose

public static OptimizationPlanCompositeElement compose(String name,
                                                       Object[] elems)
Compose together the argument elements into a composite element of an optimization plan.

Parameters:
name - The name associated with this composite.
elems - An Object[] of CompilerPhases or OptimizationPlanElements to be composed
Returns:
an OptimizationPlanCompositeElement that represents the composition.

shouldPerform

public boolean shouldPerform(OptOptions options)
Description copied from class: OptimizationPlanElement
Determine, possibly by consulting the passed options object, if this optimization plan element should be performed.

Specified by:
shouldPerform in class OptimizationPlanElement
Parameters:
options - The Options object for the current compilation.
Returns:
true if the plan element should be performed.

printingEnabled

public boolean printingEnabled(OptOptions options,
                               boolean before)
Returns true if the phase wants the IR dumped before and/or after it runs. By default, printing is not enabled. Subclasses should overide this method if they want to provide IR dumping.

Parameters:
options - the compiler options for the compilation
before - true when invoked before perform, false otherwise.
Returns:
true if the IR should be printed, false otherwise.

perform

public final void perform(IR ir)
Description copied from class: OptimizationPlanElement
Do the work represented by this element in the optimization plan. The assumption is that the work will modify the IR in some way.

Specified by:
perform in class OptimizationPlanElement
Parameters:
ir - The IR object to work with.

getName

public String getName()
Specified by:
getName in class OptimizationPlanElement
Returns:
a String which is the name of the phase.

reportStats

public final void reportStats(int indent,
                              int timeCol,
                              double totalTime)
Description copied from class: OptimizationPlanElement
Generate (to the sysWrite stream) a report of the time spent performing this element of the optimization plan.

Specified by:
reportStats in class OptimizationPlanElement
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 double elapsedTime()
Description copied from class: OptimizationPlanElement
Report the elapsed time spent in the PlanElement

Specified by:
elapsedTime in class OptimizationPlanElement
Returns:
time spend in the plan (in ms)