Fix for ICE with -g on testcase with incomplete types.
[official-gcc.git] / include / gomp-constants.h
blobf834dec4f1f40e07ad60ef73a4166e88b63680d8
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 /* OpenMP always flag. */
45 #define GOMP_MAP_FLAG_ALWAYS (1 << 6)
46 /* Flag to force a specific behavior (or else, trigger a run-time error). */
47 #define GOMP_MAP_FLAG_FORCE (1 << 7)
49 enum gomp_map_kind
51 /* If not already present, allocate. */
52 GOMP_MAP_ALLOC = 0,
53 /* ..., and copy to device. */
54 GOMP_MAP_TO = (GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO),
55 /* ..., and copy from device. */
56 GOMP_MAP_FROM = (GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM),
57 /* ..., and copy to and from device. */
58 GOMP_MAP_TOFROM = (GOMP_MAP_TO | GOMP_MAP_FROM),
59 /* The following kind is an internal only map kind, used for pointer based
60 array sections. OMP_CLAUSE_SIZE for these is not the pointer size,
61 which is implicitly POINTER_SIZE_UNITS, but the bias. */
62 GOMP_MAP_POINTER = (GOMP_MAP_FLAG_SPECIAL_0 | 0),
63 /* Also internal, behaves like GOMP_MAP_TO, but additionally any
64 GOMP_MAP_POINTER records consecutive after it which have addresses
65 falling into that range will not be ignored if GOMP_MAP_TO_PSET wasn't
66 mapped already. */
67 GOMP_MAP_TO_PSET = (GOMP_MAP_FLAG_SPECIAL_0 | 1),
68 /* Must already be present. */
69 GOMP_MAP_FORCE_PRESENT = (GOMP_MAP_FLAG_SPECIAL_0 | 2),
70 /* Deallocate a mapping, without copying from device. */
71 GOMP_MAP_FORCE_DEALLOC = (GOMP_MAP_FLAG_SPECIAL_0 | 3),
72 /* Is a device pointer. OMP_CLAUSE_SIZE for these is unused; is implicitly
73 POINTER_SIZE_UNITS. */
74 GOMP_MAP_FORCE_DEVICEPTR = (GOMP_MAP_FLAG_SPECIAL_1 | 0),
75 /* Do not map, copy bits for firstprivate instead. */
76 GOMP_MAP_FIRSTPRIVATE = (GOMP_MAP_FLAG_SPECIAL | 0),
77 /* Similarly, but store the value in the pointer rather than
78 pointed by the pointer. */
79 GOMP_MAP_FIRSTPRIVATE_INT = (GOMP_MAP_FLAG_SPECIAL | 1),
80 /* Pointer translate host address into device address and copy that
81 back to host. */
82 GOMP_MAP_USE_DEVICE_PTR = (GOMP_MAP_FLAG_SPECIAL | 2),
83 /* Allocate a zero length array section. Prefer next non-zero length
84 mapping over previous non-zero length mapping over zero length mapping
85 at the address. If not already mapped, do nothing (and pointer translate
86 to NULL). */
87 GOMP_MAP_ZERO_LEN_ARRAY_SECTION = (GOMP_MAP_FLAG_SPECIAL | 3),
88 /* Allocate. */
89 GOMP_MAP_FORCE_ALLOC = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC),
90 /* ..., and copy to device. */
91 GOMP_MAP_FORCE_TO = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO),
92 /* ..., and copy from device. */
93 GOMP_MAP_FORCE_FROM = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM),
94 /* ..., and copy to and from device. */
95 GOMP_MAP_FORCE_TOFROM = (GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM),
96 /* If not already present, allocate. And unconditionally copy to
97 device. */
98 GOMP_MAP_ALWAYS_TO = (GOMP_MAP_FLAG_ALWAYS | GOMP_MAP_TO),
99 /* If not already present, allocate. And unconditionally copy from
100 device. */
101 GOMP_MAP_ALWAYS_FROM = (GOMP_MAP_FLAG_ALWAYS | GOMP_MAP_FROM),
102 /* If not already present, allocate. And unconditionally copy to and from
103 device. */
104 GOMP_MAP_ALWAYS_TOFROM = (GOMP_MAP_FLAG_ALWAYS | GOMP_MAP_TOFROM),
105 /* Map a sparse struct; the address is the base of the structure, alignment
106 it's required alignment, and size is the number of adjacent entries
107 that belong to the struct. The adjacent entries should be sorted by
108 increasing address, so it is easy to determine lowest needed address
109 (address of the first adjacent entry) and highest needed address
110 (address of the last adjacent entry plus its size). */
111 GOMP_MAP_STRUCT = (GOMP_MAP_FLAG_ALWAYS
112 | GOMP_MAP_FLAG_SPECIAL | 0),
113 /* Forced deallocation of zero length array section. */
114 GOMP_MAP_DELETE_ZERO_LEN_ARRAY_SECTION
115 = (GOMP_MAP_FLAG_ALWAYS
116 | GOMP_MAP_FLAG_SPECIAL | 3),
117 /* OpenMP 4.1 alias for forced deallocation. */
118 GOMP_MAP_DELETE = GOMP_MAP_FORCE_DEALLOC,
119 /* Decrement usage count and deallocate if zero. */
120 GOMP_MAP_RELEASE = (GOMP_MAP_FLAG_ALWAYS
121 | GOMP_MAP_FORCE_DEALLOC),
123 /* Internal to GCC, not used in libgomp. */
124 /* Do not map, but pointer assign a pointer instead. */
125 GOMP_MAP_FIRSTPRIVATE_POINTER = (GOMP_MAP_LAST | 1)
128 #define GOMP_MAP_COPY_TO_P(X) \
129 (!((X) & GOMP_MAP_FLAG_SPECIAL) \
130 && ((X) & GOMP_MAP_FLAG_TO))
132 #define GOMP_MAP_COPY_FROM_P(X) \
133 (!((X) & GOMP_MAP_FLAG_SPECIAL) \
134 && ((X) & GOMP_MAP_FLAG_FROM))
136 #define GOMP_MAP_POINTER_P(X) \
137 ((X) == GOMP_MAP_POINTER)
139 #define GOMP_MAP_ALWAYS_TO_P(X) \
140 (((X) == GOMP_MAP_ALWAYS_TO) || ((X) == GOMP_MAP_ALWAYS_TOFROM))
142 #define GOMP_MAP_ALWAYS_FROM_P(X) \
143 (((X) == GOMP_MAP_ALWAYS_FROM) || ((X) == GOMP_MAP_ALWAYS_TOFROM))
146 /* Asynchronous behavior. Keep in sync with
147 libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_async_t. */
149 #define GOMP_ASYNC_NOVAL -1
150 #define GOMP_ASYNC_SYNC -2
153 /* Device codes. Keep in sync with
154 libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_device_t as well as
155 libgomp/libgomp-plugin.h. */
156 #define GOMP_DEVICE_NONE 0
157 #define GOMP_DEVICE_DEFAULT 1
158 #define GOMP_DEVICE_HOST 2
159 /* #define GOMP_DEVICE_HOST_NONSHM 3 removed. */
160 #define GOMP_DEVICE_NOT_HOST 4
161 #define GOMP_DEVICE_NVIDIA_PTX 5
162 #define GOMP_DEVICE_INTEL_MIC 6
164 #define GOMP_DEVICE_ICV -1
165 #define GOMP_DEVICE_HOST_FALLBACK -2
167 /* GOMP_task/GOMP_taskloop* flags argument. */
168 #define GOMP_TASK_FLAG_UNTIED (1 << 0)
169 #define GOMP_TASK_FLAG_FINAL (1 << 1)
170 #define GOMP_TASK_FLAG_MERGEABLE (1 << 2)
171 #define GOMP_TASK_FLAG_DEPEND (1 << 3)
172 #define GOMP_TASK_FLAG_PRIORITY (1 << 4)
173 #define GOMP_TASK_FLAG_UP (1 << 8)
174 #define GOMP_TASK_FLAG_GRAINSIZE (1 << 9)
175 #define GOMP_TASK_FLAG_IF (1 << 10)
176 #define GOMP_TASK_FLAG_NOGROUP (1 << 11)
178 /* GOMP_target{_41,update_41,enter_exit_data} flags argument. */
179 #define GOMP_TARGET_FLAG_NOWAIT (1 << 0)
180 #define GOMP_TARGET_FLAG_EXIT_DATA (1 << 1)
181 /* Internal to libgomp. */
182 #define GOMP_TARGET_FLAG_UPDATE (1U << 31)
184 /* Versions of libgomp and device-specific plugins. */
185 #define GOMP_VERSION 0
186 #define GOMP_VERSION_NVIDIA_PTX 1
187 #define GOMP_VERSION_INTEL_MIC 0
189 #define GOMP_VERSION_PACK(LIB, DEV) (((LIB) << 16) | (DEV))
190 #define GOMP_VERSION_LIB(PACK) (((PACK) >> 16) & 0xffff)
191 #define GOMP_VERSION_DEV(PACK) ((PACK) & 0xffff)
193 #define GOMP_DIM_GANG 0
194 #define GOMP_DIM_WORKER 1
195 #define GOMP_DIM_VECTOR 2
196 #define GOMP_DIM_MAX 3
197 #define GOMP_DIM_MASK(X) (1u << (X))
199 /* Varadic launch arguments. End of list is marked by a zero. */
200 #define GOMP_LAUNCH_DIM 1 /* Launch dimensions, op = mask */
201 #define GOMP_LAUNCH_ASYNC 2 /* Async, op = cst val if not MAX */
202 #define GOMP_LAUNCH_WAIT 3 /* Waits, op = num waits. */
203 #define GOMP_LAUNCH_CODE_SHIFT 28
204 #define GOMP_LAUNCH_DEVICE_SHIFT 16
205 #define GOMP_LAUNCH_OP_SHIFT 0
206 #define GOMP_LAUNCH_PACK(CODE,DEVICE,OP) \
207 (((CODE) << GOMP_LAUNCH_CODE_SHIFT) \
208 | ((DEVICE) << GOMP_LAUNCH_DEVICE_SHIFT) \
209 | ((OP) << GOMP_LAUNCH_OP_SHIFT))
210 #define GOMP_LAUNCH_CODE(X) (((X) >> GOMP_LAUNCH_CODE_SHIFT) & 0xf)
211 #define GOMP_LAUNCH_DEVICE(X) (((X) >> GOMP_LAUNCH_DEVICE_SHIFT) & 0xfff)
212 #define GOMP_LAUNCH_OP(X) (((X) >> GOMP_LAUNCH_OP_SHIFT) & 0xffff)
213 #define GOMP_LAUNCH_OP_MAX 0xffff
215 #endif