harpoon.IR.Quads
Class Code

java.lang.Object
  |
  +--harpoon.ClassFile.HCode
        |
        +--harpoon.IR.Quads.Code
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Code, QuadNoSSA, QuadRSSx, QuadSSA, QuadSSI, QuadWithTry

public abstract class Code
extends HCode
implements Serializable

Quads.Code is an abstract superclass of codeviews using the components in IR.Quads. It implements shared methods for the various codeviews using Quads.

Version:
$Id: Code.java,v 1.3 2002/02/26 22:45:56 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class harpoon.ClassFile.HCode
HCode.PrintCallback
 
Field Summary
protected  AllocationInformation ai
          AllocationInformation for this HCode.
protected  HMethod parent
          The method that this code view represents.
protected  QuadFactory qf
          Quad factory.
protected  Quad quads
          The quadruples composing this code view.
 
Constructor Summary
protected Code(HMethod parent, Quad quads)
          constructor.
 
Method Summary
abstract  HCodeAndMaps clone(HMethod newMethod)
          Clone this code representation.
protected  HCodeAndMaps cloneHelper(Code qc)
          Helper for clone
protected  HCodeAndMaps cloneHelper(Code _this, Code qc)
          Helper for clone
 ArrayFactory elementArrayFactory()
          Return an ArrayFactory for the HCodeElements composing this HCode.
 AllocationInformation getAllocationInformation()
          Return the AllocationInformation for this codeview.
 Derivation getDerivation()
          Return a Derivation for this codeview.
 HCodeElement[] getElements()
          Returns an ordered list of the Quads making up this code view.
 Iterator getElementsI()
          Returns an iterator over the Quads making up this code view.
 HCodeElement[] getLeafElements()
          Returns the leaves of the control flow graph.
 HMethod getMethod()
          Return the HMethod this codeview belongs to.
abstract  String getName()
          Return the name of this code view.
 HCodeElement getRootElement()
          Returns the root of the control flow graph.
protected  QuadFactory newQF(HMethod parent)
          Create a proper QuadFactory.
 void print(PrintWriter pw, HCode.PrintCallback callback)
          Pretty-print this code view using the specified callback.
 void setAllocationInformation(AllocationInformation ai)
          Set an AllocationInformation for this codeview.
 
Methods inherited from class harpoon.ClassFile.HCode
clone, elementIndexer, getElementsE, getElementsL, print, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

protected final HMethod parent
The method that this code view represents.


quads

protected Quad quads
The quadruples composing this code view.


qf

protected final QuadFactory qf
Quad factory.


ai

protected AllocationInformation ai
AllocationInformation for this HCode.

Constructor Detail

Code

protected Code(HMethod parent,
               Quad quads)
constructor.

Method Detail

newQF

protected QuadFactory newQF(HMethod parent)
Create a proper QuadFactory.


clone

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

Overrides:
clone in class HCode

cloneHelper

protected final HCodeAndMaps cloneHelper(Code qc)
Helper for clone


cloneHelper

protected HCodeAndMaps cloneHelper(Code _this,
                                   Code qc)
Helper for clone


getName

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

Specified by:
getName in class HCode

getMethod

public HMethod getMethod()
Return the HMethod this codeview belongs to.

Specified by:
getMethod in class HCode

getAllocationInformation

public AllocationInformation getAllocationInformation()
Return the AllocationInformation for this codeview.


setAllocationInformation

public void setAllocationInformation(AllocationInformation ai)
Set an AllocationInformation for this codeview.


getDerivation

public Derivation getDerivation()
Return a Derivation for this codeview.

Returns:
null, always.

getRootElement

public HCodeElement getRootElement()
Returns the root of the control flow graph.

Overrides:
getRootElement in class HCode
Returns:
root of the code view, or null if this notion is not applicable.

getLeafElements

public HCodeElement[] getLeafElements()
Returns the leaves of the control flow graph.

Overrides:
getLeafElements in class HCode
Returns:
leaves of the code view, or null if this notion is not applicable.

getElements

public HCodeElement[] getElements()
Returns an ordered list of the Quads making up this code view. The root of the graph is in element 0 of the array.

Overrides:
getElements in class HCode
See Also:
Instr

getElementsI

public Iterator getElementsI()
Returns an iterator over the Quads making up this code view. The root of the graph is the first element in the iteration.

Overrides:
getElementsI in class HCode

elementArrayFactory

public ArrayFactory elementArrayFactory()
Description copied from class: HCode
Return an ArrayFactory for the HCodeElements composing this HCode.

Specified by:
elementArrayFactory in class HCode

print

public void print(PrintWriter pw,
                  HCode.PrintCallback callback)
Description copied from class: HCode
Pretty-print this code view using the specified callback.

Overrides:
print in class HCode