pub enum CompilerENode {
Show 30 variants
Int(i64),
Bool(bool),
Float(u64),
Var(u32, u32),
Opaque(u32),
Add(NodeId, NodeId),
Sub(NodeId, NodeId),
Mul(NodeId, NodeId),
Div(NodeId, NodeId),
Mod(NodeId, NodeId),
Shl(NodeId, NodeId),
Shr(NodeId, NodeId),
BitXor(NodeId, NodeId),
BitAnd(NodeId, NodeId),
BitOr(NodeId, NodeId),
And(NodeId, NodeId),
Or(NodeId, NodeId),
Not(NodeId),
Eq(NodeId, NodeId),
Ne(NodeId, NodeId),
Lt(NodeId, NodeId),
Le(NodeId, NodeId),
Gt(NodeId, NodeId),
Ge(NodeId, NodeId),
Concat(NodeId, NodeId),
Len(NodeId),
Index(NodeId, NodeId),
Copy(NodeId),
Slice(NodeId, NodeId, NodeId),
Contains(NodeId, NodeId),
}Variants§
Int(i64)
Bool(bool)
Float(u64)
f64 bit pattern. Floats are NEVER arithmetic-rewritten (no identity, no reassociation — bit-exactness is the contract); the variant exists so float-valued subtrees still participate in congruence.
Var(u32, u32)
(symbol index, version)
Opaque(u32)
Index into the converter’s originals table.
Add(NodeId, NodeId)
Sub(NodeId, NodeId)
Mul(NodeId, NodeId)
Div(NodeId, NodeId)
Mod(NodeId, NodeId)
Shl(NodeId, NodeId)
Shr(NodeId, NodeId)
BitXor(NodeId, NodeId)
BitAnd(NodeId, NodeId)
Bitwise &/| on Int (the surface &/| symbols; also what the
mod-pow2 mask rule synthesizes).
BitOr(NodeId, NodeId)
And(NodeId, NodeId)
Logical and/or: truthiness in, Bool out, short-circuit. Rules
consult class facts (is_bool) before rewriting.
Or(NodeId, NodeId)
Not(NodeId)
Eq(NodeId, NodeId)
Ne(NodeId, NodeId)
Lt(NodeId, NodeId)
Le(NodeId, NodeId)
Gt(NodeId, NodeId)
Ge(NodeId, NodeId)
Concat(NodeId, NodeId)
Len(NodeId)
Index(NodeId, NodeId)
Copy(NodeId)
copy of xs — a fresh, unaliased deep copy. Total.
Slice(NodeId, NodeId, NodeId)
xs sliced from a to b (1-based, inclusive). NON-total: raises on
out-of-bounds, so rewrites may never delete one without proofs.
Contains(NodeId, NodeId)
xs contains x — membership. Total; modeled for congruence/CSE
only (no rewrite touches its semantics).
Implementations§
Source§impl CompilerENode
impl CompilerENode
Sourcepub fn map_children(self, f: impl FnMut(NodeId) -> NodeId) -> Self
pub fn map_children(self, f: impl FnMut(NodeId) -> NodeId) -> Self
Rebuild the node with each child mapped (canonicalization).
Sourcepub fn op_is_total(&self) -> bool
pub fn op_is_total(&self) -> bool
Ops whose evaluation can never raise a runtime error, given total
children. Div/Mod (zero divisor), Index/Slice (bounds), and Opaque
(arbitrary effects) are the non-total ones — a rewrite may only
DELETE a subterm whose whole tree is total, or it would erase the
program’s error/effect behavior. Len/Copy/Contains raise KIND
errors over non-collections, so they are non-total HERE and earn
totality through class facts in
super::CompilerEGraph::provably_total.
Trait Implementations§
Source§impl Clone for CompilerENode
impl Clone for CompilerENode
Source§fn clone(&self) -> CompilerENode
fn clone(&self) -> CompilerENode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompilerENode
impl Debug for CompilerENode
Source§impl Hash for CompilerENode
impl Hash for CompilerENode
Source§impl PartialEq for CompilerENode
impl PartialEq for CompilerENode
Source§fn eq(&self, other: &CompilerENode) -> bool
fn eq(&self, other: &CompilerENode) -> bool
self and other values to be equal, and is used by ==.impl Copy for CompilerENode
impl Eq for CompilerENode
impl StructuralPartialEq for CompilerENode
Auto Trait Implementations§
impl Freeze for CompilerENode
impl RefUnwindSafe for CompilerENode
impl Send for CompilerENode
impl Sync for CompilerENode
impl Unpin for CompilerENode
impl UnsafeUnpin for CompilerENode
impl UnwindSafe for CompilerENode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.