@@ -20,10 +20,10 @@ subroutine declare_mapper_1
20
20
end type
21
21
type (my_type2) :: t
22
22
real :: x, y(nvals)
23
- ! CHECK-LABEL :omp.declare_mapper @_QQFdeclare_mapper_1my_type.default : !fir.type<_QFdeclare_mapper_1Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}> {
24
- ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref<!fir.type<_QFdeclare_mapper_1Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}> >):
25
- ! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFdeclare_mapper_1Evar"} : (!fir.ref<!fir.type<_QFdeclare_mapper_1Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>> ) -> (!fir.ref<!fir.type<_QFdeclare_mapper_1Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>> , !fir.ref<!fir.type<_QFdeclare_mapper_1Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}> >)
26
- ! CHECK: %[[VAL_2:.*]] = hlfir.designate %[[VAL_1]]#0{"values"} {fortran_attrs = #fir.var_attrs<allocatable>} : (!fir.ref<!fir.type<_QFdeclare_mapper_1Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}> >) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>
23
+ ! CHECK:omp.declare_mapper @[[MY_TYPE_MAPPER: _QQFdeclare_mapper_1my_type\ .default]] : [[MY_TYPE: !fir\ .type<_QFdeclare_mapper_1Tmy_type\ {num_vals:i32,values:!fir\ .box<!fir\ .heap<!fir\ .array<\ ?xi32>>>\}>]] {
24
+ ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref<[[MY_TYPE]] >):
25
+ ! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFdeclare_mapper_1Evar"} : (!fir.ref<[[MY_TYPE]]> ) -> (!fir.ref<[[MY_TYPE]]> , !fir.ref<[[MY_TYPE]] >)
26
+ ! CHECK: %[[VAL_2:.*]] = hlfir.designate %[[VAL_1]]#0{"values"} {fortran_attrs = #fir.var_attrs<allocatable>} : (!fir.ref<[[MY_TYPE]] >) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>
27
27
! CHECK: %[[VAL_3:.*]] = fir.load %[[VAL_2]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>
28
28
! CHECK: %[[VAL_4:.*]] = fir.box_addr %[[VAL_3]] : (!fir.box<!fir.heap<!fir.array<?xi32>>>) -> !fir.heap<!fir.array<?xi32>>
29
29
! CHECK: %[[VAL_5:.*]] = arith.constant 0 : index
@@ -32,19 +32,19 @@ subroutine declare_mapper_1
32
32
! CHECK: %[[VAL_8:.*]] = arith.constant 1 : index
33
33
! CHECK: %[[VAL_9:.*]] = arith.constant 1 : index
34
34
! CHECK: %[[VAL_10:.*]] = arith.subi %[[VAL_9]], %[[VAL_6]]#0 : index
35
- ! CHECK: %[[VAL_11:.*]] = hlfir.designate %[[VAL_1]]#0{"num_vals"} : (!fir.ref<!fir.type<_QFdeclare_mapper_1Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}> >) -> !fir.ref<i32>
35
+ ! CHECK: %[[VAL_11:.*]] = hlfir.designate %[[VAL_1]]#0{"num_vals"} : (!fir.ref<[[MY_TYPE]] >) -> !fir.ref<i32>
36
36
! CHECK: %[[VAL_12:.*]] = fir.load %[[VAL_11]] : !fir.ref<i32>
37
37
! CHECK: %[[VAL_13:.*]] = fir.convert %[[VAL_12]] : (i32) -> i64
38
38
! CHECK: %[[VAL_14:.*]] = fir.convert %[[VAL_13]] : (i64) -> index
39
39
! CHECK: %[[VAL_15:.*]] = arith.subi %[[VAL_14]], %[[VAL_6]]#0 : index
40
40
! CHECK: %[[VAL_16:.*]] = omp.map.bounds lower_bound(%[[VAL_10]] : index) upper_bound(%[[VAL_15]] : index) extent(%[[VAL_6]]#1 : index) stride(%[[VAL_8]] : index) start_idx(%[[VAL_6]]#0 : index)
41
41
! CHECK: %[[VAL_17:.*]] = arith.constant 1 : index
42
- ! CHECK: %[[VAL_18:.*]] = fir.coordinate_of %[[VAL_1]]#0, %[[VAL_17]] : (!fir.ref<!fir.type<_QFdeclare_mapper_1Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}> >, index) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>
42
+ ! CHECK: %[[VAL_18:.*]] = fir.coordinate_of %[[VAL_1]]#0, %[[VAL_17]] : (!fir.ref<[[MY_TYPE]] >, index) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>
43
43
! CHECK: %[[VAL_19:.*]] = fir.box_offset %[[VAL_18]] base_addr : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>
44
44
! CHECK: %[[VAL_20:.*]] = omp.map.info var_ptr(%[[VAL_18]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, !fir.array<?xi32>) var_ptr_ptr(%[[VAL_19]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) map_clauses(tofrom) capture(ByRef) bounds(%[[VAL_16]]) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>> {name = ""}
45
45
! CHECK: %[[VAL_21:.*]] = omp.map.info var_ptr(%[[VAL_18]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, !fir.box<!fir.heap<!fir.array<?xi32>>>) map_clauses(to) capture(ByRef) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>> {name = "var%[[VAL_22:.*]](1:var%[[VAL_23:.*]])"}
46
- ! CHECK: %[[VAL_24:.*]] = omp.map.info var_ptr(%[[VAL_1]]#1 : !fir.ref<!fir.type<_QFdeclare_mapper_1Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>>, !fir.type<_QFdeclare_mapper_1Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}> ) map_clauses(tofrom) capture(ByRef) members(%[[VAL_21]], %[[VAL_20]] : [1], [1, 0] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) -> !fir.ref<!fir.type<_QFdeclare_mapper_1Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}> > {name = "var"}
47
- ! CHECK: omp.declare_mapper_info map_entries(%[[VAL_24]], %[[VAL_21]], %[[VAL_20]] : !fir.ref<!fir.type<_QFdeclare_mapper_1Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}> >, !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>)
46
+ ! CHECK: %[[VAL_24:.*]] = omp.map.info var_ptr(%[[VAL_1]]#1 : !fir.ref<[[MY_TYPE]]>, [[MY_TYPE]] ) map_clauses(tofrom) capture(ByRef) members(%[[VAL_21]], %[[VAL_20]] : [1], [1, 0] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) -> !fir.ref<[[MY_TYPE]] > {name = "var"}
47
+ ! CHECK: omp.declare_mapper.info map_entries(%[[VAL_24]], %[[VAL_21]], %[[VAL_20]] : !fir.ref<[[MY_TYPE]] >, !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>)
48
48
! CHECK: }
49
49
! $omp declare mapper (my_type :: var) map (var, var%values (1:var%num_vals))
50
50
end subroutine declare_mapper_1
@@ -65,21 +65,21 @@ subroutine declare_mapper_2
65
65
end type
66
66
type (my_type2) :: t
67
67
real :: x, y(nvals)
68
- ! CHECK-LABEL :omp.declare_mapper @_QQFdeclare_mapper_2my_mapper : !fir.type<_QFdeclare_mapper_2Tmy_type2{my_type_var:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,temp:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,unmapped:!fir.array<250xf32>,arr:!fir.array<250xf32>}> {
69
- ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type2{my_type_var:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,temp:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,unmapped:!fir.array<250xf32>,arr:!fir.array<250xf32>}> >):
70
- !CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFdeclare_mapper_2Ev"} : (!fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type2{my_type_var:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,temp:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,unmapped:!fir.array<250xf32>,arr:!fir.array<250xf32>}>>) -> (!fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type2{my_type_var:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,temp:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,unmapped:!fir.array<250xf32>,arr:!fir.array<250xf32>}>>, !fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type2{my_type_var:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,temp:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,unmapped:!fir.array<250xf32>,arr:!fir.array<250xf32>}>>)
68
+ ! CHECK:omp.declare_mapper @[[MY_TYPE_MAPPER: _QQFdeclare_mapper_2my_mapper]] : [[MY_TYPE: !fir\ .type<_QFdeclare_mapper_2Tmy_type2\ {my_type_var:!fir\ .type<_QFdeclare_mapper_2Tmy_type\ {num_vals:i32,values:!fir\ .box<!fir\ .heap<!fir\ .array<\ ?xi32>>>\ }>,temp:!fir\ .type<_QFdeclare_mapper_2Tmy_type\ {num_vals:i32,values:!fir\ .box<!fir\ .heap<!fir\ .array<\ ?xi32>>>\ }>,unmapped:!fir\ .array<250xf32>,arr:!fir\ .array<250xf32>\}>]] {
69
+ ! CHECK: ^bb0(%[[VAL_0:.*]]: !fir.ref<[[MY_TYPE]] >):
70
+ ! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFdeclare_mapper_2Ev"} : (!fir.ref<[[MY_TYPE]]>) -> (!fir.ref<[[MY_TYPE]]>, !fir.ref<[[MY_TYPE]]>)
71
71
! CHECK: %[[VAL_2:.*]] = arith.constant 250 : index
72
72
! CHECK: %[[VAL_3:.*]] = fir.shape %[[VAL_2]] : (index) -> !fir.shape<1>
73
- ! CHECK: %[[VAL_4:.*]] = hlfir.designate %[[VAL_1]]#0{"arr"} shape %[[VAL_3]] : (!fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type2{my_type_var:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,temp:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,unmapped:!fir.array<250xf32>,arr:!fir.array<250xf32>}> >, !fir.shape<1>) -> !fir.ref<!fir.array<250xf32>>
73
+ ! CHECK: %[[VAL_4:.*]] = hlfir.designate %[[VAL_1]]#0{"arr"} shape %[[VAL_3]] : (!fir.ref<[[MY_TYPE]] >, !fir.shape<1>) -> !fir.ref<!fir.array<250xf32>>
74
74
! CHECK: %[[VAL_5:.*]] = arith.constant 1 : index
75
75
! CHECK: %[[VAL_6:.*]] = arith.constant 0 : index
76
76
! CHECK: %[[VAL_7:.*]] = arith.subi %[[VAL_2]], %[[VAL_5]] : index
77
77
! CHECK: %[[VAL_8:.*]] = omp.map.bounds lower_bound(%[[VAL_6]] : index) upper_bound(%[[VAL_7]] : index) extent(%[[VAL_2]] : index) stride(%[[VAL_5]] : index) start_idx(%[[VAL_5]] : index)
78
78
! CHECK: %[[VAL_9:.*]] = omp.map.info var_ptr(%[[VAL_4]] : !fir.ref<!fir.array<250xf32>>, !fir.array<250xf32>) map_clauses(tofrom) capture(ByRef) bounds(%[[VAL_8]]) -> !fir.ref<!fir.array<250xf32>> {name = "v%[[VAL_10:.*]]"}
79
- ! CHECK: %[[VAL_11:.*]] = hlfir.designate %[[VAL_1]]#0{"temp"} : (!fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type2{my_type_var:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,temp:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,unmapped:!fir.array<250xf32>,arr:!fir.array<250xf32>}> >) -> !fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>>
79
+ ! CHECK: %[[VAL_11:.*]] = hlfir.designate %[[VAL_1]]#0{"temp"} : (!fir.ref<[[MY_TYPE]] >) -> !fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>>
80
80
! CHECK: %[[VAL_12:.*]] = omp.map.info var_ptr(%[[VAL_11]] : !fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>>, !fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>) map_clauses(exit_release_or_enter_alloc) capture(ByRef) -> !fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>> {name = "v%[[VAL_13:.*]]"}
81
- !CHECK: %[[VAL_14:.*]] = omp.map.info var_ptr(%[[VAL_1]]#1 : !fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type2{my_type_var:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,temp:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,unmapped:!fir.array<250xf32>,arr:!fir.array<250xf32>}>>, !fir.type<_QFdeclare_mapper_2Tmy_type2{my_type_var:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,temp:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,unmapped:!fir.array<250xf32>,arr:!fir.array<250xf32>}>) map_clauses(tofrom) capture(ByRef) members(%[[VAL_9]], %[[VAL_12]] : [3], [1] : !fir.ref<!fir.array<250xf32>>, !fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>>) -> !fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type2{my_type_var:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,temp:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,unmapped:!fir.array<250xf32>,arr:!fir.array<250xf32>}>> {name = "v", partial_map = true}
82
- ! CHECK: omp.declare_mapper_info map_entries(%[[VAL_14]], %[[VAL_9]], %[[VAL_12]] : !fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type2{my_type_var:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,temp:!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>,unmapped:!fir.array<250xf32>,arr:!fir.array<250xf32>}> >, !fir.ref<!fir.array<250xf32>>, !fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>>)
81
+ ! CHECK: %[[VAL_14:.*]] = omp.map.info var_ptr(%[[VAL_1]]#1 : !fir.ref<[[MY_TYPE]]>, [[MY_TYPE]]) map_clauses(tofrom) capture(ByRef) members(%[[VAL_9]], %[[VAL_12]] : [3], [1] : !fir.ref<!fir.array<250xf32>>, !fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>>) -> !fir.ref<[[MY_TYPE]]> {name = "v", partial_map = true}
82
+ ! CHECK: omp.declare_mapper.info map_entries(%[[VAL_14]], %[[VAL_9]], %[[VAL_12]] : !fir.ref<[[MY_TYPE]] >, !fir.ref<!fir.array<250xf32>>, !fir.ref<!fir.type<_QFdeclare_mapper_2Tmy_type{num_vals:i32,values:!fir.box<!fir.heap<!fir.array<?xi32>>>}>>)
83
83
! CHECK: }
84
84
! $omp declare mapper (my_mapper : my_type2 :: v) map (v%arr) map (alloc : v%temp)
85
85
end subroutine declare_mapper_2
0 commit comments