VariableDecl

public class VariableDecl extends SymbolDecl

A symbol declaration object specialized for variables.

Fields

activityInfo

public TapList activityInfo

constantValue

public Integer constantValue

formalArgRank

public int formalArgRank

for a formal parameter, its rank in the parameters list. From 1 up (special 0 for result).

formalArgRankInOrigUnit

public int formalArgRankInOrigUnit

for a VariableDecl in generated code (e.g. in the differentiated CallGraph), the formalArgRank of its counterpart in the source (i.e. in the original CallGraph).

initFunctionDecls

public FunctionDecl[] initFunctionDecls

When this is a “pointer-to-function” variable, holding a pointer to a function, holds the function it is given upon initialization.

isFunctionName

public boolean isFunctionName

True to remember that this is a SUBROUTINE’s name.

isReturnVar

public boolean isReturnVar

isReturnVarFromFunction

public FunctionDecl isReturnVarFromFunction

isVariableName

public boolean isVariableName

True to remember that this is certainly a variable (i.e. certainly not a SUBROUTINE’s name).

Constructors

VariableDecl

public VariableDecl(Tree identTree, WrapperTypeSpec typeSpec)

VariableDecl

public VariableDecl(Tree identTree, WrapperTypeSpec typeSpec, boolean isATrueSymbolDecl)

VariableDecl

public VariableDecl()

Methods

accumulateZones

public void accumulateZones(TapList intTree)

adoptZones

public void adoptZones(VariableDecl model)

buildVarDeclaration

public Tree buildVarDeclaration(SymbolTable symbolTable)

collectUsedTrees

public void collectUsedTrees(TapList<Tree> toUsedTrees, TapList<TypeSpec> toDejaVu)

Collects into toUsedTrees all expressions that are needed for the declaration of this SymbolDecl.

Parameters
  • toUsedTrees – TapList of used Tree

  • toDejaVu – TapList of TypeSpec

cumulActiveField

public boolean cumulActiveField(Tree tree)

equalsOther

public boolean equalsOther(VariableDecl varDecl)

eraseDiffSymbolHolder

protected void eraseDiffSymbolHolder(int diffSort)

formalArgRankOrResultZero

public int formalArgRankOrResultZero()

generateInitializationTree

public Tree generateInitializationTree()

getDiffSymbolHolder

public NewSymbolHolder getDiffSymbolHolder(int diffSort, ActivityPattern pattern, int iReplic)
Returns

the NewSymbolHolder that has been stored by setDiffSymbolHolder() as the differentiated symbol of this VariableDecl, for the given diffSort and for the given replica number

getInitializationTree

public Tree getInitializationTree()

hasDiffSymbolHolders

public boolean hasDiffSymbolHolders()

initializationTree

public Tree initializationTree()

isTarget

public boolean isTarget(WrapperTypeSpec modelTypeSpec)

passesByValue

public boolean passesByValue(Unit refUnit)

recomputeDependsOn

protected void recomputeDependsOn(SymbolTable symbolTable)

replaceDiffSymbolHolder

protected void replaceDiffSymbolHolder(NewSymbolHolder oldNSH, NewSymbolHolder newNSH)

For every NewSymbolHolder that is stored in this VariableDecl (in provision of the moment when this Symboldecl receives its finalname), replace it with newNSH if it was oldNSH. This is used when oldNSH is absorbed by newNSH.

setConstant

public void setConstant()

Set a variable declaration as a CONSTANT.

setDiffSymbolHolder

public void setDiffSymbolHolder(int diffSort, ActivityPattern pattern, int iReplic, NewSymbolHolder nSH)

Puts the NewSymbolHolder “nSH” as the differentiated symbol of this VariableDecl, for the given diffSort and for the given replica number. “diffSort” is here because there may be different coexisting derivative symbols for a given original symbol, for example vd, vb, vb0… for a given variable v. “replica” (unless negative) is the number of the replicated diff variable. “pattern” is not used, it is only for FunctionDecl’s.

setInitializationTree

public void setInitializationTree(Tree tree)

setReturnVar

public void setReturnVar()

setReturnVar

public void setReturnVar(FunctionDecl funcDecl, boolean isFortran)

setType

public void setType(WrapperTypeSpec typeSpec)

setZones

public void setZones(TapList value)

toString

public String toString()

turnTypeIntoPointer

public void turnTypeIntoPointer()

type

public WrapperTypeSpec type()

zones

public TapList zones()