org.jikesrvm.compilers.opt.ir
Class WeightedBranchTargets

java.lang.Object
  extended by org.jikesrvm.compilers.opt.ir.WeightedBranchTargets

public final class WeightedBranchTargets
extends Object

Used to iterate over the branch targets (including the fall through edge) and associated probabilites of a basic block. Takes into account the ordering of branch instructions when computing the edge weights such that the total target weight will always be equal to 1.0 (flow in == flow out).


Field Summary
private  int cur
           
private  int max
           
private  BasicBlock[] targets
           
private  float[] weights
           
 
Constructor Summary
WeightedBranchTargets(BasicBlock bb)
           
 
Method Summary
private  void addEdge(BasicBlock target, float weight)
           
 void advance()
           
 BasicBlock curBlock()
           
 float curWeight()
           
private  boolean epsilon(float a, float b)
           
 boolean hasMoreElements()
           
 void reset()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

targets

private BasicBlock[] targets

weights

private float[] weights

cur

private int cur

max

private int max
Constructor Detail

WeightedBranchTargets

public WeightedBranchTargets(BasicBlock bb)
Method Detail

reset

public void reset()

hasMoreElements

public boolean hasMoreElements()

advance

public void advance()

curBlock

public BasicBlock curBlock()

curWeight

public float curWeight()

addEdge

private void addEdge(BasicBlock target,
                     float weight)

epsilon

private boolean epsilon(float a,
                        float b)