SymbolDecl¶
-
public class
SymbolDecl
¶ A symbol declaration, i.e. and entry in a SymbolTable.
Fields¶
copySymbolDecl¶
-
protected SymbolDecl
copySymbolDecl
¶ Temporary: link to the copy of this SymbolDecl.
dependsOn¶
-
public TapList<SymbolDecl>
dependsOn
¶ The list of symbols defined in the same SymbolTable level, that are used by this symbol declaration, and must therefore be declared before this symbol is declared.
importedFrom¶
-
public TapPair<SymbolDecl, SymbolTable>
importedFrom
¶ When this SymbolDecl was IMPORTed from another SymbolTable, keeps the link to the original SymbolDecl and SymbolTable
inheritanceTree¶
-
protected InheritanceTree
inheritanceTree
¶ Useful to know what are the different notations leading to the same copy (a tree of this list)
isConsideredRemoved¶
-
public boolean
isConsideredRemoved
¶ Sometimes a SymbolDecl must be replaced with another, but the old SymbolDecl must remain for a while because someone will look for it (see all the “update” functions that replace FOO with FOO_NODIFF). Instead of actually removing the SymbolDecl in a later sweep, we may just mark it as “isConsideredRemoved” to ensure TreeGen will not regenerate a declaration for it.
toIsActive¶
Constructors¶
Methods¶
addInfosInList¶
addUsedSymbolsInExpr¶
-
public static void
addUsedSymbolsInExpr
(Tree expression, TapList<SymbolDecl> toUsedSymbols, SymbolTable symbolTable, TapList<String> undeclaredSymbols, boolean top, boolean strict)¶ Finds all symbols used in “expression”, that must be declared before “expression”, and that are defined in (the current top level of) “symbolTable”. When “top” is true, accumulates only symbols found in the top of “symbolTable”. Accumulates them in the tail of “toUsedSymbols”.
- Parameters
toUsedSymbols – a hatted list (TapList starting with a null) that accumulates the used symbols
top – when true, searches VariableDecl’s only in the top of “symbolTable”.
strict – true, variable in Common are added to its “UsedSymbols”
allocateZones¶
-
public void
allocateZones
(ZoneAllocator zoneAllocator, SymbolTable symbolTable, Unit declarationUnit)¶ Assuming that this SymbolDecl has associated memory, allocate the zones for this memory, and create the corresponding ZoneInfo’s. When these zones are already allocated/created, it means this SymbolDecl is a global, and we must tell the enclosing importsSymbolTable to later build a proxy ZoneInfo for it.
build¶
-
public static SymbolDecl
build
(WrapperTypeSpec typeSpec, TapList<String> accessInfo, boolean isPointer, Tree declarator, int flag, SymbolTable symbolTable, Instruction instruction, TapList<SymbolDecl> typeUsedSymbols)¶
buildTypeSpecFromArgs¶
-
protected static TapList<WrapperTypeSpec>
buildTypeSpecFromArgs
(SymbolTable symbolTable, Instruction instruction, TapList<SymbolDecl> toTypeUsedSymbols, Tree[] argDecls, ToBool isVariableArgList)¶
collectImportedSiblingsDecls¶
-
public static void
collectImportedSiblingsDecls
(SymbolDecl symbolDecl, TapList<TapPair<SymbolTable, TapList<SymbolDecl>>> siblingDecls)¶ collects into siblingDecls (must be a hatted list) for each SymbolDecl’s of which the given “symbolDecl” is a same-name copy built by an import (aka USE), the pair of the original SymbolDecl and the SymbolTable it belongs to.
collectSiblingDecl¶
-
public static void
collectSiblingDecl
(TapList<TapPair<SymbolTable, TapList<SymbolDecl>>> siblingDecls, SymbolDecl symbolDecl, SymbolTable symbolTable)¶ Collects into the collection “siblingDecls” the pair of “symbolDecl” and the SymbolTable “symbolDecl” belongs to.
- Parameters
siblingDecls – the current list of “sibling” declarations collected. It is a hatted list, ans all declarations must concern the same symbol with same name. All found declarations are grouped per owner SymbolTable, rootmost last.
symbolDecl – The symbolDecl we want to collect into “siblingDecls”
symbolTable – The SymbolTable that owns “symbolDecl”.
collectUsedTrees¶
copy¶
-
protected static SymbolDecl
copy
(SymbolDecl symbol2copy)¶
copy¶
-
protected SymbolDecl
copy
(TapList<TapPair<SymbolTable, SymbolTable>> associationsST, UnitStorage<Unit> associationsUnits)¶ Build a rather shallow copy of this SymbolDecl, suitable for SymbolTable.copy() TypeDecl’s are not copied. Remember the copy in this symbolDecl’s “copySymbolDecl” field, so as to build a single copy.
copyLinksIntoCopy¶
-
protected void
copyLinksIntoCopy
(SymbolDecl copyDecl, TapList<TapPair<SymbolTable, SymbolTable>> associationsST)¶
dependsOn¶
-
public TapList<SymbolDecl>
dependsOn
()¶
dump¶
-
public void
dump
(int indent)¶ Prints in detail the contents of this SymbolDecl, onto TapEnv.curOutputStream().
- Parameters
indent – the amount of indentation to be used for this printing (not used at present).
fromInclude¶
-
protected Instruction
fromInclude
()¶
getDiffSymbolHolder¶
-
public NewSymbolHolder
getDiffSymbolHolder
(int diffSort, ActivityPattern pattern, int replica)¶ - Returns
the NewSymbolHolder that has been stored by setDiffSymbolHolder() as the differentiated symbol of this SymbolDecl for the given diffSort.
hasInstructionWithRootOperator¶
hasInstructionWithRootOperatorAndArrayDeclarator¶
-
public boolean
hasInstructionWithRootOperatorAndArrayDeclarator
(int operator)¶
hasPrivateModifier¶
-
protected boolean
hasPrivateModifier
(TapList<SymbolDecl> addSymbolDecls)¶
hasProtectedModifier¶
-
protected boolean
hasProtectedModifier
(TapList<SymbolDecl> addSymbolDecls)¶
hasPublicModifier¶
-
protected boolean
hasPublicModifier
(TapList<SymbolDecl> addSymbolDecls)¶
isA¶
-
public boolean
isA
(int testKind)¶ - Returns
true when this SymbolDecl is of the given kind “testKind” The kind may be SYMBOL, VARIABLE, FIELD, FUNCTION, TYPE, CONSTANT, FUNCNAME, INTERFACE, CLASS, NAMESPACE.
isActive¶
-
public boolean
isActive
()¶ isActive true means: for this SymbolDecl, there exists a derivative, i.e. another symbolDecl which contains the derivative of this one.
isDifferentiableSymbolDecl¶
-
public boolean
isDifferentiableSymbolDecl
(int diffKind, boolean diffConstants)¶
isExternalDeclared¶
-
public boolean
isExternalDeclared
(TapList<Instruction> instructions)¶
isExternalDeclared¶
-
public boolean
isExternalDeclared
(Instruction instruction)¶
isIntrinsicDeclared¶
-
public boolean
isIntrinsicDeclared
(TapList<Instruction> instructions)¶
isIntrinsicDeclared¶
-
public boolean
isIntrinsicDeclared
(Instruction instruction)¶
isTarget¶
-
public boolean
isTarget
(WrapperTypeSpec modelTypeSpec)¶ - Returns
true when this SymbolDecl is a target and its type matches the given “modelTypeSpec”.
isVarDeclared¶
-
public boolean
isVarDeclared
(TapList<Instruction> instructions)¶
recomputeDependsOn¶
-
protected void
recomputeDependsOn
(SymbolTable symbolTable)¶
replaceDiffSymbolHolder¶
-
protected void
replaceDiffSymbolHolder
(NewSymbolHolder oldNSH, NewSymbolHolder newNSH)¶ For every NewSymbolHolder that is stored in this SymbolDecl (in provision of the moment when this Symboldecl will receive its finalname), replace it with newNSH if it was oldNSH. This is used when oldNSH is absorbed by newNSH.
sameOriginDecl¶
-
public static boolean
sameOriginDecl
(SymbolDecl decl1, SymbolDecl decl2)¶
setDiffSymbolHolder¶
-
public void
setDiffSymbolHolder
(int diffSort, ActivityPattern pattern, int replica, NewSymbolHolder nSH)¶ Puts the NewSymbolHolder “nSH” as the differentiated symbol of this SymbolDecl, for the given diffSort and for the given ActivityPattern and for the given replica number. This is the default implementation, that uses only “diffSort”, not “pattern” not “replica”. “diffSort” is here because there may be different coexisting derivative symbols for a given original symbol, for example F_FWD, F_BWD, F_B for a given function F. “pattern” is used only for FunctionDecl’s. “replica” is used only for VariableDecl’s.
setFromInclude¶
-
protected void
setFromInclude
(Instruction fromInc)¶
setInstruction¶
-
public void
setInstruction
(Instruction instr)¶ Declare that this SymbolDecl already has an existing declaration, made by Instruction “instr” that is located in the given “code”.
- Parameters
instr – The Instruction that contains the existing declaration of SymbolDecl.
setInstruction¶
-
public void
setInstruction
(SymbolDecl model)¶
shareActivity¶
type¶
-
public WrapperTypeSpec
type
()¶