|
|||||||||
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.decl.Declaration
public abstract class Declaration
This is the base class for declarations such as variable, routines, etc.
$Id: Declaration.java,v 1.106 2007-10-04 19:58:03 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
Constructor Summary | |
---|---|
protected |
Declaration(java.lang.String name)
Create a declaration with the specified name and no type. |
protected |
Declaration(java.lang.String name,
Type type)
Create a declaration with the specified name and type. |
Method Summary | |
---|---|
Accessibility |
accessibility()
Return the declaration accessibility. |
boolean |
addressTaken()
Return true if the address of this Declaration has been taken. |
int |
compareTo(java.lang.Object a)
|
abstract Declaration |
copy(java.lang.String name)
Return a copy of this Declaration but with a different name. |
Type |
getActualType()
Return the type of the Declaration. |
int |
getAddressRegister()
Return the register the code generator assigned to the address of this variable. |
java.lang.String |
getAlias()
Return the alias for this declaration. |
Literal |
getConstantValue()
Return the constant value of the expression. |
Type |
getCoreType()
Return the type of the Declaration without attributes. |
Declaration |
getDecl()
Return any Declaration associated with this Node. |
Displacement |
getDisplacement()
Return the code generator displacement associated with this call node. |
DColor |
getDisplayColorHint()
Return a String specifying the color to use for coloring this node in a graphical display. |
java.lang.String |
getDisplayLabel()
Return a String suitable for labeling this node in a graphical display. |
DShape |
getDisplayShapeHint()
Return a String specifying a shape to use when drawing this node in a graphical display. |
ParameterMode |
getMode()
Return the parameter passing mode of this declaration. |
java.lang.String |
getName()
Return the name of the Declaration. |
Type |
getPointedToCore()
Return the type of the thing pointed to by the type of the expression. |
Assigned |
getStorageLoc()
Return the location type used for this declaration. |
int |
getTag()
Return the tag associated with this variable. |
Type |
getType()
Return the type of the Declaration. |
int |
getValueRegister()
Return the register the code generator assigned to this variable. |
int |
hashCode()
Use the name of the declaration instead of the address of the instance so things are more predictable. |
boolean |
hasHiddenAliases()
Return true if the declaration may be modified in an unknown way. |
boolean |
inMemory()
Return true if this declaration is to be allocated to memory. |
boolean |
isCaseLabelDecl()
Return true if CaseLabelDecl instance. |
boolean |
isCommonBaseVariable()
Return true if this is the base variable of a Fortran COMMON area. |
boolean |
isConst()
Return true. |
boolean |
isEnumElementDecl()
Return true if EnumElementDecl instance. |
boolean |
isEquivalenceDecl()
Return true if the declaration is a variable in Fortran COMMON. |
boolean |
isExceptionDecl()
Return true if ExceptionDecl instance. |
boolean |
isFieldDecl()
Return true if FieldDecl instance. |
boolean |
isFileDecl()
Return true if FileDecl instance. |
boolean |
isFormalDecl()
Return true if this declaration is a formal parameter to the routine. |
boolean |
isForwardProcedureDecl()
Return true if ForwardProcedureDecl instance. |
boolean |
isFtnResultVar()
Return true if the declaration is declared as the result variable of a function. |
boolean |
isGlobal()
Return true if this declaration is globally visible. |
boolean |
isLabelDecl()
Return true if LabelDecl instance. |
boolean |
isProcedureDecl()
Return true if ProcedureDecl instance. |
boolean |
isPure()
Return true if this declaration has a purity level of PUREGV. |
boolean |
isReferenced()
Return true if the declaration is referenced somewhere in the Clef AST. |
boolean |
isRenamed()
Return true if the declaration is a renamed variable. |
boolean |
isRenamedVariableDecl()
Return true if RenamedVariableDecl instance. |
boolean |
isRoutineDecl()
Return true if RoutineDecl instance. |
boolean |
isStmtFtnDecl()
Return true if StmtFtnDecl instance. |
boolean |
isTemporary()
Return true if the declaration is a temporary variable. |
boolean |
isTypeDecl()
Return true if TypeDecl instance. |
boolean |
isTypeName()
Return true if TypeName instance. |
boolean |
isUnknownFormals()
Return true if UnknownFormals instance. |
boolean |
isValueDecl()
Return true if ValueDecl instance. |
boolean |
isVariableDecl()
Return true if VariableDecl instance. |
boolean |
isVirtual()
Return true if the declaration is a virtual variable. |
boolean |
isWeak()
Return true if the declaration has the "weak" attribute. |
Residency |
residency()
Return the declaration residency. |
CaseLabelDecl |
returnCaseLabelDecl()
Return a CaseLabelDecl instance or
null . |
EnumElementDecl |
returnEnumElementDecl()
Return a EnumElementDecl instance or
null . |
EquivalenceDecl |
returnEquivalenceDecl()
Return a EquivalenceDecl instance or
null . |
ExceptionDecl |
returnExceptionDecl()
Return a ExceptionDecl instance or
null . |
FieldDecl |
returnFieldDecl()
R a FieldDecl instance or null . |
FileDecl |
returnFileDecl()
a FileDecl instance or null . |
FormalDecl |
returnFormalDecl()
Re a FormalDecl instance or null . |
ForwardProcedureDecl |
returnForwardProcedureDecl()
Return a For a ForwardProcedureDecl
instance or null . |
LabelDecl |
returnLabelDecl()
R a LabelDecl instance or null . |
ProcedureDecl |
returnProcedureDecl()
Return a ProcedureDecl instance or
null . |
RenamedVariableDecl |
returnRenamedVariableDecl()
Return a Re a RenamedVariableDecl
instance or null . |
RoutineDecl |
returnRoutineDecl()
Return a RoutineDecl instance or
null . |
StmtFtnDecl |
returnStmtFtnDecl()
Return a StmtFtnDecl instance or
null . |
TypeDecl |
returnTypeDecl()
Return a TypeDecl instance or null . |
TypeName |
returnTypeName()
Return a TypeName instance or
null . |
UnknownFormals |
returnUnknownFormals()
Return a UnknownFormals instance or
null . |
ValueDecl |
returnValueDecl()
Return a ValueDecl instance or null . |
VariableDecl |
returnVariableDecl()
Return a VariableDecl instance or
null . |
void |
setAccessibility(Accessibility accessibility)
Specify the accessibility of the declaration. |
void |
setAddressRegister(int reg)
Specify the register the code generator assigned to the address of this variable. |
void |
setAddressTaken()
Record that the address is used. |
void |
setAlias(java.lang.String alias)
Set the alias for this declaration. |
void |
setDisplacement(Displacement disp)
Specify the code generator displacement associated with this call node. |
void |
setName(java.lang.String name)
Change the display name of the declaration. |
void |
setReferenced()
Specify that the Declaration is referenced somewhere in the Clef AST. |
void |
setResidency(Residency residency)
Specify the residency of the declaration. |
void |
setStorageLoc(Assigned loc)
Set the location type used for this declaration. |
void |
setTag(int tag)
Set the tag for this variable. |
void |
setType(Type type)
Specify the type of this declaration. |
void |
setValueRegister(int reg,
ResultMode mode)
Specify the register the code generator assigned to this variable. |
void |
setVisibility(Visibility visibility)
Specify the visibility of the declaration. |
void |
setWeak(boolean weak)
Specify that the declaration has the "weak" attribute. |
java.lang.String |
toStringSpecial()
This method allows sub-classes to provide class specific stuff to the string. |
ResultMode |
valueRegMode()
Return true if the register the code generator assigned to this variable contains the address and not the value. |
Visibility |
visibility()
Return the declaration visibility. |
void |
visit(Predicate p)
Process a node by calling its associated routine. |
Methods inherited from class scale.clef.Node |
---|
getChild, getSourceLineNumber, numChildren, setAnnotationLevel, setReportLevel, setSourceLineNumber, toString, toString, toStringChildren |
Methods inherited from class scale.common.Root |
---|
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayName, getDisplayString, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, 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 |
---|
protected Declaration(java.lang.String name)
protected Declaration(java.lang.String name, Type type)
Method Detail |
---|
public int hashCode()
hashCode
in class Root
public final int compareTo(java.lang.Object a)
compareTo
in interface java.lang.Comparable
public void setAccessibility(Accessibility accessibility)
accessibility
- is the accessibility of the declarationAccessibility
public Accessibility accessibility()
Accessibility
public void setVisibility(Visibility visibility)
visibility
- is the visibility of the declarationVisibility
public Visibility visibility()
Visibility
public final boolean isWeak()
public final void setWeak(boolean weak)
public final java.lang.String getAlias()
public final void setAlias(java.lang.String alias)
extern
may be aliased to another name.
public void setResidency(Residency residency)
residency
- is the residency of the declarationResidency
public Residency residency()
Residency
public void setAddressTaken()
public boolean addressTaken()
public boolean hasHiddenAliases()
public final void setTag(int tag)
public final int getTag()
public Assigned getStorageLoc()
public int getValueRegister()
public ResultMode valueRegMode()
public void setValueRegister(int reg, ResultMode mode)
public int getAddressRegister()
public void setAddressRegister(int reg)
public void setStorageLoc(Assigned loc)
public Displacement getDisplacement()
public void setDisplacement(Displacement disp)
public Declaration getDecl()
getDecl
in class Node
public java.lang.String toStringSpecial()
Node
toStringSpecial
in class Node
public java.lang.String getDisplayLabel()
getDisplayLabel
in interface DisplayNode
getDisplayLabel
in class Root
public DColor getDisplayColorHint()
getDisplayColorHint
in interface DisplayNode
getDisplayColorHint
in class Root
DColor
public DShape getDisplayShapeHint()
getDisplayShapeHint
in interface DisplayNode
getDisplayShapeHint
in class Root
DShape
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 Node
Predicate
public final java.lang.String getName()
public final Type getType()
getType
in class Node
public final Type getActualType()
public final Type getCoreType()
getCoreType
in class Node
Node.getType()
,
RefType
public final Type getPointedToCore()
getCoreType().getPointedTo().getCoreType()
public final void setName(java.lang.String name)
name
- is the new name for the declarationpublic void setType(Type type)
public Literal getConstantValue()
Lattice
public boolean isReferenced()
VariableDecl
,
RoutineDecl
public void setReferenced()
VariableDecl
,
RoutineDecl
public boolean isGlobal()
public boolean inMemory()
public boolean isTemporary()
public boolean isFtnResultVar()
public boolean isCaseLabelDecl()
public CaseLabelDecl returnCaseLabelDecl()
CaseLabelDecl
instance or
null
.
public boolean isEnumElementDecl()
public EnumElementDecl returnEnumElementDecl()
EnumElementDecl
instance or
null
.
public boolean isEquivalenceDecl()
public EquivalenceDecl returnEquivalenceDecl()
EquivalenceDecl
instance or
null
.
public boolean isExceptionDecl()
public ExceptionDecl returnExceptionDecl()
ExceptionDecl
instance or
null
.
public boolean isFieldDecl()
public FieldDecl returnFieldDecl()
FieldDecl
instance or null
.
public boolean isFileDecl()
public FileDecl returnFileDecl()
FileDecl
instance or null
.
public boolean isFormalDecl()
public FormalDecl returnFormalDecl()
FormalDecl
instance or null
.
public boolean isForwardProcedureDecl()
public ForwardProcedureDecl returnForwardProcedureDecl()
ForwardProcedureDecl
instance or null
.
public boolean isLabelDecl()
public LabelDecl returnLabelDecl()
LabelDecl
instance or null
.
public boolean isProcedureDecl()
public ProcedureDecl returnProcedureDecl()
ProcedureDecl
instance or
null
.
public boolean isRenamedVariableDecl()
public RenamedVariableDecl returnRenamedVariableDecl()
RenamedVariableDecl
instance or null
.
public boolean isRoutineDecl()
public RoutineDecl returnRoutineDecl()
RoutineDecl
instance or
null
.
public boolean isStmtFtnDecl()
public StmtFtnDecl returnStmtFtnDecl()
StmtFtnDecl
instance or
null
.
public boolean isTypeDecl()
public TypeDecl returnTypeDecl()
TypeDecl
instance or null
.
public boolean isValueDecl()
public ValueDecl returnValueDecl()
ValueDecl
instance or null
.
public boolean isVariableDecl()
public VariableDecl returnVariableDecl()
VariableDecl
instance or
null
.
public boolean isTypeName()
public TypeName returnTypeName()
TypeName
instance or
null
.
public boolean isUnknownFormals()
public UnknownFormals returnUnknownFormals()
UnknownFormals
instance or
null
.
public boolean isCommonBaseVariable()
public boolean isVirtual()
public boolean isRenamed()
public boolean isPure()
public boolean isConst()
public ParameterMode getMode()
formal
parameter
to a routine, the value returned is
cValue
.
public abstract Declaration copy(java.lang.String name)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |