PR ipa/65237
[official-gcc.git] / include / gomp-constants.h
blobe3d2820d76361722b0008412f16b435559c79c96
1 /* Communication between GCC and libgomp.
3 Copyright (C) 2014-2015 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_LAST (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 enum gomp_map_kind
49 /* If not already present, allocate. */
50 GOMP_MAP_ALLOC = 0,
51 /* ..., and copy to device. */
52 GOMP_MAP_TO = (GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO),
53 /* ..., and copy from device. */
54 GOMP_MAP_FROM = (GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM),
55 /* ..., and copy to and from device. */
56 GOMP_MAP_TOFROM = (GOMP_MAP_TO | GOMP_MAP_FROM),
57 /* The following kind is an internal only map kind, used for pointer based
58 array sections. OMP_CLAUSE_SIZE for these is not the pointer size,
59 which is implicitly POINTER_SIZE_UNITS, but the bias. */
60 GOMP_MAP_POINTER = (GOMP_MAP_FLAG_SPECIAL_0 | 0),
61 /* Also internal, behaves like GOMP_MAP_TO, but additionally any
62 GOMP_MAP_POINTER records consecutive after it which have addresses
63 falling into that range will not be ignored if GOMP_MAP_TO_PSET wasn't
64 mapped already. */
65 GOMP_MAP_TO_PSET = (GOMP_MAP_FLAG_SPECIAL_0 | 1),
66 /* Must already be present. */
67 GOMP_MAP_FORCE_PRESENT = (GOMP_MAP_FLAG_SPECIAL_0 | 2),
68 /* Deallocate a mapping, without copying from device. */
69 GOMP_MAP_FORCE_DEALLOC = (GOMP_MAP_FLAG_SPECIAL_0 | 3),
70 /* Is a device pointer. OMP_CLAUSE_SIZE for these is unused; is implicitly
71 POINTER_SIZE_UNITS. */
72 GOMP_MAP_FORCE_DEVICEPTR = (GOMP_MAP_FLAG_SPECIAL_1 | 0),
73 /* Allocate. */
74 GOMP_MAP_FORCE_ALLOC = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC),
75 /* ..., and copy to device. */
76 GOMP_MAP_FORCE_TO = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO),
77 /* ..., and copy from device. */
78 GOMP_MAP_FORCE_FROM = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM),
79 /* ..., and copy to and from device. */
80 GOMP_MAP_FORCE_TOFROM = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
83 #define GOMP_MAP_COPY_TO_P(X) \
84 (!((X) & GOMP_MAP_FLAG_SPECIAL) \
85 && ((X) & GOMP_MAP_FLAG_TO))
87 #define GOMP_MAP_COPY_FROM_P(X) \
88 (!((X) & GOMP_MAP_FLAG_SPECIAL) \
89 && ((X) & GOMP_MAP_FLAG_FROM))
91 #define GOMP_MAP_POINTER_P(X) \
92 ((X) == GOMP_MAP_POINTER)
95 /* Asynchronous behavior. Keep in sync with
96 libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_async_t. */
98 #define GOMP_ASYNC_NOVAL -1
99 #define GOMP_ASYNC_SYNC -2
102 /* Device codes. Keep in sync with
103 libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_device_t as well as
104 libgomp/libgomp_target.h. */
105 #define GOMP_DEVICE_NONE 0
106 #define GOMP_DEVICE_DEFAULT 1
107 #define GOMP_DEVICE_HOST 2
108 #define GOMP_DEVICE_HOST_NONSHM 3
109 #define GOMP_DEVICE_NOT_HOST 4
110 #define GOMP_DEVICE_NVIDIA_PTX 5
111 #define GOMP_DEVICE_INTEL_MIC 6
113 #define GOMP_DEVICE_ICV -1
114 #define GOMP_DEVICE_HOST_FALLBACK -2
116 #endif