org.jikesrvm.compilers.opt.driver
Class OptimizationPlanner

java.lang.Object
  extended by org.jikesrvm.compilers.opt.driver.OptimizationPlanner
Direct Known Subclasses:
MIROptimizationPlanner

public class OptimizationPlanner
extends Object

This class specifies the order in which CompilerPhases are executed during the HIR and LIR phase of the opt compilation of a method.

See Also:
ArchitectureSpecificOpt.MIROptimizationPlanner

Field Summary
private static OptimizationPlanElement[] masterPlan
          The master optimization plan.
 
Constructor Summary
OptimizationPlanner()
           
 
Method Summary
protected static void addComponent(ArrayList<OptimizationPlanElement> p, CompilerPhase e)
           
protected static void addComponent(ArrayList<OptimizationPlanElement> p, OptimizationPlanElement e)
          Add an optimization plan element to a vector.
private static void BC2HIR(ArrayList<OptimizationPlanElement> p)
          This method defines the optimization plan elements required to generate HIR from bytecodes.
protected static void composeComponents(ArrayList<OptimizationPlanElement> p, String name, Object[] es)
          Add a set of optimization plan elements to a vector.
static OptimizationPlanElement[] createOptimizationPlan(OptOptions options)
          Using the passed options create an optimization plan by selecting a subset of the elements in the masterPlan.
static void generateOptimizingCompilerSubsystemReport(boolean explain)
          Generate a report of time spent in various phases of the opt compiler.
private static void HIR2LIR(ArrayList<OptimizationPlanElement> p)
          This method defines the optimization plan elements that are to be performed to lower HIR to LIR.
private static void HIROptimizations(ArrayList<OptimizationPlanElement> p)
          This method defines the optimization plan elements that are to be performed on the HIR.
private static void initializeMasterPlan()
          Initialize the "master plan", which holds all optimization elements that will normally execute.
static void initializeMeasureCompilation()
          This method is called to initialize all phases to support measuring compilation.
private static void LIROptimizations(ArrayList<OptimizationPlanElement> p)
          This method defines the optimization plan elements that are to be performed on the LIR.
private static void SSAinHIR(ArrayList<OptimizationPlanElement> p)
          This method defines the optimization plan elements that are to be performed with SSA form on HIR.
private static void SSAinLIR(ArrayList<OptimizationPlanElement> p)
          This method defines the optimization plan elements that are to be performed with SSA form on LIR.
private static OptimizationPlanElement[] toArray(ArrayList<OptimizationPlanElement> planElementList)
          Convert the ArrayList to an array of elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

masterPlan

private static OptimizationPlanElement[] masterPlan
The master optimization plan. All plans that are actually executed should be subsets of this plan constructed by calling createOptimizationPlan.

Constructor Detail

OptimizationPlanner

public OptimizationPlanner()
Method Detail

generateOptimizingCompilerSubsystemReport

public static void generateOptimizingCompilerSubsystemReport(boolean explain)
Generate a report of time spent in various phases of the opt compiler.

NB: This method may be called in a context where classloading and/or GC cannot be allowed. Therefore we must use primitive sysWrites for output and avoid string appends and other allocations.

Parameters:
explain - Should an explanation of the metrics be generated?

createOptimizationPlan

public static OptimizationPlanElement[] createOptimizationPlan(OptOptions options)
Using the passed options create an optimization plan by selecting a subset of the elements in the masterPlan.

Parameters:
options - the Options to use
Returns:
an OptimizationPlanElement[] selected from the masterPlan based on options.

initializeMeasureCompilation

public static void initializeMeasureCompilation()
This method is called to initialize all phases to support measuring compilation.


initializeMasterPlan

private static void initializeMasterPlan()
Initialize the "master plan", which holds all optimization elements that will normally execute.


toArray

private static OptimizationPlanElement[] toArray(ArrayList<OptimizationPlanElement> planElementList)
Convert the ArrayList to an array of elements.

Parameters:
planElementList - the array list to convert, must be non-null
Returns:
list as array

BC2HIR

private static void BC2HIR(ArrayList<OptimizationPlanElement> p)
This method defines the optimization plan elements required to generate HIR from bytecodes.

Parameters:
p - the plan under construction

HIROptimizations

private static void HIROptimizations(ArrayList<OptimizationPlanElement> p)
This method defines the optimization plan elements that are to be performed on the HIR.

Parameters:
p - the plan under construction

SSAinHIR

private static void SSAinHIR(ArrayList<OptimizationPlanElement> p)
This method defines the optimization plan elements that are to be performed with SSA form on HIR.

Parameters:
p - the plan under construction

SSAinLIR

private static void SSAinLIR(ArrayList<OptimizationPlanElement> p)
This method defines the optimization plan elements that are to be performed with SSA form on LIR.

Parameters:
p - the plan under construction

HIR2LIR

private static void HIR2LIR(ArrayList<OptimizationPlanElement> p)
This method defines the optimization plan elements that are to be performed to lower HIR to LIR.

Parameters:
p - the plan under construction

LIROptimizations

private static void LIROptimizations(ArrayList<OptimizationPlanElement> p)
This method defines the optimization plan elements that are to be performed on the LIR.

Parameters:
p - the plan under construction

addComponent

protected static void addComponent(ArrayList<OptimizationPlanElement> p,
                                   CompilerPhase e)

addComponent

protected static void addComponent(ArrayList<OptimizationPlanElement> p,
                                   OptimizationPlanElement e)
Add an optimization plan element to a vector.


composeComponents

protected static void composeComponents(ArrayList<OptimizationPlanElement> p,
                                        String name,
                                        Object[] es)
Add a set of optimization plan elements to a vector.

Parameters:
p - the vector to add to
name - the name for this composition
es - the array of composed elements