pub enum Instr {
Const {
dst: Reg,
value: f64,
},
LoadInput {
dst: Reg,
index: usize,
},
ReadState {
dst: Reg,
slot: StateSlot,
},
ReadDelay {
dst: Reg,
line: usize,
},
Un {
dst: Reg,
op: UnOp,
src: Reg,
},
Bin {
dst: Reg,
op: BinArith,
a: Reg,
b: Reg,
},
Move {
dst: Reg,
src: Reg,
},
WriteState {
slot: StateSlot,
src: Reg,
},
WriteDelay {
line: usize,
src: Reg,
},
CallSample {
dst: Reg,
srcs: Vec<Reg>,
instance: usize,
},
CallBlock {
dst: Reg,
src: Reg,
instance: usize,
},
ReadParam {
dst: Reg,
idx: usize,
},
}Expand description
One IR instruction. dst is the scratch register it writes.
Variants§
Const
Load a constant.
LoadInput
Load the k-th program input for the current sample.
ReadState
Read a persistent state slot (its value from the previous sample).
ReadDelay
Read from a delay line: value len samples ago.
Un
Unary op.
Bin
Binary op.
Fields
Move
Copy one register to another (wire).
WriteState
Schedule a write of src into state slot at end of the sample.
WriteDelay
Schedule a push of src into a delay line at end of the sample.
CallSample
Call a per-sample built-in: srcs inputs → dst, instance index.
Fields
§
instance: usizeIndex into Ir::builtins.
CallBlock
Call a whole-buffer built-in (1→1): src → dst, instance index.
Fields
§
instance: usizeIndex into Ir::builtins.
ReadParam
Read a named parameter slot. Value is constant within a block.
Trait Implementations§
impl StructuralPartialEq for Instr
Auto Trait Implementations§
impl Freeze for Instr
impl RefUnwindSafe for Instr
impl Send for Instr
impl Sync for Instr
impl Unpin for Instr
impl UnsafeUnpin for Instr
impl UnwindSafe for Instr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more