.. java:import:: fr.inria.tapenade.utils ILLang .. java:import:: fr.inria.tapenade.utils TapPair .. java:import:: fr.inria.tapenade.utils Tree NewSymbolHolder =============== .. java:package:: fr.inria.tapenade.representation :noindex: .. java:type:: public final class NewSymbolHolder Class that holds all info about a new symbol that we are going to add into a subroutine. For each new variable name that we wish to add, we create one such object. Then each time we want to insert a new reference to this new variable, we ask this object to build this new reference. Finally, when all references are built, we ask this object to choose the definitive name of the new variable, and insert its SymbolDecl into the correct symbolTable. Fields ------ declare ^^^^^^^ .. java:field:: public boolean declare :outertype: NewSymbolHolder If false, do not declare this new symbol (e.g. the end-user will do it). definitionModule ^^^^^^^^^^^^^^^^ .. java:field:: public Unit definitionModule :outertype: NewSymbolHolder When this new symbol is declared by a module (of the target CallGraph), keeps this module. derivationFrom ^^^^^^^^^^^^^^ .. java:field:: public SymbolDecl derivationFrom :outertype: NewSymbolHolder The SymbolDecl of the symbol that gives its base name for this new symbol. hintArrayTreeForCallSize ^^^^^^^^^^^^^^^^^^^^^^^^ .. java:field:: public Tree hintArrayTreeForCallSize :outertype: NewSymbolHolder The Tree that must be used each time a variable must be created to with size(hintArrayTreeForCallSize). hintRootTree ^^^^^^^^^^^^ .. java:field:: public Tree hintRootTree :outertype: NewSymbolHolder When non-null, this tree is used to build the ISIZEnOF... variables that represent unknown dimension sizes, and the messages that come with them. newSolvedVariableDecl ^^^^^^^^^^^^^^^^^^^^^ .. java:field:: public VariableDecl newSolvedVariableDecl :outertype: NewSymbolHolder newVariableDecl ^^^^^^^^^^^^^^^ .. java:field:: public VariableDecl newVariableDecl :outertype: NewSymbolHolder If needed, the VariableDecl for this future symbol. probableName ^^^^^^^^^^^^ .. java:field:: public String probableName :outertype: NewSymbolHolder The probable future name of this new symbol. zone ^^^^ .. java:field:: public int zone :outertype: NewSymbolHolder a temporary zone number for this new symbol. Constructors ------------ NewSymbolHolder ^^^^^^^^^^^^^^^ .. java:constructor:: public NewSymbolHolder(String probableName, int diffSymbolSort) :outertype: NewSymbolHolder Builds a NewSymbolHolder for a future symbol of probable name "probableName" "diffSymbolSort" is the sort (e.g. _FWD, _B, ...) of derivative that this new symbol stands for. NewSymbolHolder ^^^^^^^^^^^^^^^ .. java:constructor:: public NewSymbolHolder(String probableName) :outertype: NewSymbolHolder Builds a NewSymbolHolder for a future symbol of probable name "probableName". NewSymbolHolder ^^^^^^^^^^^^^^^ .. java:constructor:: public NewSymbolHolder(String probableName, Unit hostUnit, WrapperTypeSpec type, int sizeModifier) :outertype: NewSymbolHolder Builds a NewSymbolHolder that will be placed inside hostUnit, of probable name "probableName", of the given type, possibly with a size modifier. Methods ------- absorb ^^^^^^ .. java:method:: public void absorb(NewSymbolHolder absorbedSymbolHolder) :outertype: NewSymbolHolder Add available info from absorbedSymbolHolder into this. accumulateSymbolDecl ^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void accumulateSymbolDecl(SymbolDecl newSymbolDecl, SymbolTable targetSymbolTable) :outertype: NewSymbolHolder accumulateTargetForSymbolDecl ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void accumulateTargetForSymbolDecl(SymbolDecl modelSymbolDecl, SymbolTable targetSymbolTable) :outertype: NewSymbolHolder addTypeDeclSymbolTable ^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void addTypeDeclSymbolTable(SymbolTable symbolTable) :outertype: NewSymbolHolder buildCptrTree ^^^^^^^^^^^^^ .. java:method:: public static TapPair buildCptrTree(Tree expr, SymbolTable usageSymbolTable, boolean isNullPTR, String cptrName, Unit targetUnit, WrapperTypeSpec type, boolean initCptr) :outertype: NewSymbolHolder checkVariableDimension ^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public static WrapperTypeSpec checkVariableDimension(WrapperTypeSpec typeSpec, String arrayNameInIdent, String arrayNameInText, Tree treeInCallSize, Unit diffUnit, Unit origUnit, SymbolTable symbolTable) :outertype: NewSymbolHolder Checks that the array dimensions in typeSpec use only numerical constants. :param treeInCallSize: :param symbolTable: copySymbolHolderAnnotation ^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public static void copySymbolHolderAnnotation(Tree fromTree, Tree toTree, SymbolTable newUsageSymbolTable) :outertype: NewSymbolHolder If there is a "NewSymbolHolder" annotation on "fromTree", put a similar annotation on "toTree", and register "toTree" as a new occurrence of this NewSymbolHolder. As a consequence, the given "newUsageSymbolTable", which is the SymbolTable on toTree, must see the future declaration of this NewSymbolHolder, This is to permit creation of a new symbol based on another new symbol, with the SymbolHolder mechanism (cf adj10.f) declarationLevelMustInclude ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void declarationLevelMustInclude(SymbolTable symbolTable) :outertype: NewSymbolHolder Says that the main SymbolDecl of this NewSymbolHolder must be declared in a SymbolTable which must be seen by (i.e. must be a root symbol table of) the given "symbolTable". declareUsageInstruction ^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void declareUsageInstruction(Instruction instruction) :outertype: NewSymbolHolder dependsOn ^^^^^^^^^ .. java:method:: public TapList dependsOn() :outertype: NewSymbolHolder extraInfo ^^^^^^^^^ .. java:method:: public TapList extraInfo() :outertype: NewSymbolHolder finalName ^^^^^^^^^ .. java:method:: public String finalName() :outertype: NewSymbolHolder getAttachedVariableDecl ^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public static VariableDecl getAttachedVariableDecl(Tree tree) :outertype: NewSymbolHolder getNewSymbolHolder ^^^^^^^^^^^^^^^^^^ .. java:method:: public static NewSymbolHolder getNewSymbolHolder(Tree refTree) :outertype: NewSymbolHolder Assuming that the given "refTree" is a reference to a NewSymbolHolder. :return: this NewSymbolHolder. hasNewFunctionDecl ^^^^^^^^^^^^^^^^^^ .. java:method:: public boolean hasNewFunctionDecl() :outertype: NewSymbolHolder instruction ^^^^^^^^^^^ .. java:method:: public Instruction instruction() :outertype: NewSymbolHolder instruction ^^^^^^^^^^^ .. java:method:: public Instruction instruction(SymbolTable symbolTable) :outertype: NewSymbolHolder isANewSymbolRef ^^^^^^^^^^^^^^^ .. java:method:: public static boolean isANewSymbolRef(Tree refTree) :outertype: NewSymbolHolder :return: true if the given "refTree" is a reference to a NewSymbolHolder. isDerivationFrom ^^^^^^^^^^^^^^^^ .. java:method:: public void isDerivationFrom(SymbolDecl baseDecl, String suffix) :outertype: NewSymbolHolder isUsed ^^^^^^ .. java:method:: public boolean isUsed() :outertype: NewSymbolHolder :return: true if this NewSymbolHolder is actually used and therefore must be declared. makeNewRef ^^^^^^^^^^ .. java:method:: public Tree makeNewRef(SymbolTable symbolTable) :outertype: NewSymbolHolder Builds a new Tree referencing the future symbol. Register it so that it will receive the final name when chosen. If symbolTable is not null, add it into the usage SymbolTable's. migrateToCopySymbolTable ^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void migrateToCopySymbolTable(SymbolTable copyST) :outertype: NewSymbolHolder newFunctionDecl ^^^^^^^^^^^^^^^ .. java:method:: public FunctionDecl newFunctionDecl() :outertype: NewSymbolHolder newTypeDecl ^^^^^^^^^^^ .. java:method:: public TypeDecl newTypeDecl() :outertype: NewSymbolHolder newVariableDecl ^^^^^^^^^^^^^^^ .. java:method:: public VariableDecl newVariableDecl() :outertype: NewSymbolHolder prepareDeclarationInstr ^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void prepareDeclarationInstr(Unit targetUnit) :outertype: NewSymbolHolder Prepares the Instruction that will contain the declaration of this NewSymbolHolder in targetUnit. preparePrivateClause ^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void preparePrivateClause(Block srcOfUsageBlock, SymbolTable srcDeclST, boolean inFwd, boolean diff) :outertype: NewSymbolHolder If this future new symbol is used in a block whose source correspondent is "srcOfUsageBlock" and if the opening clause ($OMP PARALLEL) of the enclosing OpenMP region is between usageBlock and its corresponding (future) declaration scope "srcDeclST", then this opening clause must be extended to specify that this new symbol is "omp private". :param srcOfUsageBlock: (the source block of) the block where this NewSymbolHolder will be used. :param srcDeclST: source correspondent of the SymbolTable where the new symbol will be declared. :param inFwd: when true, the private clause goes to the fwd differentiated pragma :param diff: when true, the private clause must be about the variable's derivative prepareSharedClause ^^^^^^^^^^^^^^^^^^^ .. java:method:: public void prepareSharedClause(Block srcOfUsageBlock, SymbolTable srcDeclST, boolean inFwd, boolean diff) :outertype: NewSymbolHolder Same as preparePrivateClause, but will create a "omp shared" clause prepareSumReductionClause ^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void prepareSumReductionClause(Block usageBlock) :outertype: NewSymbolHolder Same as preparePrivateClause, but will cause a REDUCTION(+:...), always in the BWD sweep, and on the diff probableName ^^^^^^^^^^^^ .. java:method:: public String probableName() :outertype: NewSymbolHolder sameNSH ^^^^^^^ .. java:method:: public static boolean sameNSH(Tree tree1, Tree tree2) :outertype: NewSymbolHolder setAsConstantVariable ^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void setAsConstantVariable(WrapperTypeSpec typeSpec, TapList dependsOn, Tree value) :outertype: NewSymbolHolder Declares that this NewSymbolHolder represents a CONSTANT name, of the given "typeSpec", and this "typeSpec" depends on the previous declarations "dependsOn". setAsType ^^^^^^^^^ .. java:method:: public void setAsType(WrapperTypeSpec typeSpec, TapList dependsOn) :outertype: NewSymbolHolder Declares that this NewSymbolHolder represents a TYPE name. setAsVariable ^^^^^^^^^^^^^ .. java:method:: public void setAsVariable(WrapperTypeSpec typeSpec, TapList dependsOn) :outertype: NewSymbolHolder Declares that this NewSymbolHolder represents a VARIABLE name, of the given "typeSpec", and this "typeSpec" depends on the previous declarations "dependsOn". setDependsOn ^^^^^^^^^^^^ .. java:method:: public void setDependsOn(TapList dependsOn) :outertype: NewSymbolHolder setExtraInfo ^^^^^^^^^^^^ .. java:method:: public void setExtraInfo(TapList info) :outertype: NewSymbolHolder setHintArrayTreeForCallSize ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void setHintArrayTreeForCallSize(Tree hintSize) :outertype: NewSymbolHolder setHintRootTree ^^^^^^^^^^^^^^^ .. java:method:: public void setHintRootTree(Tree hintRootTree) :outertype: NewSymbolHolder setInstruction ^^^^^^^^^^^^^^ .. java:method:: public void setInstruction(Instruction instr) :outertype: NewSymbolHolder setNewTypeDecl ^^^^^^^^^^^^^^ .. java:method:: public void setNewTypeDecl(TypeDecl typeDecl) :outertype: NewSymbolHolder setOtherDefSymbolTable ^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void setOtherDefSymbolTable(SymbolTable symbolTable) :outertype: NewSymbolHolder setTypeDeclTreeAlreadyPlacedFor ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void setTypeDeclTreeAlreadyPlacedFor(SymbolTable symbolTable) :outertype: NewSymbolHolder setUsesRefTo ^^^^^^^^^^^^ .. java:method:: public void setUsesRefTo() :outertype: NewSymbolHolder Say that references to this variable X must emulate PASS-BY-REFERENCE by using \ ``*X``\ and \ ``&X``\ . setVarDeclTreeAlreadyPlacedFor ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void setVarDeclTreeAlreadyPlacedFor(SymbolTable symbolTable) :outertype: NewSymbolHolder setVarDeclTreeNotAlreadyPlaced ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void setVarDeclTreeNotAlreadyPlaced() :outertype: NewSymbolHolder solve ^^^^^ .. java:method:: public void solve(SymbolTable symbolTable, boolean noCopySuffix) :outertype: NewSymbolHolder SOLVE a NewSymbolHolder. When we reach the rootmost SymbolTable, solve this NewSymbolHolder i.e. choose its final name and insert the new symbol SymbolDecl(s). solvingLevelMustInclude ^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public void solvingLevelMustInclude(SymbolTable symbolTable) :outertype: NewSymbolHolder solvingRootIsOutsideFile ^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public boolean solvingRootIsOutsideFile(SymbolTable symbolTable) :outertype: NewSymbolHolder :return: true when the symbolSolvingRootSymbolTable resulting from merging with "symbolTable" would be outside a C compilation unit, i.e. would be th C language root symboltable, therefore causing conflicts when solving for the new name. toString ^^^^^^^^ .. java:method:: @Override public String toString() :outertype: NewSymbolHolder typeSpec ^^^^^^^^ .. java:method:: public WrapperTypeSpec typeSpec() :outertype: NewSymbolHolder usesRefTo ^^^^^^^^^ .. java:method:: public boolean usesRefTo() :outertype: NewSymbolHolder