harpoon.Analysis.Maps
Class Derivation.DList

java.lang.Object
  extended by harpoon.Analysis.Maps.Derivation.DList
Enclosing interface:
Derivation<HCE extends HCodeElement>

public static class Derivation.DList
extends Object

Structure of the derivation information.

Given three Temps t1, t2, and t3, a derived pointer d whose value can be described by the equation:

   d = K + t1 - t2 + t3
  
for some (non-constant) integer K at every point during runtime can be represented as the DList
   new DList(t1, true, new DList(t2, false, new DList(t3, true)))
  
.

NOTE that the temporaries named in the DList refer to the reaching definitions of those temporaries at the definition point of the variable with the derived type. In SSI/SSA forms, this does not matter, as every variable has exactly one reaching definition, but in other forms it is the responsibility of the implementor to ensure that the base pointers are not overwritten while the derived value is live.

ALSO NOTE that the temporaries named in the DList are base pointers -- that is, they have pure types, not derived types. In particular, the derivation() method applied to any temporary named in a DList should return null. Derived types derived from other derived types are not allowed.


Field Summary
 Temp base
          Base pointer.
 Derivation.DList next
          Pointer to a continuation of the derivation, or null if there are no more base pointers associated with this derived pointer.
 boolean sign
          Sign of base pointer.
 
Constructor Summary
Derivation.DList(Temp base, boolean sign, Derivation.DList next)
          Constructor.
 
Method Summary
 Derivation.DList canonicalize()
          Canonicalize a DList.
static Derivation.DList clone(Derivation.DList dlist)
          Returns a clean copy of this DList.
 boolean equals(Object o)
          Equality test.
static Derivation.DList rename(Derivation.DList dlist, TempMap tempMap)
          Returns a new DList with the Temps renamed by the supplied mapping
 String toString()
          Returns a human-readable description of this DList.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

base

public final Temp base
Base pointer.


sign

public final boolean sign
Sign of base pointer. true if derived pointer equals offset + base pointer, false if derived pointer equals offset - base pointer.


next

public final Derivation.DList next
Pointer to a continuation of the derivation, or null if there are no more base pointers associated with this derived pointer.

Constructor Detail

Derivation.DList

public Derivation.DList(Temp base,
                        boolean sign,
                        Derivation.DList next)
Constructor.

Method Detail

toString

public String toString()
Returns a human-readable description of this DList.

Overrides:
toString in class Object

equals

public boolean equals(Object o)
Equality test. Compares the canonical forms of the DLists for strict equality.

Overrides:
equals in class Object

canonicalize

public Derivation.DList canonicalize()
Canonicalize a DList. The canonicalized form of a DList has all components sorted by Temp (using the natural ordering of Temps), and is algebraically simplified --- that is, components with the same Temp and opposite signs cancel out.


clone

public static Derivation.DList clone(Derivation.DList dlist)
Returns a clean copy of this DList. Does not rename Temps in any way.


rename

public static Derivation.DList rename(Derivation.DList dlist,
                                      TempMap tempMap)
Returns a new DList with the Temps renamed by the supplied mapping