harpoon.IR.Tree
Class DATUM

java.lang.Object
  extended by harpoon.IR.Tree.Tree
      extended by harpoon.IR.Tree.Stm
          extended by harpoon.IR.Tree.DATUM
All Implemented Interfaces:
HCodeElement, HDataElement

public class DATUM
extends Stm
implements HDataElement

DATUM objects are statements which write a value to memory at the time when a program is loaded. The location written is calculated using this formula:

         location = base + offset
 
 where 
         base   = location of nearest LABEL, l,  which precedes this DATUM
         offset = the total size of all instructions between l and this DATUM
                      
 

Version:
$Id: DATUM.java,v 1.4 2002/04/10 03:05:44 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
 boolean initialized
          If false, the memory is not initialized; instead it is reserved with an unspecified value.
 
Fields inherited from class harpoon.IR.Tree.Tree
arrayFactory, child
 
Constructor Summary
DATUM(TreeFactory tf, HCodeElement source, Exp data)
          Class constructor.
DATUM(TreeFactory tf, HCodeElement source, int type)
          Class constructor.
DATUM(TreeFactory tf, HCodeElement source, int bitwidth, boolean signed)
          Class constructor.
 
Method Summary
 void accept(TreeVisitor v)
          Accept a visitor
 Stm build(TreeFactory tf, ExpList kids)
           
 Exp getData()
          Returns the expression to write to memory.
 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 setData(Exp data)
          Sets the expression to write to memory.
 String toString()
           
 
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, kids, rename, replace, setChild, unlink
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface harpoon.ClassFile.HDataElement
getID, getSourceFile
 

Field Detail

initialized

public final boolean initialized
If false, the memory is not initialized; instead it is reserved with an unspecified value.

Constructor Detail

DATUM

public DATUM(TreeFactory tf,
             HCodeElement source,
             Exp data)
Class constructor. The parameter
data must be an instance of either harpoon.IR.Tree.CONST or harpoon.IR.Tree.NAME. Passing null for the parameter data reserves a word of memory at the location of this DATUM without assigning it a value.


DATUM

public DATUM(TreeFactory tf,
             HCodeElement source,
             int type)
Class constructor. Reserves memory at the location of this DATUM of the size of the specified type without assigning it a value.


DATUM

public DATUM(TreeFactory tf,
             HCodeElement source,
             int bitwidth,
             boolean signed)
Class constructor. Reserves memory at the location of this DATUM of the specified small without assigning it a value.

Method Detail

getData

public Exp getData()
Returns the expression to write to memory. Never null.


setData

public void setData(Exp data)
Sets the expression to write to memory. Never null.


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 Stm build(TreeFactory tf,
                 ExpList kids)
Specified by:
build in class Stm

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

toString

public String toString()
Overrides:
toString in class Object