NewSymbolHolder¶
-
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¶
-
public boolean
declare
¶ If false, do not declare this new symbol (e.g. the end-user will do it).
definitionModule¶
derivationFrom¶
-
public SymbolDecl
derivationFrom
¶ The SymbolDecl of the symbol that gives its base name for this new symbol.
hintArrayTreeForCallSize¶
hintRootTree¶
newSolvedVariableDecl¶
-
public VariableDecl
newSolvedVariableDecl
¶
newVariableDecl¶
-
public VariableDecl
newVariableDecl
¶ If needed, the VariableDecl for this future symbol.
Constructors¶
NewSymbolHolder¶
NewSymbolHolder¶
NewSymbolHolder¶
-
public
NewSymbolHolder
(String probableName, Unit hostUnit, WrapperTypeSpec type, int sizeModifier)¶ Builds a NewSymbolHolder that will be placed inside hostUnit, of probable name “probableName”, of the given type, possibly with a size modifier.
Methods¶
absorb¶
-
public void
absorb
(NewSymbolHolder absorbedSymbolHolder)¶ Add available info from absorbedSymbolHolder into this.
accumulateSymbolDecl¶
-
public void
accumulateSymbolDecl
(SymbolDecl newSymbolDecl, SymbolTable targetSymbolTable)¶
accumulateTargetForSymbolDecl¶
-
public void
accumulateTargetForSymbolDecl
(SymbolDecl modelSymbolDecl, SymbolTable targetSymbolTable)¶
addTypeDeclSymbolTable¶
-
public void
addTypeDeclSymbolTable
(SymbolTable symbolTable)¶
buildCptrTree¶
-
public static TapPair<NewSymbolHolder, Tree>
buildCptrTree
(Tree expr, SymbolTable usageSymbolTable, boolean isNullPTR, String cptrName, Unit targetUnit, WrapperTypeSpec type, boolean initCptr)¶
checkVariableDimension¶
-
public static WrapperTypeSpec
checkVariableDimension
(WrapperTypeSpec typeSpec, String arrayNameInIdent, String arrayNameInText, Tree treeInCallSize, Unit diffUnit, Unit origUnit, SymbolTable symbolTable)¶ Checks that the array dimensions in typeSpec use only numerical constants.
- Parameters
treeInCallSize –
symbolTable –
copySymbolHolderAnnotation¶
-
public static void
copySymbolHolderAnnotation
(Tree fromTree, Tree toTree, SymbolTable newUsageSymbolTable)¶ 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¶
-
public void
declarationLevelMustInclude
(SymbolTable symbolTable)¶ 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¶
-
public void
declareUsageInstruction
(Instruction instruction)¶
dependsOn¶
-
public TapList<SymbolDecl>
dependsOn
()¶
getAttachedVariableDecl¶
-
public static VariableDecl
getAttachedVariableDecl
(Tree tree)¶
getNewSymbolHolder¶
-
public static NewSymbolHolder
getNewSymbolHolder
(Tree refTree)¶ Assuming that the given “refTree” is a reference to a NewSymbolHolder.
- Returns
this NewSymbolHolder.
instruction¶
-
public Instruction
instruction
()¶
instruction¶
-
public Instruction
instruction
(SymbolTable symbolTable)¶
isANewSymbolRef¶
isDerivationFrom¶
-
public void
isDerivationFrom
(SymbolDecl baseDecl, String suffix)¶
isUsed¶
-
public boolean
isUsed
()¶ - Returns
true if this NewSymbolHolder is actually used and therefore must be declared.
makeNewRef¶
-
public Tree
makeNewRef
(SymbolTable symbolTable)¶ 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¶
-
public void
migrateToCopySymbolTable
(SymbolTable copyST)¶
newFunctionDecl¶
-
public FunctionDecl
newFunctionDecl
()¶
newVariableDecl¶
-
public VariableDecl
newVariableDecl
()¶
prepareDeclarationInstr¶
preparePrivateClause¶
-
public void
preparePrivateClause
(Block srcOfUsageBlock, SymbolTable srcDeclST, boolean inFwd, boolean diff)¶ 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”.
- Parameters
srcOfUsageBlock – (the source block of) the block where this NewSymbolHolder will be used.
srcDeclST – source correspondent of the SymbolTable where the new symbol will be declared.
inFwd – when true, the private clause goes to the fwd differentiated pragma
diff – when true, the private clause must be about the variable’s derivative
prepareSumReductionClause¶
setAsConstantVariable¶
-
public void
setAsConstantVariable
(WrapperTypeSpec typeSpec, TapList<SymbolDecl> dependsOn, Tree value)¶ Declares that this NewSymbolHolder represents a CONSTANT name, of the given “typeSpec”, and this “typeSpec” depends on the previous declarations “dependsOn”.
setAsType¶
-
public void
setAsType
(WrapperTypeSpec typeSpec, TapList<SymbolDecl> dependsOn)¶ Declares that this NewSymbolHolder represents a TYPE name.
setAsVariable¶
-
public void
setAsVariable
(WrapperTypeSpec typeSpec, TapList<SymbolDecl> dependsOn)¶ Declares that this NewSymbolHolder represents a VARIABLE name, of the given “typeSpec”, and this “typeSpec” depends on the previous declarations “dependsOn”.
setDependsOn¶
-
public void
setDependsOn
(TapList<SymbolDecl> dependsOn)¶
setInstruction¶
-
public void
setInstruction
(Instruction instr)¶
setOtherDefSymbolTable¶
-
public void
setOtherDefSymbolTable
(SymbolTable symbolTable)¶
setTypeDeclTreeAlreadyPlacedFor¶
-
public void
setTypeDeclTreeAlreadyPlacedFor
(SymbolTable symbolTable)¶
setUsesRefTo¶
-
public void
setUsesRefTo
()¶ Say that references to this variable X must emulate PASS-BY-REFERENCE by using
*X
and&X
.
setVarDeclTreeAlreadyPlacedFor¶
-
public void
setVarDeclTreeAlreadyPlacedFor
(SymbolTable symbolTable)¶
solve¶
-
public void
solve
(SymbolTable symbolTable, boolean noCopySuffix)¶ 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¶
-
public void
solvingLevelMustInclude
(SymbolTable symbolTable)¶
solvingRootIsOutsideFile¶
-
public boolean
solvingRootIsOutsideFile
(SymbolTable symbolTable)¶ - Returns
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.
typeSpec¶
-
public WrapperTypeSpec
typeSpec
()¶