Class RewriteSimplifier#
Defined in File analyzer.h
Class Documentation#
-
class RewriteSimplifier#
Rewrite-rule based simplifier.
Public Functions
-
PrimExpr operator()(const PrimExpr &expr)#
Simplify an expression under the current premises.
- Parameters:
expr – The expression to simplify.
- Returns:
An equivalent expression under those premises.
-
CompareResult TryCompare(const PrimExpr &lhs, const PrimExpr &rhs)#
Compare signed integer expressions using active premises and constant offsets.
- Parameters:
lhs – The left-hand side of the comparison.
rhs – The right-hand side of the comparison.
- Returns:
The directly known ordering, or kUnknown when it cannot be established.
-
ffi::ObjectRef GetStatsCounters() const#
Read cumulative rewrite statistics.
- Returns:
A snapshot of the current counters.
-
void ResetStatsCounters()#
Clear cumulative rewrite counters without changing facts or the rewrite limit.
-
void SetMaximumRewriteSteps(int64_t maximum)#
Set the maximum allowed cumulative number of successful rewrites.
By default, the simplifier may perform as many steps as are required. If a positive limit is set, then the simplifier will throw an exception when exceeding that number of rewrite steps. This allows tests to guard against performance regressions.
Note: To maintain accurate usage counters,
Analyzerinstances should be re-used wherever possible. For example, TIR transformations should declare a singleAnalyzerthat is used throughout the pass. Internal helpers may borrow itsAnalyzerObj*.The limit applies to the cumulative counter, not separately to each query. ResetStatsCounters starts a new accounting interval.
- Parameters:
maximum – Positive rewrite limit, or a nonpositive value for no limit.
-
PrimExpr operator()(const PrimExpr &expr)#