Instruction¶
-
public final class
Instruction
¶ Container for an atomic instruction in a Block in a Flow Graph.
Fields¶
directives¶
isDifferentiated¶
-
public boolean
isDifferentiated
¶ Used during differentiation to mark that this instruction has been differentiated (Specific to AD).
isPhantom¶
-
public boolean
isPhantom
¶ Set “isPhantom” to true to ensure this Instruction will not be shown.
lineNo¶
-
public int
lineNo
¶ When not lost by parsing, the line number in the source file. 0 otherwise.
pointerDestsChanges¶
-
public TapList<TapPair<TapIntList, BoolVector>>
pointerDestsChanges
¶ List of all the modifications brought by this instruction on the current pointers destinations info. List of TapPair’s:
first : singleton TapIntList of pointer row index
second: BoolVector of the new possible destinations
postComments¶
postCommentsBlock¶
preComments¶
preCommentsBlock¶
syntaxController¶
-
public Instruction
syntaxController
¶ The deepest instruction syntactically around this instruction, if any. This is the control instruction of the deepest syntactic construct that contains this instruction.
Constructors¶
Instruction¶
-
public
Instruction
(Tree tree, Instruction syntaxController)¶ Create an Instruction containing the given tree, also giving its syntactic controller.
Instruction¶
-
public
Instruction
(Tree tree, Instruction syntaxController, int lineNo)¶ Create an Instruction containing the given tree, also giving its syntactic controller and source code line number.
Instruction¶
-
public
Instruction
(Tree tree, Instruction syntaxController, Block block)¶ Create an Instruction containing the given tree, also giving its syntactic controller and containing Block.
Methods¶
addPreComments¶
appendPostComments¶
appendPreComments¶
copy¶
-
public Instruction
copy
(TapList<TapPair<Instruction, Instruction>> alreadyCopiedMasks)¶ - Returns
a copy of this instruction, making sure that the copy’s where mask is a copy of the instruction’s vectorial mask.
copyCommentsToTree¶
copyTreePlusComments¶
createUnitDefinitionStub¶
-
public static Instruction
createUnitDefinitionStub
(Unit definedUnit, Block containerBlock)¶ - Returns
a new “unit definition stub” Instruction, used to mark the location of this Unit’s definition in the code.
createUnitDefinitionStubTree¶
declareIsMaskDefinition¶
-
protected void
declareIsMaskDefinition
()¶ States that this instruction is the one that sets the mask of a WHERE.
declaredSymbolDecls¶
-
public TapList<SymbolDecl>
declaredSymbolDecls
(SymbolTable publicSymbolTable, SymbolTable privateSymbolTable)¶ - Returns
the list of all SymbolDecl’s declared by this Instruction.
declaresUnits¶
-
public TapList<Unit>
declaresUnits
(SymbolTable symbolTable)¶
differentiateChainedIncludes¶
-
public static Instruction
differentiateChainedIncludes
(Instruction includeInstr, String suffix, boolean wait)¶ - Parameters
wait – When true, use the existing diff name if exists, but do not create it if it doesn’t exist.
suffix – The suffix used for differentiation. May be passed null when wait==true.
dump¶
-
public void
dump
()¶ Prints in detail the contents of this Instruction, onto TapEnv.curOutputStream().
encloseInWhereMask¶
-
public void
encloseInWhereMask
(InstructionMask enclosingWhereMask)¶ Connects enclosingWhereMask as an additional enclosing where mask around this Instruction (except if it has already been connected)
forceDiffInclude¶
fromInclude¶
-
public Instruction
fromInclude
()¶ When this instruction comes from an INCLUDE file.
- Returns
the instruction that does the include.
fromIncludeCopy¶
-
public static Instruction
fromIncludeCopy
(Instruction fromIncludeInstr, boolean copy)¶ - Returns
a copy of this.fromInclude.
getPosition¶
-
public int
getPosition
()¶ - Returns
the “position” of this instruction in the file it comes from.
getWhereMask¶
-
public InstructionMask
getWhereMask
()¶ - Returns
the vectorial mask of this instruction. When the instruction is a where test, the returned vectorial mask does not include this where control.
hasCommentStartingWith¶
hasDirective¶
isADeclaration¶
-
public boolean
isADeclaration
()¶ - Returns
true if this instruction is a declaration statement.
isANoOp¶
-
public boolean
isANoOp
()¶ - Returns
true if this instruction is a no_op, i.e. a op_none, created only e.g. to hold some comments.
isAWhereControl¶
-
public boolean
isAWhereControl
()¶ - Returns
true if this instruction is a where control instruction.
isMaskDefinition¶
-
public boolean
isMaskDefinition
()¶ - Returns
true when this instruction is the one that sets the mask of a WHERE.
replaceTree¶
setFromInclude¶
-
public void
setFromInclude
(Instruction incl)¶
setFromIncludeCopy¶
-
public void
setFromIncludeCopy
(Instruction origInclude, boolean copy)¶ Declare that this Instruction belongs to the include file “origInclude”.
setIncludeOfDiffInstructions¶
-
public void
setIncludeOfDiffInstructions
(Instruction primalInstruction, boolean primalIsRewritten, TapList<Instruction>[] diffInstructionSR, String suffix)¶ Decorates the given primalInstruction and each of diffInstructionS, with the “fromInclude” info built by differentiation of this Instruction (“this” Instruction is the “fromInclude” of the original non-differentiated instruction). Keeps track of the correspondence between non-diff and diff include file names through TapEnv.get().differentiatedIncludeNames.
- Parameters
primalInstruction – the primal copy of the original source instruction
primalIsRewritten – true when the primal copy is created specifically for the diff code (e.g. foo_nodiff), instead of being just a reference to the source (e.g. foo)
diffInstructionSR – the (array of (replicas)) list of new differentiated instructions.
suffix – The suffix used for differentiation. May be passed null when this is called not for differentiation but during fixImplicits preliminary phase.
setInterfaceUnits¶
setPosition¶
-
public void
setPosition
(Instruction refInstr)¶ Sets the “position” of this instruction to the same as of refInstr.
setTree¶
setWhereMask¶
-
public void
setWhereMask
(InstructionMask whereMask)¶ Sets a vectorial mask on this instruction.
syntaxControls¶
-
public boolean
syntaxControls
(Instruction controlled)¶ - Returns
true if this instruction syntactically controls “controlled”.
thisCallIsCheckpointed¶
updateUnitDefinitionStub¶
usedUnits¶
whereMask¶
-
public InstructionMask
whereMask
()¶ - Returns
the vectorial mask of this instruction, if any.