org.jikesrvm.compilers.opt.ssa
Class RedundantBranchElimination.RBE

java.lang.Object
  extended by org.jikesrvm.compilers.opt.driver.CompilerPhase
      extended by org.jikesrvm.compilers.opt.ssa.RedundantBranchElimination.RBE
Enclosing class:
RedundantBranchElimination

private static final class RedundantBranchElimination.RBE
extends CompilerPhase


Field Summary
private static boolean DEBUG
           
 
Fields inherited from class org.jikesrvm.compilers.opt.driver.CompilerPhase
container
 
Constructor Summary
private RedundantBranchElimination.RBE()
           
 
Method Summary
 String getName()
           
private  BasicBlock getNotTakenBlock(Instruction s)
          Return the basic block that s's block will goto if s is not taken.
 CompilerPhase newExecution(IR ir)
          Return this instance of this phase.
 void perform(IR ir)
          Transform to eliminate redundant branches passed on GVNs and dominator information.
 boolean printingEnabled(OptOptions options, boolean before)
          Returns true if the phase wants the IR dumped before and/or after it runs.
private  void removeCondBranch(BasicBlock source, Instruction cb, IR ir, Instruction di)
          Remove cb from source, updating PHI nodes to maintain SSA form.
private  void removeUnreachableCode(IR ir)
          Remove unreachable code
private  void takeCondBranch(BasicBlock source, Instruction cb, IR ir)
          Transform cb into a GOTO, updating PHI nodes to maintain SSA form.
 
Methods inherited from class org.jikesrvm.compilers.opt.driver.CompilerPhase
dumpIR, dumpIR, getClassConstructor, getCompilerPhaseConstructor, getCompilerPhaseConstructor, performPhase, reportAdditionalStats, setContainer, shouldPerform, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values
Constructor Detail

RedundantBranchElimination.RBE

private RedundantBranchElimination.RBE()
Method Detail

getName

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

printingEnabled

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

Overrides:
printingEnabled in class CompilerPhase
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.

newExecution

public CompilerPhase newExecution(IR ir)
Return this instance of this phase. This phase contains no per-compilation instance fields.

Overrides:
newExecution in class CompilerPhase
Parameters:
ir - not used
Returns:
this

perform

public void perform(IR ir)
Transform to eliminate redundant branches passed on GVNs and dominator information.

Specified by:
perform in class CompilerPhase
Parameters:
ir - The IR on which to apply the phase

removeUnreachableCode

private void removeUnreachableCode(IR ir)
Remove unreachable code

Parameters:
ir - the IR to optimize

getNotTakenBlock

private BasicBlock getNotTakenBlock(Instruction s)
Return the basic block that s's block will goto if s is not taken.


removeCondBranch

private void removeCondBranch(BasicBlock source,
                              Instruction cb,
                              IR ir,
                              Instruction di)
Remove cb from source, updating PHI nodes to maintain SSA form.

Parameters:
source - basic block containing cb
cb - conditional branch to remove
ir - containing IR
di - branch that dominates cb

takeCondBranch

private void takeCondBranch(BasicBlock source,
                            Instruction cb,
                            IR ir)
Transform cb into a GOTO, updating PHI nodes to maintain SSA form.