harpoon.Analysis.Quads
Class TypeInfo

java.lang.Object
  |
  +--harpoon.Analysis.Quads.TypeInfo
All Implemented Interfaces:
ExactTypeMap, TypeMap

public class TypeInfo
extends Object
implements ExactTypeMap

TypeInfo is a simple type analysis tool for quad-ssi form.

Version:
$Id: TypeInfo.java,v 1.3 2002/02/26 22:41:42 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Nested Class Summary
 
Nested classes inherited from class harpoon.Analysis.Maps.ExactTypeMap
ExactTypeMap.ExactType
 
Nested classes inherited from class harpoon.Analysis.Maps.TypeMap
TypeMap.TypeNotKnownException
 
Constructor Summary
TypeInfo(Code hc)
          Creates a TypeInfo analyzer for the specified HCode, which must be in quad-ssi form.
TypeInfo(Code hc, UseDefMap usedef)
          Creates a TypeInfo analyzer for the specified HCode, which must be in quad-ssi form.
TypeInfo(Code hc, UseDefMap usedef, boolean vBehavior)
          Creates a TypeInfo analyzer for the specified HCode, which must be in quad-ssi form.
 
Method Summary
 boolean isExactType(HCodeElement hce, Temp t)
          Returns true if temporary t defined at definition point hce contains an object of the type returned by typeMap(hce, t) and not a subtype of that type.
 HClass typeMap(HCodeElement hce, Temp t)
          Return the type of a given temporary t, as defined at the definition point hce.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeInfo

public TypeInfo(Code hc,
                UseDefMap usedef)
Creates a TypeInfo analyzer for the specified HCode, which must be in quad-ssi form.


TypeInfo

public TypeInfo(Code hc,
                UseDefMap usedef,
                boolean vBehavior)
Creates a TypeInfo analyzer for the specified HCode, which must be in quad-ssi form. If vBehavior is true, the TypeInfo pass's IQ drops to the same level as a typical bytecode verifier; i.e. it gathers no information from instanceof's and such. Because of the IQ drop, the verifier sometimes can't determine that the operand of an AGET is really an array; with vBehaviour true the TypeInfo handles this case gracefully, rather than failing an assertion.


TypeInfo

public TypeInfo(Code hc)
Creates a TypeInfo analyzer for the specified HCode, which must be in quad-ssi form.

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

isExactType

public boolean isExactType(HCodeElement hce,
                           Temp t)
                    throws TypeMap.TypeNotKnownException
Description copied from interface: ExactTypeMap
Returns true if temporary t defined at definition point hce contains an object of the type returned by typeMap(hce, t) and not a subtype of that type. Returns false if the object in t can be a subtype of the type returned by typeMap(hce, t).

If typeMap() returns a primitive type, then isExactType() should return true.

Specified by:
isExactType in interface ExactTypeMap
Parameters:
hce - The HCodeElement defining t for this request.
t - The Temp to examine.
Returns:
true if t's type is exact, false otherwise.
TypeMap.TypeNotKnownException