Skip to content

Commit 0d86e53

Browse files
committed
[mlir][NFC] Update PDL operations to use hasVerifier instead of verifier
The verifier field is deprecated, and slated for removal. Differential Revision: https://reviews.llvm.org/D118828
1 parent 094ede6 commit 0d86e53

File tree

4 files changed

+136
-86
lines changed

4 files changed

+136
-86
lines changed

mlir/include/mlir/Dialect/PDL/IR/PDLOps.td

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class PDL_Op<string mnemonic, list<Trait> traits = []>
2626
: Op<PDL_Dialect, mnemonic, traits> {
2727
let printer = [{ ::print(p, *this); }];
2828
let parser = [{ return ::parse$cppClass(parser, result); }];
29-
let verifier = [{ return ::verify(*this); }];
3029
}
3130

3231
//===----------------------------------------------------------------------===//
@@ -66,6 +65,7 @@ def PDL_ApplyNativeConstraintOp
6665
params.empty() ? ArrayAttr() : $_builder.getArrayAttr(params));
6766
}]>,
6867
];
68+
let hasVerifier = 1;
6969
}
7070

7171
//===----------------------------------------------------------------------===//
@@ -118,6 +118,7 @@ def PDL_ApplyNativeRewriteOp
118118
$name ($constParams^)? (`(` $args^ `:` type($args) `)`)?
119119
(`:` type($results)^)? attr-dict
120120
}];
121+
let hasVerifier = 1;
121122
}
122123

123124
//===----------------------------------------------------------------------===//
@@ -164,6 +165,7 @@ def PDL_AttributeOp : PDL_Op<"attribute", [NoSideEffect]> {
164165
build($_builder, $_state, $_builder.getType<AttributeType>(), Value(), attr);
165166
}]>,
166167
];
168+
let hasVerifier = 1;
167169
}
168170

169171
//===----------------------------------------------------------------------===//
@@ -185,7 +187,6 @@ def PDL_EraseOp : PDL_Op<"erase", [HasParent<"pdl::RewriteOp">]> {
185187
}];
186188
let arguments = (ins PDL_Operation:$operation);
187189
let assemblyFormat = "$operation attr-dict";
188-
let verifier = ?;
189190
}
190191

191192
//===----------------------------------------------------------------------===//
@@ -224,6 +225,7 @@ def PDL_OperandOp
224225
build($_builder, $_state, $_builder.getType<ValueType>(), Value());
225226
}]>,
226227
];
228+
let hasVerifier = 1;
227229
}
228230

229231
//===----------------------------------------------------------------------===//
@@ -263,6 +265,7 @@ def PDL_OperandsOp
263265
Value());
264266
}]>,
265267
];
268+
let hasVerifier = 1;
266269
}
267270

268271
//===----------------------------------------------------------------------===//
@@ -396,6 +399,7 @@ def PDL_OperationOp : PDL_Op<"operation", [AttrSizedOperandSegments]> {
396399
/// inference.
397400
bool hasTypeInference();
398401
}];
402+
let hasVerifier = 1;
399403
}
400404

401405
//===----------------------------------------------------------------------===//
@@ -452,6 +456,7 @@ def PDL_PatternOp : PDL_Op<"pattern", [
452456
/// Returns the rewrite operation of this pattern.
453457
RewriteOp getRewriter();
454458
}];
459+
let hasVerifier = 1;
455460
}
456461

457462
//===----------------------------------------------------------------------===//
@@ -492,6 +497,7 @@ def PDL_ReplaceOp : PDL_Op<"replace", [
492497
$operation `with` (`(` $replValues^ `:` type($replValues) `)`)?
493498
($replOperation^)? attr-dict
494499
}];
500+
let hasVerifier = 1;
495501
}
496502

497503
//===----------------------------------------------------------------------===//
@@ -524,7 +530,6 @@ def PDL_ResultOp : PDL_Op<"result", [NoSideEffect]> {
524530
let arguments = (ins PDL_Operation:$parent, I32Attr:$index);
525531
let results = (outs PDL_Value:$val);
526532
let assemblyFormat = "$index `of` $parent attr-dict";
527-
let verifier = ?;
528533
}
529534

530535
//===----------------------------------------------------------------------===//
@@ -567,6 +572,7 @@ def PDL_ResultsOp : PDL_Op<"results", [NoSideEffect]> {
567572
($index^)? `of` $parent custom<ResultsValueType>(ref($index), type($val))
568573
attr-dict
569574
}];
575+
let hasVerifier = 1;
570576
}
571577

572578
//===----------------------------------------------------------------------===//
@@ -629,6 +635,7 @@ def PDL_RewriteOp : PDL_Op<"rewrite", [
629635
($body^)?
630636
attr-dict-with-keyword
631637
}];
638+
let hasVerifier = 1;
632639
}
633640

634641
//===----------------------------------------------------------------------===//
@@ -657,6 +664,7 @@ def PDL_TypeOp : PDL_Op<"type", [NoSideEffect]> {
657664
let arguments = (ins OptionalAttr<TypeAttr>:$type);
658665
let results = (outs PDL_Type:$result);
659666
let assemblyFormat = "attr-dict (`:` $type^)?";
667+
let hasVerifier = 1;
660668
}
661669

662670
//===----------------------------------------------------------------------===//
@@ -685,6 +693,7 @@ def PDL_TypesOp : PDL_Op<"types", [NoSideEffect]> {
685693
let arguments = (ins OptionalAttr<TypeArrayAttr>:$types);
686694
let results = (outs PDL_RangeOf<PDL_Type>:$result);
687695
let assemblyFormat = "attr-dict (`:` $types^)?";
696+
let hasVerifier = 1;
688697
}
689698

690699
#endif // MLIR_DIALECT_PDL_IR_PDLOPS

mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,6 @@ class PDLInterp_SwitchOp<string mnemonic, list<Trait> traits = []> :
7575
PDLInterp_Op<mnemonic, !listconcat([Terminator], traits)> {
7676
let successors = (successor AnySuccessor:$defaultDest,
7777
VariadicSuccessor<AnySuccessor>:$cases);
78-
79-
let verifier = [{
80-
// Verify that the number of case destinations matches the number of case
81-
// values.
82-
size_t numDests = cases().size();
83-
size_t numValues = caseValues().size();
84-
if (numDests != numValues) {
85-
return emitOpError("expected number of cases to match the number of case "
86-
"values, got ")
87-
<< numDests << " but expected " << numValues;
88-
}
89-
return success();
90-
}];
9178
}
9279

9380
//===----------------------------------------------------------------------===//
@@ -638,7 +625,7 @@ def PDLInterp_ForEachOp
638625
}];
639626
let parser = [{ return ::parseForEachOp(parser, result); }];
640627
let printer = [{ return ::print(p, *this); }];
641-
let verifier = [{ return ::verify(*this); }];
628+
let hasVerifier = 1;
642629
}
643630

644631
//===----------------------------------------------------------------------===//
@@ -1078,6 +1065,7 @@ def PDLInterp_SwitchAttributeOp
10781065
build($_builder, $_state, attribute, $_builder.getArrayAttr(caseValues),
10791066
defaultDest, dests);
10801067
}]>];
1068+
let hasVerifier = 1;
10811069
}
10821070

10831071
//===----------------------------------------------------------------------===//
@@ -1111,6 +1099,7 @@ def PDLInterp_SwitchOperandCountOp
11111099
build($_builder, $_state, operation, $_builder.getI32VectorAttr(counts),
11121100
defaultDest, dests);
11131101
}]>];
1102+
let hasVerifier = 1;
11141103
}
11151104

11161105
//===----------------------------------------------------------------------===//
@@ -1148,6 +1137,7 @@ def PDLInterp_SwitchOperationNameOp
11481137
defaultDest, dests);
11491138
}]>,
11501139
];
1140+
let hasVerifier = 1;
11511141
}
11521142

11531143
//===----------------------------------------------------------------------===//
@@ -1181,6 +1171,7 @@ def PDLInterp_SwitchResultCountOp
11811171
build($_builder, $_state, operation, $_builder.getI32VectorAttr(counts),
11821172
defaultDest, dests);
11831173
}]>];
1174+
let hasVerifier = 1;
11841175
}
11851176

11861177
//===----------------------------------------------------------------------===//
@@ -1218,6 +1209,7 @@ def PDLInterp_SwitchTypeOp : PDLInterp_SwitchOp<"switch_type", [NoSideEffect]> {
12181209
let extraClassDeclaration = [{
12191210
auto getCaseTypes() { return caseValues().getAsValueRange<TypeAttr>(); }
12201211
}];
1212+
let hasVerifier = 1;
12211213
}
12221214

12231215
//===----------------------------------------------------------------------===//
@@ -1259,6 +1251,7 @@ def PDLInterp_SwitchTypesOp : PDLInterp_SwitchOp<"switch_types",
12591251
let extraClassDeclaration = [{
12601252
auto getCaseTypes() { return caseValues().getAsRange<ArrayAttr>(); }
12611253
}];
1254+
let hasVerifier = 1;
12621255
}
12631256

12641257
#endif // MLIR_DIALECT_PDLINTERP_IR_PDLINTERPOPS

0 commit comments

Comments
 (0)