1 // RUN: llvm-tblgen %s | FileCheck %s 2 3 //===----------------------------------------------------------------------===// 4 // Substitution of an int. 5 def X1; 6 7 class C1<int N> { 8 dag d = (X1 N); 9 } 10 11 def VAL1 : C1<13>; 12 13 // CHECK: def VAL1 { 14 // CHECK-NEXT: dag d = (X1 13) 15 16 17 //===----------------------------------------------------------------------===// 18 // Substitution of a DAG. 19 def X2; 20 21 class yclass; 22 def Y2 : yclass; 23 24 class C2<yclass N> { 25 dag d = (X2 N); 26 dag e = (N X2); 27 } 28 29 def VAL2 : C2<Y2>; 30 31 // CHECK: def VAL2 { 32 // CHECK-NEXT: dag d = (X2 Y2) 33 // CHECK-NEXT: dag e = (Y2 X2) 34 35 36 //===----------------------------------------------------------------------===// 37 // Complex dag operator (F.TheOp). 38 39 class operator; 40 def somedef1 : operator; 41 def somedef2 : operator; 42 43 class foo<operator a> { 44 operator TheOp = a; 45 } 46 47 class bar<foo F, operator a> { 48 dag Dag1 = (somedef1 1); 49 dag Dag2 = (a 2); 50 dag Dag3 = (F.TheOp 2); 51 } 52 53 def foo1 : foo<somedef1>; 54 def foo2 : foo<somedef2>; 55 56 def VAL3 : bar<foo1, somedef1>; 57 58 // CHECK: def VAL3 { // bar 59 // CHECK-NEXT: dag Dag1 = (somedef1 1); 60 // CHECK-NEXT: dag Dag2 = (somedef1 2); 61 // CHECK-NEXT: dag Dag3 = (somedef1 2); 62 // CHECK-NEXT: NAME = ? 63 // CHECK-NEXT: } 64 65 66 def VAL4 : bar<foo2, somedef2>; 67 // CHECK: def VAL4 { 68 // CHECK-NEXT: dag Dag1 = (somedef1 1); 69 // CHECK-NEXT: dag Dag2 = (somedef2 2); 70 // CHECK-NEXT: dag Dag3 = (somedef2 2); 71 // CHECK-NEXT: NAME = ? 72 // CHECK-NEXT: } 73 74 def VAL5 : bar<foo2, somedef2> { 75 // Named operands. 76 let Dag1 = (somedef1 1:$name1); 77 78 // Name, no node. 79 let Dag2 = (somedef2 $name2, $name3); 80 } 81 82 // CHECK: def VAL5 { 83 // CHECK-NEXT: dag Dag1 = (somedef1 1:$name1); 84 // CHECK-NEXT: dag Dag2 = (somedef2 ?:$name2, ?:$name3); 85