Struct transform::cse::relation_cse::Bindings[][src]

pub struct Bindings {
    bindings: HashMap<MirRelationExpr, u64>,
    rebindings: HashMap<LocalId, LocalId>,
    recursion_guard: RecursionGuard,
}
Expand description

Maintains Let bindings in a compact, explicit representation.

The bindings map contains neither Let bindings nor two structurally equivalent expressions.

The bindings can be interpreted as an ordered sequence of let bindings, ordered by their identifier, that should be applied in order before the use of the expression from which they have been extracted.

Fields

bindings: HashMap<MirRelationExpr, u64>

A list of let-bound expressions and their order / identifier.

rebindings: HashMap<LocalId, LocalId>

Mapping from conventional local Get identifiers to new ones.

recursion_guard: RecursionGuard

Implementations

Replace relation with an equivalent Get expression referencing a location in bindings.

The algorithm performs a post-order traversal of the expression tree, binding each distinct expression to a new local identifier. It maintains the invariant that bindings contains no Let expressions, nor any two structurally equivalent expressions.

Once each sub-expression is replaced by a canonical Get expression, each expression is also in a canonical representation, which is used to check for prior instances and drives re-use.

Populates expression with necessary Let bindings.

This population may result in substantially more Let bindings that one might expect. It is very appropriate to run the InlineLet transformation afterwards to remove Let bindings that it deems unhelpful.

Trait Implementations

Extracts a reference to the recursion guard embedded within the type.

Checks whether it is safe to recur and calls f if so. Read more

Like CheckedRecursion::checked_recur, but operates on a mutable reference to Self. Read more

Formats the value using the given formatter. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more