|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.compilers.opt.util.SpaceEffGraph
public class SpaceEffGraph
SpaceEffGraph package implements a generic directed graph that can be a multigraph. It uses Lists to model nodes and edges information.
SpaceEffGraph is a generic graph. Extend to implement specific graph types.
Nested Class Summary | |
---|---|
private static class |
SpaceEffGraph.NodeEnumeration
|
Field Summary | |
---|---|
protected SpaceEffGraphNode |
_firstNode
First node |
protected SpaceEffGraphNode |
_lastNode
Last node |
private SpaceEffGraphNodeListHeader |
_rootNodes
Nodes with no predecessors |
private SpaceEffGraphNodeListHeader |
_topSortNodes
Topological sort order |
boolean |
backwardTopSorted
|
boolean |
forwardTopSorted
|
protected int |
numberOfNodes
Number of nodes |
Constructor Summary | |
---|---|
SpaceEffGraph()
|
Method Summary | |
---|---|
void |
addGraphEdge(GraphNode from,
GraphNode to)
Add an edge to the graph. |
void |
addGraphEdge(SpaceEffGraphEdge e)
Add an edge to the graph. |
void |
addGraphNode(GraphNode inode)
Add a new graph node to the graph. |
void |
addRootNode(SpaceEffGraphNode root)
Add a root node to the graph. |
protected void |
addTopSortNode(SpaceEffGraphNode node)
|
int |
allocateNodeNumber()
Get the next node number |
SortedGraphNode |
buildRevTopSort()
Build a reverse topological sort of this graph |
void |
buildTopSort()
Build a topological sort of this graph |
void |
clearDFS()
Clear the DFS flags. |
void |
compactNodeNumbering()
Renumber the nodes densely from 0...numberOfNodes-1. |
private void |
dfs(SpaceEffGraphNode node)
|
Enumeration<GraphNode> |
enumerateNodes()
Enumerate the nodes in no particular order |
SpaceEffGraphNode |
firstNode()
Get the list of nodes. |
protected void |
initTopSort()
|
boolean |
isTopSorted(boolean forward)
Return true if no resetTopSorted(forward) has been executed since the last setTopSorted(forward) has been executed |
SpaceEffGraphNode |
lastNode()
Get the end of the list of nodes. |
int |
numberOfNodes()
Find out how many nodes are in the graph |
private void |
print(Enumeration<GraphNode> e)
Print, to System.out, the basic blocks in the order given in the supplied enumeration. |
void |
printDepthFirst()
Print, to System.out, the basic blocks in depth first order. |
void |
removeGraphNode(SpaceEffGraphNode node)
Remove a node from the graph. |
void |
resetTopSorted()
Should have a side effect such that isTopSorted(forward) returns the correct value. |
SpaceEffGraphNodeList |
rootNodes()
Get the list of root nodes. |
void |
setFirstNode(SpaceEffGraphNode firstNode)
Reset the list of nodes of the graph. |
void |
setLastNode(SpaceEffGraphNode lastNode)
Reset the list of nodes of the graph. |
void |
setNumberOfNodes(int n)
Set number of nodes |
void |
setTopSorted(boolean forward)
Should have a side effect such that isTopSorted(forward) returns the correct value. |
SortedGraphNode |
startNode(boolean forward)
Return the start node if forward = true for forward topsort, and return the end node if forward = false for backward topsort. |
void |
topSort()
|
SpaceEffGraphNodeList |
topSortOrder()
Get the topological order of nodes. |
String |
toString()
Return a string representation of this graph. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected SpaceEffGraphNode _firstNode
protected SpaceEffGraphNode _lastNode
private SpaceEffGraphNodeListHeader _rootNodes
private SpaceEffGraphNodeListHeader _topSortNodes
protected int numberOfNodes
public boolean forwardTopSorted
public boolean backwardTopSorted
Constructor Detail |
---|
public SpaceEffGraph()
Method Detail |
---|
public final int numberOfNodes()
Graph
numberOfNodes
in interface Graph
numberOfNodes
in interface TopSortInterface
public final void setNumberOfNodes(int n)
n
- new number of nodespublic final int allocateNodeNumber()
public void compactNodeNumbering()
compactNodeNumbering
in interface Graph
public Enumeration<GraphNode> enumerateNodes()
enumerateNodes
in interface Graph
GraphNode
public SortedGraphNode startNode(boolean forward)
TopSortInterface
startNode
in interface TopSortInterface
forward
- whether we are viewing the graph in the forward direction
public boolean isTopSorted(boolean forward)
TopSortInterface
isTopSorted
in interface TopSortInterface
forward
- whether we are viewing the graph in the forward direction
public void setTopSorted(boolean forward)
TopSortInterface
setTopSorted
in interface TopSortInterface
forward
- whether we are viewing the graph in the forward directionpublic void resetTopSorted()
TopSortInterface
resetTopSorted
in interface TopSortInterface
public final void addGraphNode(GraphNode inode)
Graph
addGraphNode
in interface Graph
inode
- node to addpublic final void removeGraphNode(SpaceEffGraphNode node)
node
- node to removepublic void addGraphEdge(GraphNode from, GraphNode to)
addGraphEdge
in interface Graph
from
- start nodeto
- end nodeaddGraphEdge(SpaceEffGraphEdge)
public void addGraphEdge(SpaceEffGraphEdge e)
e
- edge to insertaddGraphEdge(GraphNode,GraphNode)
public final void setFirstNode(SpaceEffGraphNode firstNode)
firstNode
- new value of the node listpublic final void setLastNode(SpaceEffGraphNode lastNode)
lastNode
- new value of the node listpublic final SpaceEffGraphNode firstNode()
public final SpaceEffGraphNode lastNode()
public final void addRootNode(SpaceEffGraphNode root)
root
- a node to addpublic final SpaceEffGraphNodeList rootNodes()
public final SpaceEffGraphNodeList topSortOrder()
public final void clearDFS()
public void buildTopSort()
public SortedGraphNode buildRevTopSort()
protected void initTopSort()
protected void addTopSortNode(SpaceEffGraphNode node)
public void topSort()
private void dfs(SpaceEffGraphNode node)
public String toString()
toString
in class Object
public void printDepthFirst()
private void print(Enumeration<GraphNode> e)
e
- enumeration order to print blocks
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |