harpoon.Util.TypeInference
Class TypeInference

java.lang.Object
  extended by harpoon.Util.TypeInference.TypeInference
All Implemented Interfaces:
Serializable

public class TypeInference
extends Object
implements Serializable

TypeInference is a very simple type inference module. It was written to satisfy some immediate needs in the Pointer Analysis (mainly determining is a temp could point to an array of non-primitive objects (ie not int[]). However, it is very general and can be used to compute the types of some arbitrary set of ExactTemps (not necessarily all the Temps from the body of a method).
Works for quad-no-ssa only (anyway, it is trivial to write the extensions for the other quads).

Version:
$Id: TypeInference.java,v 1.6 2005/08/17 23:40:52 salcianu Exp $
Author:
Alexandru SALCIANU <salcianu@retezat.lcs.mit.edu>
See Also:
Serialized Form

Field Summary
static boolean DEBUG
           
 
Constructor Summary
TypeInference(HMethod hm, HCode hcode, Set ietemps)
          Creates a TypeInference.
 
Method Summary
 Set getType(ExactTemp et)
          Returns the possible types for the temp et.t in the quad et.q.
 boolean isArrayOfNonPrimitives(ExactTemp et)
          Checks whether the temp et.t in instruction et.q points to an array of non-primitive type components (ie non an int[].
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG
Constructor Detail

TypeInference

public TypeInference(HMethod hm,
                     HCode hcode,
                     Set ietemps)
Creates a TypeInference. This object is supposed to provide type information about the ExactTemps from the set ietemps. All these exact temps are supposed to be defined in hcode.

Method Detail

getType

public Set getType(ExactTemp et)
Returns the possible types for the temp et.t in the quad et.q. This method should be called only for ExactTemp that were in the ietemps set passed to the constructor of this object.


isArrayOfNonPrimitives

public boolean isArrayOfNonPrimitives(ExactTemp et)
Checks whether the temp et.t in instruction et.q points to an array of non-primitive type components (ie non an int[]. This is useful in the PointerAnalysis stuff to see if an AGET deserves to be introduced (and possibly a new LOAD node).