@@ -101,6 +101,85 @@ typedef struct caf_vector_t {
101101caf_vector_t ;
102102
103103
104+ /* Keep in sync with gcc/libgfortran/caf/libcaf.h. */
105+ typedef enum caf_ref_type_t {
106+ /* Reference a component of a derived type, either regular one or an
107+ allocatable or pointer type. For regular ones idx in caf_reference_t is
108+ set to -1. */
109+ CAF_REF_COMPONENT ,
110+ /* Reference an allocatable array. */
111+ CAF_REF_ARRAY ,
112+ /* Reference a non-allocatable/non-pointer array. */
113+ CAF_REF_STATIC_ARRAY
114+ } caf_ref_type_t ;
115+
116+ /* Keep in sync with gcc/libgfortran/caf/libcaf.h. */
117+ typedef enum caf_array_ref_t {
118+ /* No array ref. This terminates the array ref. */
119+ CAF_ARR_REF_NONE = 0 ,
120+ /* Reference array elements given by a vector. Only for this mode
121+ caf_reference_t.u.a.dim[i].v is valid. */
122+ CAF_ARR_REF_VECTOR ,
123+ /* A full array ref (:). */
124+ CAF_ARR_REF_FULL ,
125+ /* Reference a range on elements given by start, end and stride. */
126+ CAF_ARR_REF_RANGE ,
127+ /* Only a single item is referenced given in the start member. */
128+ CAF_ARR_REF_SINGLE ,
129+ /* An array ref of the kind (i:), where i is an arbitrary valid index in the
130+ array. The index i is given in the start member. */
131+ CAF_ARR_REF_OPEN_END ,
132+ /* An array ref of the kind (:i), where the lower bound of the array ref
133+ is given by the remote side. The index i is given in the end member. */
134+ CAF_ARR_REF_OPEN_START
135+ } caf_array_ref_t ;
136+
137+ /* References to remote components of a derived type.
138+ Keep in sync with gcc/libgfortran/caf/libcaf.h. */
139+ typedef struct caf_reference_t {
140+ /* A pointer to the next ref or NULL. */
141+ struct caf_reference_t * next ;
142+ /* The type of the reference. */
143+ /* caf_ref_type_t, replaced by int to allow specification in fortran FE. */
144+ int type ;
145+ /* The size of an item referenced in bytes. I.e. in an array ref this is
146+ the factor to advance the array pointer with to get to the next item.
147+ For component refs this gives just the size of the element referenced. */
148+ size_t item_size ;
149+ union {
150+ struct {
151+ /* The offset (in bytes) of the component in the derived type. */
152+ ptrdiff_t offset ;
153+ /* The offset (in bytes) to the caf_token associated with this
154+ component. NULL, when not allocatable/pointer ref. */
155+ ptrdiff_t caf_token_offset ;
156+ } c ;
157+ struct {
158+ /* The mode of the array ref. See CAF_ARR_REF_*. */
159+ /* caf_array_ref_t, replaced by unsigend char to allow specification in
160+ fortran FE. */
161+ unsigned char mode [GFC_MAX_DIMENSIONS ];
162+ /* The type of a static array. Unset for array's with descriptors. */
163+ int static_array_type ;
164+ /* Subscript refs (s) or vector refs (v). */
165+ union {
166+ struct {
167+ /* The start and end boundary of the ref and the stride. */
168+ ptrdiff_t start , end , stride ;
169+ } s ;
170+ struct {
171+ /* nvec entries of kind giving the elements to reference. */
172+ void * vector ;
173+ /* The number of entries in vector. */
174+ size_t nvec ;
175+ /* The integer kind used for the elements in vector. */
176+ int kind ;
177+ } v ;
178+ } dim [GFC_MAX_DIMENSIONS ];
179+ } a ;
180+ } u ;
181+ } caf_reference_t ;
182+
104183
105184/* Common auxiliary functions: caf_auxiliary.c. */
106185
@@ -115,19 +194,32 @@ void PREFIX (finalize) (void);
115194int PREFIX (this_image ) (int );
116195int PREFIX (num_images ) (int , int );
117196
118- void * PREFIX (register) (size_t , caf_register_t , caf_token_t * , int * , char * ,
119- int );
197+ void PREFIX (register) (size_t , caf_register_t , caf_token_t * ,
198+ gfc_descriptor_t * , int * , char * , int );
120199void PREFIX (deregister ) (caf_token_t * , int * , char * , int );
121200
122201void PREFIX (caf_get ) (caf_token_t , size_t , int , gfc_descriptor_t * ,
123- caf_vector_t * , gfc_descriptor_t * , int , int );
202+ caf_vector_t * , gfc_descriptor_t * , int , int , int );
124203void PREFIX (caf_send ) (caf_token_t , size_t , int , gfc_descriptor_t * ,
125204 caf_vector_t * , gfc_descriptor_t * , int , int );
126205
127206void PREFIX (caf_sendget ) (caf_token_t , size_t , int , gfc_descriptor_t * ,
128207 caf_vector_t * , caf_token_t , size_t , int ,
129208 gfc_descriptor_t * , caf_vector_t * , int , int );
130209
210+ void PREFIX (get_by_ref ) (caf_token_t , int ,
211+ gfc_descriptor_t * dst , caf_reference_t * refs ,
212+ int dst_kind , int src_kind , bool may_require_tmp ,
213+ bool dst_reallocatable , int * stat );
214+ void PREFIX (send_by_ref ) (caf_token_t token , int image_index ,
215+ gfc_descriptor_t * src , caf_reference_t * refs ,
216+ int dst_kind , int src_kind , bool may_require_tmp ,
217+ bool dst_reallocatable , int * stat );
218+ void PREFIX (sendget_by_ref ) (caf_token_t dst_token , int dst_image_index ,
219+ caf_reference_t * dst_refs , caf_token_t src_token , int src_image_index ,
220+ caf_reference_t * src_refs , int dst_kind , int src_kind ,
221+ bool may_require_tmp , int * dst_stat , int * src_stat );
222+
131223void PREFIX (co_max ) (gfc_descriptor_t * , int , int * , char * , int , int );
132224void PREFIX (co_min ) (gfc_descriptor_t * , int , int * , char * , int , int );
133225void PREFIX (co_sum ) (gfc_descriptor_t * , int , int * , char * , int );
0 commit comments