harpoon.IR.Quads
Class QuadSSI

java.lang.Object
  extended by harpoon.ClassFile.HCode<Quad>
      extended by harpoon.IR.Quads.Code
          extended by harpoon.IR.Quads.QuadSSI
All Implemented Interfaces:
Graph<Quad,Edge>, Serializable
Direct Known Subclasses:
ContCodeSSI, EnvCode, EventDrivenCode

public class QuadSSI
extends Code

Quads.QuadSSI is a code view in SSI form. Quad form exposes the details of the java classfile bytecodes in a pseudo-quadruple format. Implementation details of the stack-based JVM are hidden in favor of a flat consistent temporary-variable based approach. The generated quadruples adhere to an SSI form; that is, every variable has exactly one definition, and PHI and SIGMA functions are used where control flow merges or splits, respectively.

Version:
$Id: QuadSSI.java,v 1.11 2005/08/09 20:23:54 salcianu Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class harpoon.ClassFile.HCode
HCode.PrintCallback<HCE extends HCodeElement>
 
Nested classes/interfaces inherited from interface harpoon.Util.Collections.Graph
Graph.Edge<N extends Graph.Node<N,E>,E extends Graph.Edge<N,E>>, Graph.Node<N extends Graph.Node<N,E>,E extends Graph.Edge<N,E>>
 
Field Summary
static String codename
          The name of this code view.
static boolean KEEP_QUAD_MAP_HACK
           
 
Fields inherited from class harpoon.IR.Quads.Code
ai, parent, qf, quads
 
Constructor Summary
protected QuadSSI(HMethod parent, Quad quads)
          Create a new code object given a quadruple representation of the method instructions.
  QuadSSI(QuadNoSSA qns)
          Creates a Code object from a bytecode object.
  QuadSSI(ResilientNoSSA rns)
          Creates a Code object from a resilient-no-ssa object.
 
Method Summary
 HCodeAndMaps<Quad> clone(HMethod newMethod)
          Clone this code representation.
static HCodeFactory codeFactory()
          Return a code factory for QuadSSI, using the default code factory for QuadNoSSA.
static HCodeFactory codeFactory(HCodeFactory hcf)
          Return a code factory for QuadSSI, given a code factory for QuadNoSSA.
 String getName()
          Return the name of this code view.
 Map getQuadMapNoSSA2SSI()
          Every QuadSSI is built from a QuadNoSSA.
 Map getQuadMapSSI2NoSSA()
          Returns the reverse of the map returned by getQuadMapNoSSA2SSI.
 void notifyReplace(Quad oldquad, Quad newquad, TempMap tm)
          Update the QuadNoSSA to QuadSSI mappings when the SSI quad oldquad is replaced of this is replaced with the new SSI quad newquad.
 
Methods inherited from class harpoon.IR.Quads.Code
cloneHelper, cloneHelper, elementArrayFactory, getAllocationInformation, getDerivation, getElements, getElementsI, getLeafElements, getMethod, getRootElement, newQF, nodes, print, selectAllocations, selectCALLs, selectQuads, setAllocationInformation
 
Methods inherited from class harpoon.ClassFile.HCode
clone, elementIndexer, getElementsL, print, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

codename

public static final String codename
The name of this code view.

See Also:
Constant Field Values

KEEP_QUAD_MAP_HACK

public static boolean KEEP_QUAD_MAP_HACK
Constructor Detail

QuadSSI

public QuadSSI(QuadNoSSA qns)
Creates a Code object from a bytecode object.


QuadSSI

public QuadSSI(ResilientNoSSA rns)
Creates a Code object from a resilient-no-ssa object.


QuadSSI

protected QuadSSI(HMethod parent,
                  Quad quads)
Create a new code object given a quadruple representation of the method instructions.

Method Detail

getQuadMapNoSSA2SSI

public Map getQuadMapNoSSA2SSI()
Every QuadSSI is built from a QuadNoSSA. This method returns a map from the original NoSSA quads to the SSI quads of this codeview.

Returns:
a map original NoSSA quads -> SSI quads
See Also:
getQuadMapSSI2NoSSA()

getQuadMapSSI2NoSSA

public Map getQuadMapSSI2NoSSA()
Returns the reverse of the map returned by getQuadMapNoSSA2SSI.

Returns:
a map SSI quads -> original NoSSA quads
See Also:
getQuadMapNoSSA2SSI()

notifyReplace

public void notifyReplace(Quad oldquad,
                          Quad newquad,
                          TempMap tm)
Update the QuadNoSSA to QuadSSI mappings when the SSI quad oldquad is replaced of this is replaced with the new SSI quad newquad.

Overrides:
notifyReplace in class Code
Parameters:
oldquad - quad that is being replaced
newquad - new quad that replaces oldquad
tm - maps old temps to new temps

clone

public HCodeAndMaps<Quad> clone(HMethod newMethod)
Clone this code representation. The clone has its own copy of the quad graph.

Specified by:
clone in class Code

getName

public String getName()
Return the name of this code view.

Specified by:
getName in class Code
Returns:
the string "quad-ssi".

codeFactory

public static HCodeFactory codeFactory(HCodeFactory hcf)
Return a code factory for QuadSSI, given a code factory for QuadNoSSA. Given a code factory for Bytecode or QuadWithTry, chain through QuadNoSSA.codeFactory().


codeFactory

public static HCodeFactory codeFactory()
Return a code factory for QuadSSI, using the default code factory for QuadNoSSA.