pub enum Operation {
Assign {
dst: Scalar,
src: Expression,
},
Store {
index: Expression,
src: Expression,
},
Load {
dst: Scalar,
index: Expression,
},
Branch {
target: Expression,
},
Intrinsic {
intrinsic: Intrinsic,
},
Nop {
placeholder: Option<Box<Operation>>,
},
}
Expand description
An IL Operation updates some state.
Variants§
Assign
Assign the value given in expression to the variable indicated.
Store
Store the value in src at the address given in index.
Load
Load the value in memory at index and place the result in the variable dst.
Branch
Fields
target: Expression
Branch to the value given by target.
Intrinsic
Holds an Intrinsic for unmodellable instructions
Nop
An operation that does nothing, and allows for a placeholder Instruction
Implementations§
source§impl Operation
impl Operation
sourcepub fn assign(dst: Scalar, src: Expression) -> Operation
pub fn assign(dst: Scalar, src: Expression) -> Operation
Create a new Operation::Assign
.
sourcepub fn store(index: Expression, src: Expression) -> Operation
pub fn store(index: Expression, src: Expression) -> Operation
Create a new Operation::Store
.
sourcepub fn load(dst: Scalar, index: Expression) -> Operation
pub fn load(dst: Scalar, index: Expression) -> Operation
Create a new Operation::Load
.
sourcepub fn branch(target: Expression) -> Operation
pub fn branch(target: Expression) -> Operation
Create a new Operation::Brc
.
sourcepub fn placeholder(operation: Operation) -> Operation
pub fn placeholder(operation: Operation) -> Operation
Create a new Operation::Nop
as placeholder for the given Operation
pub fn is_assign(&self) -> bool
pub fn is_store(&self) -> bool
pub fn is_load(&self) -> bool
pub fn is_branch(&self) -> bool
pub fn is_intrinsic(&self) -> bool
pub fn is_nop(&self) -> bool
sourcepub fn scalars_read(&self) -> Option<Vec<&Scalar>>
pub fn scalars_read(&self) -> Option<Vec<&Scalar>>
Get each Scalar
read by this Operation
.
sourcepub fn scalars_read_mut(&mut self) -> Option<Vec<&mut Scalar>>
pub fn scalars_read_mut(&mut self) -> Option<Vec<&mut Scalar>>
Get a mutable reference to each Scalar
read by this Operation
.
sourcepub fn scalars_written(&self) -> Option<Vec<&Scalar>>
pub fn scalars_written(&self) -> Option<Vec<&Scalar>>
Get a Vec of the Scalar
s written by this Operation
sourcepub fn scalars_written_mut(&mut self) -> Option<Vec<&mut Scalar>>
pub fn scalars_written_mut(&mut self) -> Option<Vec<&mut Scalar>>
Get a Vec of mutable referencer to the Scalar
s written by this
Operation
Trait Implementations§
source§impl<'de> Deserialize<'de> for Operation
impl<'de> Deserialize<'de> for Operation
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl Ord for Operation
impl Ord for Operation
source§impl PartialEq<Operation> for Operation
impl PartialEq<Operation> for Operation
source§impl PartialOrd<Operation> for Operation
impl PartialOrd<Operation> for Operation
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more