ConditionalNode

Directs control flow to exactly one of multiple possible edges.

The choice of which branch to take is controled by a data dependency interpreted as an unsigned integer indexing an array of options. If the selector's value does not match the index of any option, program behavior is undefined. A Gyre compiler may assume that this never happens and either issue warnings / errors or optimize accordingly (e.g. by assuming that the selector's value is one of the valid indexes, if control flow reaches this node).

More...

Members

Functions

opEquals
bool opEquals(const(ConditionalNode) rhs)

Equivalence check.

opIndex
inout(InEdge)* opIndex(InEdge.ID slot)

See Node.opIndex.

toHash
hash_t toHash()

Semantic hash.

Properties

inEdges
InEdgeIterator!Callable inEdges [@property getter]

Provides an iterator over this node's in-edges.

options
inout(UnsafeHashMap!(ulong, OutEdge)) options [@property getter]

At least two outgoing control flow edges, only one of which will be taken.

outEdges
OutEdgeIterator!Callable outEdges [@property getter]

Provides an iterator over this node's out-edges.

Static functions

dispose
void dispose(ConditionalNode* self)

Frees all resources allocated by this node and sets it to an uninitialized state.

initialize
err_t initialize(ConditionalNode* self, uint n)

Initializes a conditional node, must be later disposed.

Variables

control
InEdge control;

Incoming control flow edge.

selector
OutEdge selector;

Data selector used to choose the taken branch.

Mixed In Members

From mixin NodeInheritance

opPostMove
void opPostMove(const(This) old)

Post-move adjusts in-edge slots' owner pointer.

Detailed Description

Conditional nodes are technically redundant in the IR, since they could be emulated by a jump into the result of a mux node. In the worst case, however, this would require one extra instantiation node for each branch, so we define this as a dedicated control branch operation.

See Also