1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
// RUN: mlir-pdll %s -I %S -split-input-file | FileCheck %s
// CHECK: Module
// CHECK: `-UserRewriteDecl {{.*}} Name<Foo> ResultType<Tuple<>>
Rewrite Foo();
// -----
// CHECK: Module
// CHECK: `-UserRewriteDecl {{.*}} Name<Foo> ResultType<Tuple<>> Code< /* Native Code */ >
Rewrite Foo() [{ /* Native Code */ }];
// -----
// CHECK: Module
// CHECK: `-UserRewriteDecl {{.*}} Name<Foo> ResultType<Value>
// CHECK: `Inputs`
// CHECK: `-VariableDecl {{.*}} Name<arg> Type<Op>
// CHECK: `Results`
// CHECK: `-VariableDecl {{.*}} Name<> Type<Value>
// CHECK: `-CompoundStmt {{.*}}
// CHECK: `-ReturnStmt {{.*}}
// CHECK: `-MemberAccessExpr {{.*}} Member<$results> Type<Value>
// CHECK: `-DeclRefExpr {{.*}} Type<Op>
// CHECK: `-VariableDecl {{.*}} Name<arg> Type<Op>
Rewrite Foo(arg: Op) -> Value => arg;
// -----
// CHECK: Module
// CHECK: `-UserRewriteDecl {{.*}} Name<Foo> ResultType<Tuple<result1: Value, result2: Attr>>
// CHECK: `Results`
// CHECK: |-VariableDecl {{.*}} Name<result1> Type<Value>
// CHECK: | `Constraints`
// CHECK: | `-ValueConstraintDecl {{.*}}
// CHECK: `-VariableDecl {{.*}} Name<result2> Type<Attr>
// CHECK: `Constraints`
// CHECK: `-AttrConstraintDecl {{.*}}
// CHECK: `-CompoundStmt {{.*}}
// CHECK: `-ReturnStmt {{.*}}
// CHECK: `-TupleExpr {{.*}} Type<Tuple<result1: Value, result2: Attr>>
// CHECK: |-MemberAccessExpr {{.*}} Member<0> Type<Value>
// CHECK: | `-TupleExpr {{.*}} Type<Tuple<Value, Attr>>
// CHECK: `-MemberAccessExpr {{.*}} Member<1> Type<Attr>
// CHECK: `-TupleExpr {{.*}} Type<Tuple<Value, Attr>>
Rewrite Foo() -> (result1: Value, result2: Attr) => (_: Value, attr<"10">);
// -----
// Test that anonymous Rewrites are uniquely named.
// CHECK: Module
// CHECK: UserRewriteDecl {{.*}} Name<<anonymous_rewrite_0>> ResultType<Tuple<>>
// CHECK: UserRewriteDecl {{.*}} Name<<anonymous_rewrite_1>> ResultType<Attr>
Rewrite Outer() {
Rewrite() {};
Rewrite() => attr<"10">;
}
|