[PDL] Remove RewriteEndOp and mark RewriteOp as NoTerminator

RewriteEndOp was a fake terminator operation that is no longer needed now that blocks are not required to have terminators.

Differential Revision: https://reviews.llvm.org/D106911
This commit is contained in:
River Riddle 2021-07-27 20:27:24 +00:00
parent 8baa87d918
commit ddd8482117
2 changed files with 5 additions and 18 deletions

View File

@ -576,17 +576,17 @@ def PDL_ResultsOp : PDL_Op<"results"> {
//===----------------------------------------------------------------------===//
def PDL_RewriteOp : PDL_Op<"rewrite", [
Terminator, HasParent<"pdl::PatternOp">,
SingleBlockImplicitTerminator<"pdl::RewriteEndOp">
Terminator, HasParent<"pdl::PatternOp">, NoTerminator, NoRegionArguments,
SingleBlock
]> {
let summary = "Specify the rewrite of a matched pattern";
let description = [{
`pdl.rewrite` operations terminate the region of a `pdl.pattern` and specify
the main rewrite of a `pdl.pattern`, on the specified root operation. The
rewrite is specified either via a string name (`name`) to an external
rewrite is specified either via a string name (`name`) to a native
rewrite function, or via the region body. The rewrite region, if specified,
must contain a single block and terminate via the `pdl.rewrite_end`
operation. If the rewrite is external, it also takes a set of constant
must contain a single block. If the rewrite is external it functions
similarly to `pdl.apply_native_rewrite`, and takes a set of constant
parameters and a set of additional positional values defined within the
matcher as arguments. If the rewrite is external, the root operation is
passed to the native function as the first argument.
@ -618,16 +618,6 @@ def PDL_RewriteOp : PDL_Op<"rewrite", [
}];
}
def PDL_RewriteEndOp : PDL_Op<"rewrite_end", [Terminator,
HasParent<"pdl::RewriteOp">]> {
let summary = "Implicit terminator of a `pdl.rewrite` region";
let description = [{
`pdl.rewrite_end` operations terminate the region of a `pdl.rewrite`.
}];
let assemblyFormat = "attr-dict";
let verifier = ?;
}
//===----------------------------------------------------------------------===//
// pdl::TypeOp
//===----------------------------------------------------------------------===//

View File

@ -223,7 +223,6 @@ pdl.pattern : benefit(1) {
// expected-error@below {{expected no external arguments when the rewrite is specified inline}}
"pdl.rewrite"(%op, %op) ({
^bb1:
pdl.rewrite_end
}) : (!pdl.operation, !pdl.operation) -> ()
}
@ -235,7 +234,6 @@ pdl.pattern : benefit(1) {
// expected-error@below {{expected no external constant parameters when the rewrite is specified inline}}
"pdl.rewrite"(%op) ({
^bb1:
pdl.rewrite_end
}) {externalConstParams = []} : (!pdl.operation) -> ()
}
@ -247,7 +245,6 @@ pdl.pattern : benefit(1) {
// expected-error@below {{expected rewrite region to be empty when rewrite is external}}
"pdl.rewrite"(%op) ({
^bb1:
pdl.rewrite_end
}) {name = "foo"} : (!pdl.operation) -> ()
}