Skip to content

Commit 2e896be

Browse files
allightcopybara-github
authored andcommitted
Add Specialize function to proc-state range query engine.
This is used by some potential users and can be implemented better than the default do-nothing implementation. Also fix a small typo. PiperOrigin-RevId: 689129685
1 parent e5d71a6 commit 2e896be

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

xls/passes/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3420,6 +3420,7 @@ cc_library(
34203420
":back_propagate_range_analysis",
34213421
":dataflow_visitor",
34223422
":node_dependency_analysis",
3423+
":predicate_state",
34233424
":query_engine",
34243425
":range_query_engine",
34253426
":ternary_query_engine",

xls/passes/proc_state_range_query_engine.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <optional>
2020
#include <utility>
2121

22+
#include "absl/container/flat_hash_set.h"
2223
#include "absl/log/check.h"
2324
#include "absl/status/statusor.h"
2425
#include "absl/types/span.h"
@@ -30,6 +31,7 @@
3031
#include "xls/ir/node.h"
3132
#include "xls/ir/proc.h"
3233
#include "xls/ir/ternary.h"
34+
#include "xls/passes/predicate_state.h"
3335
#include "xls/passes/query_engine.h"
3436
#include "xls/passes/range_query_engine.h"
3537
#include "xls/passes/ternary_query_engine.h"
@@ -81,7 +83,7 @@ class ProcStateRangeQueryEngine final : public QueryEngine {
8183
}
8284

8385
bool AtLeastOneTrue(absl::Span<TreeBitLocation const> bits) const override {
84-
return AtLeastOneTrue(bits);
86+
return inner_.AtLeastOneTrue(bits);
8587
}
8688

8789
bool KnownEquals(const TreeBitLocation& a,
@@ -136,6 +138,11 @@ class ProcStateRangeQueryEngine final : public QueryEngine {
136138
return inner_.GetTernary(node);
137139
}
138140

141+
std::unique_ptr<QueryEngine> SpecializeGivenPredicate(
142+
const absl::flat_hash_set<PredicateState>& state) const override {
143+
return inner_.SpecializeGivenPredicate(state);
144+
}
145+
139146
private:
140147
// Actual range results from the proc-state aware analysis.
141148
std::unique_ptr<TernaryQueryEngine> ternary_;

0 commit comments

Comments
 (0)