org.jikesrvm.compilers.opt.ssa
Class GVCongruenceClass

java.lang.Object
  extended by org.jikesrvm.compilers.opt.ssa.GVCongruenceClass
All Implemented Interfaces:
Iterable<ValueGraphVertex>

final class GVCongruenceClass
extends Object
implements Iterable<ValueGraphVertex>

This class represents a congruence class for global value numbering.


Field Summary
private  Object label
          A label representing a property of this congruence class.
private  int nParameter
          How many vertices in this congruence class represent parameters?
private  ValueGraphVertex representativeV
          A representative of the congruence class - saves having to find one
private  int valueNumber
          A value number representing this congruence class.
private  HashSet<ValueGraphVertex> vertices
          The set of vertices in this congruence class
 
Constructor Summary
GVCongruenceClass(int valueNumber, Object label)
          Create a congruence class with a given representative value number and label.
 
Method Summary
 void addVertex(ValueGraphVertex v)
          Add a vertex to this congruence class.
 boolean containsParameter()
          Do any of the vertices in this set represent a parameter?
 Object getLabel()
           
 ValueGraphVertex getRepresentative()
          Return a representative vertex for this congruence class.
 int getValueNumber()
           
 Iterator<ValueGraphVertex> iterator()
          Return an iterator over the vertices in this congruence class
 void removeVertex(ValueGraphVertex v)
          Remove a vertex from this congruence class.
 int size()
          Return the number of vertices in this class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

label

private final Object label
A label representing a property of this congruence class.


valueNumber

private final int valueNumber
A value number representing this congruence class.


nParameter

private int nParameter
How many vertices in this congruence class represent parameters?


vertices

private final HashSet<ValueGraphVertex> vertices
The set of vertices in this congruence class


representativeV

private ValueGraphVertex representativeV
A representative of the congruence class - saves having to find one

Constructor Detail

GVCongruenceClass

GVCongruenceClass(int valueNumber,
                  Object label)
Create a congruence class with a given representative value number and label.

Parameters:
valueNumber - the value number of the class
label - the label of the class
Method Detail

getLabel

public Object getLabel()

getValueNumber

public int getValueNumber()

containsParameter

public boolean containsParameter()
Do any of the vertices in this set represent a parameter?

TODO: for efficiency, keep this information incrementally

Returns:
true or false

addVertex

public void addVertex(ValueGraphVertex v)
Add a vertex to this congruence class.

Parameters:
v - the vertex to add

removeVertex

public void removeVertex(ValueGraphVertex v)
Remove a vertex from this congruence class.

Parameters:
v - the vertex to remove

getRepresentative

public ValueGraphVertex getRepresentative()
Return a representative vertex for this congruence class.

Returns:
a representative vertex for this congruence class.

iterator

public Iterator<ValueGraphVertex> iterator()
Return an iterator over the vertices in this congruence class

Specified by:
iterator in interface Iterable<ValueGraphVertex>
Returns:
an iterator over the vertices in this congruence class

size

public int size()
Return the number of vertices in this class

Returns:
the number of vertices in this class