pub struct ComputedValue {
pub op: ComputedOp,
pub operands: Vec<SsaVarId>,
}Expand description
Computed value for common subexpression elimination (CSE).
This represents the result of a computation, enabling recognition of equivalent expressions that can be eliminated.
Fields§
§op: ComputedOpThe operation that produced this value.
operands: Vec<SsaVarId>The operands to the operation.
Implementations§
Source§impl ComputedValue
impl ComputedValue
Sourcepub fn new(op: ComputedOp, operands: Vec<SsaVarId>) -> Self
pub fn new(op: ComputedOp, operands: Vec<SsaVarId>) -> Self
Creates a new computed value.
Sourcepub fn unary(op: ComputedOp, operand: SsaVarId) -> Self
pub fn unary(op: ComputedOp, operand: SsaVarId) -> Self
Creates a unary computed value.
Sourcepub fn binary(op: ComputedOp, left: SsaVarId, right: SsaVarId) -> Self
pub fn binary(op: ComputedOp, left: SsaVarId, right: SsaVarId) -> Self
Creates a binary computed value.
Sourcepub fn normalized(self) -> Self
pub fn normalized(self) -> Self
Normalizes commutative operations for better CSE.
For commutative ops like add/mul, orders operands consistently
so that a + b and b + a have the same computed value.
Trait Implementations§
Source§impl Clone for ComputedValue
impl Clone for ComputedValue
Source§fn clone(&self) -> ComputedValue
fn clone(&self) -> ComputedValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ComputedValue
impl Debug for ComputedValue
Source§impl<'de> Deserialize<'de> for ComputedValue
impl<'de> Deserialize<'de> for ComputedValue
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ComputedValue
impl Display for ComputedValue
impl Eq for ComputedValue
Source§impl Hash for ComputedValue
impl Hash for ComputedValue
Source§impl PartialEq for ComputedValue
impl PartialEq for ComputedValue
Source§impl Serialize for ComputedValue
impl Serialize for ComputedValue
impl StructuralPartialEq for ComputedValue
Auto Trait Implementations§
impl Freeze for ComputedValue
impl RefUnwindSafe for ComputedValue
impl Send for ComputedValue
impl Sync for ComputedValue
impl Unpin for ComputedValue
impl UnsafeUnpin for ComputedValue
impl UnwindSafe for ComputedValue
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more