org.jikesrvm.compilers.opt.regalloc
Class CoalesceGraph

java.lang.Object
  extended by org.jikesrvm.compilers.opt.util.SpaceEffGraph
      extended by org.jikesrvm.compilers.opt.regalloc.CoalesceGraph
All Implemented Interfaces:
Graph, TopSortInterface

 class CoalesceGraph
extends SpaceEffGraph

This class represents a graph, where

This graph is used to drive coalescing during register allocation.

Implementation: this is meant to be an undirected graph. By convention, we enforce that the register with the lower number is the source of an edge.


Nested Class Summary
(package private) static class CoalesceGraph.Edge
           
(package private) static class CoalesceGraph.Node
           
 
Field Summary
(package private)  HashMap<Register,CoalesceGraph.Node> nodeMap
          Mapping register -> Node
 
Fields inherited from class org.jikesrvm.compilers.opt.util.SpaceEffGraph
_firstNode, _lastNode, backwardTopSorted, forwardTopSorted, numberOfNodes
 
Constructor Summary
CoalesceGraph()
           
 
Method Summary
(package private)  void addAffinity(int w, Register r1, Register r2)
          Add an affinity of weight w between registers r1 and r2
(package private)  CoalesceGraph.Node findNode(Register r)
          Find the node corresponding to a regsiter.
private  CoalesceGraph.Edge findOrCreateEdge(CoalesceGraph.Node src, CoalesceGraph.Node dest)
          find or create an edge in the graph
private  CoalesceGraph.Node findOrCreateNode(Register r)
          find or create a node in the graph corresponding to a register.
 
Methods inherited from class org.jikesrvm.compilers.opt.util.SpaceEffGraph
addGraphEdge, addGraphEdge, addGraphNode, addRootNode, addTopSortNode, allocateNodeNumber, buildRevTopSort, buildTopSort, clearDFS, compactNodeNumbering, enumerateNodes, firstNode, initTopSort, isTopSorted, lastNode, numberOfNodes, printDepthFirst, removeGraphNode, resetTopSorted, rootNodes, setFirstNode, setLastNode, setNumberOfNodes, setTopSorted, startNode, topSort, topSortOrder, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nodeMap

final HashMap<Register,CoalesceGraph.Node> nodeMap
Mapping register -> Node

Constructor Detail

CoalesceGraph

CoalesceGraph()
Method Detail

findOrCreateNode

private CoalesceGraph.Node findOrCreateNode(Register r)
find or create a node in the graph corresponding to a register.


findNode

CoalesceGraph.Node findNode(Register r)
Find the node corresponding to a regsiter.


findOrCreateEdge

private CoalesceGraph.Edge findOrCreateEdge(CoalesceGraph.Node src,
                                            CoalesceGraph.Node dest)
find or create an edge in the graph


addAffinity

void addAffinity(int w,
                 Register r1,
                 Register r2)
Add an affinity of weight w between registers r1 and r2