scale.alias.steensgaard
Class FunctionType

java.lang.Object
  extended by scale.alias.steensgaard.AliasType
      extended by scale.alias.steensgaard.FunctionType

public class FunctionType
extends AliasType

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

$Id: FunctionType.java,v 1.24 2005-02-07 21:27:11 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
FunctionType()
          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(ValueType a)
          Add an argument to the function type.
 void addNewArguments(int n)
          Create new arguments.
 void cleanup()
          Remove any un-needed stuff after analysis has been performed.
 Vector<ValueType> getArguments()
          Return the list of arguments.
 ValueType getRetval()
          Return the type representing the function return value.
 Vector<ECR> pointsTo()
          Return the points-to relation for this type.
 int pointsToSize()
          Return the points-to size for this type.
 void setRetval(ValueType 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, toString, toStringClass, toStringShort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FunctionType

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

Method Detail

getArguments

public final Vector<ValueType> getArguments()
Return the list of arguments.


addArgument

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

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

addNewArguments

public void addNewArguments(int n)
Create new arguments.

Parameters:
n - is the number of new arguments to create

getRetval

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


setRetval

public final void setRetval(ValueType 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.

pointsToSize

public int pointsToSize()
Return the points-to size for this type. In this representation, function types do not point to anything.

Overrides:
pointsToSize in class AliasType

toStringSpecial

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

Overrides:
toStringSpecial in class AliasType

cleanup

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

Overrides:
cleanup in class AliasType