harpoon.IR.LowQuad
Class DerivationMap<HCE extends HCodeElement>

java.lang.Object
  extended by harpoon.IR.LowQuad.DerivationMap<HCE>
All Implemented Interfaces:
Derivation<HCE>, TypeMap<HCE>

public class DerivationMap<HCE extends HCodeElement>
extends Object
implements Derivation<HCE>

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

Version:
$Id: DerivationMap.java,v 1.6 2004/02/08 01:55:17 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
DerivationGenerator

Nested Class Summary
 
Nested classes/interfaces inherited from interface harpoon.Analysis.Maps.Derivation
Derivation.DList
 
Nested classes/interfaces inherited from interface harpoon.Analysis.Maps.TypeMap
TypeMap.TypeNotKnownException
 
Constructor Summary
DerivationMap()
          Creates a DerivationMap.
 
Method Summary
 Derivation.DList derivation(HCE hce, Temp t)
          Map compiler temporaries to their derivations.
 void putDerivation(HCE 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(HCE 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(HCE hce, Temp t)
          Remove all type and derivation mappings for the given Temp defined at the given HCodeElement.
<HCE2 extends HCodeElement>
void
transfer(HCE new_hce, HCE2 old_hce, Temp[] old_defs, TempMap old2new, Derivation<HCE2> old_deriv)
          Transfer typings from one Derivation to another, using an appropriate TempMap.
 HClass typeMap(HCE hce, Temp t)
          Return the type of a given temporary t, as defined at the definition point hce.
 void update(HCE old_hce, Temp old_t, HCE 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(HCE 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<HCE extends HCodeElement>
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.

derivation

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

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

putType

public void putType(HCE 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(HCE 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(HCE old_hce,
                   Temp old_t,
                   HCE new_hce,
                   Temp new_t)
Transfer typing from one place to another.


transfer

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


remove

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