Skip to main content

CompilerEGraph

Struct CompilerEGraph 

Source
pub struct CompilerEGraph { /* private fields */ }

Implementations§

Source§

impl CompilerEGraph

Source

pub fn new() -> Self

Source

pub fn node_count(&self) -> usize

Source

pub fn find(&mut self, id: NodeId) -> NodeId

Source

pub fn canonical_node(&mut self, id: NodeId) -> CompilerENode

The stored node with children mapped to their CURRENT class roots.

Source

pub fn class_members(&mut self, id: NodeId) -> Vec<NodeId>

Member node ids of id’s class, in insertion order (deterministic).

Source

pub fn add(&mut self, node: CompilerENode) -> NodeId

Hash-consing insert: an existing congruent node is returned instead of allocating. Literal leaves seed their own class facts.

Source

pub fn union(&mut self, a: NodeId, b: NodeId) -> bool

Merge two classes. Facts intersect (both described the same value). Returns true if a merge actually happened.

Source

pub fn rebuild(&mut self)

Restore the congruence invariant: parents of merged classes are re-canonicalized; newly congruent pairs are unioned (worklist).

Source

pub fn set_scalar(&mut self, id: NodeId, kind: ScalarKind)

Source

pub fn set_int_range(&mut self, id: NodeId, lo: i64, hi: i64)

Source

pub fn scalar_of(&mut self, id: NodeId) -> Option<ScalarKind>

Source

pub fn int_range(&mut self, id: NodeId) -> Option<(i64, i64)>

Source

pub fn int_value(&mut self, id: NodeId) -> Option<i64>

A PROVEN single value (point interval) — sound grounds for folding.

Source

pub fn proven_nonneg(&mut self, id: NodeId) -> bool

Source

pub fn set_collection(&mut self, id: NodeId)

Mark the class a proven collection (list/text/map/set).

Source

pub fn set_list(&mut self, id: NodeId)

Mark the class a proven LIST (implies collection).

Source

pub fn proven_collection(&mut self, id: NodeId) -> bool

Source

pub fn proven_list(&mut self, id: NodeId) -> bool

Source

pub fn class_has_bool(&mut self, id: NodeId, b: bool) -> bool

Does the class contain the literal Bool(b)?

Source

pub fn provably_total(&mut self, id: NodeId) -> bool

Whole-tree totality: the class has at least one member whose op is total and whose children are recursively total. A rewrite may only DELETE (stop evaluating) a provably total subterm — anything else could erase a runtime error or an effect. Bottom-up fixpoint, cycle-tolerant (cycles stay “not yet proven” until a leaf grounds them).

Totality is FACT-CONDITIONAL where the op’s only failure mode is a kind error: Len/Copy/Contains never raise over a PROVEN collection, and raise a type error over anything unproven — so without the fact they stay non-total, exactly like fold.rs’s fail-closed expr_is_total.

Source

pub fn saturate(&mut self, rules: &[Rewrite])

Budgeted equality saturation: deterministic node order × rule order, unions applied immediately, congruence repaired per iteration. Stops at fixpoint, iteration cap, or the node-bank cap.

Trait Implementations§

Source§

impl Default for CompilerEGraph

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> 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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> Same for T

Source§

type Output = T

Should always be Self
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.
§

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

§

fn vzip(self) -> V

§

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

§

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

§

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