|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--scale.common.Root
|
+--scale.clef.Node
|
+--scale.clef.type.Type
This class is the root class for type nodes.
$Id: Type.java,v 1.68 2002/01/03 21:44:15 burrill Exp $
Copyright 2002 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
A type is represented by a graph (DAG) of type nodes.
The current list of special case nodes is as follows:
Types should not have annotations unless the annotation applies to every instance where the type may be used.
| Fields inherited from interface scale.common.DisplayNode |
ANNO, CLEF, DD, DEFUSE, DOM, EXPR, MAYUSE, TYPE |
| Constructor Summary | |
Type()
|
|
| Method Summary | |
abstract int |
alignment(Machine machine)
Calculate the alignment needed for this data type. |
abstract boolean |
equivalent(Type t)
Return true if the types are strictly equivalent. |
protected void |
finalize()
Keep the count of instances up-to-date. |
Type |
getCompleteType()
Return the completed type or null if it is not complete. |
Type |
getCoreType()
This method filters out some of the special case type nodes from a type DAG. |
java.lang.String |
getDisplayColorHint()
Return a String specifying the color to use for coloring this node in a graphical display. |
java.lang.String |
getDisplayShapeHint()
Return a String specifying a shape to use when drawing this node in a graphical display. |
java.lang.String |
getDisplayText()
Return a String suitable for labeling this node in a graphical display. |
Type |
getPointedTo()
Return the type of the thing pointed to. |
int |
getTag()
Return the tag associated with this variable. |
Type |
getType()
Return the Type associated with this Node. |
boolean |
isAddressType()
Return true if type represents the address of something. |
boolean |
isAggregateType()
Return true if type represents an aggregate object. |
boolean |
isArrayType()
Return true if type represents an array. |
boolean |
isAtomicType()
Return true if type represents a scaler value. |
boolean |
isAttributeSet(int attribute)
Return true if the attribute is associated with this type. |
boolean |
isComplexType()
Return true if type represents a complex value. |
boolean |
isCompositeType()
Return true if type represents a composite type. |
boolean |
isConst()
Return true if the type specifies const. |
boolean |
isIntegerType()
Return true if type represents an integer value. |
boolean |
isNamedType()
Return true if this type has an associated TypeDecl or TypeName. |
boolean |
isNumericType()
Return true if type represents a numeric value. |
boolean |
isPointerType()
Return true if type represents an address. |
boolean |
isRealType()
Return true if type represents a floating point value. |
boolean |
isSigned()
Return true is the type is signed. |
boolean |
isVoidType()
Return true if type represents no type. |
boolean |
isVolatile()
Return true if the type specifies volatile. |
abstract int |
memorySize(Machine machine)
Calculate how many addressable memory units are needed to represent the type. |
static void |
nextVisit()
Set up for a new traversal - that is, use the next color value. |
static int |
number()
Return the current number of instances of this class. |
void |
setTag(int tag)
Set the tag for this variable. |
void |
setVisited()
Associate the current color value with this Type. |
java.lang.String |
toString()
|
java.lang.String |
toStringShort()
|
void |
visit(Predicate p)
The visit() method is used to implement a visit 'pattern'. |
boolean |
visited()
Return true if this Type has been visited during the current visit (i.e., is the current color). |
| Methods inherited from class scale.clef.Node |
createChildren, getChildren, getDecl, getParent, setAnnotationLevel, setParent, setReportLevel, toString, toStringChildren, toStringSpecial |
| 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 |
public Type()
| Method Detail |
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable - [needs description]public static int number()
public static void nextVisit()
setVisited(),
visited(),
nextVisit()public void setVisited()
nextVisit(),
visited()public final boolean visited()
nextVisit(),
setVisited()public final void setTag(int tag)
public final int getTag()
public java.lang.String toString()
toString in class Nodepublic java.lang.String toStringShort()
public java.lang.String getDisplayText()
getDisplayText in class Rootpublic java.lang.String getDisplayColorHint()
getDisplayColorHint in class Rootpublic java.lang.String getDisplayShapeHint()
getDisplayShapeHint in class Rootpublic boolean isAddressType()
public boolean isArrayType()
public boolean isPointerType()
public boolean isVoidType()
public boolean isAggregateType()
public boolean isCompositeType()
public boolean isRealType()
public boolean isIntegerType()
public boolean isComplexType()
public boolean isAtomicType()
public boolean isNumericType()
public boolean isNamedType()
public boolean isSigned()
public boolean isAttributeSet(int attribute)
RefTypepublic void visit(Predicate p)
Nodevisit in class Nodepublic Type getCoreType()
We define
The remaining two special case type nodes are simply irrelevant for my current application, so I haven't bothered to determine what happens to them. This nondecision may be changed as appropriate in the future. Null implies the absense of a type, so no core type would exist.
This method instance defines the behavior for all core types, which is to simply return the current type. This method needs to be overridden in the select special case type classes.
getCoreType in class Nodescale.clef.NodeNode.getType(),
RefTypepublic Type getType()
NodegetType in class Nodepublic Type getCompleteType()
IncompleteTypepublic abstract boolean equivalent(Type t)
public Type getPointedTo()
public boolean isConst()
public boolean isVolatile()
public abstract int memorySize(Machine machine)
machine - is the machine-specific data machinepublic abstract int alignment(Machine machine)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||