scale.alias.shapirohorowitz
Class FunctionTypeCat

java.lang.Object
  extended by scale.alias.steensgaard.AliasType
      extended by scale.alias.shapirohorowitz.FunctionTypeCat

public class FunctionTypeCat
extends AliasType

A class which implements the non-standard type describing functions (or pointers to functions).

$Id: FunctionTypeCat.java,v 1.12 2005-02-07 21:27:10 burrill Exp $

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

In Steensgaard's paper, he refers to this as lambda types. A function type contains a list of parameters (represented as ValueType objects) and a list of function return values (also represented as ValueType objects). Although Steensgaard's algorithm allows multiple return values, we just use one.


Field Summary
 
Fields inherited from class scale.alias.steensgaard.AliasType
BOT
 
Constructor Summary
FunctionTypeCat(int numberCategories)
          Create a function type with an empty list of arguments and a return type with the value BOTTOM (upside down T).
 
Method Summary
 void addArgument(ValueTypeCat a)
          Add an argument to the function type.
 void cleanup()
          Remove any un-needed stuff after analysis has been performed.
 AliasType getArgument(int i)
          Return the specified argument.
 ValueTypeCat getRetval()
          Return the type representing the function return value.
 int numArguments()
          Return the number of arguments.
 Vector<ECR> pointsTo()
          Return the points-to relation for this type.
 void setRetval(ValueTypeCat r)
          Set function's return value type.
 java.lang.String toStringSpecial()
          Return a string representing of a function type.
 void unify(AliasType t)
          Recursively join two function types.
 
Methods inherited from class scale.alias.steensgaard.AliasType
getNodeID, pointsToSize, toString, toStringClass, toStringShort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FunctionTypeCat

public FunctionTypeCat(int numberCategories)
Create a function type with an empty list of arguments and a return type with the value BOTTOM (upside down T).

Method Detail

numArguments

public int numArguments()
Return the number of arguments.


getArgument

public AliasType getArgument(int i)
Return the specified argument.


addArgument

public final void addArgument(ValueTypeCat a)
Add an argument to the function type.

Parameters:
a - the argument to add to the function type

getRetval

public final ValueTypeCat getRetval()
Return the type representing the function return value.

Returns:
the type representing the function return value.

setRetval

public final void setRetval(ValueTypeCat r)
Set function's return value type.

Parameters:
r - the ECR representing the return value.

unify

public final void unify(AliasType t)
Recursively join two function types.

Overrides:
unify in class AliasType
Parameters:
t - a function type.

pointsTo

public Vector<ECR> pointsTo()
Return the points-to relation for this type. In this representation, function types do not point to anything.

Overrides:
pointsTo in class AliasType
Returns:
an empty vector.

toStringSpecial

public java.lang.String toStringSpecial()
Return a string representing of a function type.

Overrides:
toStringSpecial in class AliasType
Returns:
a string representing of a function type.

cleanup

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

Overrides:
cleanup in class AliasType