harpoon.IR.Tree
Class Stm

java.lang.Object
  extended by harpoon.IR.Tree.Tree
      extended by harpoon.IR.Tree.Stm
All Implemented Interfaces:
HCodeElement
Direct Known Subclasses:
ALIGN, CJUMP, DATUM, EXPR, INVOCATION, JUMP, LABEL, METHOD, MOVE, RETURN, SEGMENT, SEQ, THROW

public abstract class Stm
extends Tree

Stm objects are statements which perform side effects and control flow.

Version:
$Id: Stm.java,v 1.3 2002/04/10 03:05:45 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/interfaces inherited from class harpoon.IR.Tree.Tree
Tree.CloneCallback
 
Field Summary
 
Fields inherited from class harpoon.IR.Tree.Tree
arrayFactory, child
 
Constructor Summary
protected Stm(TreeFactory tf, HCodeElement source, int arity)
           
 
Method Summary
 Stm build(ExpList kids)
          Build an Stm of this type from the given list of subexpressions.
abstract  Stm build(TreeFactory tf, ExpList kids)
           
static boolean isNop(Stm stm)
          Returns true if stm has no effect.
static Stm linearize(Stm stm)
          Returns a Stm such that all SEQ objects contained within the Stm object are on the top level.
static Stm toStm(List<Stm> list)
          Returns a tree-based representation of list.
 
Methods inherited from class harpoon.IR.Tree.Tree
accept, clone, clone, getChild, getFactory, getFirstChild, getID, getLineNumber, getParent, getSibling, getSourceFile, hashCode, kids, kind, rename, rename, replace, setChild, unlink
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stm

protected Stm(TreeFactory tf,
              HCodeElement source,
              int arity)
Method Detail

build

public final Stm build(ExpList kids)
Build an Stm of this type from the given list of subexpressions.


build

public abstract Stm build(TreeFactory tf,
                          ExpList kids)

toStm

public static Stm toStm(List<Stm> list)
Returns a tree-based representation of list.
Requires: foreach element, l, of list, (l != null) && (l instanceof Stm).
Modifies:
Effects: returns a tree-based representation of list. If list is null, returns null.


linearize

public static Stm linearize(Stm stm)
Returns a Stm such that all SEQ objects contained within the Stm object are on the top level.


isNop

public static boolean isNop(Stm stm)
Returns true if stm has no effect.