coins.ssa
Class SsaGraph

java.lang.Object
  extended bycoins.ssa.SsaGraph
All Implemented Interfaces:
LocalTransformer, Transformer

class SsaGraph
extends java.lang.Object
implements LocalTransformer

SSA graph

This class defined the object of the SSA graph. Ths SSA graph has nodes which have the value or operator and labeled by the variable that defined by the value or operation. The edge of the node of the SSA graph is from the node that value is used to the node that value is defined.

Reference:
Bowen Alpern and Mark N. Wegman and F. Kenneth Zadeck, "Detecting Equality of Variables in Programs," Proceedings of the Fifteenth Annual ACM Symposium on Principles of Programming Language, pp. 1-11, January, 1988.


Field Summary
 java.lang.String optName
          The name of the optimizer which uses SSA graph
static java.lang.String symName
          The prefix of the new symbol
static int THR
          The threshold of the debug print
 
Constructor Summary
SsaGraph(SsaEnvironment e, SsaSymTab symtab, java.lang.String opt)
          Constructor
 
Method Summary
(package private)  SsaGraphNode appendNode(LirNode node, BasicBlk blk, int numOfParents)
          Append a new node to the SSA graph.
 boolean doIt(Data data, ImList args)
          Transform the DATA component.
 boolean doIt(Function function, ImList args)
          Make the SSA graph and optimize with the graph.
 java.lang.String name()
          Return the name of the transforming engine.
(package private)  BiList nodeList()
          Return the list of the node of the SSA graph.
(package private)  void printGraph(java.lang.String filename)
          Print the node as graphviz format.
(package private)  void setSymbol(Symbol s, SsaGraphNode node)
          Register again the symbol `s' as a value of the node and put it to the map.
 java.lang.String subject()
          Return brief description of the tranformation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

symName

public static final java.lang.String symName
The prefix of the new symbol

See Also:
Constant Field Values

optName

public final java.lang.String optName
The name of the optimizer which uses SSA graph


THR

public static final int THR
The threshold of the debug print

See Also:
Constant Field Values
Constructor Detail

SsaGraph

public SsaGraph(SsaEnvironment e,
                SsaSymTab symtab,
                java.lang.String opt)
Constructor

Parameters:
e - The environment of the SSA module
symtab - The current symbol table of the SSA module
opt - The name of the optimizer which uses the SSA graph
Method Detail

doIt

public boolean doIt(Data data,
                    ImList args)
Description copied from interface: LocalTransformer
Transform the DATA component.

Specified by:
doIt in interface LocalTransformer
Parameters:
data - DATA to be transformed.
args - list of optional arguments.
Returns:
true if transformation suceeded.

name

public java.lang.String name()
Description copied from interface: Transformer
Return the name of the transforming engine. Used for trace tag name.

Specified by:
name in interface Transformer
Returns:
the name of the transforming engine.

subject

public java.lang.String subject()
Description copied from interface: Transformer
Return brief description of the tranformation.

Specified by:
subject in interface Transformer
Returns:
brief description of the tranformation.

doIt

public boolean doIt(Function function,
                    ImList args)
Make the SSA graph and optimize with the graph.

Specified by:
doIt in interface LocalTransformer
Parameters:
function - the current function
args - The list of options
Returns:
true if transformation suceeded.

appendNode

SsaGraphNode appendNode(LirNode node,
                        BasicBlk blk,
                        int numOfParents)
Append a new node to the SSA graph.

Parameters:
node - The LIR node which append into the graph
blk - The basic block which the LIR node belongs to
numOfParents - The number of references of the node
Returns:
A new node of the SSA graph

nodeList

BiList nodeList()
Return the list of the node of the SSA graph.

Returns:
The list of the node of the SSA graph

setSymbol

void setSymbol(Symbol s,
               SsaGraphNode node)
Register again the symbol `s' as a value of the node and put it to the map. If the map already has `s', then remove the old one and register again.

Parameters:
s - The symbol to register
node - The node of the SSA graph which has `s'

printGraph

void printGraph(java.lang.String filename)
Print the node as graphviz format.

Parameters:
filename - The file name for output