harpoon.IR.Tree
Class CanonicalTreeCode

java.lang.Object
  extended by harpoon.ClassFile.HCode<Tree>
      extended by harpoon.IR.Tree.Code
          extended by harpoon.IR.Tree.CanonicalTreeCode

public class CanonicalTreeCode
extends Code

The CanonicalTreeCode codeview is the same as the TreeCode codeview, except for the fact that it does not allow ESEQ objects to be part of its representation. There is seldom a compelling reason not to use the canonical tree view, as ESEQs complicate analysis, while providing no real benefits. The CanonicalTreeCode is based around Andrew Appel's canonical tree form.

Version:
$Id: CanonicalTreeCode.java,v 1.5 2003/03/11 17:24:56 cananian Exp $
Author:
Duncan Bryce <duncan@lcs.mit.edu>

Nested Class Summary
 
Nested classes/interfaces inherited from class harpoon.IR.Tree.Code
Code.TreeFactory
 
Nested classes/interfaces inherited from class harpoon.ClassFile.HCode
HCode.PrintCallback<HCE extends HCodeElement>
 
Field Summary
static String codename
          The getName() method return codename, which is "canonical-tree" for this Code.
 
Fields inherited from class harpoon.IR.Tree.Code
frame, parent, tf, tree
 
Method Summary
 HCodeAndMaps<Tree> clone(HMethod newMethod, Frame frame)
          Clone this code representation.
static HCodeFactory codeFactory(Frame frame)
          Return a code factory for CanonicalTreeCode, using the default code factory for TreeCode
static HCodeFactory codeFactory(HCodeFactory hcf, Frame frame)
          Return a code factory for CanonicalTreeCode, given a code factory for TreeCode.
 String getName()
          Return the name of this code view.
 TreeDerivation getTreeDerivation()
          Returns a TreeDerivation object for the generated Tree form.
 boolean isCanonical()
          Returns true if this codeview is a canonical representation
 
Methods inherited from class harpoon.IR.Tree.Code
clone, cloneHelper, elementArrayFactory, getElements, getElementsI, getFrame, getGrapher, getLeafElements, getMethod, getRootElement, getUseDefer, print, remove
 
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 getName() method return codename, which is "canonical-tree" for this Code.

See Also:
Constant Field Values
Method Detail

getTreeDerivation

public TreeDerivation getTreeDerivation()
Returns a TreeDerivation object for the generated Tree form.

Specified by:
getTreeDerivation in class Code

clone

public HCodeAndMaps<Tree> clone(HMethod newMethod,
                                Frame frame)
Clone this code representation. The clone has its own copy of the tree structure.

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 "canonical-tree".

isCanonical

public boolean isCanonical()
Description copied from class: Code
Returns true if this codeview is a canonical representation

Specified by:
isCanonical in class Code
Returns:
true

codeFactory

public static HCodeFactory codeFactory(HCodeFactory hcf,
                                       Frame frame)
Return a code factory for CanonicalTreeCode, given a code factory for TreeCode.
effects: if hcf is a code factory for TreeCode, then creates and returns a code factory for CanonicalTreeCode. Else passes hcf to TreeCode.codeFactory(), and reattempts to create a code factory for CanonicalTreeCode from the code factory returned by TreeCode.

See Also:
TreeCode.codeFactory(HCodeFactory, Frame)

codeFactory

public static HCodeFactory codeFactory(Frame frame)
Return a code factory for CanonicalTreeCode, using the default code factory for TreeCode