1 /* Pragma related interfaces.
2 Copyright (C) 1995-2015 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_C_PRAGMA_H
21 #define GCC_C_PRAGMA_H
23 #include "cpplib.h" /* For enum cpp_ttype. */
25 /* Pragma identifiers built in to the front end parsers. Identifiers
26 for ancillary handlers will follow these. */
33 PRAGMA_OACC_ENTER_DATA
,
34 PRAGMA_OACC_EXIT_DATA
,
44 PRAGMA_OMP_CANCELLATION_POINT
,
46 PRAGMA_OMP_DECLARE_REDUCTION
,
47 PRAGMA_OMP_DISTRIBUTE
,
48 PRAGMA_OMP_END_DECLARE_TARGET
,
64 PRAGMA_OMP_THREADPRIVATE
,
67 /* Top level clause to handle all Cilk Plus pragma simd clauses. */
70 /* This pragma handles setting of grainsize for a _Cilk_for. */
71 PRAGMA_CILK_GRAINSIZE
,
73 PRAGMA_GCC_PCH_PREPROCESS
,
80 /* All clauses defined by OpenACC 2.0, and OpenMP 2.5, 3.0, 3.1, 4.0 and 4.5.
81 Used internally by both C and C++ parsers. */
82 enum pragma_omp_clause
{
83 PRAGMA_OMP_CLAUSE_NONE
= 0,
85 PRAGMA_OMP_CLAUSE_ALIGNED
,
86 PRAGMA_OMP_CLAUSE_COLLAPSE
,
87 PRAGMA_OMP_CLAUSE_COPYIN
,
88 PRAGMA_OMP_CLAUSE_COPYPRIVATE
,
89 PRAGMA_OMP_CLAUSE_DEFAULT
,
90 PRAGMA_OMP_CLAUSE_DEFAULTMAP
,
91 PRAGMA_OMP_CLAUSE_DEPEND
,
92 PRAGMA_OMP_CLAUSE_DEVICE
,
93 PRAGMA_OMP_CLAUSE_DIST_SCHEDULE
,
94 PRAGMA_OMP_CLAUSE_FINAL
,
95 PRAGMA_OMP_CLAUSE_FIRSTPRIVATE
,
96 PRAGMA_OMP_CLAUSE_FOR
,
97 PRAGMA_OMP_CLAUSE_FROM
,
98 PRAGMA_OMP_CLAUSE_GRAINSIZE
,
99 PRAGMA_OMP_CLAUSE_HINT
,
100 PRAGMA_OMP_CLAUSE_IF
,
101 PRAGMA_OMP_CLAUSE_INBRANCH
,
102 PRAGMA_OMP_CLAUSE_IS_DEVICE_PTR
,
103 PRAGMA_OMP_CLAUSE_LASTPRIVATE
,
104 PRAGMA_OMP_CLAUSE_LINEAR
,
105 PRAGMA_OMP_CLAUSE_LINK
,
106 PRAGMA_OMP_CLAUSE_MAP
,
107 PRAGMA_OMP_CLAUSE_MERGEABLE
,
108 PRAGMA_OMP_CLAUSE_NOGROUP
,
109 PRAGMA_OMP_CLAUSE_NOTINBRANCH
,
110 PRAGMA_OMP_CLAUSE_NOWAIT
,
111 PRAGMA_OMP_CLAUSE_NUM_TASKS
,
112 PRAGMA_OMP_CLAUSE_NUM_TEAMS
,
113 PRAGMA_OMP_CLAUSE_NUM_THREADS
,
114 PRAGMA_OMP_CLAUSE_ORDERED
,
115 PRAGMA_OMP_CLAUSE_PARALLEL
,
116 PRAGMA_OMP_CLAUSE_PRIORITY
,
117 PRAGMA_OMP_CLAUSE_PRIVATE
,
118 PRAGMA_OMP_CLAUSE_PROC_BIND
,
119 PRAGMA_OMP_CLAUSE_REDUCTION
,
120 PRAGMA_OMP_CLAUSE_SAFELEN
,
121 PRAGMA_OMP_CLAUSE_SCHEDULE
,
122 PRAGMA_OMP_CLAUSE_SECTIONS
,
123 PRAGMA_OMP_CLAUSE_SHARED
,
124 PRAGMA_OMP_CLAUSE_SIMD
,
125 PRAGMA_OMP_CLAUSE_SIMDLEN
,
126 PRAGMA_OMP_CLAUSE_TASKGROUP
,
127 PRAGMA_OMP_CLAUSE_THREAD_LIMIT
,
128 PRAGMA_OMP_CLAUSE_THREADS
,
129 PRAGMA_OMP_CLAUSE_TO
,
130 PRAGMA_OMP_CLAUSE_UNIFORM
,
131 PRAGMA_OMP_CLAUSE_UNTIED
,
132 PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR
,
134 /* Clauses for Cilk Plus SIMD-enabled function. */
135 PRAGMA_CILK_CLAUSE_NOMASK
,
136 PRAGMA_CILK_CLAUSE_MASK
,
137 PRAGMA_CILK_CLAUSE_VECTORLENGTH
,
138 PRAGMA_CILK_CLAUSE_NONE
= PRAGMA_OMP_CLAUSE_NONE
,
139 PRAGMA_CILK_CLAUSE_LINEAR
= PRAGMA_OMP_CLAUSE_LINEAR
,
140 PRAGMA_CILK_CLAUSE_PRIVATE
= PRAGMA_OMP_CLAUSE_PRIVATE
,
141 PRAGMA_CILK_CLAUSE_FIRSTPRIVATE
= PRAGMA_OMP_CLAUSE_FIRSTPRIVATE
,
142 PRAGMA_CILK_CLAUSE_LASTPRIVATE
= PRAGMA_OMP_CLAUSE_LASTPRIVATE
,
143 PRAGMA_CILK_CLAUSE_REDUCTION
= PRAGMA_OMP_CLAUSE_REDUCTION
,
144 PRAGMA_CILK_CLAUSE_UNIFORM
= PRAGMA_OMP_CLAUSE_UNIFORM
,
146 /* Clauses for OpenACC. */
147 PRAGMA_OACC_CLAUSE_ASYNC
= PRAGMA_CILK_CLAUSE_VECTORLENGTH
+ 1,
148 PRAGMA_OACC_CLAUSE_AUTO
,
149 PRAGMA_OACC_CLAUSE_COPY
,
150 PRAGMA_OACC_CLAUSE_COPYOUT
,
151 PRAGMA_OACC_CLAUSE_CREATE
,
152 PRAGMA_OACC_CLAUSE_DELETE
,
153 PRAGMA_OACC_CLAUSE_DEVICEPTR
,
154 PRAGMA_OACC_CLAUSE_GANG
,
155 PRAGMA_OACC_CLAUSE_HOST
,
156 PRAGMA_OACC_CLAUSE_INDEPENDENT
,
157 PRAGMA_OACC_CLAUSE_NUM_GANGS
,
158 PRAGMA_OACC_CLAUSE_NUM_WORKERS
,
159 PRAGMA_OACC_CLAUSE_PRESENT
,
160 PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY
,
161 PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN
,
162 PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT
,
163 PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE
,
164 PRAGMA_OACC_CLAUSE_SELF
,
165 PRAGMA_OACC_CLAUSE_SEQ
,
166 PRAGMA_OACC_CLAUSE_TILE
,
167 PRAGMA_OACC_CLAUSE_VECTOR
,
168 PRAGMA_OACC_CLAUSE_VECTOR_LENGTH
,
169 PRAGMA_OACC_CLAUSE_WAIT
,
170 PRAGMA_OACC_CLAUSE_WORKER
,
171 PRAGMA_OACC_CLAUSE_COLLAPSE
= PRAGMA_OMP_CLAUSE_COLLAPSE
,
172 PRAGMA_OACC_CLAUSE_COPYIN
= PRAGMA_OMP_CLAUSE_COPYIN
,
173 PRAGMA_OACC_CLAUSE_DEVICE
= PRAGMA_OMP_CLAUSE_DEVICE
,
174 PRAGMA_OACC_CLAUSE_DEFAULT
= PRAGMA_OMP_CLAUSE_DEFAULT
,
175 PRAGMA_OACC_CLAUSE_FIRSTPRIVATE
= PRAGMA_OMP_CLAUSE_FIRSTPRIVATE
,
176 PRAGMA_OACC_CLAUSE_IF
= PRAGMA_OMP_CLAUSE_IF
,
177 PRAGMA_OACC_CLAUSE_PRIVATE
= PRAGMA_OMP_CLAUSE_PRIVATE
,
178 PRAGMA_OACC_CLAUSE_REDUCTION
= PRAGMA_OMP_CLAUSE_REDUCTION
181 extern struct cpp_reader
* parse_in
;
183 /* It's safe to always leave visibility pragma enabled as if
184 visibility is not supported on the host OS platform the
185 statements are ignored. */
186 extern void push_visibility (const char *, int);
187 extern bool pop_visibility (int);
189 extern void init_pragma (void);
191 /* Front-end wrappers for pragma registration. */
192 typedef void (*pragma_handler_1arg
)(struct cpp_reader
*);
193 /* A second pragma handler, which adds a void * argument allowing to pass extra
194 data to the handler. */
195 typedef void (*pragma_handler_2arg
)(struct cpp_reader
*, void *);
197 /* This union allows to abstract the different handlers. */
198 union gen_pragma_handler
{
199 pragma_handler_1arg handler_1arg
;
200 pragma_handler_2arg handler_2arg
;
202 /* Internally used to keep the data of the handler. */
203 struct internal_pragma_handler
{
204 union gen_pragma_handler handler
;
205 /* Permits to know if handler is a pragma_handler_1arg (extra_data is false)
206 or a pragma_handler_2arg (extra_data is true). */
208 /* A data field which can be used when extra_data is true. */
212 extern void c_register_pragma (const char *space
, const char *name
,
213 pragma_handler_1arg handler
);
214 extern void c_register_pragma_with_data (const char *space
, const char *name
,
215 pragma_handler_2arg handler
,
218 extern void c_register_pragma_with_expansion (const char *space
,
220 pragma_handler_1arg handler
);
221 extern void c_register_pragma_with_expansion_and_data (const char *space
,
223 pragma_handler_2arg handler
,
225 extern void c_invoke_pragma_handler (unsigned int);
227 extern void maybe_apply_pragma_weak (tree
);
228 extern void maybe_apply_pending_pragma_weaks (void);
229 extern tree
maybe_apply_renaming_pragma (tree
, tree
);
230 extern void maybe_apply_pragma_scalar_storage_order (tree
);
231 extern void add_to_renaming_pragma_list (tree
, tree
);
233 extern enum cpp_ttype
pragma_lex (tree
*, location_t
*loc
= NULL
);
235 /* Flags for use with c_lex_with_flags. The values here were picked
236 so that 0 means to translate and join strings. */
237 #define C_LEX_STRING_NO_TRANSLATE 1 /* Do not lex strings into
238 execution character set. */
239 #define C_LEX_STRING_NO_JOIN 2 /* Do not concatenate strings
240 nor translate them into execution
243 /* This is not actually available to pragma parsers. It's merely a
244 convenient location to declare this function for c-lex, after
245 having enum cpp_ttype declared. */
246 extern enum cpp_ttype
c_lex_with_flags (tree
*, location_t
*, unsigned char *,
249 extern void c_pp_lookup_pragma (unsigned int, const char **, const char **);
251 extern GTY(()) tree pragma_extern_prefix
;
253 #endif /* GCC_C_PRAGMA_H */