|
|||||||||
| 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.decl.Declaration
scale.clef.decl.ValueDecl
scale.clef.decl.VariableDecl
scale.clef.decl.EquivalenceDecl
public final class EquivalenceDecl
This class declares a variable that is equivalenced to an offset in another variable.
$Id: EquivalenceDecl.java,v 1.39 2007-10-04 19:58:04 burrill Exp $
Copyright 2007 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
This class declares a variable that is equivalenced to an offset in another variable. An equivalence relationship is generated for Fortran EQUIVALENCE statements and COMMON statements. For the statement
EQUIVALENCE A, Bthe base variable would be A with a offset of zero. For the statement
EQUIVALENCE A(20), Bthe base variable would be A with a offset of 20*sizeof(double).
Note - an EquivalenceDecl specifies an implied equivalence for COMMON variables.
| Field Summary |
|---|
| Fields inherited from class scale.clef.decl.VariableDecl |
|---|
ignoreAddressTaken |
| Constructor Summary | |
|---|---|
EquivalenceDecl(java.lang.String name,
Type type,
VariableDecl base,
long offset)
|
|
| Method Summary | |
|---|---|
Declaration |
copy(java.lang.String name)
Make a copy of this VariableDecl using a new name. |
long |
getBaseOffset()
Return the offset from the base (i.e. |
VariableDecl |
getBaseVariable()
Return the base variable (i.e. |
Node |
getChild(int i)
Return the specified AST child of this node. |
Literal |
getConstantValue()
Return the constant value of the expression. |
Assigned |
getStorageLoc()
Return the location type used for this declaration. |
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 |
isEquivalenceDecl()
Return true if the declaration is a variable in Fortran COMMON. |
boolean |
isGlobal()
Return true if this declaration is globally visible. |
int |
numChildren()
Return the number of AST children of this node. |
Residency |
residency()
Return the declaration residency. |
EquivalenceDecl |
returnEquivalenceDecl()
Return a EquivalenceDecl instance or
null. |
void |
setBaseOffset(long offset)
Specify the offset from the base variable that this variable is equivalenced to. |
void |
setBaseVariable(VariableDecl base)
Specify the base variable that this variable is equivalenced to. |
void |
setResidency(Residency residency)
Generate an error - residency is specified only for the base VariableDecl. |
void |
setVisibility(int visibility)
Generate an error - visibility is specified only for the base variable. |
Visibility |
visibility()
Return the declaration visibility. |
void |
visit(Predicate p)
Process a node by calling its associated routine. |
| Methods inherited from class scale.clef.decl.ValueDecl |
|---|
getValue, isValueDecl, returnValueDecl |
| Methods inherited from class scale.clef.Node |
|---|
getSourceLineNumber, 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 |
|---|
public EquivalenceDecl(java.lang.String name,
Type type,
VariableDecl base,
long offset)
name - - name of the variabletype - - type of the variablebase - - VariableDecl representing the base variable
(COMMONM area) in the equivalence relationshipoffset - - offset of this variable in bytes into the base
variable| Method Detail |
|---|
public Declaration copy(java.lang.String name)
copy in class VariableDeclpublic 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 VariableDeclPredicatepublic VariableDecl getBaseVariable()
public void setBaseVariable(VariableDecl base)
public long getBaseOffset()
public void setBaseOffset(long offset)
public void setResidency(Residency residency)
setResidency in class VariableDeclresidency - is the residency of the declarationResidencypublic Residency residency()
residency in class VariableDeclResidencypublic boolean inMemory()
inMemory in class VariableDeclpublic void setVisibility(int visibility)
variable.
visibility - is the visibility of the declarationVisibilitypublic Visibility visibility()
variable.
visibility in class DeclarationVisibilitypublic boolean isGlobal()
isGlobal in class Declarationpublic boolean hasHiddenAliases()
hasHiddenAliases in class VariableDeclpublic Assigned getStorageLoc()
getStorageLoc in class VariableDeclVariableDecl.setStorageLoc(scale.clef.decl.Assigned),
Machine.keepTypeInRegister(scale.clef.type.Type, boolean)public Literal getConstantValue()
getConstantValue in class VariableDeclLatticepublic Node getChild(int i)
getChild in class ValueDeclpublic int numChildren()
numChildren in class ValueDeclpublic final boolean isEquivalenceDecl()
Declaration
isEquivalenceDecl in class Declarationpublic final EquivalenceDecl returnEquivalenceDecl()
DeclarationEquivalenceDecl instance or
null.
returnEquivalenceDecl in class Declaration
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||