Skip to main content

Module pattern

Module pattern 

Source
Expand description

Pattern matching infrastructure for UOp graphs.

This module provides pattern matching using SimplifiedPatternMatcher, which uses closures that do inline Rust pattern matching. The patterns! macro generates closures with native match expressions for O(1) OpKey dispatch.

Modules§

helpers
Helper functions for pattern matching.
simplified
High-performance pattern matcher with OpKey-based O(1) dispatch.

Structs§

SimplifiedPatternMatcher
High-performance pattern matcher with O(1) OpKey-based dispatch.

Enums§

RewriteResult
Result of applying a pattern rewrite.

Traits§

Matcher
Trait for pattern matchers used by the rewrite engine.

Functions§

const_matches
Check if a UOp matches a constant predicate.
is_any_const
Check if a UOp is a pure constant tree (no buffer references).
is_neg_one
Check if a UOp is a negative one constant.
is_nonzero
Check if a UOp is a non-zero constant.
is_one
Check if a UOp is a one constant.
is_zero
Check if a UOp is a zero constant.
try_const
Extract const value if present.

Type Aliases§

PatternClosure
Closure type for pattern matching + rewriting.
TypedPatternMatcher
Type alias for backwards compatibility.