VarRefDifferentiator¶
-
public class
VarRefDifferentiator
¶ Object that knows how to differentiate a variable.
Fields¶
dirIndexSymbolHolder¶
-
protected NewSymbolHolder
dirIndexSymbolHolder
¶
dirNumberMaxSymbolHolder¶
-
protected NewSymbolHolder
dirNumberMaxSymbolHolder
¶
dirNumberSymbolHolder¶
-
protected NewSymbolHolder
dirNumberSymbolHolder
¶
multiDirIterDescriptor¶
-
protected IterDescriptor
multiDirIterDescriptor
¶ To get vector/multiDir indices in derivative vars and loops around derivative instructions.
multiDirMaxIterDescriptor¶
-
protected IterDescriptor
multiDirMaxIterDescriptor
¶
Constructors¶
VarRefDifferentiator¶
-
protected
VarRefDifferentiator
(DifferentiationEnv adEnv)¶
Methods¶
buildAAInstructionVORD¶
-
protected Tree
buildAAInstructionVORD
(Tree expression, SymbolTable diffSymbolTable, Tree diffVarRef, String vORd, boolean checkActive)¶ For association by address.
- Parameters
expression – source Tree.
diffSymbolTable – differentiated SymbolTable.
diffVarRef – differentiated Tree.
vORd – value or diff
checkActive – when true, does the work only after checking activity. Otherwise always does the work, which I believe should always be the case… TODO: check this and then simplify!
- Returns
if expression is x, returns x.v or x.d.
buildDirNumberReference¶
-
protected Tree
buildDirNumberReference
(SymbolTable usageSymbolTable)¶
diffSymbolName¶
-
protected Tree
diffSymbolName
(ActivityPattern pattern, String symbolName, SymbolTable diffSymbolTable, boolean searchAsVariable, boolean searchAsFunction, boolean searchAsModule, Tree callTree, WrapperTypeSpec[] actualTypes, boolean skipImportedSymbolTables, int diffSort, int diffSuffixSort, int symbolSort, Tree hintRootTree)¶
diffSymbolTree¶
-
protected Tree
diffSymbolTree
(ActivityPattern pattern, Tree symbolTree, SymbolTable diffSymbolTable, boolean searchAsVariable, boolean searchAsFunction, boolean searchAsModule, Tree callTree, boolean skipImportedSymbolTables, int diffSort, int diffSuffixSort, int symbolSort, Tree hintRootTree)¶ - Parameters
symbolTree – The op_ident Tree of the original, non-differentiated symbol.
diffSymbolTable – The SymbolTable of the usage place of the future diff symbol in the future diff Unit. It must see the declaration of the diff symbol.
searchAsVariable – True means that the given “symbolTree” may stand for a variable (but also maybe the function’s return value).
searchAsFunction – True means that the given “symbolTree” may stand for a procedure or procedure interface name.
searchAsModule – True means that the given “symbolTree” may stand for a module name.
callTree – When symbolTree is a procedure name, holds the procedure call Tree.
skipImportedSymbolTables – When true, method will not search for “sibling” declarations in symbol tables that come from the USE (i.e. import) of a module.
diffSort – The sort of differentiated symbol
diffSuffixSort – the sort of differentiation, used to look for the correct suffix.
symbolSort – the sort of symbol, used to look for the correct suffix.
hintRootTree – The tree used in the hints for unknown dimensions.
- Returns
a new Tree, that holds the differentiated symbol of the given “symbolTree”. Takes care of distinguishing function names and variable names, takes care of the function return name, which in FORTRAN is equal to the function name. The new Tree is not finished (looks like #xd#), but is registered into the “diffSymbolTable”, so that its definitive name will be chosen at the end and this new Tree will then be updated.
diffVarRef¶
-
protected Tree
diffVarRef
(ActivityPattern pattern, Tree expression, SymbolTable diffSymbolTable, boolean identifyFunctionResult, Tree contextExpression, boolean needMultiDirDim, boolean addNbDirsDimContext, Tree hintRootTree)¶ Differentiate a reference to a variable. When “identifyFunctionResult” is true, we must take care of the case where the variable may be the result of the current function. In this case, the diff variable and the diff function must also have the same names. Most of the complexity of this function is due to the “vector mode”, where derivatives receive an extra dimension wrt original variables.
diffVarRefNoCopy¶
-
protected Tree
diffVarRefNoCopy
(ActivityPattern pattern, Tree expression, SymbolTable diffSymbolTable, boolean identifyFunctionResult, Tree hintRootTree)¶ Same as diffVarRef, but modifies the given “expression” in place.
differentiateTypeTree¶
-
protected Tree
differentiateTypeTree
(Tree typeTree, SymbolTable diffSymbolTable)¶
findDiffFuncName¶
-
protected Tree
findDiffFuncName
(ActivityPattern pattern, FunctionDecl functionDecl, int diffSort, SymbolTable diffSymbolTable, Tree declTree, boolean asAFunction, boolean asAnInterface)¶ Utility for diffDeclNames: differentiates a function name or interface name. If the differentiated newSymbolHolder is available, uses it. Otherwise differentiate the name through varRefDifferentiator().diffSymbolTree().
isCurFunctionName¶
isOnlyIncrementedDiff¶
-
protected boolean
isOnlyIncrementedDiff
(ActivityPattern pattern, ZoneInfo zoneInfo)¶
mapDiffVarRef¶
-
protected TapList<Tree>
mapDiffVarRef
(ActivityPattern pattern, TapList<Tree> expressions, SymbolTable diffSymbolTable)¶
paramHasOnlyLocalDiff¶
-
protected boolean
paramHasOnlyLocalDiff
(ActivityPattern pattern, Tree varBaseTree, VariableDecl variableDecl)¶ - Returns
true when the variable in “varBaseTree” (assumed active inside curUnit) is a formal parameter of curUnit and is not active as a formal parameter because this parameter is passive upon entry and upon exit from curUnit.