Enum spirt::ControlNodeKind
source · pub enum ControlNodeKind {
Block {
insts: EntityList<DataInst>,
},
Select {
kind: SelectionKind,
scrutinee: Value,
cases: SmallVec<[ControlRegion; 2]>,
},
Loop {
initial_inputs: SmallVec<[Value; 2]>,
body: ControlRegion,
repeat_condition: Value,
},
}Variants§
Block
Fields
insts: EntityList<DataInst>Linear chain of DataInsts, executing in sequence.
This is only an optimization over keeping DataInsts in ControlRegion
linear chains directly, or even merging DataInst with ControlNode.
Select
Choose one ControlRegion out of cases to execute, based on a single
value input (scrutinee) interpreted according to SelectionKind.
This corresponds to “gamma” (γ) nodes in (R)VSDG, though those are
sometimes limited only to a two-way selection on a boolean condition.
Loop
Execute body repeatedly, until repeat_condition evaluates to false.
To represent “loop state”, body can take inputs, getting values from:
- on the first iteration:
initial_inputs - on later iterations:
body’s ownoutputs(from the last iteration)
As the condition is checked only after the body, this type of loop is
sometimes described as “tail-controlled”, and is also equivalent to the
C-like do { body; } while(repeat_condition) construct.
This corresponds to “theta” (θ) nodes in (R)VSDG.
Trait Implementations§
source§impl Clone for ControlNodeKind
impl Clone for ControlNodeKind
source§fn clone(&self) -> ControlNodeKind
fn clone(&self) -> ControlNodeKind
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more