|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectscale.common.Root
scale.clef.Node
scale.clef.type.Type
scale.clef.type.IncompleteType
public class IncompleteType
An IncompleteType is used to represent a type before the complete type is known.
$Id: IncompleteType.java,v 1.63 2007-08-27 18:13:32 burrill Exp $
Copyright 2007 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
For example, when creating a struct type in C, a field of the struct may reference itself.
| Constructor Summary | |
|---|---|
IncompleteType()
|
|
| Method Summary | |
|---|---|
int |
alignment(Machine machine)
Calculate the alignment needed for this data type. |
long |
elementSize(Machine machine)
Return the number of addressable memory units are needed to represent an element of the type. |
boolean |
equivalent(Type t)
Return true if the types are equivalent. |
Node |
getChild(int i)
Return the specified AST child of this node. |
Type |
getCompleteType()
Return the completed type or null if it is not complete. |
Type |
getCoreType()
This method filters out some the special case type nodes from a type DAG. |
Declaration |
getDecl()
Return the TypeDecl or TypeName of this type reference. |
protected Type |
getEquivalentType()
Return the type to be used by the equivalence method. |
Type |
getNonConstType()
Return the type without any "const" attributes. |
int |
getRank()
Return the rank of the type. |
Type |
getSignedType()
Return the equivalent signed type. |
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(RefAttr 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 |
isIncompleteType()
Return true if type represents an incomplete type. |
boolean |
isIntegerType()
Return true if type represents an integer value. |
boolean |
isNamedType()
Return true if this type has an associated TypeName or TypeDecl. |
boolean |
isNumericType()
Return true if type represents a numeric value. |
boolean |
isPointerType()
Return true if type represents an address. |
boolean |
isProcedureType()
Return true if this type represents a procedure. |
boolean |
isRealType()
Return true if type represents a floating point value. |
boolean |
isRestricted()
Return true if the type specifies restricted. |
boolean |
isSigned()
Return true is the type is signed. |
boolean |
isUnionType()
Return true if type represents a union object. |
boolean |
isVoidType()
Return true if type represents no type. |
boolean |
isVolatile()
Return true if the type specifies volatile. |
long |
memorySize(Machine machine)
Return the number of addressable memory units are needed to represent the type. |
int |
numChildren()
Return the number of AST children of this node. |
int |
precedence()
Return a precedence value for types. |
Type |
registerType()
Return the type to use if a variable of this type is in a register. |
IncompleteType |
returnIncompleteType()
Return if this is a IncompleteType, return this. |
void |
setCompleteType(Type type)
Specify the completed type. |
java.lang.String |
toStringSpecial()
This method allows sub-classes to provide class specific stuff to the string. |
void |
visit(Predicate p)
Process a node by calling its associated routine. |
void |
visit(TypePredicate p)
Process a node by calling its associated routine. |
| Methods inherited from class scale.clef.Node |
|---|
getSourceLineNumber, setAnnotationLevel, setReportLevel, setSourceLineNumber, toString, toStringChildren |
| Methods inherited from class scale.common.Root |
|---|
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayName, getDisplayString, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, hashCode, removeAnnotation, removeAnnotations, toStringAnnotations, toStringClass, trace, trace, trace |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IncompleteType()
| Method Detail |
|---|
public Type getCompleteType()
getCompleteType in class TypeIncompleteTypepublic final void setCompleteType(Type type)
public Type getNonConstType()
getNonConstType in class TypeRefTypepublic boolean isAttributeSet(RefAttr attribute)
isAttributeSet in class TypeRefTypepublic final boolean isIncompleteType()
isIncompleteType in class Typepublic final IncompleteType returnIncompleteType()
Typethis is a IncompleteType, return this. Otherwise, return
null.
returnIncompleteType in class Typepublic boolean isArrayType()
isArrayType in class Typepublic boolean isPointerType()
isPointerType in class Typepublic boolean isVoidType()
isVoidType in class Typepublic boolean isAggregateType()
isAggregateType in class Typepublic boolean isUnionType()
isUnionType in class Typepublic boolean isCompositeType()
isCompositeType in class Typepublic boolean isRealType()
isRealType in class Typepublic boolean isIntegerType()
isIntegerType in class Typepublic boolean isComplexType()
isComplexType in class Typepublic boolean isAtomicType()
isAtomicType in class Typepublic boolean isNumericType()
isNumericType in class Typepublic boolean isNamedType()
isNamedType in class Typepublic boolean isProcedureType()
isProcedureType in class Typepublic boolean isSigned()
isSigned in class Typepublic Type getSignedType()
getSignedType in class Typepublic Declaration getDecl()
getDecl in class Nodepublic Type registerType()
registerType in class Typepublic void visit(Predicate p)
Node
Each class has a visit(Predicate p) method. For
example, in class ABC:
public void visit(Predicate p)
{
p.visitABC(this);
}
and the class that implements Predicate has a method
public void visitABC(Node n)
{
ABC a = (ABC) n;
...
}
Thus, the class that implements Predicate can call
n.visit(this);where
n is a Node sub-class without
determining which specific sub-class n is.
The visit pattern basically avoids implementing a large
switch statement or defining different methods
in each class for some purpose.
visit in class TypePredicatepublic void visit(TypePredicate p)
Type
Each type class has a visit(TypePredicate p) method.
For example, in class ABC:
public void visit(Predicate p)
{
p.visitABC(this);
}
and the class that implements Predicate has a method
public void visitABC(Node n)
{
ABC a = (ABC) n;
...
}
Thus, the class that implements TypePredicate can call
n.visit(this);where
n is a Node sub-class without
determining which specific sub-class n is.
The visit pattern basically avoids implementing a large
switch statement or defining different methods
in each class for some purpose.
visit in class TypeTypePredicatepublic Node getChild(int i)
getChild in class Nodepublic int numChildren()
numChildren in class Nodepublic Type getCoreType()
getCoreType in class TypeType.getCoreType()public int getRank()
getRank in class Typepublic long memorySize(Machine machine)
memorySize in class Typemachine - is the machine-specific data machinepublic long elementSize(Machine machine)
memorySize().
elementSize in class Typemachine - is the machine-specific data machinepublic int alignment(Machine machine)
alignment in class Typepublic boolean isConst()
isConst in class Typepublic boolean isVolatile()
isVolatile in class Typepublic boolean isRestricted()
isRestricted in class Typepublic java.lang.String toStringSpecial()
Node
toStringSpecial in class Nodepublic boolean equivalent(Type t)
equivalent in class Typeprotected Type getEquivalentType()
getEquivalentType in class Typepublic int precedence()
precedence in class Type
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||