Files
clang-p2996/mlir/test/mlir-pdll/Parser/pattern.pdll
River Riddle 3d8b906012 [PDLL] Add support for single line lambda-like patterns
This allows for defining simple patterns in a single line. The lambda
body of a Pattern expects a single operation rewrite statement:

```
Pattern => replace op<my_dialect.foo>(operands: ValueRange) with operands;
```

Differential Revision: https://reviews.llvm.org/D115835
2022-02-10 12:48:58 -08:00

34 lines
636 B
Plaintext

// RUN: mlir-pdll %s -I %S -split-input-file | FileCheck %s
// CHECK: Module
// CHECK: `-PatternDecl
// CHECK: `-CompoundStmt
// CHECK: `-EraseStmt
Pattern {
erase _: Op;
}
// -----
// CHECK: Module
// CHECK: `-PatternDecl {{.*}} Name<NamedPattern>
Pattern NamedPattern {
erase _: Op;
}
// -----
// CHECK: Module
// CHECK: `-PatternDecl {{.*}} Name<NamedPattern> Benefit<10> Recursion
Pattern NamedPattern with benefit(10), recursion {
erase _: Op;
}
// -----
// CHECK: Module
// CHECK: `-PatternDecl {{.*}} Name<NamedPattern>
// CHECK: `-CompoundStmt
// CHECK: `-EraseStmt
Pattern NamedPattern => erase _: Op;