harpoon.IR.Tree
Class ESEQ

java.lang.Object
  |
  +--harpoon.IR.Tree.Tree
        |
        +--harpoon.IR.Tree.Exp
              |
              +--harpoon.IR.Tree.ESEQ
All Implemented Interfaces:
HCodeElement, PreciselyTyped, Typed

public class ESEQ
extends Exp
implements PreciselyTyped

ESEQ objects are expressions which chain a statement and an expression together. The statement is evaluated for side effects, then the expression is evaluated. The value of the expression is the value of the ESEQ.

ESEQs are PreciselyTyped because the enclosed Exp may be PreciselyTyped. In contexts such as MOVE(ESEQ(stm, MEM<small>(e1)), e2), the ESEQ clearly has the same small type as the MEM.

Version:
$Id: ESEQ.java,v 1.3 2002/02/26 22:46:10 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>, based on Modern Compiler Implementation in Java by Andrew Appel.

Nested Class Summary
 
Nested classes inherited from class harpoon.IR.Tree.Tree
Tree.CloneCallback
 
Field Summary
 
Fields inherited from class harpoon.IR.Tree.Tree
arrayFactory, child
 
Fields inherited from interface harpoon.IR.Tree.Typed
DOUBLE, FLOAT, INT, LONG, POINTER
 
Constructor Summary
ESEQ(TreeFactory tf, HCodeElement source, Stm stm, Exp exp)
          Constructor.
 
Method Summary
 void accept(TreeVisitor v)
          Accept a visitor
 int bitwidth()
          Returns the size of the expression, in bits.
 Exp build(TreeFactory tf, ExpList kids)
           
 Exp getExp()
          Returns the expression whose value is the the value of the ESEQ.
 Stm getStm()
          Returns the statement to evaluate for side-effects.
 boolean isSmall()
          Returns true if this expression is a small type, false otherwise.
 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 setExp(Exp exp)
          Sets the expression whose value is the the value of the ESEQ.
 void setStm(Stm stm)
          Sets the statement to evaluate for side-effects.
 boolean signed()
          Returns true if this is a signed expression, false otherwise.
 String toString()
           
 int type()
          Returns enumerated constant (INT, LONG, FLOAT, DOUBLE, or POINTER) corresponding to the type of the expression.
 
Methods inherited from class harpoon.IR.Tree.Exp
build, isDoubleWord, isFloatingPoint
 
Methods inherited from class harpoon.IR.Tree.Tree
clone, clone, getChild, getFactory, getFirstChild, getID, getLineNumber, getParent, getSibling, getSourceFile, hashCode, rename, replace, setChild
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface harpoon.IR.Tree.Typed
isDoubleWord, isFloatingPoint
 

Constructor Detail

ESEQ

public ESEQ(TreeFactory tf,
            HCodeElement source,
            Stm stm,
            Exp exp)
Constructor.

Method Detail

getStm

public Stm getStm()
Returns the statement to evaluate for side-effects.


getExp

public Exp getExp()
Returns the expression whose value is the the value of the ESEQ.


setStm

public void setStm(Stm stm)
Sets the statement to evaluate for side-effects.


setExp

public void setExp(Exp exp)
Sets the expression whose value is the the value of the ESEQ.


kids

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

Overrides:
kids in class Tree

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

build

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

accept

public void accept(TreeVisitor v)
Accept a visitor

Specified by:
accept in class Tree

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

type

public int type()
Description copied from interface: Typed
Returns enumerated constant (INT, LONG, FLOAT, DOUBLE, or POINTER) corresponding to the type of the expression.

Specified by:
type in interface Typed
Specified by:
type in class Exp

isSmall

public boolean isSmall()
Description copied from interface: PreciselyTyped
Returns true if this expression is a small type, false otherwise.

Specified by:
isSmall in interface PreciselyTyped

bitwidth

public int bitwidth()
Description copied from interface: PreciselyTyped
Returns the size of the expression, in bits. Only valid if the isSmall()==true.

Specified by:
bitwidth in interface PreciselyTyped

signed

public boolean signed()
Description copied from interface: PreciselyTyped
Returns true if this is a signed expression, false otherwise. Only valid if the isSmall()==true.

Specified by:
signed in interface PreciselyTyped

toString

public String toString()
Overrides:
toString in class Object