| 1 |
733 |
jeremybenn |
/* Common declarations for all of GNU Fortran libcaf implementations.
|
| 2 |
|
|
Copyright (C) 2011, 2012
|
| 3 |
|
|
Free Software Foundation, Inc.
|
| 4 |
|
|
Contributed by Tobias Burnus <burnus@net-b.de>
|
| 5 |
|
|
|
| 6 |
|
|
This file is part of the GNU Fortran Coarray Runtime Library (libcaf).
|
| 7 |
|
|
|
| 8 |
|
|
Libcaf is free software; you can redistribute it and/or modify
|
| 9 |
|
|
it under the terms of the GNU General Public License as published by
|
| 10 |
|
|
the Free Software Foundation; either version 3, or (at your option)
|
| 11 |
|
|
any later version.
|
| 12 |
|
|
|
| 13 |
|
|
Libcaf is distributed in the hope that it will be useful,
|
| 14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 16 |
|
|
GNU General Public License for more details.
|
| 17 |
|
|
|
| 18 |
|
|
Under Section 7 of GPL version 3, you are granted additional
|
| 19 |
|
|
permissions described in the GCC Runtime Library Exception, version
|
| 20 |
|
|
3.1, as published by the Free Software Foundation.
|
| 21 |
|
|
|
| 22 |
|
|
You should have received a copy of the GNU General Public License and
|
| 23 |
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
| 24 |
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
| 25 |
|
|
<http://www.gnu.org/licenses/>. */
|
| 26 |
|
|
|
| 27 |
|
|
#ifndef LIBCAF_H
|
| 28 |
|
|
#define LIBCAF_H
|
| 29 |
|
|
|
| 30 |
|
|
#include <stdint.h> /* For int32_t. */
|
| 31 |
|
|
#include <stddef.h> /* For ptrdiff_t. */
|
| 32 |
|
|
|
| 33 |
|
|
#ifndef __GNUC__
|
| 34 |
|
|
#define __attribute__(x)
|
| 35 |
|
|
#define likely(x) (x)
|
| 36 |
|
|
#define unlikely(x) (x)
|
| 37 |
|
|
#else
|
| 38 |
|
|
#define likely(x) __builtin_expect(!!(x), 1)
|
| 39 |
|
|
#define unlikely(x) __builtin_expect(!!(x), 0)
|
| 40 |
|
|
#endif
|
| 41 |
|
|
|
| 42 |
|
|
/* Definitions of the Fortran 2008 standard; need to kept in sync with
|
| 43 |
|
|
ISO_FORTRAN_ENV, cf. libgfortran.h. */
|
| 44 |
|
|
#define STAT_UNLOCKED 0
|
| 45 |
|
|
#define STAT_LOCKED 1
|
| 46 |
|
|
#define STAT_LOCKED_OTHER_IMAGE 2
|
| 47 |
|
|
#define STAT_STOPPED_IMAGE 6000
|
| 48 |
|
|
|
| 49 |
|
|
/* Describes what type of array we are registerring. Keep in sync with
|
| 50 |
|
|
gcc/fortran/trans.h. */
|
| 51 |
|
|
typedef enum caf_register_t {
|
| 52 |
|
|
CAF_REGTYPE_COARRAY_STATIC,
|
| 53 |
|
|
CAF_REGTYPE_COARRAY_ALLOC,
|
| 54 |
|
|
CAF_REGTYPE_LOCK,
|
| 55 |
|
|
CAF_REGTYPE_LOCK_COMP
|
| 56 |
|
|
}
|
| 57 |
|
|
caf_register_t;
|
| 58 |
|
|
|
| 59 |
|
|
/* Linked list of static coarrays registered. */
|
| 60 |
|
|
typedef struct caf_static_t {
|
| 61 |
|
|
void **token;
|
| 62 |
|
|
struct caf_static_t *prev;
|
| 63 |
|
|
}
|
| 64 |
|
|
caf_static_t;
|
| 65 |
|
|
|
| 66 |
|
|
|
| 67 |
|
|
void _gfortran_caf_init (int *, char ***, int *, int *);
|
| 68 |
|
|
void _gfortran_caf_finalize (void);
|
| 69 |
|
|
|
| 70 |
|
|
void * _gfortran_caf_register (ptrdiff_t, caf_register_t, void ***, int *,
|
| 71 |
|
|
char *, int);
|
| 72 |
|
|
void _gfortran_caf_deregister (void ***, int *, char *, int);
|
| 73 |
|
|
|
| 74 |
|
|
|
| 75 |
|
|
void _gfortran_caf_sync_all (int *, char *, int);
|
| 76 |
|
|
void _gfortran_caf_sync_images (int, int[], int *, char *, int);
|
| 77 |
|
|
|
| 78 |
|
|
/* FIXME: The CRITICAL functions should be removed;
|
| 79 |
|
|
the functionality is better represented using Coarray's lock feature. */
|
| 80 |
|
|
void _gfortran_caf_critical (void) { }
|
| 81 |
|
|
void _gfortran_caf_end_critical (void) { }
|
| 82 |
|
|
|
| 83 |
|
|
|
| 84 |
|
|
void _gfortran_caf_error_stop_str (const char *, int32_t)
|
| 85 |
|
|
__attribute__ ((noreturn));
|
| 86 |
|
|
void _gfortran_caf_error_stop (int32_t) __attribute__ ((noreturn));
|
| 87 |
|
|
|
| 88 |
|
|
#endif /* LIBCAF_H */
|