]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgfortran/caf/libcaf.h
check.c (check_co_collective): Renamed from
[thirdparty/gcc.git] / libgfortran / caf / libcaf.h
CommitLineData
5092eb96 1/* Common declarations for all of GNU Fortran libcaf implementations.
f0bcf628 2 Copyright (C) 2011-2014 Free Software Foundation, Inc.
5092eb96
TB
3 Contributed by Tobias Burnus <burnus@net-b.de>
4
5This file is part of the GNU Fortran Coarray Runtime Library (libcaf).
6
7Libcaf is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12Libcaf is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17Under Section 7 of GPL version 3, you are granted additional
18permissions described in the GCC Runtime Library Exception, version
193.1, as published by the Free Software Foundation.
20
21You should have received a copy of the GNU General Public License and
22a copy of the GCC Runtime Library Exception along with this program;
23see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24<http://www.gnu.org/licenses/>. */
25
26#ifndef LIBCAF_H
27#define LIBCAF_H
28
a8a5f4a9
TB
29#include <stdbool.h>
30#include <stddef.h> /* For size_t. */
cc9ae24c 31#include <stdint.h> /* For int32_t. */
cc9ae24c 32
b5116268
TB
33#include "libgfortran.h"
34
35#if 0
4054bc52
TB
36#ifndef __GNUC__
37#define __attribute__(x)
38#define likely(x) (x)
39#define unlikely(x) (x)
40#else
41#define likely(x) __builtin_expect(!!(x), 1)
42#define unlikely(x) __builtin_expect(!!(x), 0)
43#endif
5092eb96
TB
44
45/* Definitions of the Fortran 2008 standard; need to kept in sync with
46 ISO_FORTRAN_ENV, cf. libgfortran.h. */
47#define STAT_UNLOCKED 0
48#define STAT_LOCKED 1
49#define STAT_LOCKED_OTHER_IMAGE 2
5d81ddd0 50#define STAT_STOPPED_IMAGE 6000
b5116268 51#endif
5092eb96 52
4054bc52
TB
53/* Describes what type of array we are registerring. Keep in sync with
54 gcc/fortran/trans.h. */
cc9ae24c 55typedef enum caf_register_t {
0a1138af
DC
56 CAF_REGTYPE_COARRAY_STATIC,
57 CAF_REGTYPE_COARRAY_ALLOC,
bc0229f9
TB
58 CAF_REGTYPE_LOCK_STATIC,
59 CAF_REGTYPE_LOCK_ALLOC,
60 CAF_REGTYPE_CRITICAL
cc9ae24c
TB
61}
62caf_register_t;
63
a8a5f4a9 64typedef void* caf_token_t;
b5116268 65typedef gfc_array_void gfc_descriptor_t;
a8a5f4a9 66
0a1138af
DC
67/* Linked list of static coarrays registered. */
68typedef struct caf_static_t {
a8a5f4a9 69 caf_token_t token;
0a1138af
DC
70 struct caf_static_t *prev;
71}
72caf_static_t;
73
b5116268
TB
74/* When there is a vector subscript in this dimension, nvec == 0, otherwise,
75 lower_bound, upper_bound, stride contains the bounds relative to the declared
76 bounds; kind denotes the integer kind of the elements of vector[]. */
d62cf3df 77typedef struct caf_vector_t {
b5116268 78 size_t nvec;
d62cf3df 79 union {
b5116268
TB
80 struct {
81 void *vector;
82 int kind;
83 } v;
d62cf3df
TB
84 struct {
85 ptrdiff_t lower_bound, upper_bound, stride;
86 } triplet;
d62cf3df
TB
87 } u;
88}
89caf_vector_t;
90
cc9ae24c 91
a8a5f4a9 92void _gfortran_caf_init (int *, char ***);
5092eb96
TB
93void _gfortran_caf_finalize (void);
94
a8a5f4a9 95int _gfortran_caf_this_image (int);
a9fe6877 96int _gfortran_caf_num_images (int, int);
cc9ae24c 97
a8a5f4a9
TB
98void *_gfortran_caf_register (size_t, caf_register_t, caf_token_t *, int *,
99 char *, int);
100void _gfortran_caf_deregister (caf_token_t *, int *, char *, int);
cc9ae24c 101
f5c01f5b
DC
102void _gfortran_caf_sync_all (int *, char *, int);
103void _gfortran_caf_sync_images (int, int[], int *, char *, int);
cc9ae24c 104
cc9ae24c
TB
105void _gfortran_caf_error_stop_str (const char *, int32_t)
106 __attribute__ ((noreturn));
5092eb96
TB
107void _gfortran_caf_error_stop (int32_t) __attribute__ ((noreturn));
108
a16ee379
TB
109void _gfortran_caf_co_broadcast (gfc_descriptor_t *, int, int *, char *, int);
110void _gfortran_caf_co_sum (gfc_descriptor_t *, int, int *, char *, int);
111void _gfortran_caf_co_min (gfc_descriptor_t *, int, int *, char *, int, int);
112void _gfortran_caf_co_max (gfc_descriptor_t *, int, int *, char *, int, int);
b5116268
TB
113
114void _gfortran_caf_get (caf_token_t, size_t, int, gfc_descriptor_t *,
93e2e046 115 caf_vector_t *, gfc_descriptor_t *, int, int, bool);
b5116268 116void _gfortran_caf_send (caf_token_t, size_t, int, gfc_descriptor_t *,
93e2e046 117 caf_vector_t *, gfc_descriptor_t *, int, int, bool);
b5116268
TB
118void _gfortran_caf_sendget (caf_token_t, size_t, int, gfc_descriptor_t *,
119 caf_vector_t *, caf_token_t, size_t, int,
93e2e046 120 gfc_descriptor_t *, caf_vector_t *, int, int, bool);
42a8246d
TB
121
122void _gfortran_caf_atomic_define (caf_token_t, size_t, int, void *, int *,
123 int, int);
124void _gfortran_caf_atomic_ref (caf_token_t, size_t, int, void *, int *,
125 int, int);
126void _gfortran_caf_atomic_cas (caf_token_t, size_t, int, void *, void *,
127 void *, int *, int, int);
128void _gfortran_caf_atomic_op (int, caf_token_t, size_t, int, void *, void *,
129 int *, int, int);
bc0229f9
TB
130
131void _gfortran_caf_lock (caf_token_t, size_t, int, int *, int *, char *, int);
132void _gfortran_caf_unlock (caf_token_t, size_t, int, int *, char *, int);
133
5092eb96 134#endif /* LIBCAF_H */