2 // Parse types and check that we can reparse what we print.
3 // RUN: fir-opt --split-input-file %s | fir-opt --split-input-file | FileCheck %s
5 // Fortran Intrinsic types
6 // CHECK-LABEL: func private @it1() -> !fir.int<4>
7 // CHECK-LABEL: func private @it3() -> complex<f64>
8 // CHECK-LABEL: func private @it4() -> !fir.logical<1>
9 // CHECK-LABEL: func private @it5() -> !fir.char<1>
10 // CHECK-LABEL: func private @it6() -> !fir.char<2,10>
11 // CHECK-LABEL: func private @it7() -> !fir.char<4,?>
12 func.func private @it1() -> !fir.int<4>
13 func.func private @it3() -> complex<f64>
14 func.func private @it4() -> !fir.logical<1>
15 func.func private @it5() -> !fir.char<1>
16 func.func private @it6() -> !fir.char<2,10>
17 func.func private @it7() -> !fir.char<4,?>
21 // Fortran Derived types (records)
22 // CHECK-LABEL: func private @dvd1() -> !fir.type<derived1>
23 // CHECK-LABEL: func private @dvd2() -> !fir.type<derived2(p:i32)>
24 // CHECK-LABEL: func private @dvd3() -> !fir.type<derived3{f:f32}>
25 // CHECK-LABEL: func private @dvd4() -> !fir.type<derived4(p:i8){f:f32}>
26 // CHECK-LABEL: func private @dvd5() -> !fir.type<derived5(p1:i8,p2:i8,p3:i8,p4:i8,p5:i8){f1:f32,f2:f32,f3:f32,f4:f32,f5:f32,f6:f32,f7:f32,f8:f32}>
27 // CHECK-LABEL: func private @dvd6() -> !fir.type<derived6{f:!fir.ptr<!fir.type<derived6>>}>
28 // CHECK-LABEL: func private @dvd7() -> !fir.type<derived_with_field_name_same_as_integer_type{i32:f32}>
29 func.func private @dvd1() -> !fir.type<derived1>
30 func.func private @dvd2() -> !fir.type<derived2(p:i32)>
31 func.func private @dvd3() -> !fir.type<derived3{f:f32}>
32 func.func private @dvd4() -> !fir.type<derived4(p:i8){f:f32}>
33 func.func private @dvd5() -> !fir.type<derived5(p1:i8,p2:i8,p3:i8,p4:i8,p5:i8){f1:f32,f2:f32,f3:f32,f4:f32,f5:f32,f6:f32,f7:f32,f8:f32}>
34 func.func private @dvd6() -> !fir.type<derived6{f:!fir.ptr<!fir.type<derived6>>}>
35 func.func private @dvd7() -> !fir.type<derived_with_field_name_same_as_integer_type{i32:f32}>
40 // CHECK-LABEL: func private @arr1() -> !fir.array<10xf32>
41 // CHECK-LABEL: func private @arr2() -> !fir.array<10x10xf32>
42 // CHECK-LABEL: func private @arr3() -> !fir.array<?xf32>
43 // CHECK-LABEL: func private @arr4() -> !fir.array<10x?xf32>
44 // CHECK-LABEL: func private @arr5() -> !fir.array<?x?xf32>
45 // CHECK-LABEL: func private @arr6() -> !fir.array<*:f32>
46 // CHECK-LABEL: func private @arr7() -> !fir.array<1x2x?x4x5x6x7x8x9xf32>
47 func.func private @arr1() -> !fir.array<10xf32>
48 func.func private @arr2() -> !fir.array<10x10xf32>
49 func.func private @arr3() -> !fir.array<?xf32>
50 func.func private @arr4() -> !fir.array<10x?xf32>
51 func.func private @arr5() -> !fir.array<?x?xf32>
52 func.func private @arr6() -> !fir.array<*:f32>
53 func.func private @arr7() -> !fir.array<1x2x?x4x5x6x7x8x9xf32>
57 // FIR pointer-like types
58 // CHECK-LABEL: func private @mem1() -> !fir.ref<i32>
59 // CHECK-LABEL: func private @mem2() -> !fir.ptr<i32>
60 // CHECK-LABEL: func private @mem3() -> !fir.heap<i32>
61 // CHECK-LABEL: func private @mem4() -> !fir.ref<() -> ()>
62 // CHECK-LABEL: func private @mem5() -> !fir.llvm_ptr<!fir.ref<f32>>
63 // CHECK-LABEL: func private @mem6() -> !fir.llvm_ptr<i8>
64 func.func private @mem1() -> !fir.ref<i32>
65 func.func private @mem2() -> !fir.ptr<i32>
66 func.func private @mem3() -> !fir.heap<i32>
67 func.func private @mem4() -> !fir.ref<() -> ()>
68 func.func private @mem5() -> !fir.llvm_ptr<!fir.ref<f32>>
69 func.func private @mem6() -> !fir.llvm_ptr<i8>
73 // FIR box types (descriptors)
74 // CHECK-LABEL: func private @box1() -> !fir.box<!fir.array<?xf32>>
75 // CHECK-LABEL: func private @box2() -> !fir.boxchar<2>
76 // CHECK-LABEL: func private @box3() -> !fir.boxproc<(i32, i32) -> i64>
77 // CHECK-LABEL: func private @box4() -> !fir.box<none>
78 // CHECK-LABEL: func private @box5() -> !fir.box<!fir.type<derived3{f:f32}>>
79 func.func private @box1() -> !fir.box<!fir.array<?xf32>>
80 func.func private @box2() -> !fir.boxchar<2>
81 func.func private @box3() -> !fir.boxproc<(i32, i32) -> i64>
82 func.func private @box4() -> !fir.box<none>
83 func.func private @box5() -> !fir.box<!fir.type<derived3{f:f32}>>
88 // CHECK-LABEL: func private @oth1() -> !fir.shape<1>
89 // CHECK-LABEL: func private @oth2() -> !fir.field
90 // CHECK-LABEL: func private @oth3() -> !fir.tdesc<!fir.type<derived7{f1:f32,f2:f32}>>
91 // CHECK-LABEL: func private @oth4() -> !fir.shapeshift<15>
92 // CHECK-LABEL: func private @oth5() -> !fir.slice<8>
93 func.func private @oth1() -> !fir.shape<1>
94 func.func private @oth2() -> !fir.field
95 func.func private @oth3() -> !fir.tdesc<!fir.type<derived7{f1:f32,f2:f32}>>
96 func.func private @oth4() -> !fir.shapeshift<15>
97 func.func private @oth5() -> !fir.slice<8>
102 // CHECK-LABEL: func private @vecty(i1) -> !fir.vector<10:i32>
103 func.func private @vecty(i1) -> !fir.vector<10:i32>
108 // CHECK-LABEL: class1() -> !fir.class<!fir.type<c1{p:i32}>>
109 // CHECK-LABEL: class2() -> !fir.class<!fir.array<?x!fir.type<c1{p:i32}>>>
110 // CHECK-LABEL: class3() -> !fir.class<!fir.heap<!fir.type<c1{p:i32}>>>
111 // CHECK-LABEL: class4() -> !fir.class<!fir.ptr<!fir.type<c1{p:i32}>>>
112 // CHECK-LABEL: class5() -> !fir.class<none>
113 // CHECK-LABEL: class6() -> !fir.class<!fir.array<?xnone>>
114 // CHECK-LABEL: class7() -> !fir.class<!fir.heap<none>>
115 // CHECK-LABEL: class8() -> !fir.class<!fir.ptr<none>>
116 func.func private @class1() -> !fir.class<!fir.type<c1{p:i32}>>
117 func.func private @class2() -> !fir.class<!fir.array<?x!fir.type<c1{p:i32}>>>
118 func.func private @class3() -> !fir.class<!fir.heap<!fir.type<c1{p:i32}>>>
119 func.func private @class4() -> !fir.class<!fir.ptr<!fir.type<c1{p:i32}>>>
120 func.func private @class5() -> !fir.class<none>
121 func.func private @class6() -> !fir.class<!fir.array<?xnone>>
122 func.func private @class7() -> !fir.class<!fir.heap<none>>
123 func.func private @class8() -> !fir.class<!fir.ptr<none>>