|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.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 Type
IncompleteType
public final void setCompleteType(Type type)
public Type getNonConstType()
getNonConstType
in class Type
RefType
public boolean isAttributeSet(RefAttr attribute)
isAttributeSet
in class Type
RefType
public final boolean isIncompleteType()
isIncompleteType
in class Type
public final IncompleteType returnIncompleteType()
Type
this
is a IncompleteType
, return this
. Otherwise, return
null
.
returnIncompleteType
in class Type
public boolean isArrayType()
isArrayType
in class Type
public boolean isPointerType()
isPointerType
in class Type
public boolean isVoidType()
isVoidType
in class Type
public boolean isAggregateType()
isAggregateType
in class Type
public boolean isUnionType()
isUnionType
in class Type
public boolean isCompositeType()
isCompositeType
in class Type
public boolean isRealType()
isRealType
in class Type
public boolean isIntegerType()
isIntegerType
in class Type
public boolean isComplexType()
isComplexType
in class Type
public boolean isAtomicType()
isAtomicType
in class Type
public boolean isNumericType()
isNumericType
in class Type
public boolean isNamedType()
isNamedType
in class Type
public boolean isProcedureType()
isProcedureType
in class Type
public boolean isSigned()
isSigned
in class Type
public Type getSignedType()
getSignedType
in class Type
public Declaration getDecl()
getDecl
in class Node
public Type registerType()
registerType
in class Type
public 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 Type
Predicate
public 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 Type
TypePredicate
public Node getChild(int i)
getChild
in class Node
public int numChildren()
numChildren
in class Node
public Type getCoreType()
getCoreType
in class Type
Type.getCoreType()
public int getRank()
getRank
in class Type
public long memorySize(Machine machine)
memorySize
in class Type
machine
- is the machine-specific data machinepublic long elementSize(Machine machine)
memorySize()
.
elementSize
in class Type
machine
- is the machine-specific data machinepublic int alignment(Machine machine)
alignment
in class Type
public boolean isConst()
isConst
in class Type
public boolean isVolatile()
isVolatile
in class Type
public boolean isRestricted()
isRestricted
in class Type
public java.lang.String toStringSpecial()
Node
toStringSpecial
in class Node
public boolean equivalent(Type t)
equivalent
in class Type
protected Type getEquivalentType()
getEquivalentType
in class Type
public int precedence()
precedence
in class Type
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |