harpoon.IR.Tree
Class METHOD

java.lang.Object
  extended by harpoon.IR.Tree.Tree
      extended by harpoon.IR.Tree.Stm
          extended by harpoon.IR.Tree.METHOD
All Implemented Interfaces:
HCodeElement

public class METHOD
extends Stm

Tree.METHOD objects encode method-specific information: the mapping of method formals to temporary variables, and links to the exception handlers for the method.

Version:
$Id: METHOD.java,v 1.4 2002/04/10 03:05:45 cananian Exp $
Author:
Duncan Bryce <duncan@lcs.mit.edu>

Nested Class Summary
 
Nested classes/interfaces inherited from class harpoon.IR.Tree.Tree
Tree.CloneCallback
 
Field Summary
 
Fields inherited from class harpoon.IR.Tree.Tree
arrayFactory, child
 
Constructor Summary
METHOD(TreeFactory tf, HCodeElement source, Label method, int retType, TEMP[] params)
          Creates a Tree.METHOD object.
 
Method Summary
 void accept(TreeVisitor v)
          Accept a visitor.
 Stm build(TreeFactory tf, ExpList kids)
           
 Label getMethod()
          Return the label which should mark the top of the method.
 TEMP[] getParams()
          Return the temporary variables used for method formals.
 TEMP getParams(int i)
           
 int getParamsLength()
           
 int getReturnType()
          Return an integer enumeration (see Typed) of the return type of the method.
 ExpList kids()
          Return a list of subexpressions of this Tree.
 int kind()
          Return an integer enumeration of the kind of this Tree.
 Tree rename(TreeFactory tf, TempMap tm, Tree.CloneCallback cb)
          Rename while cloning a subtree.
 void setParams(TEMP[] params)
          Set the temporary variables used for method formals.
 String toString()
          Returns human-readable representation of this Tree.
 
Methods inherited from class harpoon.IR.Tree.Stm
build, isNop, linearize, toStm
 
Methods inherited from class harpoon.IR.Tree.Tree
clone, clone, getChild, getFactory, getFirstChild, getID, getLineNumber, getParent, getSibling, getSourceFile, hashCode, rename, replace, setChild, unlink
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

METHOD

public METHOD(TreeFactory tf,
              HCodeElement source,
              Label method,
              int retType,
              TEMP[] params)
Creates a Tree.METHOD object.

Parameters:
method - label to mark the top of the method
retType - integer enumeration (see Typed) of the return type of this method, or -1 if the method returns no value.
params - temporaries which map directly to the parameters of this Tree.METHOD. The first element should be a pointer to the exception-handling code for this method. For non-static methods, the second parameter should be the this pointer of the caller. Subsequent elements of the array should be the formal parameters of the method, in the order which they are declared.
Method Detail

getMethod

public Label getMethod()
Return the label which should mark the top of the method.


getReturnType

public int getReturnType()
Return an integer enumeration (see Typed) of the return type of the method. Returns -1 if the method returns no value.


getParams

public TEMP[] getParams()
Return the temporary variables used for method formals.


setParams

public void setParams(TEMP[] params)
Set the temporary variables used for method formals.


getParamsLength

public int getParamsLength()

getParams

public TEMP getParams(int i)

kind

public int kind()
Description copied from class: Tree
Return an integer enumeration of the kind of this Tree. The enumerated values are defined in TreeKind.

Specified by:
kind in class Tree

kids

public ExpList kids()
Description copied from class: Tree
Return a list of subexpressions of this Tree.

Overrides:
kids in class Tree

build

public Stm build(TreeFactory tf,
                 ExpList kids)
Specified by:
build in class Stm

rename

public Tree rename(TreeFactory tf,
                   TempMap tm,
                   Tree.CloneCallback cb)
Description copied from class: Tree
Rename while cloning a subtree. This node and all child nodes are cloned; the 'temp' information of all TEMP nodes are renamed according to the supplied TempMap. Note that Temps not belonging to this.getFactory().tempFactory() are not affected. The callback() method of the supplied CloneCallback is invoked once on each subtree cloned, starting from the leaves and working back to the root in a post-order depth-first manner.

Specified by:
rename in class Tree

accept

public void accept(TreeVisitor v)
Accept a visitor.

Specified by:
accept in class Tree

toString

public String toString()
Returns human-readable representation of this Tree.

Overrides:
toString in class Object