org.jikesrvm.compilers.opt.dfsolver
Class DF_AbstractCell

java.lang.Object
  extended by org.jikesrvm.compilers.opt.dfsolver.DF_AbstractCell
All Implemented Interfaces:
DF_LatticeCell, GraphElement, GraphNode
Direct Known Subclasses:
DominatorCell, IndexPropagation.ArrayCell, IndexPropagation.ObjectCell

public abstract class DF_AbstractCell
extends Object
implements DF_LatticeCell

Represents a single lattice cell in a dataflow system.


Field Summary
private  HashSet<DF_Equation> defs
          Set of DF_Equations which define this lattice cell.
private  int index
          Field used for GraphNode interface.
private  int scratch
           
private  HashSet<DF_Equation> uses
          Set of DF_Equations which use this lattice cell.
 
Constructor Summary
DF_AbstractCell()
          Default Constructor
DF_AbstractCell(int capacity)
          This constructor bounds the initial capacity to save space.
 
Method Summary
 void addDef(DF_Equation eq)
          Note that this variable appears on the LHS of an equation
 void addUse(DF_Equation eq)
          Note that this variable appears on the RHS of an equation
 Iterator<DF_Equation> getDefs()
          Returns an enumeration of the equations in which this lattice cell is defined.
 int getIndex()
          The index of this node in its graph.
 int getScratch()
          read the scratch field of int type
 Iterator<DF_Equation> getUses()
          Returns an enumeration of the equations in which this lattice cell is used.
 Enumeration<GraphNode> inNodes()
          Get an enumeration of all the edges at which edges that point to this node are sourced.
 Enumeration<GraphNode> outNodes()
          Get an enumeration of all the edges to which edges sourced at this node point.
 void setIndex(int i)
          Implementation of GraphNode interface.
 int setScratch(int o)
          set the scratch field of int type
abstract  String toString()
          Return a string representation of the cell
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uses

private final HashSet<DF_Equation> uses
Set of DF_Equations which use this lattice cell.


defs

private final HashSet<DF_Equation> defs
Set of DF_Equations which define this lattice cell.


index

private int index
Field used for GraphNode interface. TODO: is this needed?


scratch

private int scratch
Constructor Detail

DF_AbstractCell

public DF_AbstractCell()
Default Constructor


DF_AbstractCell

public DF_AbstractCell(int capacity)
This constructor bounds the initial capacity to save space.

Parameters:
capacity - the initial capacity of the "uses" set
Method Detail

getUses

public Iterator<DF_Equation> getUses()
Description copied from interface: DF_LatticeCell
Returns an enumeration of the equations in which this lattice cell is used.

Specified by:
getUses in interface DF_LatticeCell
Returns:
an enumeration of the equations in which this lattice cell is used

getDefs

public Iterator<DF_Equation> getDefs()
Description copied from interface: DF_LatticeCell
Returns an enumeration of the equations in which this lattice cell is defined.

Specified by:
getDefs in interface DF_LatticeCell
Returns:
an enumeration of the equations in which this lattice cell is defined

toString

public abstract String toString()
Description copied from interface: DF_LatticeCell
Return a string representation of the cell

Specified by:
toString in interface DF_LatticeCell
Overrides:
toString in class Object
Returns:
a string representation of the cell

addUse

public void addUse(DF_Equation eq)
Description copied from interface: DF_LatticeCell
Note that this variable appears on the RHS of an equation

Specified by:
addUse in interface DF_LatticeCell
Parameters:
eq - the equation

addDef

public void addDef(DF_Equation eq)
Description copied from interface: DF_LatticeCell
Note that this variable appears on the LHS of an equation

Specified by:
addDef in interface DF_LatticeCell
Parameters:
eq - the equation

inNodes

public Enumeration<GraphNode> inNodes()
Description copied from interface: GraphNode
Get an enumeration of all the edges at which edges that point to this node are sourced.

Specified by:
inNodes in interface GraphNode
Returns:
an enumeration of all the edges at which edges that point to this node are sourced.

outNodes

public Enumeration<GraphNode> outNodes()
Description copied from interface: GraphNode
Get an enumeration of all the edges to which edges sourced at this node point.

Specified by:
outNodes in interface GraphNode
Returns:
an enumeration of all the edges to which edges sourced at this node point.

setIndex

public void setIndex(int i)
Implementation of GraphNode interface.

Specified by:
setIndex in interface GraphNode

getIndex

public int getIndex()
Description copied from interface: GraphNode
The index of this node in its graph. In general, this can e anarbitrary number, but after a call to Graph.compactNodeNumbering the nodes of a graph should be numbered 0 thru (# of nodes in graph - 1).

Specified by:
getIndex in interface GraphNode
Returns:
the index of this node in its graph.

getScratch

public int getScratch()
Description copied from interface: GraphElement
read the scratch field of int type

Specified by:
getScratch in interface GraphElement
Returns:
the contents of the int scratch field

setScratch

public int setScratch(int o)
Description copied from interface: GraphElement
set the scratch field of int type

Specified by:
setScratch in interface GraphElement
Parameters:
o - the new contents of the int scratch field