public abstract class BranchOptimizationDriver extends CompilerPhase
Modifier and Type | Field and Description |
---|---|
private int |
level
Optimization level at which phase should be performed.
|
private boolean |
simplify
Optimization level at which phase should be performed.
|
container
Constructor and Description |
---|
BranchOptimizationDriver(int level) |
BranchOptimizationDriver(int level,
boolean simplify) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
applyPeepholeBranchOpts(IR ir)
This pass performs peephole branch optimizations.
|
private static boolean |
applySimplify(IR ir)
Perform branch simplifications.
|
protected Instruction |
firstLabelFollowing(Instruction s) |
protected Instruction |
firstRealInstructionFollowing(Instruction s) |
String |
getName() |
protected void |
maximizeBasicBlocks(IR ir)
Merge adjacent basic blocks
|
CompilerPhase |
newExecution(IR ir)
This phase contains no per-compilation instance fields.
|
protected abstract boolean |
optimizeBranchInstruction(IR ir,
Instruction s,
BasicBlock bb)
This method actually does the work of attempting to
peephole optimize a branch instruction.
|
void |
perform(IR ir)
Perform peephole branch optimizations.
|
void |
perform(IR ir,
boolean renumber) |
boolean |
printingEnabled(OptOptions options,
boolean before)
Returns true if the phase wants the IR dumped before and/or after it runs.
|
protected boolean |
removeUnreachableCode(IR ir)
Remove unreachable code
|
boolean |
shouldPerform(OptOptions options)
Interface
|
dumpIR, dumpIR, getClassConstructor, getCompilerPhaseConstructor, getCompilerPhaseConstructor, performPhase, reportAdditionalStats, setContainer, verify
private final int level
private final boolean simplify
BranchOptimizationDriver(int level, boolean simplify)
level
- the minimum optimization level at which the branch
optimizations should be performed.simplify
- perform simplification prior to optimization?BranchOptimizationDriver(int level)
level
- the minimum optimization level at which the branch
optimizations should be performed.public final boolean shouldPerform(OptOptions options)
shouldPerform
in class CompilerPhase
options
- the compiler options for the compilationpublic final String getName()
getName
in class CompilerPhase
public final boolean printingEnabled(OptOptions options, boolean before)
CompilerPhase
printingEnabled
in class CompilerPhase
options
- the compiler options for the compilationbefore
- true when invoked before perform, false otherwise.public final CompilerPhase newExecution(IR ir)
newExecution
in class CompilerPhase
ir
- the IR that is about to be passed to performPhasepublic final void perform(IR ir)
perform
in class CompilerPhase
ir
- the IR to optimizeprivate static boolean applySimplify(IR ir)
ir
- the IR to optimizeprotected boolean applyPeepholeBranchOpts(IR ir)
ir
- the IR to optimizeprotected abstract boolean optimizeBranchInstruction(IR ir, Instruction s, BasicBlock bb)
ir
- the containing IRs
- the branch instruction to optimizebb
- the containing basic blockprotected final boolean removeUnreachableCode(IR ir)
ir
- the IR to optimizeprotected final void maximizeBasicBlocks(IR ir)
ir
- the IR to optimizeprotected final Instruction firstLabelFollowing(Instruction s)
protected final Instruction firstRealInstructionFollowing(Instruction s)