1 // RUN: mlir-pdll %s -I %S -split-input-file | FileCheck %s
4 // CHECK: `-UserRewriteDecl {{.*}} Name<Foo> ResultType<Tuple<>>
10 // CHECK: `-UserRewriteDecl {{.*}} Name<Foo> ResultType<Tuple<>> Code< /* Native Code */ >
11 Rewrite Foo() [{ /* Native Code */ }];
16 // CHECK: `-UserRewriteDecl {{.*}} Name<Foo> ResultType<Value>
18 // CHECK: `-VariableDecl {{.*}} Name<arg> Type<Op>
20 // CHECK: `-VariableDecl {{.*}} Name<> Type<Value>
21 // CHECK: `-CompoundStmt {{.*}}
22 // CHECK: `-ReturnStmt {{.*}}
23 // CHECK: `-MemberAccessExpr {{.*}} Member<$results> Type<Value>
24 // CHECK: `-DeclRefExpr {{.*}} Type<Op>
25 // CHECK: `-VariableDecl {{.*}} Name<arg> Type<Op>
26 Rewrite Foo(arg: Op) -> Value => arg;
31 // CHECK: `-UserRewriteDecl {{.*}} Name<Foo> ResultType<Tuple<result1: Value, result2: Attr>>
33 // CHECK: |-VariableDecl {{.*}} Name<result1> Type<Value>
34 // CHECK: | `Constraints`
35 // CHECK: | `-ValueConstraintDecl {{.*}}
36 // CHECK: `-VariableDecl {{.*}} Name<result2> Type<Attr>
37 // CHECK: `Constraints`
38 // CHECK: `-AttrConstraintDecl {{.*}}
39 // CHECK: `-CompoundStmt {{.*}}
40 // CHECK: `-ReturnStmt {{.*}}
41 // CHECK: `-TupleExpr {{.*}} Type<Tuple<result1: Value, result2: Attr>>
42 // CHECK: |-MemberAccessExpr {{.*}} Member<0> Type<Value>
43 // CHECK: | `-TupleExpr {{.*}} Type<Tuple<Value, Attr>>
44 // CHECK: `-MemberAccessExpr {{.*}} Member<1> Type<Attr>
45 // CHECK: `-TupleExpr {{.*}} Type<Tuple<Value, Attr>>
46 Rewrite Foo() -> (result1: Value, result2: Attr) => (_: Value, attr<"10">);
50 // Test that anonymous Rewrites are uniquely named.
53 // CHECK: UserRewriteDecl {{.*}} Name<<anonymous_rewrite_0>> ResultType<Tuple<>>
54 // CHECK: UserRewriteDecl {{.*}} Name<<anonymous_rewrite_1>> ResultType<Attr>
57 Rewrite() => attr<"10">;