scale.alias.steensgaard
Class TypeVar

java.lang.Object
  extended by scale.alias.AliasVar
      extended by scale.alias.steensgaard.TypeVar
Direct Known Subclasses:
TypeVarCat

public class TypeVar
extends AliasVar

A class which represents a type variable in Steensgaard's alias analysis algorithm.

$Id: TypeVar.java,v 1.30 2006-02-28 16:37:02 burrill Exp $

Copyright 2008 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

A class which represents a type variable. The type variable is the interface between the user variables and the variables maintained by Steensgaard's algorithm. In the algorithm, each variable is associated with a type which is a description of the abstract location for the variable. The type is represented by an ECR which is an element in the fast union/find data structure.

See Also:
ECR

Field Summary
protected  ECR ecr
          The ECR that represents the type of the variable.
 
Constructor Summary
TypeVar(Declaration decl)
          Create a new type variable.
TypeVar(Declaration n, AliasType t)
           
TypeVar(Declaration decl, TypeVar v)
          Create a new type variable which is equivalent to the given type variable.
 
Method Summary
 void allPointsTo(Vector<ECR> tv)
          return all points-to relations from this type variable
 void cleanup()
          Remove any un-needed stuff after analysis has been performed.
 java.lang.String getDisplayLabel()
          Return a String suitable for labeling this node in a graphical display.
 ECR getECR()
          Return the representative ECR associated with the type variable.
 ECR getOriginalECR()
          Return the original ECR associated with the type variable.
 boolean isAlias()
          Return true if the alias variable is involved in an alias relationship.
 Vector<ECR> pointsTo()
          Return the points-to relation for this alias variable.
 int pointsToSize()
          Return the points-to size for this alias variable.
 java.lang.String toStringSpecial()
          Return a string representation of a type variable.
 
Methods inherited from class scale.alias.AliasVar
getDeclName, toString, toStringClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ecr

protected ECR ecr
The ECR that represents the type of the variable.

Constructor Detail

TypeVar

public TypeVar(Declaration n,
               AliasType t)

TypeVar

public TypeVar(Declaration decl)
Create a new type variable. The initial type is ref(BOT, BOT).


TypeVar

public TypeVar(Declaration decl,
               TypeVar v)
Create a new type variable which is equivalent to the given type variable. That is, they belong to the same ECR.

Parameters:
decl - is the name of the variable.
v - is the type variable with the type information.
Method Detail

getECR

public final ECR getECR()
Return the representative ECR associated with the type variable.

Specified by:
getECR in class AliasVar

getOriginalECR

public final ECR getOriginalECR()
Return the original ECR associated with the type variable. The ECR may not be the representative ECR.


isAlias

public boolean isAlias()
Return true if the alias variable is involved in an alias relationship.

Specified by:
isAlias in class AliasVar

pointsTo

public Vector<ECR> pointsTo()
Return the points-to relation for this alias variable. In Steensgaard's algorithm, each variable only points to one other alias variable. However, each alias variable represents more than one actual variable.

Specified by:
pointsTo in class AliasVar
Returns:
the points-to relation for this alias variable.

pointsToSize

public int pointsToSize()
Return the points-to size for this alias variable. In Steensgaard's algorithm, each variable only points to one other alias variable. However, each alias variable represents more than one actual variable.

Specified by:
pointsToSize in class AliasVar

toStringSpecial

public java.lang.String toStringSpecial()
Return a string representation of a type variable.

Overrides:
toStringSpecial in class AliasVar

getDisplayLabel

public java.lang.String getDisplayLabel()
Return a String suitable for labeling this node in a graphical display. This method should be over-ridden as it simplay returns the class name.

Overrides:
getDisplayLabel in class AliasVar

cleanup

public void cleanup()
Remove any un-needed stuff after analysis has been performed.

Specified by:
cleanup in class AliasVar

allPointsTo

public void allPointsTo(Vector<ECR> tv)
return all points-to relations from this type variable

Specified by:
allPointsTo in class AliasVar