@@ -43,6 +43,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
43
43
#define unlikely (x ) __builtin_expect(!!(x), 0)
44
44
#endif
45
45
46
+ #if __GNUC__ >= 7
47
+ #define GCC_GE_7 1
48
+ #endif
49
+
46
50
#ifdef PREFIX_NAME
47
51
#define PREFIX3 (X ,Y ) X ## Y
48
52
#define PREFIX2 (X ,Y ) PREFIX3(X,Y)
@@ -101,6 +105,87 @@ typedef struct caf_vector_t {
101
105
caf_vector_t ;
102
106
103
107
108
+ #ifdef GCC_GE_7
109
+ /* Keep in sync with gcc/libgfortran/caf/libcaf.h. */
110
+ typedef enum caf_ref_type_t {
111
+ /* Reference a component of a derived type, either regular one or an
112
+ allocatable or pointer type. For regular ones idx in caf_reference_t is
113
+ set to -1. */
114
+ CAF_REF_COMPONENT ,
115
+ /* Reference an allocatable array. */
116
+ CAF_REF_ARRAY ,
117
+ /* Reference a non-allocatable/non-pointer array. */
118
+ CAF_REF_STATIC_ARRAY
119
+ } caf_ref_type_t ;
120
+
121
+ /* Keep in sync with gcc/libgfortran/caf/libcaf.h. */
122
+ typedef enum caf_array_ref_t {
123
+ /* No array ref. This terminates the array ref. */
124
+ CAF_ARR_REF_NONE = 0 ,
125
+ /* Reference array elements given by a vector. Only for this mode
126
+ caf_reference_t.u.a.dim[i].v is valid. */
127
+ CAF_ARR_REF_VECTOR ,
128
+ /* A full array ref (:). */
129
+ CAF_ARR_REF_FULL ,
130
+ /* Reference a range on elements given by start, end and stride. */
131
+ CAF_ARR_REF_RANGE ,
132
+ /* Only a single item is referenced given in the start member. */
133
+ CAF_ARR_REF_SINGLE ,
134
+ /* An array ref of the kind (i:), where i is an arbitrary valid index in the
135
+ array. The index i is given in the start member. */
136
+ CAF_ARR_REF_OPEN_END ,
137
+ /* An array ref of the kind (:i), where the lower bound of the array ref
138
+ is given by the remote side. The index i is given in the end member. */
139
+ CAF_ARR_REF_OPEN_START
140
+ } caf_array_ref_t ;
141
+
142
+ /* References to remote components of a derived type.
143
+ Keep in sync with gcc/libgfortran/caf/libcaf.h. */
144
+ typedef struct caf_reference_t {
145
+ /* A pointer to the next ref or NULL. */
146
+ struct caf_reference_t * next ;
147
+ /* The type of the reference. */
148
+ /* caf_ref_type_t, replaced by int to allow specification in fortran FE. */
149
+ int type ;
150
+ /* The size of an item referenced in bytes. I.e. in an array ref this is
151
+ the factor to advance the array pointer with to get to the next item.
152
+ For component refs this gives just the size of the element referenced. */
153
+ size_t item_size ;
154
+ union {
155
+ struct {
156
+ /* The offset (in bytes) of the component in the derived type. */
157
+ ptrdiff_t offset ;
158
+ /* The offset (in bytes) to the caf_token associated with this
159
+ component. NULL, when not allocatable/pointer ref. */
160
+ ptrdiff_t caf_token_offset ;
161
+ } c ;
162
+ struct {
163
+ /* The mode of the array ref. See CAF_ARR_REF_*. */
164
+ /* caf_array_ref_t, replaced by unsigend char to allow specification in
165
+ fortran FE. */
166
+ unsigned char mode [GFC_MAX_DIMENSIONS ];
167
+ /* The type of a static array. Unset for array's with descriptors. */
168
+ int static_array_type ;
169
+ /* Subscript refs (s) or vector refs (v). */
170
+ union {
171
+ struct {
172
+ /* The start and end boundary of the ref and the stride. */
173
+ ptrdiff_t start , end , stride ;
174
+ } s ;
175
+ struct {
176
+ /* nvec entries of kind giving the elements to reference. */
177
+ void * vector ;
178
+ /* The number of entries in vector. */
179
+ size_t nvec ;
180
+ /* The integer kind used for the elements in vector. */
181
+ int kind ;
182
+ } v ;
183
+ } dim [GFC_MAX_DIMENSIONS ];
184
+ } a ;
185
+ } u ;
186
+ } caf_reference_t ;
187
+ #endif
188
+
104
189
105
190
/* Common auxiliary functions: caf_auxiliary.c. */
106
191
@@ -115,19 +200,39 @@ void PREFIX (finalize) (void);
115
200
int PREFIX (this_image ) (int );
116
201
int PREFIX (num_images ) (int , int );
117
202
118
- void * PREFIX (register) (size_t , caf_register_t , caf_token_t * , int * , char * ,
119
- int );
203
+ #ifdef GCC_GE_7
204
+ void PREFIX (register) (size_t , caf_register_t , caf_token_t * ,
205
+ gfc_descriptor_t * , int * , char * , int );
206
+ #else
207
+ void * PREFIX (register) (size_t , caf_register_t , caf_token_t * ,
208
+ int * , char * , int );
209
+ #endif
120
210
void PREFIX (deregister ) (caf_token_t * , int * , char * , int );
121
211
122
212
void PREFIX (caf_get ) (caf_token_t , size_t , int , gfc_descriptor_t * ,
123
- caf_vector_t * , gfc_descriptor_t * , int , int );
213
+ caf_vector_t * , gfc_descriptor_t * , int , int , int );
124
214
void PREFIX (caf_send ) (caf_token_t , size_t , int , gfc_descriptor_t * ,
125
215
caf_vector_t * , gfc_descriptor_t * , int , int );
126
216
127
217
void PREFIX (caf_sendget ) (caf_token_t , size_t , int , gfc_descriptor_t * ,
128
218
caf_vector_t * , caf_token_t , size_t , int ,
129
219
gfc_descriptor_t * , caf_vector_t * , int , int );
130
220
221
+ #ifdef GCC_GE_7
222
+ void PREFIX (get_by_ref ) (caf_token_t , int ,
223
+ gfc_descriptor_t * dst , caf_reference_t * refs ,
224
+ int dst_kind , int src_kind , bool may_require_tmp ,
225
+ bool dst_reallocatable , int * stat );
226
+ void PREFIX (send_by_ref ) (caf_token_t token , int image_index ,
227
+ gfc_descriptor_t * src , caf_reference_t * refs ,
228
+ int dst_kind , int src_kind , bool may_require_tmp ,
229
+ bool dst_reallocatable , int * stat );
230
+ void PREFIX (sendget_by_ref ) (caf_token_t dst_token , int dst_image_index ,
231
+ caf_reference_t * dst_refs , caf_token_t src_token , int src_image_index ,
232
+ caf_reference_t * src_refs , int dst_kind , int src_kind ,
233
+ bool may_require_tmp , int * dst_stat , int * src_stat );
234
+ #endif
235
+
131
236
void PREFIX (co_max ) (gfc_descriptor_t * , int , int * , char * , int , int );
132
237
void PREFIX (co_min ) (gfc_descriptor_t * , int , int * , char * , int , int );
133
238
void PREFIX (co_sum ) (gfc_descriptor_t * , int , int * , char * , int );
0 commit comments