Trait mz_transform::analysis::Analysis

source ·
pub trait Analysis: 'static {
    type Value: Debug;

    // Required method
    fn derive(
        &self,
        expr: &MirRelationExpr,
        index: usize,
        results: &[Self::Value],
        depends: &Derived,
    ) -> Self::Value;

    // Provided methods
    fn announce_dependencies(_builder: &mut DerivedBuilder<'_>) { ... }
    fn lattice() -> Option<Box<dyn Lattice<Self::Value>>> { ... }
}
Expand description

An analysis that can be applied bottom-up to a MirRelationExpr.

Required Associated Types§

source

type Value: Debug

The type of value this analysis associates with an expression.

Required Methods§

source

fn derive( &self, expr: &MirRelationExpr, index: usize, results: &[Self::Value], depends: &Derived, ) -> Self::Value

The analysis value derived for an expression, given other analysis results.

The other analysis results include the results of this analysis for all children, in results, and the results of other analyses this analysis has expressed a dependence upon, in depends, for children and the expression itself. The analysis results for Self can only be found in results, and are not available in depends.

Implementors of this method must defensively check references into results, as it may be invoked on LetRec bindings that have not yet been populated. It is up to the analysis what to do in that case, but conservative behavior is recommended.

The index indicates the post-order index for the expression, for use in finding the corresponding information in results and depends.

The return result will be associated with this expression for this analysis, and the analyses will continue.

Provided Methods§

source

fn announce_dependencies(_builder: &mut DerivedBuilder<'_>)

Announce any depencies this analysis has on other analyses.

The method should invoke builder.require::<Foo>() for each other analysis Foo this analysis depends upon.

source

fn lattice() -> Option<Box<dyn Lattice<Self::Value>>>

When available, provide a lattice interface to allow optimistic recursion.

Providing a non-None output indicates that the analysis intends re-iteration.

Object Safety§

This trait is not object safe.

Implementors§