Skip to main content

Instr

Enum Instr 

Source
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.

Fields

§dst: Reg

Destination register.

§value: f64

Constant value to load.

§

LoadInput

Load the k-th program input for the current sample.

Fields

§dst: Reg

Destination register.

§index: usize

Program input index.

§

ReadState

Read a persistent state slot (its value from the previous sample).

Fields

§dst: Reg

Destination register.

§slot: StateSlot

State slot to read.

§

ReadDelay

Read from a delay line: value len samples ago.

Fields

§dst: Reg

Destination register.

§line: usize

Delay line index.

§

Un

Unary op.

Fields

§dst: Reg

Destination register.

§op: UnOp

Unary operation.

§src: Reg

Source register.

§

Bin

Binary op.

Fields

§dst: Reg

Destination register.

§op: BinArith

Binary operation.

§a: Reg

First operand register.

§b: Reg

Second operand register.

§

Move

Copy one register to another (wire).

Fields

§dst: Reg

Destination register.

§src: Reg

Source register.

§

WriteState

Schedule a write of src into state slot at end of the sample.

Fields

§slot: StateSlot

State slot to write.

§src: Reg

Source register.

§

WriteDelay

Schedule a push of src into a delay line at end of the sample.

Fields

§line: usize

Delay line index.

§src: Reg

Source register.

§

CallSample

Call a per-sample built-in: srcs inputs → dst, instance index.

Fields

§dst: Reg

Destination register.

§srcs: Vec<Reg>

Source registers.

§instance: usize

Index into Ir::builtins.

§

CallBlock

Call a whole-buffer built-in (1→1): srcdst, instance index.

Fields

§dst: Reg

Destination register.

§src: Reg

Source register.

§instance: usize

Index into Ir::builtins.

§

ReadParam

Read a named parameter slot. Value is constant within a block.

Fields

§dst: Reg

Destination register.

§idx: usize

Index into Ir::params.

Trait Implementations§

Source§

impl Clone for Instr

Source§

fn clone(&self) -> Instr

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Instr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Instr

Source§

fn eq(&self, other: &Instr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert to &dyn std::any::Any
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert to &mut dyn std::any::Any
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V