scale.clef.type
Class ProcedureType

java.lang.Object
  |
  +--scale.common.Root
        |
        +--scale.clef.Node
              |
              +--scale.clef.type.Type
                    |
                    +--scale.clef.type.ProcedureType
All Implemented Interfaces:
AnnotationInterface, DisplayNode, java.io.Serializable
Direct Known Subclasses:
MethodType

public class ProcedureType
extends Type

A ProcedureType represents the type of a procedure.

$Id: ProcedureType.java,v 1.35 2002/01/03 21:44:13 burrill Exp $

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

See Also:
Serialized Form

Fields inherited from interface scale.common.DisplayNode
ANNO, CLEF, DD, DEFUSE, DOM, EXPR, MAYUSE, TYPE
 
Constructor Summary
protected ProcedureType(Type returnType, Vector formals, Vector raises)
           
 
Method Summary
 int alignment(Machine machine)
          Calculate the alignment needed for this data type.
 boolean compareSignatures(ProcedureType s2, boolean procedureMatchUnknown, boolean procedureFormalName, boolean procedureFormalMode, boolean procedureMatchExceptions, boolean procedureExactExceptions)
           
static ProcedureType create(Type returnType, Vector formals, Vector raises)
          Re-use an existing instance of a particular procedure type.
protected  Vector createChildren()
          Create the list of children for the node - each node that has children must implement this method.
 boolean equivalent(Type t)
          Compares two ProcedureTypes for equivalence as defined by the type equivalence rules specified in ted.
protected  void finalize()
          Keep the count of instances up-to-date.
 java.util.Enumeration getFormals()
          Return an Enumeration of the formal parameters.
 int getNumFormals()
          Return the number of formal parameters.
 int getNumRaises()
          Return the number of exceptions raised.
 java.util.Enumeration getRaises()
          Return an enumeration of the exceptions raised.
 Vector getRaiseVector()
          Return a Vector of exceptions raised.
 Type getReturnType()
          Return the return type of the procedure.
static java.util.Enumeration getTypes()
          Return an Enumeration of all the different types.
 boolean isAddressType()
          Return true if type represents the address of something.
 int memorySize(Machine machine)
          Calculate how many addressable memory units are needed to represent the type.
static int number()
          Return the current number of instances of this class.
 boolean sameFormals(Vector formals)
          Return true if the formals match.
 boolean sameRaises(Vector raises)
          Return true if the formals match.
 java.lang.String toStringSpecial()
          Return any special information of a node that is not a child or annotation.
 void visit(Predicate p)
          The visit() method is used to implement a visit 'pattern'.
 
Methods inherited from class scale.clef.type.Type
getCompleteType, getCoreType, getDisplayColorHint, getDisplayShapeHint, getDisplayText, getPointedTo, getTag, getType, isAggregateType, isArrayType, isAtomicType, isAttributeSet, isComplexType, isCompositeType, isConst, isIntegerType, isNamedType, isNumericType, isPointerType, isRealType, isSigned, isVoidType, isVolatile, nextVisit, setTag, setVisited, toString, toStringShort, visited
 
Methods inherited from class scale.clef.Node
getChildren, getDecl, getParent, setAnnotationLevel, setParent, setReportLevel, toString, toStringChildren
 
Methods inherited from class scale.common.Root
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayName, getDisplayString, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, hashCode, removeAnnotation, removeAnnotations, toStringAnnotations, toStringClass
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProcedureType

protected ProcedureType(Type returnType,
                        Vector formals,
                        Vector raises)
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Keep the count of instances up-to-date.
Overrides:
finalize in class Type
Throws:
java.lang.Throwable - [needs description]

number

public static int number()
Return the current number of instances of this class.

create

public static ProcedureType create(Type returnType,
                                   Vector formals,
                                   Vector raises)
Re-use an existing instance of a particular procedure type. If no equivalent procedure type exists, create a new one.
Parameters:
returnType - the return type of the routine.
formals - a vector of FormalDecls. If the vector is empty, the routine is of the form r(void).
raises - the exceptions raised by the routine or null if none.

sameFormals

public boolean sameFormals(Vector formals)
Return true if the formals match.

sameRaises

public boolean sameRaises(Vector raises)
Return true if the formals match.

isAddressType

public boolean isAddressType()
Return true if type represents the address of something.
Overrides:
isAddressType in class Type

getReturnType

public final Type getReturnType()
Return the return type of the procedure.

getFormals

public final java.util.Enumeration getFormals()
Return an Enumeration of the formal parameters.

getNumFormals

public int getNumFormals()
Return the number of formal parameters.

getRaises

public final java.util.Enumeration getRaises()
Return an enumeration of the exceptions raised.

getRaiseVector

public final Vector getRaiseVector()
Return a Vector of exceptions raised.

getNumRaises

public int getNumRaises()
Return the number of exceptions raised.

visit

public void visit(Predicate p)
Description copied from class: Node
The visit() method is used to implement a visit 'pattern'.
Overrides:
visit in class Type

createChildren

protected Vector createChildren()
Description copied from class: Node
Create the list of children for the node - each node that has children must implement this method. However, use getChildren() to actually get the children.
Overrides:
createChildren in class Node
Following copied from class: scale.clef.Node
Returns:
the list of children

toStringSpecial

public java.lang.String toStringSpecial()
Description copied from class: Root
Return any special information of a node that is not a child or annotation. This method is meant to be overridden by nodes that need to provide special output.
Overrides:
toStringSpecial in class Node

compareSignatures

public boolean compareSignatures(ProcedureType s2,
                                 boolean procedureMatchUnknown,
                                 boolean procedureFormalName,
                                 boolean procedureFormalMode,
                                 boolean procedureMatchExceptions,
                                 boolean procedureExactExceptions)

equivalent

public boolean equivalent(Type t)
Compares two ProcedureTypes for equivalence as defined by the type equivalence rules specified in ted.
Overrides:
equivalent in class Type
Returns:
true if the types are equivalent

getTypes

public static java.util.Enumeration getTypes()
Return an Enumeration of all the different types.

memorySize

public int memorySize(Machine machine)
Calculate how many addressable memory units are needed to represent the type.
Overrides:
memorySize in class Type
Parameters:
machine - is the machine-specific data machine
Returns:
the number of addressable memory units required to represent this type

alignment

public int alignment(Machine machine)
Calculate the alignment needed for this data type.
Overrides:
alignment in class Type