File tree Expand file tree Collapse file tree 3 files changed +29
-7
lines changed Expand file tree Collapse file tree 3 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -40,9 +40,13 @@ class FrozenRewritePatternSet {
40
40
41
41
// / Freeze the patterns held in `patterns`, and take ownership.
42
42
// / `disabledPatternLabels` is a set of labels used to filter out input
43
- // / patterns with a label in this set. `enabledPatternLabels` is a set of
44
- // / labels used to filter out input patterns that do not have one of the
45
- // / labels in this set.
43
+ // / patterns with a debug label or debug name in this set.
44
+ // / `enabledPatternLabels` is a set of labels used to filter out input
45
+ // / patterns that do not have one of the labels in this set. Debug labels must
46
+ // / be set explicitly on patterns or when adding them with
47
+ // / `RewritePatternSet::addWithLabel`. Debug names may be empty, but patterns
48
+ // / created with `RewritePattern::create` have their default debug name set to
49
+ // / their type name.
46
50
FrozenRewritePatternSet (
47
51
RewritePatternSet &&patterns,
48
52
ArrayRef<std::string> disabledPatternLabels = llvm::None,
Original file line number Diff line number Diff line change @@ -62,8 +62,17 @@ std::unique_ptr<Pass> createBufferResultsToOutParamsPass();
62
62
std::unique_ptr<Pass> createCanonicalizerPass ();
63
63
64
64
// / Creates an instance of the Canonicalizer pass with the specified config.
65
+ // / `disabledPatterns` is a set of labels used to filter out input patterns with
66
+ // / a debug label or debug name in this set. `enabledPatterns` is a set of
67
+ // / labels used to filter out input patterns that do not have one of the labels
68
+ // / in this set. Debug labels must be set explicitly on patterns or when adding
69
+ // / them with `RewritePatternSet::addWithLabel`. Debug names may be empty, but
70
+ // / patterns created with `RewritePattern::create` have their default debug name
71
+ // / set to their type name.
65
72
std::unique_ptr<Pass>
66
- createCanonicalizerPass (const GreedyRewriteConfig &config);
73
+ createCanonicalizerPass (const GreedyRewriteConfig &config,
74
+ ArrayRef<std::string> disabledPatterns = llvm::None,
75
+ ArrayRef<std::string> enabledPatterns = llvm::None);
67
76
68
77
// / Creates a pass to perform common sub expression elimination.
69
78
std::unique_ptr<Pass> createCSEPass ();
Original file line number Diff line number Diff line change @@ -21,7 +21,13 @@ using namespace mlir;
21
21
namespace {
22
22
// / Canonicalize operations in nested regions.
23
23
struct Canonicalizer : public CanonicalizerBase <Canonicalizer> {
24
- Canonicalizer (const GreedyRewriteConfig &config) : config(config) {}
24
+ Canonicalizer (const GreedyRewriteConfig &config,
25
+ ArrayRef<std::string> disabledPatterns,
26
+ ArrayRef<std::string> enabledPatterns)
27
+ : config(config) {
28
+ this ->disabledPatterns = disabledPatterns;
29
+ this ->enabledPatterns = enabledPatterns;
30
+ }
25
31
26
32
Canonicalizer () {
27
33
// Default constructed Canonicalizer takes its settings from command line
@@ -61,6 +67,9 @@ std::unique_ptr<Pass> mlir::createCanonicalizerPass() {
61
67
62
68
// / Creates an instance of the Canonicalizer pass with the specified config.
63
69
std::unique_ptr<Pass>
64
- mlir::createCanonicalizerPass (const GreedyRewriteConfig &config) {
65
- return std::make_unique<Canonicalizer>(config);
70
+ createCanonicalizerPass (const GreedyRewriteConfig &config,
71
+ ArrayRef<std::string> disabledPatterns = llvm::None,
72
+ ArrayRef<std::string> enabledPatterns = llvm::None) {
73
+ return std::make_unique<Canonicalizer>(config, disabledPatterns,
74
+ enabledPatterns);
66
75
}
You can’t perform that action at this time.
0 commit comments