|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.compilers.opt.driver.CompilerPhase
public abstract class CompilerPhase
Compiler phases all extend this abstract class. All compiler phases must provide implementations of two abstract methods:
By default, a new instance of the phase is created each time shouldPerform is called. This instance is discarded as soon as shouldPerform completes. Therefore, it is allowable (and is suggested when necessary) for subclasses to use their instance fields to hold per-compilation state. To be more concrete, the pattern of use is:
newExecution(ir).performPhase(ir).
NOTE: compiler phases that do not need to use instance
fields to hold per-compilation state may override
newExecution()
to return this. Doing so may lead to
memory leaks and concurrent access problems, so this should be done
with great care!
Field Summary | |
---|---|
protected OptimizationPlanAtomicElement |
container
The plan element that contains this phase. |
private Object[] |
initargs
Arguments to constructor that copies this phase |
Constructor Summary | |
---|---|
CompilerPhase()
Constructor |
|
CompilerPhase(Object[] initargs)
Constructor |
Method Summary | |
---|---|
static void |
dumpIR(IR ir,
String tag)
Prints the IR, optionally including the CFG |
static void |
dumpIR(IR ir,
String tag,
boolean forceCFG)
Prints the IR, optionally including the CFG |
Constructor<CompilerPhase> |
getClassConstructor()
Get a constructor object for this compiler phase |
protected static Constructor<CompilerPhase> |
getCompilerPhaseConstructor(Class<? extends CompilerPhase> klass)
Given the name of a compiler phase return the default (no argument) constructor for it. |
protected static Constructor<CompilerPhase> |
getCompilerPhaseConstructor(Class<? extends CompilerPhase> phaseType,
Class<?>[] initTypes)
Given the name of a compiler phase return the default (no argument) constructor for it. |
abstract String |
getName()
|
CompilerPhase |
newExecution(IR ir)
This method is called immediately before performPhase. |
abstract void |
perform(IR ir)
This is the method that actually does the work of the phase. |
void |
performPhase(IR ir)
Runs a phase by calling perform on the supplied IR surrounded by printing/messaging/debugging glue. |
boolean |
printingEnabled(OptOptions options,
boolean before)
Returns true if the phase wants the IR dumped before and/or after it runs. |
void |
reportAdditionalStats()
Called when printing a measure compilation report to enable a phase to report additional phase-specific statistics. |
void |
setContainer(OptimizationPlanAtomicElement atomEl)
Set the containing optimization plan element for this phase |
boolean |
shouldPerform(OptOptions options)
This method determines if the phase should be run, based on the Options object it is passed. |
void |
verify(IR ir)
Verify the IR. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected OptimizationPlanAtomicElement container
private final Object[] initargs
Constructor Detail |
---|
public CompilerPhase()
public CompilerPhase(Object[] initargs)
initargs
- arguments used when constructing copies of this phaseMethod Detail |
---|
public abstract String getName()
public abstract void perform(IR ir)
ir
- the IR on which to apply the phasepublic boolean shouldPerform(OptOptions options)
options
- the compiler options for the compilation
public boolean printingEnabled(OptOptions options, boolean before)
options
- the compiler options for the compilationbefore
- true when invoked before perform, false otherwise.
public void reportAdditionalStats()
public CompilerPhase newExecution(IR ir)
ir
- the IR that is about to be passed to performPhase
public Constructor<CompilerPhase> getClassConstructor()
protected static Constructor<CompilerPhase> getCompilerPhaseConstructor(Class<? extends CompilerPhase> klass)
protected static Constructor<CompilerPhase> getCompilerPhaseConstructor(Class<? extends CompilerPhase> phaseType, Class<?>[] initTypes)
public final void setContainer(OptimizationPlanAtomicElement atomEl)
public final void performPhase(IR ir)
ir
- the IR object on which to do the work of the phase.public static void dumpIR(IR ir, String tag)
ir
- the IR to printtag
- a String to use in the start/end message of the IR dumppublic static void dumpIR(IR ir, String tag, boolean forceCFG)
ir
- the IR to printforceCFG
- should the CFG be printed, independent of the value of ir.options.PRINT_CFG?tag
- a String to use in the start/end message of the IR dumppublic void verify(IR ir)
ir
- the IR to verify
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |