RefDescriptor¶
-
public final class
RefDescriptor
¶ Objects that hold a description of all components of a given expression Tree. Tree is most often a reference.
“components” means values contained or accessed through the tree. The RefDescriptor finds and analyzes all the iterations contained in the “tree”, using the type information available.
The RefDescriptor chooses the way to access to all these components for a given sort of “use”, e.g. a PUSH-POP, an initialization, an I-O,…
Example: to initialize A(3,:), one can use vector notation for the “:” to PUSH A(:)%x(:), the two “:” cannot be vector together. Then after the “use” is chosen, the RefDescriptor can generate PUSH-POP or initialization or other standard operations working on this “tree”. Two RefDescriptor’s can be merged, thus sharing the iterative loops when performing some operations.
NOTE: when the given expression Tree contains an array index or a C pointer-array index which is an op_dimColon instead of an op_arrayTriplet, then we consider this is a full access to this particular dimension, therefore sometimes simplifying the returned access instructions. If modifying this code, relevant nonRegression tests may be: set03/lh062 set04/lh108 set06/v322 set06/v324 set06/v325 set06/v350
Fields¶
completeType¶
-
public WrapperTypeSpec
completeType
¶ The type of “tree” seen as a whole.
elementType¶
-
public WrapperTypeSpec
elementType
¶ The type of the elements of “tree”.
holdsAPointer¶
-
public boolean
holdsAPointer
¶ True when this RefDescriptor will access a pointer, i.e. in the PUSH/POP case, it will call PUSH/POPPOINTERn(). This flag is set during createNestedLoopTree().
mayProtectAccesses¶
-
public boolean
mayProtectAccesses
¶ If true, the generated code may contain IF (ALLOCATED/ASSOCIATED(…)) tests to protect from access to unallocated memory.
toBranchVariable¶
-
public TapPair<NewSymbolHolder, WrapperTypeSpec>
toBranchVariable
¶ Because at one place, we need the variable used by the adjoint code to store the POP’ped branch. This field must be shared with the “toBranchVariable” of class FlowGraphDifferentiator.
Constructors¶
RefDescriptor¶
-
public
RefDescriptor
(Tree tree, ZoneInfo zoneInfo, WrapperTypeSpec type, WrapperTypeSpec expectedType, Tree hintRootTree, SymbolTable defSymbolTable, SymbolTable usageSymbolTable, SymbolTable otherUsageSymbolTable, Tree altRootIdent, boolean isDiff, IterDescriptor multiDirIterator, Unit targetUnit)¶ Creation of the RefDescriptor for the object given by “tree”. Extended primitive that copes with the weird case: call TOTO(T(i)) with SUBROUTINE TOTO(array[1:N]) Also copes with new variables introduced by split: they may have no type therefore we use the formal type instead. When zoneInfo is passed non-null, it means that this RefDescriptor designates exactly the full contents of this zone.
RefDescriptor¶
-
public
RefDescriptor
(Tree tree, WrapperTypeSpec forcedType, Tree hintRootTree, SymbolTable defSymbolTable, SymbolTable usageSymbolTable, SymbolTable otherUsageSymbolTable, Tree altRootIdent, boolean isDiff, IterDescriptor multiDirIterator, Unit targetUnit)¶ Creation of the RefDescriptor for the object accessed by “tree”, giving explicitly the WrapperTypeSpec that must be taken for this tree.
RefDescriptor¶
-
public
RefDescriptor
(Tree tree, Tree hintRootTree, SymbolTable defSymbolTable, SymbolTable usageSymbolTable, SymbolTable otherUsageSymbolTable, Tree altRootIdent, boolean isDiff, IterDescriptor multiDirIterator, Unit targetUnit)¶ Creation of the RefDescriptor for the object accessed by “tree”.
RefDescriptor¶
-
public
RefDescriptor
(ZoneInfo zoneInfo, Tree zoneInfoVisibleAccessTree, SymbolTable defSymbolTable, SymbolTable usageSymbolTable, SymbolTable otherUsageSymbolTable, Tree altRootIdent, boolean isDiff, IterDescriptor multiDirIterator, Unit targetUnit)¶ Creation of the RefDescriptor for the object given by “zoneInfo”.
Methods¶
collectTrees¶
explicitWhenImplicitArray¶
-
public static Tree
explicitWhenImplicitArray
(Tree tree, WrapperTypeSpec type, WrapperTypeSpec expectedType, SymbolTable symbolTable)¶ Replaces actual argument T(6) as T(6:) when the formal argument is declared with dimensions.
forceStaticSave¶
-
public void
forceStaticSave
(RefDescriptor saveVarVarDescriptor)¶
isChannelOrIO¶
-
public boolean
isChannelOrIO
()¶ returns true for special fake variables for IOstreams.
makeAssign¶
-
public static Tree
makeAssign
(Unit targetUnit, Tree lhsExpr, Tree rhsExpr, SymbolTable defSymbolTable, SymbolTable usageSymbolTable, Tree lhsAltRootIdent, Tree rhsAltRootIdent, boolean isDiff, IterDescriptor multiDirIterator)¶ - Returns
an instruction Tree that assigns one reference expression into another. Namely: “lhsExpr” := “rhsExpr” Quick call that does the whole chain of creation, preparation, merging, and making Tree in one single call. Does not allow for manipulation of individual RefDescriptors.
makeAssign¶
-
public Tree
makeAssign
(RefDescriptor rhsd)¶
makeFixedControlPop¶
-
public static Instruction
makeFixedControlPop
(Unit targetUnit, Tree expr, int nbCases, SymbolTable defSymbolTable, SymbolTable usageSymbolTable, int ppLabel)¶ Same as makePop, but will store a control integer using PUSH/POPCONTROL(case,nbCases).
makeIncrement¶
-
public static Tree
makeIncrement
(Unit targetUnit, Tree lhsExpr, Tree rhsExpr, SymbolTable defSymbolTable, SymbolTable usageSymbolTable, Tree lhsAltRootIdent, Tree rhsAltRootIdent, boolean isDiff, IterDescriptor multiDirIterator)¶ - Returns
an instruction Tree that adds one reference expression into another. Namely: “lhsExpr” := “lhsExpr”+”rhsExpr” Quick call that does the whole chain of creation, preparation, merging, and making Tree in one single call. Does not allow for manipulation of individual RefDescriptors.
makeIncrement¶
-
public Tree
makeIncrement
(RefDescriptor incrd, boolean needAtomic)¶
makeInitialize¶
-
public static Tree
makeInitialize
(Unit targetUnit, ZoneInfo zoneInfo, Tree expr, WrapperTypeSpec actualArgType, WrapperTypeSpec formalArgType, Tree hintRootTree, SymbolTable defSymbolTable, SymbolTable usageSymbolTable, SymbolTable otherUsageSymbolTable, Tree altRootIdent, boolean isDiff, IterDescriptor multiDirIterator, boolean protectAccesses, TapList ignoreStructure, boolean ignorePointed)¶ Builds an instruction Tree that initializes reference expression “expr”. Quick call that does the whole chain of creation, preparation, merging, and making Tree in one single call. Does not allow for manipulation of individual RefDescriptors. When zoneInfo is passed non-null, it indicates that we want to initialize the full corresponding zone, and then “expr” contains this zoneInfo’s accessTree, possibly slightly modified (see BlockDifferentiator.makeDiffInitialization()).
makeNormDiff¶
-
public static Tree
makeNormDiff
(Unit targetUnit, Tree cumulTree, Tree newExpr, Tree oldExpr, SymbolTable defSymbolTable, SymbolTable usageSymbolTable, Tree newAltRootIdent, Tree oldAltRootIdent, boolean isDiff, IterDescriptor multiDirIterator)¶
makePop¶
-
public static Instruction
makePop
(Unit targetUnit, Tree expr, SymbolTable defSymbolTable, SymbolTable usageSymbolTable, int ppLabel, TapPair<NewSymbolHolder, WrapperTypeSpec> toBranchVariable)¶ - Returns
an instruction Tree that POP’s expression “expr”. Quick call that does the whole chain of creation, preparation, merging, and making Tree in one single call. Does not allow for manipulation of individual RefDescriptors.
makePopDiff¶
-
public static Instruction
makePopDiff
(Unit targetUnit, Tree expr, Tree diffRoot, SymbolTable defSymbolTable, SymbolTable usageSymbolTable, int ppLabel)¶ Same as makePop(…), but replaces the root of “expr” with its derivative “diffRoot”.
makePush¶
-
public static Instruction
makePush
(Unit targetUnit, Tree expr, SymbolTable defSymbolTable, SymbolTable usageSymbolTable, int ppLabel)¶ - Returns
an instruction Tree that PUSH’es expression “expr”. Quick call that does the whole chain of creation, preparation, merging, and making Tree in one single call. Does not allow for manipulation of individual RefDescriptors.
makePushDiff¶
-
public static Instruction
makePushDiff
(Unit targetUnit, Tree expr, Tree diffRoot, SymbolTable defSymbolTable, SymbolTable usageSymbolTable, int ppLabel)¶ Same as makePush(…), but replaces the root of “expr” with its derivative “diffRoot”.
makeRebase¶
-
public Tree
makeRebase
(TapList ignorePrimal, TapList ignoreDiff, Tree diffBaseVar, int numRebase)¶ Creates the instruction that rebases all pointers and/or their diff pointers in the expression represented by this RefDescriptor. We assume the nestedLoopTree of this RefDescriptor has been prepared by this.prepareForStack(). Ignores the primal pointers for the True leaves of “ignorePrimal”. Ignores the diff pointers for the True leaves of “ignoreDiff”.
- Parameters
ignorePrimal – the tree of Booleans indicating the leaves for which no rebase is needed (for the primal)
ignoreDiff – the tree of Booleans indicating the leaves for which no rebase is needed (for the diff)
diffBaseVar – the differentiated root variable, used when some diff pointer must be rebased.
numRebase – the “unique” number used to build a label to identify this rebase for debugAD.
- Returns
an instruction that does the requested rebase of POPped pointers.
makeRef¶
makeStack¶
-
public static Tree
makeStack
(Unit targetUnit, String stackOp, boolean directDirection, ZoneInfo zoneInfo, Tree zoneInfoVisibleAccessTree, SymbolTable defSymbolTable, SymbolTable usageSymbolTable, boolean protectAccesses, int ppLabel)¶ Builds an instruction Tree that does the stack-like operation “stackOp” on the memory described by “zoneInfo”. Quick call that does the whole chain of creation, preparation, merging, and making Tree in one single call. Does not allow for manipulation of individual RefDescriptors.
prepareForAssignOrNormDiff¶
-
public void
prepareForAssignOrNormDiff
(RefDescriptor otherRefDescriptor, Unit targetUnit, TapList ignoreStructure, boolean ignorePointed)¶ Jointly prepare this RefDescriptor and the “otherRefDescriptor” RefDescriptor to be used to build an assignment or a computation of square norm operation between the two trees.
prepareForInitialize¶
prepareForStack¶
-
public void
prepareForStack
(Unit targetUnit, int ppLabel, TapList ignoreStructure, boolean ignorePointed)¶ Prepares this RefDescriptor to be used to build PUSH/POP operations on the tree. 1) Decides which iterations will be loops or arrays 2) Builds the tree of nested loops 3) If required, chooses a unique number for matching PUSH and POPs
setCompanionVarDescriptor¶
-
public void
setCompanionVarDescriptor
(RefDescriptor otherVarDescriptor)¶