org.jikesrvm.compilers.opt
Class AdjustBranchProbabilities

java.lang.Object
  extended by org.jikesrvm.compilers.opt.driver.CompilerPhase
      extended by org.jikesrvm.compilers.opt.AdjustBranchProbabilities

public class AdjustBranchProbabilities
extends CompilerPhase

This pass adjusts branch probabilities derived from static estimates to account for blocks that are statically guessed to be infrequent.


Field Summary
 
Fields inherited from class org.jikesrvm.compilers.opt.driver.CompilerPhase
container
 
Constructor Summary
AdjustBranchProbabilities()
           
 
Method Summary
private  boolean findInfrequentInstruction(BasicBlock bb)
           
 String getName()
           
 CompilerPhase newExecution(IR ir)
          This method is called immediately before performPhase.
 void perform(IR ir)
          Simplistic adjustment of branch probabilities.
 
Methods inherited from class org.jikesrvm.compilers.opt.driver.CompilerPhase
dumpIR, dumpIR, getClassConstructor, getCompilerPhaseConstructor, getCompilerPhaseConstructor, performPhase, printingEnabled, reportAdditionalStats, setContainer, shouldPerform, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdjustBranchProbabilities

public AdjustBranchProbabilities()
Method Detail

getName

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

newExecution

public final CompilerPhase newExecution(IR ir)
Description copied from class: CompilerPhase
This method is called immediately before performPhase. Phases that do not need to create a new instance for each execution may override this method to return this, but this must be done carefully! Classes that don't override this method need to override getClassConstructor.

Overrides:
newExecution in class CompilerPhase
Parameters:
ir - the IR that is about to be passed to performPhase
Returns:
an opt compiler phase on which performPhase may be invoked.

perform

public final void perform(IR ir)
Simplistic adjustment of branch probabilities. The main target of this pass is to detect idioms like
   if (P) { infrequent block }
   if (P) { } else { infrequent block }
 
that are introduced by ExpandRuntimeServices.

Key idea: If a block is infrequent then make sure that any conditional branch that targets/avoids the block does not have 0.5 as its branch probability.

Specified by:
perform in class CompilerPhase
Parameters:
ir - the governing IR

findInfrequentInstruction

private boolean findInfrequentInstruction(BasicBlock bb)