harpoon.IR.LowQuad
Class DerivationMap

java.lang.Object
  |
  +--harpoon.IR.LowQuad.DerivationMap
All Implemented Interfaces:
Derivation, TypeMap

public class DerivationMap
extends Object
implements Derivation

DerivationMap is a simple map-based implementation of common Derivation functionality.

Version:
$Id: DerivationMap.java,v 1.3 2002/02/26 22:45:45 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
DerivationGenerator

Nested Class Summary
 
Nested classes inherited from class harpoon.Analysis.Maps.Derivation
Derivation.DList
 
Nested classes inherited from class harpoon.Analysis.Maps.TypeMap
TypeMap.TypeNotKnownException
 
Constructor Summary
DerivationMap()
          Creates a DerivationMap.
 
Method Summary
 Derivation.DList derivation(HCodeElement hce, Temp t)
          Map compiler temporaries to their derivations.
 void putDerivation(HCodeElement hce, Temp t, Derivation.DList derivation)
          Add a mapping from the given Temp t defined at the given HCodeElement hce to the given Derivation.DList derivation to this DerivationMap.
 void putType(HCodeElement hce, Temp t, HClass type)
          Add a mapping from the given Temp t defined at the given HCodeElement hce to the given HClass type to this DerivationMap.
 void remove(HCodeElement hce, Temp t)
          Remove all type and derivation mappings for the given Temp defined at the given HCodeElement.
 void transfer(HCodeElement new_hce, HCodeElement old_hce, Temp[] old_defs, TempMap old2new, Derivation old_deriv)
          Transfer typings from one Derivation to another, using an appropriate TempMap.
 HClass typeMap(HCodeElement hce, Temp t)
          Return the type of a given temporary t, as defined at the definition point hce.
 void update(HCodeElement old_hce, Temp old_t, HCodeElement new_hce, Temp new_t)
          Transfer typing from one place to another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DerivationMap

public DerivationMap()
Creates a DerivationMap.

Method Detail

typeMap

public HClass typeMap(HCodeElement hce,
                      Temp t)
               throws TypeMap.TypeNotKnownException
Description copied from interface: TypeMap
Return the type of a given temporary t, as defined at the definition point hce. Iff the type of the temporary is not known, or if hce does not define t, throws TypeNotKnownException. If the temporary represents a derived pointer, null should be returned; in which case the Derivation must return a non-null value. Obviously, TypeMaps for high-level representations without derived pointers should never return null. As a special case, HClass.Void may be returned in low-level IRs to indicate an opaque pointer value which does not correspond to a java object pointer or some derivation thereof --- for example, a pointer into a method dispatch table. The only other time HClass.Void should be returned is for known-null pointer values.

Specified by:
typeMap in interface TypeMap
Parameters:
hce - The HCodeElement defining t.
t - The temporary to examine.
Returns:
the static type of t.
Throws:
TypeMap.TypeNotKnownException - if the TypeMap does not have any information about t as defined at hc.
TypeMap.TypeNotKnownException

derivation

public Derivation.DList derivation(HCodeElement hce,
                                   Temp t)
                            throws TypeMap.TypeNotKnownException
Description copied from interface: Derivation
Map compiler temporaries to their derivations.

Specified by:
derivation in interface Derivation
Parameters:
t - The temporary to query.
hce - A definition point for t.
Returns:
null if the temporary has no derivation (is a base pointer, for example), or the derivation otherwise.
TypeMap.TypeNotKnownException

putType

public void putType(HCodeElement hce,
                    Temp t,
                    HClass type)
Add a mapping from the given Temp t defined at the given HCodeElement hce to the given HClass type to this DerivationMap.


putDerivation

public void putDerivation(HCodeElement hce,
                          Temp t,
                          Derivation.DList derivation)
Add a mapping from the given Temp t defined at the given HCodeElement hce to the given Derivation.DList derivation to this DerivationMap.


update

public void update(HCodeElement old_hce,
                   Temp old_t,
                   HCodeElement new_hce,
                   Temp new_t)
Transfer typing from one place to another.


transfer

public void transfer(HCodeElement new_hce,
                     HCodeElement old_hce,
                     Temp[] old_defs,
                     TempMap old2new,
                     Derivation old_deriv)
Transfer typings from one Derivation to another, using an appropriate TempMap.


remove

public void remove(HCodeElement hce,
                   Temp t)
Remove all type and derivation mappings for the given Temp defined at the given HCodeElement. Used for memory management purposes.