libgomp: Fix locking in OpenMP GOMP_target* functions.
[official-gcc.git] / include / gomp-constants.h
blobb5f8d8898be209dd224deabf902b014786c982cc
1 /* Communication between GCC and libgomp.
3 Copyright (C) 2014 Free Software Foundation, Inc.
5 Contributed by Mentor Embedded.
7 This file is part of the GNU Offloading and Multi Processing Library
8 (libgomp).
10 Libgomp is free software; you can redistribute it and/or modify it
11 under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3, or (at your option)
13 any later version.
15 Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 more details.
20 Under Section 7 of GPL version 3, you are granted additional
21 permissions described in the GCC Runtime Library Exception, version
22 3.1, as published by the Free Software Foundation.
24 You should have received a copy of the GNU General Public License and
25 a copy of the GCC Runtime Library Exception along with this program;
26 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
27 <http://www.gnu.org/licenses/>. */
29 #ifndef GOMP_CONSTANTS_H
30 #define GOMP_CONSTANTS_H 1
32 /* Memory mapping types. */
34 /* One byte. */
35 #define GOMP_MAP_VALUE_LIMIT (1 << 8)
37 #define GOMP_MAP_FLAG_TO (1 << 0)
38 #define GOMP_MAP_FLAG_FROM (1 << 1)
39 /* Special map kinds, enumerated starting here. */
40 #define GOMP_MAP_FLAG_SPECIAL_0 (1 << 2)
41 #define GOMP_MAP_FLAG_SPECIAL_1 (1 << 3)
42 #define GOMP_MAP_FLAG_SPECIAL (GOMP_MAP_FLAG_SPECIAL_1 \
43 | GOMP_MAP_FLAG_SPECIAL_0)
44 /* Flag to force a specific behavior (or else, trigger a run-time error). */
45 #define GOMP_MAP_FLAG_FORCE (1 << 7)
47 #define GOMP_MAP_ALLOC 0
48 #define GOMP_MAP_TO (GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO)
49 #define GOMP_MAP_FROM (GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM)
50 #define GOMP_MAP_TOFROM (GOMP_MAP_TO | GOMP_MAP_FROM)
51 #define GOMP_MAP_POINTER (GOMP_MAP_FLAG_SPECIAL_0 | 0)
52 #define GOMP_MAP_TO_PSET (GOMP_MAP_FLAG_SPECIAL_0 | 1)
53 #define GOMP_MAP_FORCE_PRESENT (GOMP_MAP_FLAG_SPECIAL_0 | 2)
54 #define GOMP_MAP_FORCE_DEALLOC (GOMP_MAP_FLAG_SPECIAL_0 | 3)
55 #define GOMP_MAP_FORCE_DEVICEPTR (GOMP_MAP_FLAG_SPECIAL_1 | 0)
56 #define GOMP_MAP_FORCE_ALLOC (GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC)
57 #define GOMP_MAP_FORCE_TO (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO)
58 #define GOMP_MAP_FORCE_FROM (GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM)
59 #define GOMP_MAP_FORCE_TOFROM (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
61 #define GOMP_MAP_COPY_TO_P(X) \
62 (!((X) & GOMP_MAP_FLAG_SPECIAL) \
63 && ((X) & GOMP_MAP_FLAG_TO))
65 #define GOMP_MAP_COPY_FROM_P(X) \
66 (!((X) & GOMP_MAP_FLAG_SPECIAL) \
67 && ((X) & GOMP_MAP_FLAG_FROM))
69 #define GOMP_MAP_POINTER_P(X) \
70 ((X) == GOMP_MAP_POINTER)
73 /* Asynchronous behavior. Keep in sync with
74 libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_async_t. */
76 #define GOMP_ASYNC_NOVAL -1
77 #define GOMP_ASYNC_SYNC -2
80 /* Device codes. Keep in sync with
81 libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_device_t as well as
82 libgomp/libgomp_target.h. */
83 #define GOMP_DEVICE_NONE 0
84 #define GOMP_DEVICE_DEFAULT 1
85 #define GOMP_DEVICE_HOST 2
86 #define GOMP_DEVICE_HOST_NONSHM 3
87 #define GOMP_DEVICE_NOT_HOST 4
88 #define GOMP_DEVICE_NVIDIA_PTX 5
89 #define GOMP_DEVICE_INTEL_MIC 6
91 #define GOMP_DEVICE_ICV -1
92 #define GOMP_DEVICE_HOST_FALLBACK -2
94 #endif