NewBlockGraphNode

public final class NewBlockGraphNode

Fields

assignedRef

protected Tree assignedRef

The variable that must be assigned or incremented by the final instruction.

backFlow

public TapList<NewBlockGraphArrow> backFlow

diffInstruction

protected Instruction diffInstruction

The final Instruction that will be generated for this node.

diffValue

protected Tree diffValue

The expression that is assigned or added into the assigned tree.

flow

public TapList<NewBlockGraphArrow> flow

fromInclude

protected Instruction fromInclude

When srcInstruction comes from an include, the include’ing Instruction.

iReplic

protected int iReplic

The replica number that was used to build “assignedRef” from “primRecv”.

kind

protected int kind

The general kind of the final Tree. In {PLAIN, INCREMENT_VARIABLE, SET_VARIABLE}.

multiDir

protected boolean multiDir

true if node must run in multi-dir style, i.e. in a loop on directions.

nbDeps

public int nbDeps

overwritesUsed

protected boolean overwritesUsed

True if this instruction reads a value that it then overwrites. Default is true because this is safest.

plainTrees

protected TapList<Tree> plainTrees

When the trees are created at NewBlockGraphNode creation time (e.g. for kind==PLAIN, as opposed to kind==SET_VARIABLE or INCREMENT_VARIABLE) this field holds the list of these trees. This holds only one Tree at the beginning, but may hold several trees after node’s are merged.

preComments

protected Tree preComments

The prefix comments that must be attached to the future Instruction of this node. postfix comments are always null.

preCommentsBlock

protected Tree preCommentsBlock

The prefix comments that must be attached to the future Instruction of this node. postfix comments are always null.

primRecv

protected Tree primRecv

The primal variable whose diff is “assignedRef”.

rank

public int rank

srcInstruction

protected Instruction srcInstruction

subOrder

public int subOrder

text

public String text

tree

protected Tree tree

The final Tree of the instruction for this Node. May be given at creation time (e.g. when kind==PLAIN) Alternatively, may be null (e.g. when kind==SET_VARIABLE or INCREMENT_VARIABLE) and will be deduced from the contents of whereMask, assigned, and diffValue.

whereMask

protected InstructionMask whereMask

The where context that must be applied to the final tree.

Constructors

NewBlockGraphNode

protected NewBlockGraphNode(int kind, Tree tree, boolean multiDir, Instruction srcInstruction, InstructionMask whereMask)

Methods

attachCommentsToTree

protected void attachCommentsToTree()

buildInstruction

protected void buildInstruction(SymbolTable srcSymbolTable, SymbolTable bwdSymbolTable, DifferentiationEnv adEnv, Unit diffUnit)

fuseWith

protected boolean fuseWith(NewBlockGraphNode otherNode)

Fuses this node with the “otherNode”.

Returns

true when this node must disappear and be merged into “otherNode”. @return false when “otherNode” must disappear and be merged into this node.

gatherMultiInstructions

protected void gatherMultiInstructions(SymbolTable diffSymbolTable, Unit diffUnit, NewSymbolHolder dirIndexSymbolHolder, IterDescriptor multiDirIterDescriptor)

hasManyInstructions

protected boolean hasManyInstructions()

interestingFuseWith

protected boolean interestingFuseWith(NewBlockGraphNode otherNode, NewBlockGraph thisGraph)
Returns

true if the fusion of “this” followed by “otherNode” is possible and profitable.

recomputeText

protected void recomputeText()

toString

public String toString()