]>
Commit | Line | Data |
---|---|---|
75a70cf9 | 1 | /* Gimple IR definitions. |
2 | ||
fbd26352 | 3 | Copyright (C) 2007-2019 Free Software Foundation, Inc. |
75a70cf9 | 4 | Contributed by Aldy Hernandez <aldyh@redhat.com> |
5 | ||
6 | This file is part of GCC. | |
7 | ||
8 | GCC is free software; you can redistribute it and/or modify it under | |
9 | the terms of the GNU General Public License as published by the Free | |
10 | Software Foundation; either version 3, or (at your option) any later | |
11 | version. | |
12 | ||
13 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
14 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 | for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GCC; see the file COPYING3. If not see | |
20 | <http://www.gnu.org/licenses/>. */ | |
21 | ||
22 | #ifndef GCC_GIMPLE_H | |
23 | #define GCC_GIMPLE_H | |
24 | ||
9ef16211 | 25 | #include "tree-ssa-alias.h" |
26 | #include "gimple-expr.h" | |
27 | ||
42acab1c | 28 | typedef gimple *gimple_seq_node; |
bdba2bf3 | 29 | |
75a70cf9 | 30 | enum gimple_code { |
31 | #define DEFGSCODE(SYM, STRING, STRUCT) SYM, | |
32 | #include "gimple.def" | |
33 | #undef DEFGSCODE | |
34 | LAST_AND_UNUSED_GIMPLE_CODE | |
35 | }; | |
36 | ||
37 | extern const char *const gimple_code_name[]; | |
38 | extern const unsigned char gimple_rhs_class_table[]; | |
39 | ||
2ee9f21a | 40 | /* Strip the outermost pointer, from tr1/type_traits. */ |
41 | template<typename T> struct remove_pointer { typedef T type; }; | |
42 | template<typename T> struct remove_pointer<T *> { typedef T type; }; | |
43 | ||
75a70cf9 | 44 | /* Error out if a gimple tuple is addressed incorrectly. */ |
45 | #if defined ENABLE_GIMPLE_CHECKING | |
1e720c36 | 46 | #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR) |
42acab1c | 47 | extern void gimple_check_failed (const gimple *, const char *, int, \ |
75a70cf9 | 48 | const char *, enum gimple_code, \ |
597052b6 | 49 | enum tree_code) ATTRIBUTE_NORETURN \ |
50 | ATTRIBUTE_COLD; | |
75a70cf9 | 51 | |
52 | #define GIMPLE_CHECK(GS, CODE) \ | |
53 | do { \ | |
42acab1c | 54 | const gimple *__gs = (GS); \ |
75a70cf9 | 55 | if (gimple_code (__gs) != (CODE)) \ |
56 | gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \ | |
b9c74b4d | 57 | (CODE), ERROR_MARK); \ |
75a70cf9 | 58 | } while (0) |
2ee9f21a | 59 | template <typename T> |
60 | static inline T | |
42acab1c | 61 | GIMPLE_CHECK2(const gimple *gs, |
2ee9f21a | 62 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) |
63 | const char *file = __builtin_FILE (), | |
64 | int line = __builtin_LINE (), | |
65 | const char *fun = __builtin_FUNCTION ()) | |
66 | #else | |
67 | const char *file = __FILE__, | |
68 | int line = __LINE__, | |
69 | const char *fun = NULL) | |
70 | #endif | |
71 | { | |
72 | T ret = dyn_cast <T> (gs); | |
73 | if (!ret) | |
74 | gimple_check_failed (gs, file, line, fun, | |
75 | remove_pointer<T>::type::code_, ERROR_MARK); | |
76 | return ret; | |
77 | } | |
78 | template <typename T> | |
79 | static inline T | |
42acab1c | 80 | GIMPLE_CHECK2(gimple *gs, |
2ee9f21a | 81 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) |
82 | const char *file = __builtin_FILE (), | |
83 | int line = __builtin_LINE (), | |
84 | const char *fun = __builtin_FUNCTION ()) | |
85 | #else | |
86 | const char *file = __FILE__, | |
87 | int line = __LINE__, | |
88 | const char *fun = NULL) | |
89 | #endif | |
90 | { | |
91 | T ret = dyn_cast <T> (gs); | |
92 | if (!ret) | |
93 | gimple_check_failed (gs, file, line, fun, | |
94 | remove_pointer<T>::type::code_, ERROR_MARK); | |
95 | return ret; | |
96 | } | |
75a70cf9 | 97 | #else /* not ENABLE_GIMPLE_CHECKING */ |
1e720c36 | 98 | #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR))) |
75a70cf9 | 99 | #define GIMPLE_CHECK(GS, CODE) (void)0 |
2ee9f21a | 100 | template <typename T> |
101 | static inline T | |
42acab1c | 102 | GIMPLE_CHECK2(gimple *gs) |
2ee9f21a | 103 | { |
104 | return as_a <T> (gs); | |
105 | } | |
106 | template <typename T> | |
107 | static inline T | |
42acab1c | 108 | GIMPLE_CHECK2(const gimple *gs) |
2ee9f21a | 109 | { |
110 | return as_a <T> (gs); | |
111 | } | |
75a70cf9 | 112 | #endif |
113 | ||
114 | /* Class of GIMPLE expressions suitable for the RHS of assignments. See | |
115 | get_gimple_rhs_class. */ | |
116 | enum gimple_rhs_class | |
117 | { | |
118 | GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */ | |
00f4f705 | 119 | GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */ |
75a70cf9 | 120 | GIMPLE_BINARY_RHS, /* The expression is a binary operation. */ |
121 | GIMPLE_UNARY_RHS, /* The expression is a unary operation. */ | |
122 | GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA | |
123 | name, a _DECL, a _REF, etc. */ | |
124 | }; | |
125 | ||
126 | /* Specific flags for individual GIMPLE statements. These flags are | |
ab8c4a5e | 127 | always stored in gimple.subcode and they may only be |
d4f73cba | 128 | defined for statement codes that do not use subcodes. |
75a70cf9 | 129 | |
130 | Values for the masks can overlap as long as the overlapping values | |
131 | are never used in the same statement class. | |
132 | ||
133 | The maximum mask value that can be defined is 1 << 15 (i.e., each | |
134 | statement code can hold up to 16 bitflags). | |
135 | ||
136 | Keep this list sorted. */ | |
137 | enum gf_mask { | |
138 | GF_ASM_INPUT = 1 << 0, | |
139 | GF_ASM_VOLATILE = 1 << 1, | |
6de46ad5 | 140 | GF_ASM_INLINE = 1 << 2, |
f883da84 | 141 | GF_CALL_FROM_THUNK = 1 << 0, |
142 | GF_CALL_RETURN_SLOT_OPT = 1 << 1, | |
143 | GF_CALL_TAILCALL = 1 << 2, | |
144 | GF_CALL_VA_ARG_PACK = 1 << 3, | |
145 | GF_CALL_NOTHROW = 1 << 4, | |
146 | GF_CALL_ALLOCA_FOR_VAR = 1 << 5, | |
147 | GF_CALL_INTERNAL = 1 << 6, | |
c1e02247 | 148 | GF_CALL_CTRL_ALTERING = 1 << 7, |
b4a61e77 | 149 | GF_CALL_MUST_TAIL_CALL = 1 << 9, |
a27e3913 | 150 | GF_CALL_BY_DESCRIPTOR = 1 << 10, |
3c0f15b4 | 151 | GF_CALL_NOCF_CHECK = 1 << 11, |
75a70cf9 | 152 | GF_OMP_PARALLEL_COMBINED = 1 << 0, |
56686608 | 153 | GF_OMP_PARALLEL_GRID_PHONY = 1 << 1, |
43895be5 | 154 | GF_OMP_TASK_TASKLOOP = 1 << 0, |
7e5a76c8 | 155 | GF_OMP_TASK_TASKWAIT = 1 << 1, |
0076df39 | 156 | GF_OMP_FOR_KIND_MASK = (1 << 3) - 1, |
271fe9cf | 157 | GF_OMP_FOR_KIND_FOR = 0, |
158 | GF_OMP_FOR_KIND_DISTRIBUTE = 1, | |
43895be5 | 159 | GF_OMP_FOR_KIND_TASKLOOP = 2, |
43895be5 | 160 | GF_OMP_FOR_KIND_OACC_LOOP = 4, |
0076df39 | 161 | GF_OMP_FOR_KIND_GRID_LOOP = 5, |
162 | GF_OMP_FOR_KIND_SIMD = 6, | |
163 | GF_OMP_FOR_COMBINED = 1 << 3, | |
164 | GF_OMP_FOR_COMBINED_INTO = 1 << 4, | |
da80a82f | 165 | /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop |
166 | statements. */ | |
0076df39 | 167 | GF_OMP_FOR_GRID_PHONY = 1 << 5, |
da80a82f | 168 | /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP |
169 | loop statements. */ | |
0076df39 | 170 | GF_OMP_FOR_GRID_INTRA_GROUP = 1 << 5, |
171 | GF_OMP_FOR_GRID_GROUP_ITER = 1 << 6, | |
43895be5 | 172 | GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1, |
271fe9cf | 173 | GF_OMP_TARGET_KIND_REGION = 0, |
174 | GF_OMP_TARGET_KIND_DATA = 1, | |
175 | GF_OMP_TARGET_KIND_UPDATE = 2, | |
43895be5 | 176 | GF_OMP_TARGET_KIND_ENTER_DATA = 3, |
177 | GF_OMP_TARGET_KIND_EXIT_DATA = 4, | |
178 | GF_OMP_TARGET_KIND_OACC_PARALLEL = 5, | |
179 | GF_OMP_TARGET_KIND_OACC_KERNELS = 6, | |
180 | GF_OMP_TARGET_KIND_OACC_DATA = 7, | |
181 | GF_OMP_TARGET_KIND_OACC_UPDATE = 8, | |
182 | GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9, | |
2fc5e987 | 183 | GF_OMP_TARGET_KIND_OACC_DECLARE = 10, |
571b3486 | 184 | GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11, |
56686608 | 185 | GF_OMP_TEAMS_GRID_PHONY = 1 << 0, |
7e5a76c8 | 186 | GF_OMP_TEAMS_HOST = 1 << 1, |
75a70cf9 | 187 | |
188 | /* True on an GIMPLE_OMP_RETURN statement if the return does not require | |
189 | a thread synchronization via some sort of barrier. The exact barrier | |
190 | that would otherwise be emitted is dependent on the OMP statement with | |
191 | which this return is associated. */ | |
192 | GF_OMP_RETURN_NOWAIT = 1 << 0, | |
193 | ||
194 | GF_OMP_SECTION_LAST = 1 << 0, | |
7e5a76c8 | 195 | GF_OMP_ATOMIC_MEMORY_ORDER = (1 << 3) - 1, |
196 | GF_OMP_ATOMIC_NEED_VALUE = 1 << 3, | |
75a70cf9 | 197 | GF_PREDICT_TAKEN = 1 << 15 |
198 | }; | |
199 | ||
c64f38bf | 200 | /* This subcode tells apart different kinds of stmts that are not used |
201 | for codegen, but rather to retain debug information. */ | |
9845d120 | 202 | enum gimple_debug_subcode { |
841424cc | 203 | GIMPLE_DEBUG_BIND = 0, |
c64f38bf | 204 | GIMPLE_DEBUG_SOURCE_BIND = 1, |
8f6f3638 | 205 | GIMPLE_DEBUG_BEGIN_STMT = 2, |
206 | GIMPLE_DEBUG_INLINE_ENTRY = 3 | |
9845d120 | 207 | }; |
208 | ||
75a70cf9 | 209 | /* Masks for selecting a pass local flag (PLF) to work on. These |
210 | masks are used by gimple_set_plf and gimple_plf. */ | |
211 | enum plf_mask { | |
212 | GF_PLF_1 = 1 << 0, | |
213 | GF_PLF_2 = 1 << 1 | |
214 | }; | |
215 | ||
75a70cf9 | 216 | /* Data structure definitions for GIMPLE tuples. NOTE: word markers |
217 | are for 64 bit hosts. */ | |
218 | ||
de6bd75e | 219 | struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"), |
220 | chain_next ("%h.next"), variable_size)) | |
42acab1c | 221 | gimple |
de6bd75e | 222 | { |
75a70cf9 | 223 | /* [ WORD 1 ] |
224 | Main identifying code for a tuple. */ | |
225 | ENUM_BITFIELD(gimple_code) code : 8; | |
226 | ||
227 | /* Nonzero if a warning should not be emitted on this tuple. */ | |
228 | unsigned int no_warning : 1; | |
229 | ||
230 | /* Nonzero if this tuple has been visited. Passes are responsible | |
231 | for clearing this bit before using it. */ | |
232 | unsigned int visited : 1; | |
233 | ||
234 | /* Nonzero if this tuple represents a non-temporal move. */ | |
235 | unsigned int nontemporal_move : 1; | |
236 | ||
237 | /* Pass local flags. These flags are free for any pass to use as | |
238 | they see fit. Passes should not assume that these flags contain | |
239 | any useful value when the pass starts. Any initial state that | |
240 | the pass requires should be set on entry to the pass. See | |
241 | gimple_set_plf and gimple_plf for usage. */ | |
242 | unsigned int plf : 2; | |
243 | ||
244 | /* Nonzero if this statement has been modified and needs to have its | |
245 | operands rescanned. */ | |
246 | unsigned modified : 1; | |
247 | ||
248 | /* Nonzero if this statement contains volatile operands. */ | |
249 | unsigned has_volatile_ops : 1; | |
250 | ||
7e30ab00 | 251 | /* Padding to get subcode to 16 bit alignment. */ |
252 | unsigned pad : 1; | |
253 | ||
75a70cf9 | 254 | /* The SUBCODE field can be used for tuple-specific flags for tuples |
255 | that do not require subcodes. Note that SUBCODE should be at | |
256 | least as wide as tree codes, as several tuples store tree codes | |
257 | in there. */ | |
258 | unsigned int subcode : 16; | |
259 | ||
51e52fe3 | 260 | /* UID of this statement. This is used by passes that want to |
261 | assign IDs to statements. It must be assigned and used by each | |
262 | pass. By default it should be assumed to contain garbage. */ | |
75a70cf9 | 263 | unsigned uid; |
264 | ||
265 | /* [ WORD 2 ] | |
266 | Locus information for debug info. */ | |
267 | location_t location; | |
268 | ||
269 | /* Number of operands in this tuple. */ | |
270 | unsigned num_ops; | |
271 | ||
272 | /* [ WORD 3 ] | |
273 | Basic block holding this statement. */ | |
161dfa6e | 274 | basic_block bb; |
75a70cf9 | 275 | |
e3a19533 | 276 | /* [ WORD 4-5 ] |
277 | Linked lists of gimple statements. The next pointers form | |
278 | a NULL terminated list, the prev pointers are a cyclic list. | |
279 | A gimple statement is hence also a double-ended list of | |
280 | statements, with the pointer itself being the first element, | |
281 | and the prev pointer being the last. */ | |
42acab1c | 282 | gimple *next; |
283 | gimple *GTY((skip)) prev; | |
75a70cf9 | 284 | }; |
285 | ||
286 | ||
287 | /* Base structure for tuples with operands. */ | |
288 | ||
de6bd75e | 289 | /* This gimple subclass has no tag value. */ |
290 | struct GTY(()) | |
42acab1c | 291 | gimple_statement_with_ops_base : public gimple |
75a70cf9 | 292 | { |
de6bd75e | 293 | /* [ WORD 1-6 ] : base class */ |
75a70cf9 | 294 | |
5bb6976b | 295 | /* [ WORD 7 ] |
75a70cf9 | 296 | SSA operand vectors. NOTE: It should be possible to |
297 | amalgamate these vectors with the operand vector OP. However, | |
298 | the SSA operand vectors are organized differently and contain | |
299 | more information (like immediate use chaining). */ | |
75a70cf9 | 300 | struct use_optype_d GTY((skip (""))) *use_ops; |
301 | }; | |
302 | ||
303 | ||
304 | /* Statements that take register operands. */ | |
305 | ||
de6bd75e | 306 | struct GTY((tag("GSS_WITH_OPS"))) |
307 | gimple_statement_with_ops : public gimple_statement_with_ops_base | |
75a70cf9 | 308 | { |
de6bd75e | 309 | /* [ WORD 1-7 ] : base class */ |
75a70cf9 | 310 | |
5bb6976b | 311 | /* [ WORD 8 ] |
75a70cf9 | 312 | Operand vector. NOTE! This must always be the last field |
313 | of this structure. In particular, this means that this | |
314 | structure cannot be embedded inside another one. */ | |
de6bd75e | 315 | tree GTY((length ("%h.num_ops"))) op[1]; |
75a70cf9 | 316 | }; |
317 | ||
318 | ||
319 | /* Base for statements that take both memory and register operands. */ | |
320 | ||
de6bd75e | 321 | struct GTY((tag("GSS_WITH_MEM_OPS_BASE"))) |
322 | gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base | |
75a70cf9 | 323 | { |
de6bd75e | 324 | /* [ WORD 1-7 ] : base class */ |
75a70cf9 | 325 | |
5bb6976b | 326 | /* [ WORD 8-9 ] |
dd277d48 | 327 | Virtual operands for this statement. The GC will pick them |
328 | up via the ssa_names array. */ | |
329 | tree GTY((skip (""))) vdef; | |
330 | tree GTY((skip (""))) vuse; | |
75a70cf9 | 331 | }; |
332 | ||
333 | ||
334 | /* Statements that take both memory and register operands. */ | |
335 | ||
de6bd75e | 336 | struct GTY((tag("GSS_WITH_MEM_OPS"))) |
337 | gimple_statement_with_memory_ops : | |
338 | public gimple_statement_with_memory_ops_base | |
75a70cf9 | 339 | { |
de6bd75e | 340 | /* [ WORD 1-9 ] : base class */ |
75a70cf9 | 341 | |
5bb6976b | 342 | /* [ WORD 10 ] |
75a70cf9 | 343 | Operand vector. NOTE! This must always be the last field |
344 | of this structure. In particular, this means that this | |
345 | structure cannot be embedded inside another one. */ | |
de6bd75e | 346 | tree GTY((length ("%h.num_ops"))) op[1]; |
75a70cf9 | 347 | }; |
348 | ||
349 | ||
cb245216 | 350 | /* Call statements that take both memory and register operands. */ |
351 | ||
de6bd75e | 352 | struct GTY((tag("GSS_CALL"))) |
1a91d914 | 353 | gcall : public gimple_statement_with_memory_ops_base |
cb245216 | 354 | { |
de6bd75e | 355 | /* [ WORD 1-9 ] : base class */ |
cb245216 | 356 | |
5bb6976b | 357 | /* [ WORD 10-13 ] */ |
cb245216 | 358 | struct pt_solution call_used; |
359 | struct pt_solution call_clobbered; | |
360 | ||
5bb6976b | 361 | /* [ WORD 14 ] */ |
de6bd75e | 362 | union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) { |
fb049fba | 363 | tree GTY ((tag ("0"))) fntype; |
364 | enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn; | |
365 | } u; | |
39f59e65 | 366 | |
5bb6976b | 367 | /* [ WORD 15 ] |
cb245216 | 368 | Operand vector. NOTE! This must always be the last field |
369 | of this structure. In particular, this means that this | |
370 | structure cannot be embedded inside another one. */ | |
de6bd75e | 371 | tree GTY((length ("%h.num_ops"))) op[1]; |
31d3df5c | 372 | |
373 | static const enum gimple_code code_ = GIMPLE_CALL; | |
cb245216 | 374 | }; |
375 | ||
376 | ||
ca4c3545 | 377 | /* OMP statements. */ |
75a70cf9 | 378 | |
de6bd75e | 379 | struct GTY((tag("GSS_OMP"))) |
42acab1c | 380 | gimple_statement_omp : public gimple |
de6bd75e | 381 | { |
382 | /* [ WORD 1-6 ] : base class */ | |
75a70cf9 | 383 | |
e3a19533 | 384 | /* [ WORD 7 ] */ |
75a70cf9 | 385 | gimple_seq body; |
386 | }; | |
387 | ||
388 | ||
389 | /* GIMPLE_BIND */ | |
390 | ||
de6bd75e | 391 | struct GTY((tag("GSS_BIND"))) |
42acab1c | 392 | gbind : public gimple |
de6bd75e | 393 | { |
394 | /* [ WORD 1-6 ] : base class */ | |
75a70cf9 | 395 | |
e3a19533 | 396 | /* [ WORD 7 ] |
75a70cf9 | 397 | Variables declared in this scope. */ |
398 | tree vars; | |
399 | ||
e3a19533 | 400 | /* [ WORD 8 ] |
ab8c4a5e | 401 | This is different than the BLOCK field in gimple, |
75a70cf9 | 402 | which is analogous to TREE_BLOCK (i.e., the lexical block holding |
403 | this statement). This field is the equivalent of BIND_EXPR_BLOCK | |
404 | in tree land (i.e., the lexical scope defined by this bind). See | |
405 | gimple-low.c. */ | |
406 | tree block; | |
407 | ||
e3a19533 | 408 | /* [ WORD 9 ] */ |
75a70cf9 | 409 | gimple_seq body; |
410 | }; | |
411 | ||
412 | ||
413 | /* GIMPLE_CATCH */ | |
414 | ||
de6bd75e | 415 | struct GTY((tag("GSS_CATCH"))) |
42acab1c | 416 | gcatch : public gimple |
de6bd75e | 417 | { |
418 | /* [ WORD 1-6 ] : base class */ | |
75a70cf9 | 419 | |
e3a19533 | 420 | /* [ WORD 7 ] */ |
75a70cf9 | 421 | tree types; |
422 | ||
e3a19533 | 423 | /* [ WORD 8 ] */ |
75a70cf9 | 424 | gimple_seq handler; |
425 | }; | |
426 | ||
427 | ||
428 | /* GIMPLE_EH_FILTER */ | |
429 | ||
de6bd75e | 430 | struct GTY((tag("GSS_EH_FILTER"))) |
42acab1c | 431 | geh_filter : public gimple |
de6bd75e | 432 | { |
433 | /* [ WORD 1-6 ] : base class */ | |
75a70cf9 | 434 | |
e3a19533 | 435 | /* [ WORD 7 ] |
75a70cf9 | 436 | Filter types. */ |
437 | tree types; | |
438 | ||
e3a19533 | 439 | /* [ WORD 8 ] |
75a70cf9 | 440 | Failure actions. */ |
441 | gimple_seq failure; | |
442 | }; | |
443 | ||
4c0315d0 | 444 | /* GIMPLE_EH_ELSE */ |
445 | ||
de6bd75e | 446 | struct GTY((tag("GSS_EH_ELSE"))) |
42acab1c | 447 | geh_else : public gimple |
de6bd75e | 448 | { |
449 | /* [ WORD 1-6 ] : base class */ | |
4c0315d0 | 450 | |
e3a19533 | 451 | /* [ WORD 7,8 ] */ |
4c0315d0 | 452 | gimple_seq n_body, e_body; |
453 | }; | |
75a70cf9 | 454 | |
e38def9c | 455 | /* GIMPLE_EH_MUST_NOT_THROW */ |
456 | ||
de6bd75e | 457 | struct GTY((tag("GSS_EH_MNT"))) |
42acab1c | 458 | geh_mnt : public gimple |
de6bd75e | 459 | { |
460 | /* [ WORD 1-6 ] : base class */ | |
e38def9c | 461 | |
e3a19533 | 462 | /* [ WORD 7 ] Abort function decl. */ |
e38def9c | 463 | tree fndecl; |
464 | }; | |
465 | ||
75a70cf9 | 466 | /* GIMPLE_PHI */ |
467 | ||
de6bd75e | 468 | struct GTY((tag("GSS_PHI"))) |
42acab1c | 469 | gphi : public gimple |
de6bd75e | 470 | { |
471 | /* [ WORD 1-6 ] : base class */ | |
75a70cf9 | 472 | |
e3a19533 | 473 | /* [ WORD 7 ] */ |
75a70cf9 | 474 | unsigned capacity; |
475 | unsigned nargs; | |
476 | ||
e3a19533 | 477 | /* [ WORD 8 ] */ |
75a70cf9 | 478 | tree result; |
479 | ||
e3a19533 | 480 | /* [ WORD 9 ] */ |
75a70cf9 | 481 | struct phi_arg_d GTY ((length ("%h.nargs"))) args[1]; |
482 | }; | |
483 | ||
484 | ||
e38def9c | 485 | /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */ |
75a70cf9 | 486 | |
de6bd75e | 487 | struct GTY((tag("GSS_EH_CTRL"))) |
42acab1c | 488 | gimple_statement_eh_ctrl : public gimple |
e38def9c | 489 | { |
de6bd75e | 490 | /* [ WORD 1-6 ] : base class */ |
75a70cf9 | 491 | |
e3a19533 | 492 | /* [ WORD 7 ] |
75a70cf9 | 493 | Exception region number. */ |
494 | int region; | |
495 | }; | |
496 | ||
a9035320 | 497 | struct GTY((tag("GSS_EH_CTRL"))) |
1a91d914 | 498 | gresx : public gimple_statement_eh_ctrl |
a9035320 | 499 | { |
500 | /* No extra fields; adds invariant: | |
501 | stmt->code == GIMPLE_RESX. */ | |
502 | }; | |
503 | ||
504 | struct GTY((tag("GSS_EH_CTRL"))) | |
1a91d914 | 505 | geh_dispatch : public gimple_statement_eh_ctrl |
a9035320 | 506 | { |
507 | /* No extra fields; adds invariant: | |
508 | stmt->code == GIMPLE_EH_DISPATH. */ | |
509 | }; | |
510 | ||
75a70cf9 | 511 | |
512 | /* GIMPLE_TRY */ | |
513 | ||
de6bd75e | 514 | struct GTY((tag("GSS_TRY"))) |
42acab1c | 515 | gtry : public gimple |
de6bd75e | 516 | { |
517 | /* [ WORD 1-6 ] : base class */ | |
75a70cf9 | 518 | |
e3a19533 | 519 | /* [ WORD 7 ] |
75a70cf9 | 520 | Expression to evaluate. */ |
521 | gimple_seq eval; | |
522 | ||
e3a19533 | 523 | /* [ WORD 8 ] |
75a70cf9 | 524 | Cleanup expression. */ |
525 | gimple_seq cleanup; | |
526 | }; | |
527 | ||
528 | /* Kind of GIMPLE_TRY statements. */ | |
529 | enum gimple_try_flags | |
530 | { | |
531 | /* A try/catch. */ | |
532 | GIMPLE_TRY_CATCH = 1 << 0, | |
533 | ||
534 | /* A try/finally. */ | |
535 | GIMPLE_TRY_FINALLY = 1 << 1, | |
536 | GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY, | |
537 | ||
538 | /* Analogous to TRY_CATCH_IS_CLEANUP. */ | |
539 | GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2 | |
540 | }; | |
541 | ||
542 | /* GIMPLE_WITH_CLEANUP_EXPR */ | |
543 | ||
de6bd75e | 544 | struct GTY((tag("GSS_WCE"))) |
42acab1c | 545 | gimple_statement_wce : public gimple |
de6bd75e | 546 | { |
547 | /* [ WORD 1-6 ] : base class */ | |
75a70cf9 | 548 | |
549 | /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be | |
550 | executed if an exception is thrown, not on normal exit of its | |
551 | scope. This flag is analogous to the CLEANUP_EH_ONLY flag | |
552 | in TARGET_EXPRs. */ | |
553 | ||
e3a19533 | 554 | /* [ WORD 7 ] |
75a70cf9 | 555 | Cleanup expression. */ |
556 | gimple_seq cleanup; | |
557 | }; | |
558 | ||
559 | ||
560 | /* GIMPLE_ASM */ | |
561 | ||
de6bd75e | 562 | struct GTY((tag("GSS_ASM"))) |
1a91d914 | 563 | gasm : public gimple_statement_with_memory_ops_base |
75a70cf9 | 564 | { |
de6bd75e | 565 | /* [ WORD 1-9 ] : base class */ |
75a70cf9 | 566 | |
5bb6976b | 567 | /* [ WORD 10 ] |
75a70cf9 | 568 | __asm__ statement. */ |
569 | const char *string; | |
570 | ||
5bb6976b | 571 | /* [ WORD 11 ] |
78f55ca8 | 572 | Number of inputs, outputs, clobbers, labels. */ |
75a70cf9 | 573 | unsigned char ni; |
574 | unsigned char no; | |
78f55ca8 | 575 | unsigned char nc; |
576 | unsigned char nl; | |
75a70cf9 | 577 | |
5bb6976b | 578 | /* [ WORD 12 ] |
75a70cf9 | 579 | Operand vector. NOTE! This must always be the last field |
580 | of this structure. In particular, this means that this | |
581 | structure cannot be embedded inside another one. */ | |
de6bd75e | 582 | tree GTY((length ("%h.num_ops"))) op[1]; |
75a70cf9 | 583 | }; |
584 | ||
585 | /* GIMPLE_OMP_CRITICAL */ | |
586 | ||
de6bd75e | 587 | struct GTY((tag("GSS_OMP_CRITICAL"))) |
1a91d914 | 588 | gomp_critical : public gimple_statement_omp |
de6bd75e | 589 | { |
590 | /* [ WORD 1-7 ] : base class */ | |
75a70cf9 | 591 | |
43895be5 | 592 | /* [ WORD 8 ] */ |
593 | tree clauses; | |
594 | ||
595 | /* [ WORD 9 ] | |
75a70cf9 | 596 | Critical section name. */ |
597 | tree name; | |
598 | }; | |
599 | ||
600 | ||
fb1e4f4a | 601 | struct GTY(()) gimple_omp_for_iter { |
75a70cf9 | 602 | /* Condition code. */ |
603 | enum tree_code cond; | |
604 | ||
605 | /* Index variable. */ | |
606 | tree index; | |
48e1416a | 607 | |
75a70cf9 | 608 | /* Initial value. */ |
609 | tree initial; | |
610 | ||
611 | /* Final value. */ | |
612 | tree final; | |
48e1416a | 613 | |
75a70cf9 | 614 | /* Increment. */ |
615 | tree incr; | |
616 | }; | |
617 | ||
618 | /* GIMPLE_OMP_FOR */ | |
619 | ||
de6bd75e | 620 | struct GTY((tag("GSS_OMP_FOR"))) |
1a91d914 | 621 | gomp_for : public gimple_statement_omp |
de6bd75e | 622 | { |
623 | /* [ WORD 1-7 ] : base class */ | |
75a70cf9 | 624 | |
e3a19533 | 625 | /* [ WORD 8 ] */ |
75a70cf9 | 626 | tree clauses; |
627 | ||
e3a19533 | 628 | /* [ WORD 9 ] |
75a70cf9 | 629 | Number of elements in iter array. */ |
630 | size_t collapse; | |
631 | ||
e3a19533 | 632 | /* [ WORD 10 ] */ |
75a70cf9 | 633 | struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter; |
634 | ||
e3a19533 | 635 | /* [ WORD 11 ] |
75a70cf9 | 636 | Pre-body evaluated before the loop body begins. */ |
637 | gimple_seq pre_body; | |
638 | }; | |
639 | ||
640 | ||
7e5a76c8 | 641 | /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */ |
ca4c3545 | 642 | |
a9035320 | 643 | struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) |
644 | gimple_statement_omp_parallel_layout : public gimple_statement_omp | |
de6bd75e | 645 | { |
646 | /* [ WORD 1-7 ] : base class */ | |
75a70cf9 | 647 | |
e3a19533 | 648 | /* [ WORD 8 ] |
75a70cf9 | 649 | Clauses. */ |
650 | tree clauses; | |
651 | ||
e3a19533 | 652 | /* [ WORD 9 ] |
75a70cf9 | 653 | Child function holding the body of the parallel region. */ |
654 | tree child_fn; | |
655 | ||
e3a19533 | 656 | /* [ WORD 10 ] |
75a70cf9 | 657 | Shared data argument. */ |
658 | tree data_arg; | |
659 | }; | |
660 | ||
a9035320 | 661 | /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */ |
662 | struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) | |
663 | gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout | |
664 | { | |
665 | /* No extra fields; adds invariant: | |
666 | stmt->code == GIMPLE_OMP_PARALLEL | |
7e5a76c8 | 667 | || stmt->code == GIMPLE_OMP_TASK |
668 | || stmt->code == GIMPLE_OMP_TEAMS. */ | |
a9035320 | 669 | }; |
670 | ||
a9035320 | 671 | /* GIMPLE_OMP_PARALLEL */ |
672 | struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) | |
1a91d914 | 673 | gomp_parallel : public gimple_statement_omp_taskreg |
a9035320 | 674 | { |
675 | /* No extra fields; adds invariant: | |
676 | stmt->code == GIMPLE_OMP_PARALLEL. */ | |
677 | }; | |
678 | ||
ca4c3545 | 679 | /* GIMPLE_OMP_TARGET */ |
a9035320 | 680 | struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) |
1a91d914 | 681 | gomp_target : public gimple_statement_omp_parallel_layout |
a9035320 | 682 | { |
683 | /* No extra fields; adds invariant: | |
684 | stmt->code == GIMPLE_OMP_TARGET. */ | |
685 | }; | |
75a70cf9 | 686 | |
687 | /* GIMPLE_OMP_TASK */ | |
688 | ||
de6bd75e | 689 | struct GTY((tag("GSS_OMP_TASK"))) |
1a91d914 | 690 | gomp_task : public gimple_statement_omp_taskreg |
de6bd75e | 691 | { |
692 | /* [ WORD 1-10 ] : base class */ | |
75a70cf9 | 693 | |
e3a19533 | 694 | /* [ WORD 11 ] |
75a70cf9 | 695 | Child function holding firstprivate initialization if needed. */ |
696 | tree copy_fn; | |
697 | ||
e3a19533 | 698 | /* [ WORD 12-13 ] |
75a70cf9 | 699 | Size and alignment in bytes of the argument data block. */ |
700 | tree arg_size; | |
701 | tree arg_align; | |
702 | }; | |
703 | ||
704 | ||
705 | /* GIMPLE_OMP_SECTION */ | |
706 | /* Uses struct gimple_statement_omp. */ | |
707 | ||
708 | ||
709 | /* GIMPLE_OMP_SECTIONS */ | |
710 | ||
de6bd75e | 711 | struct GTY((tag("GSS_OMP_SECTIONS"))) |
1a91d914 | 712 | gomp_sections : public gimple_statement_omp |
de6bd75e | 713 | { |
714 | /* [ WORD 1-7 ] : base class */ | |
75a70cf9 | 715 | |
e3a19533 | 716 | /* [ WORD 8 ] */ |
75a70cf9 | 717 | tree clauses; |
718 | ||
e3a19533 | 719 | /* [ WORD 9 ] |
75a70cf9 | 720 | The control variable used for deciding which of the sections to |
721 | execute. */ | |
722 | tree control; | |
723 | }; | |
724 | ||
725 | /* GIMPLE_OMP_CONTINUE. | |
726 | ||
727 | Note: This does not inherit from gimple_statement_omp, because we | |
728 | do not need the body field. */ | |
729 | ||
de6bd75e | 730 | struct GTY((tag("GSS_OMP_CONTINUE"))) |
42acab1c | 731 | gomp_continue : public gimple |
de6bd75e | 732 | { |
733 | /* [ WORD 1-6 ] : base class */ | |
75a70cf9 | 734 | |
e3a19533 | 735 | /* [ WORD 7 ] */ |
75a70cf9 | 736 | tree control_def; |
737 | ||
e3a19533 | 738 | /* [ WORD 8 ] */ |
75a70cf9 | 739 | tree control_use; |
740 | }; | |
741 | ||
70a6624c | 742 | /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP, |
743 | GIMPLE_OMP_SCAN. */ | |
75a70cf9 | 744 | |
a9035320 | 745 | struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) |
746 | gimple_statement_omp_single_layout : public gimple_statement_omp | |
de6bd75e | 747 | { |
748 | /* [ WORD 1-7 ] : base class */ | |
75a70cf9 | 749 | |
56686608 | 750 | /* [ WORD 8 ] */ |
75a70cf9 | 751 | tree clauses; |
752 | }; | |
753 | ||
a9035320 | 754 | struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) |
1a91d914 | 755 | gomp_single : public gimple_statement_omp_single_layout |
a9035320 | 756 | { |
757 | /* No extra fields; adds invariant: | |
758 | stmt->code == GIMPLE_OMP_SINGLE. */ | |
759 | }; | |
760 | ||
7e5a76c8 | 761 | struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) |
762 | gomp_teams : public gimple_statement_omp_taskreg | |
a9035320 | 763 | { |
764 | /* No extra fields; adds invariant: | |
765 | stmt->code == GIMPLE_OMP_TEAMS. */ | |
766 | }; | |
767 | ||
43895be5 | 768 | struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) |
769 | gomp_ordered : public gimple_statement_omp_single_layout | |
770 | { | |
771 | /* No extra fields; adds invariant: | |
772 | stmt->code == GIMPLE_OMP_ORDERED. */ | |
773 | }; | |
774 | ||
70a6624c | 775 | struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) |
776 | gomp_scan : public gimple_statement_omp_single_layout | |
777 | { | |
778 | /* No extra fields; adds invariant: | |
779 | stmt->code == GIMPLE_OMP_SCAN. */ | |
780 | }; | |
781 | ||
75a70cf9 | 782 | |
48e1416a | 783 | /* GIMPLE_OMP_ATOMIC_LOAD. |
ab8c4a5e | 784 | Note: This is based on gimple, not g_s_omp, because g_s_omp |
75a70cf9 | 785 | contains a sequence, which we don't need here. */ |
786 | ||
de6bd75e | 787 | struct GTY((tag("GSS_OMP_ATOMIC_LOAD"))) |
42acab1c | 788 | gomp_atomic_load : public gimple |
de6bd75e | 789 | { |
790 | /* [ WORD 1-6 ] : base class */ | |
75a70cf9 | 791 | |
e3a19533 | 792 | /* [ WORD 7-8 ] */ |
75a70cf9 | 793 | tree rhs, lhs; |
794 | }; | |
795 | ||
796 | /* GIMPLE_OMP_ATOMIC_STORE. | |
797 | See note on GIMPLE_OMP_ATOMIC_LOAD. */ | |
798 | ||
a9035320 | 799 | struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT"))) |
42acab1c | 800 | gimple_statement_omp_atomic_store_layout : public gimple |
de6bd75e | 801 | { |
802 | /* [ WORD 1-6 ] : base class */ | |
75a70cf9 | 803 | |
e3a19533 | 804 | /* [ WORD 7 ] */ |
75a70cf9 | 805 | tree val; |
806 | }; | |
807 | ||
a9035320 | 808 | struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT"))) |
1a91d914 | 809 | gomp_atomic_store : |
a9035320 | 810 | public gimple_statement_omp_atomic_store_layout |
811 | { | |
812 | /* No extra fields; adds invariant: | |
813 | stmt->code == GIMPLE_OMP_ATOMIC_STORE. */ | |
814 | }; | |
815 | ||
816 | struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT"))) | |
817 | gimple_statement_omp_return : | |
818 | public gimple_statement_omp_atomic_store_layout | |
819 | { | |
820 | /* No extra fields; adds invariant: | |
821 | stmt->code == GIMPLE_OMP_RETURN. */ | |
822 | }; | |
823 | ||
4c0315d0 | 824 | /* GIMPLE_TRANSACTION. */ |
825 | ||
826 | /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */ | |
827 | ||
828 | /* The __transaction_atomic was declared [[outer]] or it is | |
829 | __transaction_relaxed. */ | |
830 | #define GTMA_IS_OUTER (1u << 0) | |
831 | #define GTMA_IS_RELAXED (1u << 1) | |
832 | #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED) | |
833 | ||
834 | /* The transaction is seen to not have an abort. */ | |
835 | #define GTMA_HAVE_ABORT (1u << 2) | |
836 | /* The transaction is seen to have loads or stores. */ | |
837 | #define GTMA_HAVE_LOAD (1u << 3) | |
838 | #define GTMA_HAVE_STORE (1u << 4) | |
839 | /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */ | |
840 | #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5) | |
841 | /* The transaction WILL enter serial irrevocable mode. | |
842 | An irrevocable block post-dominates the entire transaction, such | |
843 | that all invocations of the transaction will go serial-irrevocable. | |
844 | In such case, we don't bother instrumenting the transaction, and | |
845 | tell the runtime that it should begin the transaction in | |
846 | serial-irrevocable mode. */ | |
847 | #define GTMA_DOES_GO_IRREVOCABLE (1u << 6) | |
1910089e | 848 | /* The transaction contains no instrumentation code whatsover, most |
849 | likely because it is guaranteed to go irrevocable upon entry. */ | |
850 | #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7) | |
4c0315d0 | 851 | |
de6bd75e | 852 | struct GTY((tag("GSS_TRANSACTION"))) |
1a91d914 | 853 | gtransaction : public gimple_statement_with_memory_ops_base |
4c0315d0 | 854 | { |
de6bd75e | 855 | /* [ WORD 1-9 ] : base class */ |
4c0315d0 | 856 | |
5bb6976b | 857 | /* [ WORD 10 ] */ |
4c0315d0 | 858 | gimple_seq body; |
859 | ||
a08574d7 | 860 | /* [ WORD 11-13 ] */ |
861 | tree label_norm; | |
862 | tree label_uninst; | |
863 | tree label_over; | |
4c0315d0 | 864 | }; |
865 | ||
1fed3255 | 866 | #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM, |
75a70cf9 | 867 | enum gimple_statement_structure_enum { |
75a70cf9 | 868 | #include "gsstruct.def" |
75a70cf9 | 869 | LAST_GSS_ENUM |
870 | }; | |
1fed3255 | 871 | #undef DEFGSSTRUCT |
75a70cf9 | 872 | |
1a91d914 | 873 | /* A statement with the invariant that |
874 | stmt->code == GIMPLE_COND | |
875 | i.e. a conditional jump statement. */ | |
876 | ||
877 | struct GTY((tag("GSS_WITH_OPS"))) | |
878 | gcond : public gimple_statement_with_ops | |
879 | { | |
880 | /* no additional fields; this uses the layout for GSS_WITH_OPS. */ | |
31d3df5c | 881 | static const enum gimple_code code_ = GIMPLE_COND; |
1a91d914 | 882 | }; |
883 | ||
884 | /* A statement with the invariant that | |
885 | stmt->code == GIMPLE_DEBUG | |
886 | i.e. a debug statement. */ | |
887 | ||
888 | struct GTY((tag("GSS_WITH_OPS"))) | |
889 | gdebug : public gimple_statement_with_ops | |
890 | { | |
891 | /* no additional fields; this uses the layout for GSS_WITH_OPS. */ | |
892 | }; | |
893 | ||
894 | /* A statement with the invariant that | |
895 | stmt->code == GIMPLE_GOTO | |
896 | i.e. a goto statement. */ | |
897 | ||
898 | struct GTY((tag("GSS_WITH_OPS"))) | |
899 | ggoto : public gimple_statement_with_ops | |
900 | { | |
901 | /* no additional fields; this uses the layout for GSS_WITH_OPS. */ | |
902 | }; | |
903 | ||
904 | /* A statement with the invariant that | |
905 | stmt->code == GIMPLE_LABEL | |
906 | i.e. a label statement. */ | |
907 | ||
908 | struct GTY((tag("GSS_WITH_OPS"))) | |
909 | glabel : public gimple_statement_with_ops | |
910 | { | |
911 | /* no additional fields; this uses the layout for GSS_WITH_OPS. */ | |
912 | }; | |
913 | ||
914 | /* A statement with the invariant that | |
915 | stmt->code == GIMPLE_SWITCH | |
916 | i.e. a switch statement. */ | |
917 | ||
918 | struct GTY((tag("GSS_WITH_OPS"))) | |
919 | gswitch : public gimple_statement_with_ops | |
920 | { | |
921 | /* no additional fields; this uses the layout for GSS_WITH_OPS. */ | |
922 | }; | |
923 | ||
924 | /* A statement with the invariant that | |
925 | stmt->code == GIMPLE_ASSIGN | |
926 | i.e. an assignment statement. */ | |
927 | ||
928 | struct GTY((tag("GSS_WITH_MEM_OPS"))) | |
929 | gassign : public gimple_statement_with_memory_ops | |
930 | { | |
2ee9f21a | 931 | static const enum gimple_code code_ = GIMPLE_ASSIGN; |
1a91d914 | 932 | /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */ |
933 | }; | |
934 | ||
935 | /* A statement with the invariant that | |
936 | stmt->code == GIMPLE_RETURN | |
937 | i.e. a return statement. */ | |
938 | ||
939 | struct GTY((tag("GSS_WITH_MEM_OPS"))) | |
940 | greturn : public gimple_statement_with_memory_ops | |
941 | { | |
942 | /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */ | |
943 | }; | |
944 | ||
de6bd75e | 945 | template <> |
946 | template <> | |
947 | inline bool | |
42acab1c | 948 | is_a_helper <gasm *>::test (gimple *gs) |
de6bd75e | 949 | { |
950 | return gs->code == GIMPLE_ASM; | |
951 | } | |
75a70cf9 | 952 | |
de6bd75e | 953 | template <> |
954 | template <> | |
955 | inline bool | |
42acab1c | 956 | is_a_helper <gassign *>::test (gimple *gs) |
1a91d914 | 957 | { |
958 | return gs->code == GIMPLE_ASSIGN; | |
959 | } | |
960 | ||
2ee9f21a | 961 | template <> |
962 | template <> | |
963 | inline bool | |
42acab1c | 964 | is_a_helper <const gassign *>::test (const gimple *gs) |
2ee9f21a | 965 | { |
966 | return gs->code == GIMPLE_ASSIGN; | |
967 | } | |
968 | ||
1a91d914 | 969 | template <> |
970 | template <> | |
971 | inline bool | |
42acab1c | 972 | is_a_helper <gbind *>::test (gimple *gs) |
de6bd75e | 973 | { |
974 | return gs->code == GIMPLE_BIND; | |
975 | } | |
976 | ||
977 | template <> | |
978 | template <> | |
979 | inline bool | |
42acab1c | 980 | is_a_helper <gcall *>::test (gimple *gs) |
de6bd75e | 981 | { |
982 | return gs->code == GIMPLE_CALL; | |
983 | } | |
984 | ||
985 | template <> | |
986 | template <> | |
987 | inline bool | |
42acab1c | 988 | is_a_helper <gcatch *>::test (gimple *gs) |
de6bd75e | 989 | { |
990 | return gs->code == GIMPLE_CATCH; | |
991 | } | |
992 | ||
993 | template <> | |
994 | template <> | |
995 | inline bool | |
42acab1c | 996 | is_a_helper <gcond *>::test (gimple *gs) |
1a91d914 | 997 | { |
998 | return gs->code == GIMPLE_COND; | |
999 | } | |
1000 | ||
31d3df5c | 1001 | template <> |
1002 | template <> | |
1003 | inline bool | |
42acab1c | 1004 | is_a_helper <const gcond *>::test (const gimple *gs) |
31d3df5c | 1005 | { |
1006 | return gs->code == GIMPLE_COND; | |
1007 | } | |
1008 | ||
1a91d914 | 1009 | template <> |
1010 | template <> | |
1011 | inline bool | |
42acab1c | 1012 | is_a_helper <gdebug *>::test (gimple *gs) |
1a91d914 | 1013 | { |
1014 | return gs->code == GIMPLE_DEBUG; | |
1015 | } | |
1016 | ||
1017 | template <> | |
1018 | template <> | |
1019 | inline bool | |
42acab1c | 1020 | is_a_helper <ggoto *>::test (gimple *gs) |
1a91d914 | 1021 | { |
1022 | return gs->code == GIMPLE_GOTO; | |
1023 | } | |
1024 | ||
1025 | template <> | |
1026 | template <> | |
1027 | inline bool | |
42acab1c | 1028 | is_a_helper <glabel *>::test (gimple *gs) |
1a91d914 | 1029 | { |
1030 | return gs->code == GIMPLE_LABEL; | |
1031 | } | |
1032 | ||
1033 | template <> | |
1034 | template <> | |
1035 | inline bool | |
42acab1c | 1036 | is_a_helper <gresx *>::test (gimple *gs) |
de6bd75e | 1037 | { |
a9035320 | 1038 | return gs->code == GIMPLE_RESX; |
1039 | } | |
1040 | ||
1041 | template <> | |
1042 | template <> | |
1043 | inline bool | |
42acab1c | 1044 | is_a_helper <geh_dispatch *>::test (gimple *gs) |
a9035320 | 1045 | { |
1046 | return gs->code == GIMPLE_EH_DISPATCH; | |
de6bd75e | 1047 | } |
1048 | ||
1049 | template <> | |
1050 | template <> | |
1051 | inline bool | |
42acab1c | 1052 | is_a_helper <geh_else *>::test (gimple *gs) |
de6bd75e | 1053 | { |
1054 | return gs->code == GIMPLE_EH_ELSE; | |
1055 | } | |
1056 | ||
1057 | template <> | |
1058 | template <> | |
1059 | inline bool | |
42acab1c | 1060 | is_a_helper <geh_filter *>::test (gimple *gs) |
de6bd75e | 1061 | { |
1062 | return gs->code == GIMPLE_EH_FILTER; | |
1063 | } | |
1064 | ||
1065 | template <> | |
1066 | template <> | |
1067 | inline bool | |
42acab1c | 1068 | is_a_helper <geh_mnt *>::test (gimple *gs) |
de6bd75e | 1069 | { |
1070 | return gs->code == GIMPLE_EH_MUST_NOT_THROW; | |
1071 | } | |
1072 | ||
1073 | template <> | |
1074 | template <> | |
1075 | inline bool | |
42acab1c | 1076 | is_a_helper <gomp_atomic_load *>::test (gimple *gs) |
de6bd75e | 1077 | { |
1078 | return gs->code == GIMPLE_OMP_ATOMIC_LOAD; | |
1079 | } | |
1080 | ||
1081 | template <> | |
1082 | template <> | |
1083 | inline bool | |
42acab1c | 1084 | is_a_helper <gomp_atomic_store *>::test (gimple *gs) |
de6bd75e | 1085 | { |
a9035320 | 1086 | return gs->code == GIMPLE_OMP_ATOMIC_STORE; |
1087 | } | |
1088 | ||
1089 | template <> | |
1090 | template <> | |
1091 | inline bool | |
42acab1c | 1092 | is_a_helper <gimple_statement_omp_return *>::test (gimple *gs) |
a9035320 | 1093 | { |
1094 | return gs->code == GIMPLE_OMP_RETURN; | |
de6bd75e | 1095 | } |
1096 | ||
1097 | template <> | |
1098 | template <> | |
1099 | inline bool | |
42acab1c | 1100 | is_a_helper <gomp_continue *>::test (gimple *gs) |
de6bd75e | 1101 | { |
1102 | return gs->code == GIMPLE_OMP_CONTINUE; | |
1103 | } | |
1104 | ||
1105 | template <> | |
1106 | template <> | |
1107 | inline bool | |
42acab1c | 1108 | is_a_helper <gomp_critical *>::test (gimple *gs) |
de6bd75e | 1109 | { |
1110 | return gs->code == GIMPLE_OMP_CRITICAL; | |
1111 | } | |
1112 | ||
43895be5 | 1113 | template <> |
1114 | template <> | |
1115 | inline bool | |
1116 | is_a_helper <gomp_ordered *>::test (gimple *gs) | |
1117 | { | |
1118 | return gs->code == GIMPLE_OMP_ORDERED; | |
1119 | } | |
1120 | ||
70a6624c | 1121 | template <> |
1122 | template <> | |
1123 | inline bool | |
1124 | is_a_helper <gomp_scan *>::test (gimple *gs) | |
1125 | { | |
1126 | return gs->code == GIMPLE_OMP_SCAN; | |
1127 | } | |
1128 | ||
de6bd75e | 1129 | template <> |
1130 | template <> | |
1131 | inline bool | |
42acab1c | 1132 | is_a_helper <gomp_for *>::test (gimple *gs) |
de6bd75e | 1133 | { |
1134 | return gs->code == GIMPLE_OMP_FOR; | |
1135 | } | |
1136 | ||
a9035320 | 1137 | template <> |
1138 | template <> | |
1139 | inline bool | |
42acab1c | 1140 | is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs) |
a9035320 | 1141 | { |
7e5a76c8 | 1142 | return (gs->code == GIMPLE_OMP_PARALLEL |
1143 | || gs->code == GIMPLE_OMP_TASK | |
1144 | || gs->code == GIMPLE_OMP_TEAMS); | |
a9035320 | 1145 | } |
1146 | ||
de6bd75e | 1147 | template <> |
1148 | template <> | |
1149 | inline bool | |
42acab1c | 1150 | is_a_helper <gomp_parallel *>::test (gimple *gs) |
de6bd75e | 1151 | { |
a9035320 | 1152 | return gs->code == GIMPLE_OMP_PARALLEL; |
1153 | } | |
1154 | ||
1155 | template <> | |
1156 | template <> | |
1157 | inline bool | |
42acab1c | 1158 | is_a_helper <gomp_target *>::test (gimple *gs) |
a9035320 | 1159 | { |
1160 | return gs->code == GIMPLE_OMP_TARGET; | |
de6bd75e | 1161 | } |
1162 | ||
1163 | template <> | |
1164 | template <> | |
1165 | inline bool | |
42acab1c | 1166 | is_a_helper <gomp_sections *>::test (gimple *gs) |
de6bd75e | 1167 | { |
1168 | return gs->code == GIMPLE_OMP_SECTIONS; | |
1169 | } | |
1170 | ||
1171 | template <> | |
1172 | template <> | |
1173 | inline bool | |
42acab1c | 1174 | is_a_helper <gomp_single *>::test (gimple *gs) |
de6bd75e | 1175 | { |
a9035320 | 1176 | return gs->code == GIMPLE_OMP_SINGLE; |
1177 | } | |
1178 | ||
1179 | template <> | |
1180 | template <> | |
1181 | inline bool | |
42acab1c | 1182 | is_a_helper <gomp_teams *>::test (gimple *gs) |
a9035320 | 1183 | { |
1184 | return gs->code == GIMPLE_OMP_TEAMS; | |
de6bd75e | 1185 | } |
1186 | ||
1187 | template <> | |
1188 | template <> | |
1189 | inline bool | |
42acab1c | 1190 | is_a_helper <gomp_task *>::test (gimple *gs) |
de6bd75e | 1191 | { |
1192 | return gs->code == GIMPLE_OMP_TASK; | |
1193 | } | |
1194 | ||
1195 | template <> | |
1196 | template <> | |
1197 | inline bool | |
42acab1c | 1198 | is_a_helper <gphi *>::test (gimple *gs) |
de6bd75e | 1199 | { |
1200 | return gs->code == GIMPLE_PHI; | |
1201 | } | |
1202 | ||
1203 | template <> | |
1204 | template <> | |
1205 | inline bool | |
42acab1c | 1206 | is_a_helper <greturn *>::test (gimple *gs) |
1a91d914 | 1207 | { |
1208 | return gs->code == GIMPLE_RETURN; | |
1209 | } | |
1210 | ||
1211 | template <> | |
1212 | template <> | |
1213 | inline bool | |
42acab1c | 1214 | is_a_helper <gswitch *>::test (gimple *gs) |
1a91d914 | 1215 | { |
1216 | return gs->code == GIMPLE_SWITCH; | |
1217 | } | |
1218 | ||
1219 | template <> | |
1220 | template <> | |
1221 | inline bool | |
42acab1c | 1222 | is_a_helper <gtransaction *>::test (gimple *gs) |
de6bd75e | 1223 | { |
1224 | return gs->code == GIMPLE_TRANSACTION; | |
1225 | } | |
1226 | ||
1227 | template <> | |
1228 | template <> | |
1229 | inline bool | |
42acab1c | 1230 | is_a_helper <gtry *>::test (gimple *gs) |
de6bd75e | 1231 | { |
1232 | return gs->code == GIMPLE_TRY; | |
1233 | } | |
1234 | ||
1235 | template <> | |
1236 | template <> | |
1237 | inline bool | |
42acab1c | 1238 | is_a_helper <gimple_statement_wce *>::test (gimple *gs) |
de6bd75e | 1239 | { |
1240 | return gs->code == GIMPLE_WITH_CLEANUP_EXPR; | |
1241 | } | |
1242 | ||
1243 | template <> | |
1244 | template <> | |
1245 | inline bool | |
42acab1c | 1246 | is_a_helper <const gasm *>::test (const gimple *gs) |
de6bd75e | 1247 | { |
1248 | return gs->code == GIMPLE_ASM; | |
1249 | } | |
1250 | ||
1251 | template <> | |
1252 | template <> | |
1253 | inline bool | |
42acab1c | 1254 | is_a_helper <const gbind *>::test (const gimple *gs) |
de6bd75e | 1255 | { |
1256 | return gs->code == GIMPLE_BIND; | |
1257 | } | |
1258 | ||
1259 | template <> | |
1260 | template <> | |
1261 | inline bool | |
42acab1c | 1262 | is_a_helper <const gcall *>::test (const gimple *gs) |
de6bd75e | 1263 | { |
1264 | return gs->code == GIMPLE_CALL; | |
1265 | } | |
1266 | ||
1267 | template <> | |
1268 | template <> | |
1269 | inline bool | |
42acab1c | 1270 | is_a_helper <const gcatch *>::test (const gimple *gs) |
de6bd75e | 1271 | { |
1272 | return gs->code == GIMPLE_CATCH; | |
1273 | } | |
1274 | ||
1275 | template <> | |
1276 | template <> | |
1277 | inline bool | |
42acab1c | 1278 | is_a_helper <const gresx *>::test (const gimple *gs) |
a9035320 | 1279 | { |
1280 | return gs->code == GIMPLE_RESX; | |
1281 | } | |
1282 | ||
1283 | template <> | |
1284 | template <> | |
1285 | inline bool | |
42acab1c | 1286 | is_a_helper <const geh_dispatch *>::test (const gimple *gs) |
de6bd75e | 1287 | { |
a9035320 | 1288 | return gs->code == GIMPLE_EH_DISPATCH; |
de6bd75e | 1289 | } |
1290 | ||
1291 | template <> | |
1292 | template <> | |
1293 | inline bool | |
42acab1c | 1294 | is_a_helper <const geh_filter *>::test (const gimple *gs) |
de6bd75e | 1295 | { |
1296 | return gs->code == GIMPLE_EH_FILTER; | |
1297 | } | |
1298 | ||
1299 | template <> | |
1300 | template <> | |
1301 | inline bool | |
42acab1c | 1302 | is_a_helper <const gomp_atomic_load *>::test (const gimple *gs) |
de6bd75e | 1303 | { |
1304 | return gs->code == GIMPLE_OMP_ATOMIC_LOAD; | |
1305 | } | |
1306 | ||
1307 | template <> | |
1308 | template <> | |
1309 | inline bool | |
42acab1c | 1310 | is_a_helper <const gomp_atomic_store *>::test (const gimple *gs) |
de6bd75e | 1311 | { |
a9035320 | 1312 | return gs->code == GIMPLE_OMP_ATOMIC_STORE; |
1313 | } | |
1314 | ||
1315 | template <> | |
1316 | template <> | |
1317 | inline bool | |
42acab1c | 1318 | is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs) |
a9035320 | 1319 | { |
1320 | return gs->code == GIMPLE_OMP_RETURN; | |
de6bd75e | 1321 | } |
1322 | ||
1323 | template <> | |
1324 | template <> | |
1325 | inline bool | |
42acab1c | 1326 | is_a_helper <const gomp_continue *>::test (const gimple *gs) |
de6bd75e | 1327 | { |
1328 | return gs->code == GIMPLE_OMP_CONTINUE; | |
1329 | } | |
1330 | ||
1331 | template <> | |
1332 | template <> | |
1333 | inline bool | |
42acab1c | 1334 | is_a_helper <const gomp_critical *>::test (const gimple *gs) |
de6bd75e | 1335 | { |
1336 | return gs->code == GIMPLE_OMP_CRITICAL; | |
1337 | } | |
1338 | ||
43895be5 | 1339 | template <> |
1340 | template <> | |
1341 | inline bool | |
1342 | is_a_helper <const gomp_ordered *>::test (const gimple *gs) | |
1343 | { | |
1344 | return gs->code == GIMPLE_OMP_ORDERED; | |
1345 | } | |
1346 | ||
70a6624c | 1347 | template <> |
1348 | template <> | |
1349 | inline bool | |
1350 | is_a_helper <const gomp_scan *>::test (const gimple *gs) | |
1351 | { | |
1352 | return gs->code == GIMPLE_OMP_SCAN; | |
1353 | } | |
1354 | ||
de6bd75e | 1355 | template <> |
1356 | template <> | |
1357 | inline bool | |
42acab1c | 1358 | is_a_helper <const gomp_for *>::test (const gimple *gs) |
de6bd75e | 1359 | { |
1360 | return gs->code == GIMPLE_OMP_FOR; | |
1361 | } | |
1362 | ||
a9035320 | 1363 | template <> |
1364 | template <> | |
1365 | inline bool | |
42acab1c | 1366 | is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs) |
a9035320 | 1367 | { |
7e5a76c8 | 1368 | return (gs->code == GIMPLE_OMP_PARALLEL |
1369 | || gs->code == GIMPLE_OMP_TASK | |
1370 | || gs->code == GIMPLE_OMP_TEAMS); | |
a9035320 | 1371 | } |
1372 | ||
de6bd75e | 1373 | template <> |
1374 | template <> | |
1375 | inline bool | |
42acab1c | 1376 | is_a_helper <const gomp_parallel *>::test (const gimple *gs) |
de6bd75e | 1377 | { |
a9035320 | 1378 | return gs->code == GIMPLE_OMP_PARALLEL; |
1379 | } | |
1380 | ||
1381 | template <> | |
1382 | template <> | |
1383 | inline bool | |
42acab1c | 1384 | is_a_helper <const gomp_target *>::test (const gimple *gs) |
a9035320 | 1385 | { |
1386 | return gs->code == GIMPLE_OMP_TARGET; | |
de6bd75e | 1387 | } |
1388 | ||
1389 | template <> | |
1390 | template <> | |
1391 | inline bool | |
42acab1c | 1392 | is_a_helper <const gomp_sections *>::test (const gimple *gs) |
de6bd75e | 1393 | { |
1394 | return gs->code == GIMPLE_OMP_SECTIONS; | |
1395 | } | |
1396 | ||
1397 | template <> | |
1398 | template <> | |
1399 | inline bool | |
42acab1c | 1400 | is_a_helper <const gomp_single *>::test (const gimple *gs) |
de6bd75e | 1401 | { |
a9035320 | 1402 | return gs->code == GIMPLE_OMP_SINGLE; |
1403 | } | |
1404 | ||
1405 | template <> | |
1406 | template <> | |
1407 | inline bool | |
42acab1c | 1408 | is_a_helper <const gomp_teams *>::test (const gimple *gs) |
a9035320 | 1409 | { |
1410 | return gs->code == GIMPLE_OMP_TEAMS; | |
de6bd75e | 1411 | } |
1412 | ||
1413 | template <> | |
1414 | template <> | |
1415 | inline bool | |
42acab1c | 1416 | is_a_helper <const gomp_task *>::test (const gimple *gs) |
de6bd75e | 1417 | { |
1418 | return gs->code == GIMPLE_OMP_TASK; | |
1419 | } | |
1420 | ||
1421 | template <> | |
1422 | template <> | |
1423 | inline bool | |
42acab1c | 1424 | is_a_helper <const gphi *>::test (const gimple *gs) |
de6bd75e | 1425 | { |
1426 | return gs->code == GIMPLE_PHI; | |
1427 | } | |
1428 | ||
1429 | template <> | |
1430 | template <> | |
1431 | inline bool | |
42acab1c | 1432 | is_a_helper <const gtransaction *>::test (const gimple *gs) |
de6bd75e | 1433 | { |
1434 | return gs->code == GIMPLE_TRANSACTION; | |
1435 | } | |
75a70cf9 | 1436 | |
1fed3255 | 1437 | /* Offset in bytes to the location of the operand vector. |
1438 | Zero if there is no operand vector for this tuple structure. */ | |
1439 | extern size_t const gimple_ops_offset_[]; | |
1440 | ||
1441 | /* Map GIMPLE codes to GSS codes. */ | |
1442 | extern enum gimple_statement_structure_enum const gss_for_code_[]; | |
1443 | ||
8cee8dc0 | 1444 | /* This variable holds the currently expanded gimple statement for purposes |
1445 | of comminucating the profile info to the builtin expanders. */ | |
42acab1c | 1446 | extern gimple *currently_expanding_gimple_stmt; |
8cee8dc0 | 1447 | |
11ba0fb8 | 1448 | gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO); |
1a91d914 | 1449 | greturn *gimple_build_return (tree); |
1450 | void gimple_call_reset_alias_info (gcall *); | |
1451 | gcall *gimple_build_call_vec (tree, vec<tree> ); | |
1452 | gcall *gimple_build_call (tree, unsigned, ...); | |
1453 | gcall *gimple_build_call_valist (tree, unsigned, va_list); | |
1454 | gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...); | |
1455 | gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> ); | |
3c0f15b4 | 1456 | gcall *gimple_build_call_from_tree (tree, tree); |
2084326e | 1457 | gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO); |
e9cf809e | 1458 | gassign *gimple_build_assign (tree, enum tree_code, |
1459 | tree, tree, tree CXX_MEM_STAT_INFO); | |
1460 | gassign *gimple_build_assign (tree, enum tree_code, | |
1461 | tree, tree CXX_MEM_STAT_INFO); | |
1462 | gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO); | |
1a91d914 | 1463 | gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree); |
1464 | gcond *gimple_build_cond_from_tree (tree, tree, tree); | |
1465 | void gimple_cond_set_condition_from_tree (gcond *, tree); | |
1466 | glabel *gimple_build_label (tree label); | |
1467 | ggoto *gimple_build_goto (tree dest); | |
42acab1c | 1468 | gimple *gimple_build_nop (void); |
1a91d914 | 1469 | gbind *gimple_build_bind (tree, gimple_seq, tree); |
1470 | gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *, | |
1471 | vec<tree, va_gc> *, vec<tree, va_gc> *, | |
1472 | vec<tree, va_gc> *); | |
1473 | gcatch *gimple_build_catch (tree, gimple_seq); | |
1474 | geh_filter *gimple_build_eh_filter (tree, gimple_seq); | |
1475 | geh_mnt *gimple_build_eh_must_not_throw (tree); | |
1476 | geh_else *gimple_build_eh_else (gimple_seq, gimple_seq); | |
1477 | gtry *gimple_build_try (gimple_seq, gimple_seq, | |
de6bd75e | 1478 | enum gimple_try_flags); |
42acab1c | 1479 | gimple *gimple_build_wce (gimple_seq); |
1a91d914 | 1480 | gresx *gimple_build_resx (int); |
1481 | gswitch *gimple_build_switch_nlabels (unsigned, tree, tree); | |
1482 | gswitch *gimple_build_switch (tree, tree, vec<tree> ); | |
1483 | geh_dispatch *gimple_build_eh_dispatch (int); | |
8fa9cbe6 | 1484 | gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO); |
1485 | gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO); | |
90567983 | 1486 | gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO); |
8f6f3638 | 1487 | gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO); |
43895be5 | 1488 | gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree); |
1a91d914 | 1489 | gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq); |
1490 | gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree); | |
1491 | gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, | |
1492 | tree, tree); | |
42acab1c | 1493 | gimple *gimple_build_omp_section (gimple_seq); |
1494 | gimple *gimple_build_omp_master (gimple_seq); | |
56686608 | 1495 | gimple *gimple_build_omp_grid_body (gimple_seq); |
7e5a76c8 | 1496 | gimple *gimple_build_omp_taskgroup (gimple_seq, tree); |
1a91d914 | 1497 | gomp_continue *gimple_build_omp_continue (tree, tree); |
43895be5 | 1498 | gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree); |
42acab1c | 1499 | gimple *gimple_build_omp_return (bool); |
70a6624c | 1500 | gomp_scan *gimple_build_omp_scan (gimple_seq, tree); |
1a91d914 | 1501 | gomp_sections *gimple_build_omp_sections (gimple_seq, tree); |
42acab1c | 1502 | gimple *gimple_build_omp_sections_switch (void); |
1a91d914 | 1503 | gomp_single *gimple_build_omp_single (gimple_seq, tree); |
1504 | gomp_target *gimple_build_omp_target (gimple_seq, int, tree); | |
1505 | gomp_teams *gimple_build_omp_teams (gimple_seq, tree); | |
7e5a76c8 | 1506 | gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree, |
1507 | enum omp_memory_order); | |
1508 | gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order); | |
a08574d7 | 1509 | gtransaction *gimple_build_transaction (gimple_seq); |
42acab1c | 1510 | extern void gimple_seq_add_stmt (gimple_seq *, gimple *); |
1511 | extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *); | |
75a70cf9 | 1512 | void gimple_seq_add_seq (gimple_seq *, gimple_seq); |
b9ea678c | 1513 | void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq); |
e797f49f | 1514 | extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator, |
1515 | location_t); | |
1516 | extern void annotate_all_with_location (gimple_seq, location_t); | |
1517 | bool empty_body_p (gimple_seq); | |
75a70cf9 | 1518 | gimple_seq gimple_seq_copy (gimple_seq); |
42acab1c | 1519 | bool gimple_call_same_target_p (const gimple *, const gimple *); |
1520 | int gimple_call_flags (const gimple *); | |
1a91d914 | 1521 | int gimple_call_arg_flags (const gcall *, unsigned); |
1522 | int gimple_call_return_flags (const gcall *); | |
21d374ac | 1523 | bool gimple_call_nonnull_result_p (gcall *); |
1524 | tree gimple_call_nonnull_arg (gcall *); | |
42acab1c | 1525 | bool gimple_assign_copy_p (gimple *); |
1526 | bool gimple_assign_ssa_name_copy_p (gimple *); | |
1527 | bool gimple_assign_unary_nop_p (gimple *); | |
1528 | void gimple_set_bb (gimple *, basic_block); | |
75a70cf9 | 1529 | void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree); |
806413d2 | 1530 | void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code, |
1531 | tree, tree, tree); | |
42acab1c | 1532 | tree gimple_get_lhs (const gimple *); |
1533 | void gimple_set_lhs (gimple *, tree); | |
1534 | gimple *gimple_copy (gimple *); | |
1263a9e1 | 1535 | void gimple_move_vops (gimple *, gimple *); |
42acab1c | 1536 | bool gimple_has_side_effects (const gimple *); |
1537 | bool gimple_could_trap_p_1 (gimple *, bool, bool); | |
1538 | bool gimple_could_trap_p (gimple *); | |
1539 | bool gimple_assign_rhs_could_trap_p (gimple *); | |
e797f49f | 1540 | extern void dump_gimple_statistics (void); |
75a70cf9 | 1541 | unsigned get_gimple_rhs_num_ops (enum tree_code); |
e797f49f | 1542 | extern tree canonicalize_cond_expr_cond (tree); |
1a91d914 | 1543 | gcall *gimple_call_copy_skip_args (gcall *, bitmap); |
a1072234 | 1544 | extern bool gimple_compare_field_offset (tree, tree); |
7bfefa9d | 1545 | extern tree gimple_unsigned_type (tree); |
1546 | extern tree gimple_signed_type (tree); | |
1547 | extern alias_set_type gimple_get_alias_set (tree); | |
42acab1c | 1548 | extern bool gimple_ior_addresses_taken (bitmap, gimple *); |
1549 | extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree); | |
be03bd18 | 1550 | extern combined_fn gimple_call_combined_fn (const gimple *); |
4ee64e30 | 1551 | extern bool gimple_call_operator_delete_p (const gcall *); |
42acab1c | 1552 | extern bool gimple_call_builtin_p (const gimple *); |
1553 | extern bool gimple_call_builtin_p (const gimple *, enum built_in_class); | |
1554 | extern bool gimple_call_builtin_p (const gimple *, enum built_in_function); | |
1a91d914 | 1555 | extern bool gimple_asm_clobbers_memory_p (const gasm *); |
e797f49f | 1556 | extern void dump_decl_set (FILE *, bitmap); |
42acab1c | 1557 | extern bool nonfreeing_call_p (gimple *); |
05a63389 | 1558 | extern bool nonbarrier_call_p (gimple *); |
42acab1c | 1559 | extern bool infer_nonnull_range (gimple *, tree); |
1560 | extern bool infer_nonnull_range_by_dereference (gimple *, tree); | |
1561 | extern bool infer_nonnull_range_by_attribute (gimple *, tree); | |
e3668db5 | 1562 | extern void sort_case_labels (vec<tree>); |
1563 | extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *); | |
1564 | extern void gimple_seq_set_location (gimple_seq, location_t); | |
1565 | extern void gimple_seq_discard (gimple_seq); | |
42acab1c | 1566 | extern void maybe_remove_unused_call_args (struct function *, gimple *); |
f18de397 | 1567 | extern bool gimple_inexpensive_call_p (gcall *); |
531f0ff8 | 1568 | extern bool stmt_can_terminate_bb_p (gimple *); |
75a70cf9 | 1569 | |
d9dd21a8 | 1570 | /* Formal (expression) temporary table handling: multiple occurrences of |
1571 | the same scalar expression are evaluated into the same temporary. */ | |
1572 | ||
1573 | typedef struct gimple_temp_hash_elt | |
1574 | { | |
1575 | tree val; /* Key */ | |
1576 | tree temp; /* Value */ | |
1577 | } elt_t; | |
1578 | ||
582791b0 | 1579 | /* Get the number of the next statement uid to be allocated. */ |
1580 | static inline unsigned int | |
1581 | gimple_stmt_max_uid (struct function *fn) | |
1582 | { | |
1583 | return fn->last_stmt_uid; | |
1584 | } | |
1585 | ||
1586 | /* Set the number of the next statement uid to be allocated. */ | |
1587 | static inline void | |
1588 | set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid) | |
1589 | { | |
1590 | fn->last_stmt_uid = maxid; | |
1591 | } | |
1592 | ||
1593 | /* Set the number of the next statement uid to be allocated. */ | |
1594 | static inline unsigned int | |
1595 | inc_gimple_stmt_max_uid (struct function *fn) | |
1596 | { | |
1597 | return fn->last_stmt_uid++; | |
1598 | } | |
1599 | ||
e3a19533 | 1600 | /* Return the first node in GIMPLE sequence S. */ |
1601 | ||
1602 | static inline gimple_seq_node | |
924c4c71 | 1603 | gimple_seq_first (gimple_seq s) |
e3a19533 | 1604 | { |
1605 | return s; | |
1606 | } | |
1607 | ||
1608 | ||
1609 | /* Return the first statement in GIMPLE sequence S. */ | |
1610 | ||
42acab1c | 1611 | static inline gimple * |
924c4c71 | 1612 | gimple_seq_first_stmt (gimple_seq s) |
e3a19533 | 1613 | { |
1614 | gimple_seq_node n = gimple_seq_first (s); | |
1615 | return n; | |
1616 | } | |
1617 | ||
1a91d914 | 1618 | /* Return the first statement in GIMPLE sequence S as a gbind *, |
1619 | verifying that it has code GIMPLE_BIND in a checked build. */ | |
1620 | ||
1621 | static inline gbind * | |
1622 | gimple_seq_first_stmt_as_a_bind (gimple_seq s) | |
1623 | { | |
1624 | gimple_seq_node n = gimple_seq_first (s); | |
1625 | return as_a <gbind *> (n); | |
1626 | } | |
1627 | ||
e3a19533 | 1628 | |
1629 | /* Return the last node in GIMPLE sequence S. */ | |
1630 | ||
1631 | static inline gimple_seq_node | |
924c4c71 | 1632 | gimple_seq_last (gimple_seq s) |
e3a19533 | 1633 | { |
de6bd75e | 1634 | return s ? s->prev : NULL; |
e3a19533 | 1635 | } |
1636 | ||
1637 | ||
1638 | /* Return the last statement in GIMPLE sequence S. */ | |
1639 | ||
42acab1c | 1640 | static inline gimple * |
924c4c71 | 1641 | gimple_seq_last_stmt (gimple_seq s) |
e3a19533 | 1642 | { |
1643 | gimple_seq_node n = gimple_seq_last (s); | |
1644 | return n; | |
1645 | } | |
1646 | ||
1647 | ||
1648 | /* Set the last node in GIMPLE sequence *PS to LAST. */ | |
1649 | ||
1650 | static inline void | |
1651 | gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last) | |
1652 | { | |
de6bd75e | 1653 | (*ps)->prev = last; |
e3a19533 | 1654 | } |
1655 | ||
1656 | ||
1657 | /* Set the first node in GIMPLE sequence *PS to FIRST. */ | |
1658 | ||
1659 | static inline void | |
1660 | gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first) | |
1661 | { | |
1662 | *ps = first; | |
1663 | } | |
1664 | ||
1665 | ||
1666 | /* Return true if GIMPLE sequence S is empty. */ | |
1667 | ||
1668 | static inline bool | |
924c4c71 | 1669 | gimple_seq_empty_p (gimple_seq s) |
e3a19533 | 1670 | { |
1671 | return s == NULL; | |
1672 | } | |
1673 | ||
e3a19533 | 1674 | /* Allocate a new sequence and initialize its first element with STMT. */ |
1675 | ||
1676 | static inline gimple_seq | |
42acab1c | 1677 | gimple_seq_alloc_with_stmt (gimple *stmt) |
e3a19533 | 1678 | { |
1679 | gimple_seq seq = NULL; | |
1680 | gimple_seq_add_stmt (&seq, stmt); | |
1681 | return seq; | |
1682 | } | |
1683 | ||
1684 | ||
1685 | /* Returns the sequence of statements in BB. */ | |
1686 | ||
1687 | static inline gimple_seq | |
1688 | bb_seq (const_basic_block bb) | |
1689 | { | |
924c4c71 | 1690 | return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL; |
e3a19533 | 1691 | } |
1692 | ||
1693 | static inline gimple_seq * | |
924c4c71 | 1694 | bb_seq_addr (basic_block bb) |
e3a19533 | 1695 | { |
924c4c71 | 1696 | return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL; |
e3a19533 | 1697 | } |
1698 | ||
1699 | /* Sets the sequence of statements in BB to SEQ. */ | |
1700 | ||
1701 | static inline void | |
1702 | set_bb_seq (basic_block bb, gimple_seq seq) | |
1703 | { | |
1704 | gcc_checking_assert (!(bb->flags & BB_RTL)); | |
924c4c71 | 1705 | bb->il.gimple.seq = seq; |
e3a19533 | 1706 | } |
1707 | ||
1708 | ||
75a70cf9 | 1709 | /* Return the code for GIMPLE statement G. */ |
1710 | ||
1711 | static inline enum gimple_code | |
42acab1c | 1712 | gimple_code (const gimple *g) |
75a70cf9 | 1713 | { |
de6bd75e | 1714 | return g->code; |
75a70cf9 | 1715 | } |
1716 | ||
1717 | ||
1fed3255 | 1718 | /* Return the GSS code used by a GIMPLE code. */ |
1719 | ||
1720 | static inline enum gimple_statement_structure_enum | |
1721 | gss_for_code (enum gimple_code code) | |
1722 | { | |
1e720c36 | 1723 | gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE); |
1fed3255 | 1724 | return gss_for_code_[code]; |
1725 | } | |
1726 | ||
1727 | ||
1728 | /* Return which GSS code is used by GS. */ | |
1729 | ||
1730 | static inline enum gimple_statement_structure_enum | |
42acab1c | 1731 | gimple_statement_structure (gimple *gs) |
1fed3255 | 1732 | { |
1733 | return gss_for_code (gimple_code (gs)); | |
1734 | } | |
1735 | ||
1736 | ||
75a70cf9 | 1737 | /* Return true if statement G has sub-statements. This is only true for |
1738 | High GIMPLE statements. */ | |
1739 | ||
1740 | static inline bool | |
42acab1c | 1741 | gimple_has_substatements (gimple *g) |
75a70cf9 | 1742 | { |
1743 | switch (gimple_code (g)) | |
1744 | { | |
1745 | case GIMPLE_BIND: | |
1746 | case GIMPLE_CATCH: | |
1747 | case GIMPLE_EH_FILTER: | |
4c0315d0 | 1748 | case GIMPLE_EH_ELSE: |
75a70cf9 | 1749 | case GIMPLE_TRY: |
1750 | case GIMPLE_OMP_FOR: | |
1751 | case GIMPLE_OMP_MASTER: | |
bc7bff74 | 1752 | case GIMPLE_OMP_TASKGROUP: |
75a70cf9 | 1753 | case GIMPLE_OMP_ORDERED: |
1754 | case GIMPLE_OMP_SECTION: | |
1755 | case GIMPLE_OMP_PARALLEL: | |
1756 | case GIMPLE_OMP_TASK: | |
1757 | case GIMPLE_OMP_SECTIONS: | |
1758 | case GIMPLE_OMP_SINGLE: | |
bc7bff74 | 1759 | case GIMPLE_OMP_TARGET: |
1760 | case GIMPLE_OMP_TEAMS: | |
12d3d5cb | 1761 | case GIMPLE_OMP_CRITICAL: |
75a70cf9 | 1762 | case GIMPLE_WITH_CLEANUP_EXPR: |
4c0315d0 | 1763 | case GIMPLE_TRANSACTION: |
56686608 | 1764 | case GIMPLE_OMP_GRID_BODY: |
75a70cf9 | 1765 | return true; |
1766 | ||
1767 | default: | |
1768 | return false; | |
1769 | } | |
1770 | } | |
48e1416a | 1771 | |
75a70cf9 | 1772 | |
1773 | /* Return the basic block holding statement G. */ | |
1774 | ||
161dfa6e | 1775 | static inline basic_block |
42acab1c | 1776 | gimple_bb (const gimple *g) |
75a70cf9 | 1777 | { |
de6bd75e | 1778 | return g->bb; |
75a70cf9 | 1779 | } |
1780 | ||
1781 | ||
1782 | /* Return the lexical scope block holding statement G. */ | |
1783 | ||
1784 | static inline tree | |
42acab1c | 1785 | gimple_block (const gimple *g) |
75a70cf9 | 1786 | { |
de6bd75e | 1787 | return LOCATION_BLOCK (g->location); |
75a70cf9 | 1788 | } |
1789 | ||
1790 | ||
1791 | /* Set BLOCK to be the lexical scope block holding statement G. */ | |
1792 | ||
1793 | static inline void | |
42acab1c | 1794 | gimple_set_block (gimple *g, tree block) |
75a70cf9 | 1795 | { |
a96cefb2 | 1796 | g->location = set_block (g->location, block); |
75a70cf9 | 1797 | } |
1798 | ||
1799 | ||
1800 | /* Return location information for statement G. */ | |
1801 | ||
1802 | static inline location_t | |
42acab1c | 1803 | gimple_location (const gimple *g) |
75a70cf9 | 1804 | { |
de6bd75e | 1805 | return g->location; |
75a70cf9 | 1806 | } |
1807 | ||
4c8041d7 | 1808 | /* Return location information for statement G if g is not NULL. |
1809 | Otherwise, UNKNOWN_LOCATION is returned. */ | |
1810 | ||
1811 | static inline location_t | |
42acab1c | 1812 | gimple_location_safe (const gimple *g) |
4c8041d7 | 1813 | { |
1814 | return g ? gimple_location (g) : UNKNOWN_LOCATION; | |
1815 | } | |
1816 | ||
75a70cf9 | 1817 | /* Set location information for statement G. */ |
1818 | ||
1819 | static inline void | |
42acab1c | 1820 | gimple_set_location (gimple *g, location_t location) |
75a70cf9 | 1821 | { |
de6bd75e | 1822 | g->location = location; |
75a70cf9 | 1823 | } |
1824 | ||
1825 | ||
1826 | /* Return true if G contains location information. */ | |
1827 | ||
1828 | static inline bool | |
42acab1c | 1829 | gimple_has_location (const gimple *g) |
75a70cf9 | 1830 | { |
8e7408e3 | 1831 | return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION; |
75a70cf9 | 1832 | } |
1833 | ||
1834 | ||
c1a0c86c | 1835 | /* Return non-artificial location information for statement G. */ |
1836 | ||
1837 | static inline location_t | |
1838 | gimple_nonartificial_location (const gimple *g) | |
1839 | { | |
1840 | location_t *ploc = NULL; | |
1841 | ||
1842 | if (tree block = gimple_block (g)) | |
1843 | ploc = block_nonartificial_location (block); | |
1844 | ||
1845 | return ploc ? *ploc : gimple_location (g); | |
1846 | } | |
1847 | ||
1848 | ||
75a70cf9 | 1849 | /* Return the file name of the location of STMT. */ |
1850 | ||
1851 | static inline const char * | |
42acab1c | 1852 | gimple_filename (const gimple *stmt) |
75a70cf9 | 1853 | { |
1854 | return LOCATION_FILE (gimple_location (stmt)); | |
1855 | } | |
1856 | ||
1857 | ||
1858 | /* Return the line number of the location of STMT. */ | |
1859 | ||
1860 | static inline int | |
42acab1c | 1861 | gimple_lineno (const gimple *stmt) |
75a70cf9 | 1862 | { |
1863 | return LOCATION_LINE (gimple_location (stmt)); | |
1864 | } | |
1865 | ||
1866 | ||
1867 | /* Determine whether SEQ is a singleton. */ | |
1868 | ||
1869 | static inline bool | |
1870 | gimple_seq_singleton_p (gimple_seq seq) | |
1871 | { | |
1872 | return ((gimple_seq_first (seq) != NULL) | |
1873 | && (gimple_seq_first (seq) == gimple_seq_last (seq))); | |
1874 | } | |
1875 | ||
1876 | /* Return true if no warnings should be emitted for statement STMT. */ | |
1877 | ||
1878 | static inline bool | |
42acab1c | 1879 | gimple_no_warning_p (const gimple *stmt) |
75a70cf9 | 1880 | { |
de6bd75e | 1881 | return stmt->no_warning; |
75a70cf9 | 1882 | } |
1883 | ||
1884 | /* Set the no_warning flag of STMT to NO_WARNING. */ | |
1885 | ||
1886 | static inline void | |
42acab1c | 1887 | gimple_set_no_warning (gimple *stmt, bool no_warning) |
75a70cf9 | 1888 | { |
de6bd75e | 1889 | stmt->no_warning = (unsigned) no_warning; |
75a70cf9 | 1890 | } |
1891 | ||
c0a68037 | 1892 | /* Set the visited status on statement STMT to VISITED_P. |
1893 | ||
1894 | Please note that this 'visited' property of the gimple statement is | |
1895 | supposed to be undefined at pass boundaries. This means that a | |
1896 | given pass should not assume it contains any useful value when the | |
1897 | pass starts and thus can set it to any value it sees fit. | |
1898 | ||
1899 | You can learn more about the visited property of the gimple | |
1900 | statement by reading the comments of the 'visited' data member of | |
ab8c4a5e | 1901 | struct gimple. |
c0a68037 | 1902 | */ |
75a70cf9 | 1903 | |
1904 | static inline void | |
42acab1c | 1905 | gimple_set_visited (gimple *stmt, bool visited_p) |
75a70cf9 | 1906 | { |
de6bd75e | 1907 | stmt->visited = (unsigned) visited_p; |
75a70cf9 | 1908 | } |
1909 | ||
1910 | ||
c0a68037 | 1911 | /* Return the visited status for statement STMT. |
1912 | ||
1913 | Please note that this 'visited' property of the gimple statement is | |
1914 | supposed to be undefined at pass boundaries. This means that a | |
1915 | given pass should not assume it contains any useful value when the | |
1916 | pass starts and thus can set it to any value it sees fit. | |
1917 | ||
1918 | You can learn more about the visited property of the gimple | |
1919 | statement by reading the comments of the 'visited' data member of | |
ab8c4a5e | 1920 | struct gimple. */ |
75a70cf9 | 1921 | |
1922 | static inline bool | |
42acab1c | 1923 | gimple_visited_p (gimple *stmt) |
75a70cf9 | 1924 | { |
de6bd75e | 1925 | return stmt->visited; |
75a70cf9 | 1926 | } |
1927 | ||
1928 | ||
c0a68037 | 1929 | /* Set pass local flag PLF on statement STMT to VAL_P. |
1930 | ||
1931 | Please note that this PLF property of the gimple statement is | |
1932 | supposed to be undefined at pass boundaries. This means that a | |
1933 | given pass should not assume it contains any useful value when the | |
1934 | pass starts and thus can set it to any value it sees fit. | |
1935 | ||
1936 | You can learn more about the PLF property by reading the comment of | |
1937 | the 'plf' data member of struct gimple_statement_structure. */ | |
75a70cf9 | 1938 | |
1939 | static inline void | |
42acab1c | 1940 | gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p) |
75a70cf9 | 1941 | { |
1942 | if (val_p) | |
de6bd75e | 1943 | stmt->plf |= (unsigned int) plf; |
75a70cf9 | 1944 | else |
de6bd75e | 1945 | stmt->plf &= ~((unsigned int) plf); |
75a70cf9 | 1946 | } |
1947 | ||
1948 | ||
c0a68037 | 1949 | /* Return the value of pass local flag PLF on statement STMT. |
1950 | ||
1951 | Please note that this 'plf' property of the gimple statement is | |
1952 | supposed to be undefined at pass boundaries. This means that a | |
1953 | given pass should not assume it contains any useful value when the | |
1954 | pass starts and thus can set it to any value it sees fit. | |
1955 | ||
1956 | You can learn more about the plf property by reading the comment of | |
1957 | the 'plf' data member of struct gimple_statement_structure. */ | |
75a70cf9 | 1958 | |
1959 | static inline unsigned int | |
42acab1c | 1960 | gimple_plf (gimple *stmt, enum plf_mask plf) |
75a70cf9 | 1961 | { |
de6bd75e | 1962 | return stmt->plf & ((unsigned int) plf); |
75a70cf9 | 1963 | } |
1964 | ||
1965 | ||
c0a68037 | 1966 | /* Set the UID of statement. |
1967 | ||
1968 | Please note that this UID property is supposed to be undefined at | |
1969 | pass boundaries. This means that a given pass should not assume it | |
1970 | contains any useful value when the pass starts and thus can set it | |
1971 | to any value it sees fit. */ | |
75a70cf9 | 1972 | |
1973 | static inline void | |
42acab1c | 1974 | gimple_set_uid (gimple *g, unsigned uid) |
75a70cf9 | 1975 | { |
de6bd75e | 1976 | g->uid = uid; |
75a70cf9 | 1977 | } |
1978 | ||
1979 | ||
c0a68037 | 1980 | /* Return the UID of statement. |
1981 | ||
1982 | Please note that this UID property is supposed to be undefined at | |
1983 | pass boundaries. This means that a given pass should not assume it | |
1984 | contains any useful value when the pass starts and thus can set it | |
1985 | to any value it sees fit. */ | |
75a70cf9 | 1986 | |
1987 | static inline unsigned | |
42acab1c | 1988 | gimple_uid (const gimple *g) |
75a70cf9 | 1989 | { |
de6bd75e | 1990 | return g->uid; |
75a70cf9 | 1991 | } |
1992 | ||
1993 | ||
e3a19533 | 1994 | /* Make statement G a singleton sequence. */ |
1995 | ||
1996 | static inline void | |
42acab1c | 1997 | gimple_init_singleton (gimple *g) |
e3a19533 | 1998 | { |
de6bd75e | 1999 | g->next = NULL; |
2000 | g->prev = g; | |
e3a19533 | 2001 | } |
2002 | ||
2003 | ||
75a70cf9 | 2004 | /* Return true if GIMPLE statement G has register or memory operands. */ |
2005 | ||
2006 | static inline bool | |
42acab1c | 2007 | gimple_has_ops (const gimple *g) |
75a70cf9 | 2008 | { |
2009 | return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN; | |
2010 | } | |
2011 | ||
de6bd75e | 2012 | template <> |
2013 | template <> | |
2014 | inline bool | |
42acab1c | 2015 | is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs) |
de6bd75e | 2016 | { |
2017 | return gimple_has_ops (gs); | |
2018 | } | |
2019 | ||
2020 | template <> | |
2021 | template <> | |
2022 | inline bool | |
42acab1c | 2023 | is_a_helper <gimple_statement_with_ops *>::test (gimple *gs) |
de6bd75e | 2024 | { |
2025 | return gimple_has_ops (gs); | |
2026 | } | |
75a70cf9 | 2027 | |
2028 | /* Return true if GIMPLE statement G has memory operands. */ | |
2029 | ||
2030 | static inline bool | |
42acab1c | 2031 | gimple_has_mem_ops (const gimple *g) |
75a70cf9 | 2032 | { |
2033 | return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN; | |
2034 | } | |
2035 | ||
de6bd75e | 2036 | template <> |
2037 | template <> | |
2038 | inline bool | |
42acab1c | 2039 | is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs) |
de6bd75e | 2040 | { |
2041 | return gimple_has_mem_ops (gs); | |
2042 | } | |
2043 | ||
2044 | template <> | |
2045 | template <> | |
2046 | inline bool | |
42acab1c | 2047 | is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs) |
de6bd75e | 2048 | { |
2049 | return gimple_has_mem_ops (gs); | |
2050 | } | |
75a70cf9 | 2051 | |
75a70cf9 | 2052 | /* Return the set of USE operands for statement G. */ |
2053 | ||
2054 | static inline struct use_optype_d * | |
42acab1c | 2055 | gimple_use_ops (const gimple *g) |
75a70cf9 | 2056 | { |
de6bd75e | 2057 | const gimple_statement_with_ops *ops_stmt = |
13cbeaac | 2058 | dyn_cast <const gimple_statement_with_ops *> (g); |
de6bd75e | 2059 | if (!ops_stmt) |
75a70cf9 | 2060 | return NULL; |
de6bd75e | 2061 | return ops_stmt->use_ops; |
75a70cf9 | 2062 | } |
2063 | ||
2064 | ||
2065 | /* Set USE to be the set of USE operands for statement G. */ | |
2066 | ||
2067 | static inline void | |
42acab1c | 2068 | gimple_set_use_ops (gimple *g, struct use_optype_d *use) |
75a70cf9 | 2069 | { |
de6bd75e | 2070 | gimple_statement_with_ops *ops_stmt = |
13cbeaac | 2071 | as_a <gimple_statement_with_ops *> (g); |
de6bd75e | 2072 | ops_stmt->use_ops = use; |
75a70cf9 | 2073 | } |
2074 | ||
2075 | ||
dd277d48 | 2076 | /* Return the single VUSE operand of the statement G. */ |
75a70cf9 | 2077 | |
dd277d48 | 2078 | static inline tree |
42acab1c | 2079 | gimple_vuse (const gimple *g) |
75a70cf9 | 2080 | { |
de6bd75e | 2081 | const gimple_statement_with_memory_ops *mem_ops_stmt = |
13cbeaac | 2082 | dyn_cast <const gimple_statement_with_memory_ops *> (g); |
de6bd75e | 2083 | if (!mem_ops_stmt) |
dd277d48 | 2084 | return NULL_TREE; |
de6bd75e | 2085 | return mem_ops_stmt->vuse; |
75a70cf9 | 2086 | } |
2087 | ||
dd277d48 | 2088 | /* Return the single VDEF operand of the statement G. */ |
75a70cf9 | 2089 | |
dd277d48 | 2090 | static inline tree |
42acab1c | 2091 | gimple_vdef (const gimple *g) |
75a70cf9 | 2092 | { |
de6bd75e | 2093 | const gimple_statement_with_memory_ops *mem_ops_stmt = |
13cbeaac | 2094 | dyn_cast <const gimple_statement_with_memory_ops *> (g); |
de6bd75e | 2095 | if (!mem_ops_stmt) |
dd277d48 | 2096 | return NULL_TREE; |
de6bd75e | 2097 | return mem_ops_stmt->vdef; |
75a70cf9 | 2098 | } |
2099 | ||
dd277d48 | 2100 | /* Return the single VUSE operand of the statement G. */ |
75a70cf9 | 2101 | |
dd277d48 | 2102 | static inline tree * |
42acab1c | 2103 | gimple_vuse_ptr (gimple *g) |
75a70cf9 | 2104 | { |
de6bd75e | 2105 | gimple_statement_with_memory_ops *mem_ops_stmt = |
13cbeaac | 2106 | dyn_cast <gimple_statement_with_memory_ops *> (g); |
de6bd75e | 2107 | if (!mem_ops_stmt) |
75a70cf9 | 2108 | return NULL; |
de6bd75e | 2109 | return &mem_ops_stmt->vuse; |
75a70cf9 | 2110 | } |
2111 | ||
dd277d48 | 2112 | /* Return the single VDEF operand of the statement G. */ |
75a70cf9 | 2113 | |
dd277d48 | 2114 | static inline tree * |
42acab1c | 2115 | gimple_vdef_ptr (gimple *g) |
75a70cf9 | 2116 | { |
de6bd75e | 2117 | gimple_statement_with_memory_ops *mem_ops_stmt = |
13cbeaac | 2118 | dyn_cast <gimple_statement_with_memory_ops *> (g); |
de6bd75e | 2119 | if (!mem_ops_stmt) |
75a70cf9 | 2120 | return NULL; |
de6bd75e | 2121 | return &mem_ops_stmt->vdef; |
dd277d48 | 2122 | } |
2123 | ||
2124 | /* Set the single VUSE operand of the statement G. */ | |
2125 | ||
2126 | static inline void | |
42acab1c | 2127 | gimple_set_vuse (gimple *g, tree vuse) |
dd277d48 | 2128 | { |
de6bd75e | 2129 | gimple_statement_with_memory_ops *mem_ops_stmt = |
13cbeaac | 2130 | as_a <gimple_statement_with_memory_ops *> (g); |
de6bd75e | 2131 | mem_ops_stmt->vuse = vuse; |
dd277d48 | 2132 | } |
2133 | ||
2134 | /* Set the single VDEF operand of the statement G. */ | |
2135 | ||
2136 | static inline void | |
42acab1c | 2137 | gimple_set_vdef (gimple *g, tree vdef) |
dd277d48 | 2138 | { |
de6bd75e | 2139 | gimple_statement_with_memory_ops *mem_ops_stmt = |
13cbeaac | 2140 | as_a <gimple_statement_with_memory_ops *> (g); |
de6bd75e | 2141 | mem_ops_stmt->vdef = vdef; |
75a70cf9 | 2142 | } |
2143 | ||
2144 | ||
2145 | /* Return true if statement G has operands and the modified field has | |
2146 | been set. */ | |
2147 | ||
2148 | static inline bool | |
42acab1c | 2149 | gimple_modified_p (const gimple *g) |
75a70cf9 | 2150 | { |
de6bd75e | 2151 | return (gimple_has_ops (g)) ? (bool) g->modified : false; |
75a70cf9 | 2152 | } |
2153 | ||
75a70cf9 | 2154 | |
5168aa67 | 2155 | /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has |
2156 | a MODIFIED field. */ | |
2157 | ||
2158 | static inline void | |
42acab1c | 2159 | gimple_set_modified (gimple *s, bool modifiedp) |
5168aa67 | 2160 | { |
2161 | if (gimple_has_ops (s)) | |
de6bd75e | 2162 | s->modified = (unsigned) modifiedp; |
5168aa67 | 2163 | } |
2164 | ||
2165 | ||
75a70cf9 | 2166 | /* Return the tree code for the expression computed by STMT. This is |
2167 | only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For | |
2168 | GIMPLE_CALL, return CALL_EXPR as the expression code for | |
2169 | consistency. This is useful when the caller needs to deal with the | |
2170 | three kinds of computation that GIMPLE supports. */ | |
2171 | ||
2172 | static inline enum tree_code | |
42acab1c | 2173 | gimple_expr_code (const gimple *stmt) |
75a70cf9 | 2174 | { |
2175 | enum gimple_code code = gimple_code (stmt); | |
2176 | if (code == GIMPLE_ASSIGN || code == GIMPLE_COND) | |
de6bd75e | 2177 | return (enum tree_code) stmt->subcode; |
75a70cf9 | 2178 | else |
ae0e70e9 | 2179 | { |
2180 | gcc_gimple_checking_assert (code == GIMPLE_CALL); | |
2181 | return CALL_EXPR; | |
2182 | } | |
75a70cf9 | 2183 | } |
2184 | ||
2185 | ||
75a70cf9 | 2186 | /* Return true if statement STMT contains volatile operands. */ |
2187 | ||
2188 | static inline bool | |
42acab1c | 2189 | gimple_has_volatile_ops (const gimple *stmt) |
75a70cf9 | 2190 | { |
2191 | if (gimple_has_mem_ops (stmt)) | |
de6bd75e | 2192 | return stmt->has_volatile_ops; |
75a70cf9 | 2193 | else |
2194 | return false; | |
2195 | } | |
2196 | ||
2197 | ||
2198 | /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */ | |
2199 | ||
2200 | static inline void | |
42acab1c | 2201 | gimple_set_has_volatile_ops (gimple *stmt, bool volatilep) |
75a70cf9 | 2202 | { |
2203 | if (gimple_has_mem_ops (stmt)) | |
de6bd75e | 2204 | stmt->has_volatile_ops = (unsigned) volatilep; |
75a70cf9 | 2205 | } |
2206 | ||
de60f90c | 2207 | /* Return true if STMT is in a transaction. */ |
2208 | ||
2209 | static inline bool | |
42acab1c | 2210 | gimple_in_transaction (const gimple *stmt) |
de60f90c | 2211 | { |
c927329e | 2212 | return bb_in_transaction (gimple_bb (stmt)); |
de60f90c | 2213 | } |
75a70cf9 | 2214 | |
2215 | /* Return true if statement STMT may access memory. */ | |
2216 | ||
2217 | static inline bool | |
42acab1c | 2218 | gimple_references_memory_p (gimple *stmt) |
75a70cf9 | 2219 | { |
dd277d48 | 2220 | return gimple_has_mem_ops (stmt) && gimple_vuse (stmt); |
75a70cf9 | 2221 | } |
2222 | ||
2223 | ||
75a70cf9 | 2224 | /* Return the subcode for OMP statement S. */ |
2225 | ||
2226 | static inline unsigned | |
42acab1c | 2227 | gimple_omp_subcode (const gimple *s) |
75a70cf9 | 2228 | { |
1e720c36 | 2229 | gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD |
7e5a76c8 | 2230 | && gimple_code (s) <= GIMPLE_OMP_TEAMS); |
de6bd75e | 2231 | return s->subcode; |
75a70cf9 | 2232 | } |
2233 | ||
2234 | /* Set the subcode for OMP statement S to SUBCODE. */ | |
2235 | ||
2236 | static inline void | |
42acab1c | 2237 | gimple_omp_set_subcode (gimple *s, unsigned int subcode) |
75a70cf9 | 2238 | { |
2239 | /* We only have 16 bits for the subcode. Assert that we are not | |
2240 | overflowing it. */ | |
1e720c36 | 2241 | gcc_gimple_checking_assert (subcode < (1 << 16)); |
de6bd75e | 2242 | s->subcode = subcode; |
75a70cf9 | 2243 | } |
2244 | ||
2245 | /* Set the nowait flag on OMP_RETURN statement S. */ | |
2246 | ||
2247 | static inline void | |
42acab1c | 2248 | gimple_omp_return_set_nowait (gimple *s) |
75a70cf9 | 2249 | { |
2250 | GIMPLE_CHECK (s, GIMPLE_OMP_RETURN); | |
de6bd75e | 2251 | s->subcode |= GF_OMP_RETURN_NOWAIT; |
75a70cf9 | 2252 | } |
2253 | ||
2254 | ||
2255 | /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT | |
2256 | flag set. */ | |
2257 | ||
2258 | static inline bool | |
42acab1c | 2259 | gimple_omp_return_nowait_p (const gimple *g) |
75a70cf9 | 2260 | { |
2261 | GIMPLE_CHECK (g, GIMPLE_OMP_RETURN); | |
2262 | return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0; | |
2263 | } | |
2264 | ||
2265 | ||
bc7bff74 | 2266 | /* Set the LHS of OMP return. */ |
2267 | ||
2268 | static inline void | |
42acab1c | 2269 | gimple_omp_return_set_lhs (gimple *g, tree lhs) |
bc7bff74 | 2270 | { |
a9035320 | 2271 | gimple_statement_omp_return *omp_return_stmt = |
13cbeaac | 2272 | as_a <gimple_statement_omp_return *> (g); |
a9035320 | 2273 | omp_return_stmt->val = lhs; |
bc7bff74 | 2274 | } |
2275 | ||
2276 | ||
2277 | /* Get the LHS of OMP return. */ | |
2278 | ||
2279 | static inline tree | |
42acab1c | 2280 | gimple_omp_return_lhs (const gimple *g) |
bc7bff74 | 2281 | { |
a9035320 | 2282 | const gimple_statement_omp_return *omp_return_stmt = |
13cbeaac | 2283 | as_a <const gimple_statement_omp_return *> (g); |
a9035320 | 2284 | return omp_return_stmt->val; |
bc7bff74 | 2285 | } |
2286 | ||
2287 | ||
2288 | /* Return a pointer to the LHS of OMP return. */ | |
2289 | ||
2290 | static inline tree * | |
42acab1c | 2291 | gimple_omp_return_lhs_ptr (gimple *g) |
bc7bff74 | 2292 | { |
a9035320 | 2293 | gimple_statement_omp_return *omp_return_stmt = |
13cbeaac | 2294 | as_a <gimple_statement_omp_return *> (g); |
a9035320 | 2295 | return &omp_return_stmt->val; |
bc7bff74 | 2296 | } |
2297 | ||
2298 | ||
75a70cf9 | 2299 | /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST |
2300 | flag set. */ | |
2301 | ||
2302 | static inline bool | |
42acab1c | 2303 | gimple_omp_section_last_p (const gimple *g) |
75a70cf9 | 2304 | { |
2305 | GIMPLE_CHECK (g, GIMPLE_OMP_SECTION); | |
2306 | return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0; | |
2307 | } | |
2308 | ||
2309 | ||
2310 | /* Set the GF_OMP_SECTION_LAST flag on G. */ | |
2311 | ||
2312 | static inline void | |
42acab1c | 2313 | gimple_omp_section_set_last (gimple *g) |
75a70cf9 | 2314 | { |
2315 | GIMPLE_CHECK (g, GIMPLE_OMP_SECTION); | |
de6bd75e | 2316 | g->subcode |= GF_OMP_SECTION_LAST; |
75a70cf9 | 2317 | } |
2318 | ||
2319 | ||
2320 | /* Return true if OMP parallel statement G has the | |
2321 | GF_OMP_PARALLEL_COMBINED flag set. */ | |
2322 | ||
2323 | static inline bool | |
42acab1c | 2324 | gimple_omp_parallel_combined_p (const gimple *g) |
75a70cf9 | 2325 | { |
2326 | GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL); | |
2327 | return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0; | |
2328 | } | |
2329 | ||
2330 | ||
2331 | /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean | |
2332 | value of COMBINED_P. */ | |
2333 | ||
2334 | static inline void | |
42acab1c | 2335 | gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p) |
75a70cf9 | 2336 | { |
2337 | GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL); | |
2338 | if (combined_p) | |
de6bd75e | 2339 | g->subcode |= GF_OMP_PARALLEL_COMBINED; |
75a70cf9 | 2340 | else |
de6bd75e | 2341 | g->subcode &= ~GF_OMP_PARALLEL_COMBINED; |
75a70cf9 | 2342 | } |
2343 | ||
2344 | ||
2169f33b | 2345 | /* Return true if OMP atomic load/store statement G has the |
2346 | GF_OMP_ATOMIC_NEED_VALUE flag set. */ | |
2347 | ||
2348 | static inline bool | |
42acab1c | 2349 | gimple_omp_atomic_need_value_p (const gimple *g) |
2169f33b | 2350 | { |
2351 | if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) | |
2352 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); | |
2353 | return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0; | |
2354 | } | |
2355 | ||
2356 | ||
2357 | /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */ | |
2358 | ||
2359 | static inline void | |
42acab1c | 2360 | gimple_omp_atomic_set_need_value (gimple *g) |
2169f33b | 2361 | { |
2362 | if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) | |
2363 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); | |
de6bd75e | 2364 | g->subcode |= GF_OMP_ATOMIC_NEED_VALUE; |
2169f33b | 2365 | } |
2366 | ||
2367 | ||
7e5a76c8 | 2368 | /* Return the memory order of the OMP atomic load/store statement G. */ |
bc7bff74 | 2369 | |
7e5a76c8 | 2370 | static inline enum omp_memory_order |
2371 | gimple_omp_atomic_memory_order (const gimple *g) | |
bc7bff74 | 2372 | { |
2373 | if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) | |
2374 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); | |
7e5a76c8 | 2375 | return (enum omp_memory_order) |
2376 | (gimple_omp_subcode (g) & GF_OMP_ATOMIC_MEMORY_ORDER); | |
bc7bff74 | 2377 | } |
2378 | ||
2379 | ||
7e5a76c8 | 2380 | /* Set the memory order on G. */ |
bc7bff74 | 2381 | |
2382 | static inline void | |
7e5a76c8 | 2383 | gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo) |
bc7bff74 | 2384 | { |
2385 | if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) | |
2386 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); | |
7e5a76c8 | 2387 | g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER) |
2388 | | (mo & GF_OMP_ATOMIC_MEMORY_ORDER)); | |
bc7bff74 | 2389 | } |
2390 | ||
2391 | ||
75a70cf9 | 2392 | /* Return the number of operands for statement GS. */ |
2393 | ||
2394 | static inline unsigned | |
42acab1c | 2395 | gimple_num_ops (const gimple *gs) |
75a70cf9 | 2396 | { |
de6bd75e | 2397 | return gs->num_ops; |
75a70cf9 | 2398 | } |
2399 | ||
2400 | ||
2401 | /* Set the number of operands for statement GS. */ | |
2402 | ||
2403 | static inline void | |
42acab1c | 2404 | gimple_set_num_ops (gimple *gs, unsigned num_ops) |
75a70cf9 | 2405 | { |
de6bd75e | 2406 | gs->num_ops = num_ops; |
75a70cf9 | 2407 | } |
2408 | ||
2409 | ||
2410 | /* Return the array of operands for statement GS. */ | |
2411 | ||
2412 | static inline tree * | |
42acab1c | 2413 | gimple_ops (gimple *gs) |
75a70cf9 | 2414 | { |
1fed3255 | 2415 | size_t off; |
75a70cf9 | 2416 | |
2417 | /* All the tuples have their operand vector at the very bottom | |
1fed3255 | 2418 | of the structure. Note that those structures that do not |
2419 | have an operand vector have a zero offset. */ | |
2420 | off = gimple_ops_offset_[gimple_statement_structure (gs)]; | |
1e720c36 | 2421 | gcc_gimple_checking_assert (off != 0); |
1fed3255 | 2422 | |
2423 | return (tree *) ((char *) gs + off); | |
75a70cf9 | 2424 | } |
2425 | ||
2426 | ||
2427 | /* Return operand I for statement GS. */ | |
2428 | ||
2429 | static inline tree | |
42acab1c | 2430 | gimple_op (const gimple *gs, unsigned i) |
75a70cf9 | 2431 | { |
2432 | if (gimple_has_ops (gs)) | |
2433 | { | |
1e720c36 | 2434 | gcc_gimple_checking_assert (i < gimple_num_ops (gs)); |
75a70cf9 | 2435 | return gimple_ops (CONST_CAST_GIMPLE (gs))[i]; |
2436 | } | |
2437 | else | |
2438 | return NULL_TREE; | |
2439 | } | |
2440 | ||
2441 | /* Return a pointer to operand I for statement GS. */ | |
2442 | ||
2443 | static inline tree * | |
ad023323 | 2444 | gimple_op_ptr (gimple *gs, unsigned i) |
75a70cf9 | 2445 | { |
2446 | if (gimple_has_ops (gs)) | |
2447 | { | |
1e720c36 | 2448 | gcc_gimple_checking_assert (i < gimple_num_ops (gs)); |
ad023323 | 2449 | return gimple_ops (gs) + i; |
75a70cf9 | 2450 | } |
2451 | else | |
2452 | return NULL; | |
2453 | } | |
2454 | ||
2455 | /* Set operand I of statement GS to OP. */ | |
2456 | ||
2457 | static inline void | |
42acab1c | 2458 | gimple_set_op (gimple *gs, unsigned i, tree op) |
75a70cf9 | 2459 | { |
1e720c36 | 2460 | gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs)); |
75a70cf9 | 2461 | |
2462 | /* Note. It may be tempting to assert that OP matches | |
2463 | is_gimple_operand, but that would be wrong. Different tuples | |
2464 | accept slightly different sets of tree operands. Each caller | |
2465 | should perform its own validation. */ | |
2466 | gimple_ops (gs)[i] = op; | |
2467 | } | |
2468 | ||
2469 | /* Return true if GS is a GIMPLE_ASSIGN. */ | |
2470 | ||
2471 | static inline bool | |
42acab1c | 2472 | is_gimple_assign (const gimple *gs) |
75a70cf9 | 2473 | { |
2474 | return gimple_code (gs) == GIMPLE_ASSIGN; | |
2475 | } | |
2476 | ||
2477 | /* Determine if expression CODE is one of the valid expressions that can | |
2478 | be used on the RHS of GIMPLE assignments. */ | |
2479 | ||
2480 | static inline enum gimple_rhs_class | |
2481 | get_gimple_rhs_class (enum tree_code code) | |
2482 | { | |
2483 | return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code]; | |
2484 | } | |
2485 | ||
2486 | /* Return the LHS of assignment statement GS. */ | |
2487 | ||
2ee9f21a | 2488 | static inline tree |
2489 | gimple_assign_lhs (const gassign *gs) | |
2490 | { | |
2491 | return gs->op[0]; | |
2492 | } | |
2493 | ||
75a70cf9 | 2494 | static inline tree |
42acab1c | 2495 | gimple_assign_lhs (const gimple *gs) |
75a70cf9 | 2496 | { |
2ee9f21a | 2497 | const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs); |
2498 | return gimple_assign_lhs (ass); | |
75a70cf9 | 2499 | } |
2500 | ||
2501 | ||
2502 | /* Return a pointer to the LHS of assignment statement GS. */ | |
2503 | ||
2ee9f21a | 2504 | static inline tree * |
ad023323 | 2505 | gimple_assign_lhs_ptr (gassign *gs) |
2ee9f21a | 2506 | { |
ad023323 | 2507 | return &gs->op[0]; |
2ee9f21a | 2508 | } |
2509 | ||
75a70cf9 | 2510 | static inline tree * |
ad023323 | 2511 | gimple_assign_lhs_ptr (gimple *gs) |
75a70cf9 | 2512 | { |
ad023323 | 2513 | gassign *ass = GIMPLE_CHECK2<gassign *> (gs); |
2ee9f21a | 2514 | return gimple_assign_lhs_ptr (ass); |
75a70cf9 | 2515 | } |
2516 | ||
2517 | ||
2518 | /* Set LHS to be the LHS operand of assignment statement GS. */ | |
2519 | ||
2520 | static inline void | |
2ee9f21a | 2521 | gimple_assign_set_lhs (gassign *gs, tree lhs) |
75a70cf9 | 2522 | { |
2ee9f21a | 2523 | gs->op[0] = lhs; |
75a70cf9 | 2524 | |
2525 | if (lhs && TREE_CODE (lhs) == SSA_NAME) | |
2526 | SSA_NAME_DEF_STMT (lhs) = gs; | |
2527 | } | |
2528 | ||
2ee9f21a | 2529 | static inline void |
42acab1c | 2530 | gimple_assign_set_lhs (gimple *gs, tree lhs) |
2ee9f21a | 2531 | { |
2532 | gassign *ass = GIMPLE_CHECK2<gassign *> (gs); | |
2533 | gimple_assign_set_lhs (ass, lhs); | |
2534 | } | |
2535 | ||
75a70cf9 | 2536 | |
2537 | /* Return the first operand on the RHS of assignment statement GS. */ | |
2538 | ||
2ee9f21a | 2539 | static inline tree |
2540 | gimple_assign_rhs1 (const gassign *gs) | |
2541 | { | |
2542 | return gs->op[1]; | |
2543 | } | |
2544 | ||
75a70cf9 | 2545 | static inline tree |
42acab1c | 2546 | gimple_assign_rhs1 (const gimple *gs) |
75a70cf9 | 2547 | { |
2ee9f21a | 2548 | const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs); |
2549 | return gimple_assign_rhs1 (ass); | |
75a70cf9 | 2550 | } |
2551 | ||
2552 | ||
2553 | /* Return a pointer to the first operand on the RHS of assignment | |
2554 | statement GS. */ | |
2555 | ||
2ee9f21a | 2556 | static inline tree * |
ad023323 | 2557 | gimple_assign_rhs1_ptr (gassign *gs) |
2ee9f21a | 2558 | { |
ad023323 | 2559 | return &gs->op[1]; |
2ee9f21a | 2560 | } |
2561 | ||
75a70cf9 | 2562 | static inline tree * |
ad023323 | 2563 | gimple_assign_rhs1_ptr (gimple *gs) |
75a70cf9 | 2564 | { |
ad023323 | 2565 | gassign *ass = GIMPLE_CHECK2<gassign *> (gs); |
2ee9f21a | 2566 | return gimple_assign_rhs1_ptr (ass); |
75a70cf9 | 2567 | } |
2568 | ||
2569 | /* Set RHS to be the first operand on the RHS of assignment statement GS. */ | |
2570 | ||
2571 | static inline void | |
2ee9f21a | 2572 | gimple_assign_set_rhs1 (gassign *gs, tree rhs) |
75a70cf9 | 2573 | { |
2ee9f21a | 2574 | gs->op[1] = rhs; |
2575 | } | |
75a70cf9 | 2576 | |
2ee9f21a | 2577 | static inline void |
42acab1c | 2578 | gimple_assign_set_rhs1 (gimple *gs, tree rhs) |
2ee9f21a | 2579 | { |
2580 | gassign *ass = GIMPLE_CHECK2<gassign *> (gs); | |
2581 | gimple_assign_set_rhs1 (ass, rhs); | |
75a70cf9 | 2582 | } |
2583 | ||
2584 | ||
2585 | /* Return the second operand on the RHS of assignment statement GS. | |
2586 | If GS does not have two operands, NULL is returned instead. */ | |
2587 | ||
2588 | static inline tree | |
2ee9f21a | 2589 | gimple_assign_rhs2 (const gassign *gs) |
75a70cf9 | 2590 | { |
75a70cf9 | 2591 | if (gimple_num_ops (gs) >= 3) |
2ee9f21a | 2592 | return gs->op[2]; |
75a70cf9 | 2593 | else |
2594 | return NULL_TREE; | |
2595 | } | |
2596 | ||
2ee9f21a | 2597 | static inline tree |
42acab1c | 2598 | gimple_assign_rhs2 (const gimple *gs) |
2ee9f21a | 2599 | { |
2600 | const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs); | |
2601 | return gimple_assign_rhs2 (ass); | |
2602 | } | |
2603 | ||
75a70cf9 | 2604 | |
2605 | /* Return a pointer to the second operand on the RHS of assignment | |
2606 | statement GS. */ | |
2607 | ||
2ee9f21a | 2608 | static inline tree * |
ad023323 | 2609 | gimple_assign_rhs2_ptr (gassign *gs) |
2ee9f21a | 2610 | { |
2611 | gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3); | |
ad023323 | 2612 | return &gs->op[2]; |
2ee9f21a | 2613 | } |
2614 | ||
75a70cf9 | 2615 | static inline tree * |
ad023323 | 2616 | gimple_assign_rhs2_ptr (gimple *gs) |
75a70cf9 | 2617 | { |
ad023323 | 2618 | gassign *ass = GIMPLE_CHECK2<gassign *> (gs); |
2ee9f21a | 2619 | return gimple_assign_rhs2_ptr (ass); |
75a70cf9 | 2620 | } |
2621 | ||
2622 | ||
2623 | /* Set RHS to be the second operand on the RHS of assignment statement GS. */ | |
2624 | ||
2625 | static inline void | |
2ee9f21a | 2626 | gimple_assign_set_rhs2 (gassign *gs, tree rhs) |
75a70cf9 | 2627 | { |
2ee9f21a | 2628 | gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3); |
2629 | gs->op[2] = rhs; | |
2630 | } | |
75a70cf9 | 2631 | |
2ee9f21a | 2632 | static inline void |
42acab1c | 2633 | gimple_assign_set_rhs2 (gimple *gs, tree rhs) |
2ee9f21a | 2634 | { |
2635 | gassign *ass = GIMPLE_CHECK2<gassign *> (gs); | |
2636 | return gimple_assign_set_rhs2 (ass, rhs); | |
75a70cf9 | 2637 | } |
2638 | ||
00f4f705 | 2639 | /* Return the third operand on the RHS of assignment statement GS. |
2640 | If GS does not have two operands, NULL is returned instead. */ | |
2641 | ||
2642 | static inline tree | |
2ee9f21a | 2643 | gimple_assign_rhs3 (const gassign *gs) |
00f4f705 | 2644 | { |
00f4f705 | 2645 | if (gimple_num_ops (gs) >= 4) |
2ee9f21a | 2646 | return gs->op[3]; |
00f4f705 | 2647 | else |
2648 | return NULL_TREE; | |
2649 | } | |
2650 | ||
2ee9f21a | 2651 | static inline tree |
42acab1c | 2652 | gimple_assign_rhs3 (const gimple *gs) |
2ee9f21a | 2653 | { |
2654 | const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs); | |
2655 | return gimple_assign_rhs3 (ass); | |
2656 | } | |
2657 | ||
00f4f705 | 2658 | /* Return a pointer to the third operand on the RHS of assignment |
2659 | statement GS. */ | |
2660 | ||
2661 | static inline tree * | |
ad023323 | 2662 | gimple_assign_rhs3_ptr (gimple *gs) |
00f4f705 | 2663 | { |
ad023323 | 2664 | gassign *ass = GIMPLE_CHECK2<gassign *> (gs); |
2ee9f21a | 2665 | gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4); |
ad023323 | 2666 | return &ass->op[3]; |
00f4f705 | 2667 | } |
2668 | ||
2669 | ||
2670 | /* Set RHS to be the third operand on the RHS of assignment statement GS. */ | |
2671 | ||
2672 | static inline void | |
2ee9f21a | 2673 | gimple_assign_set_rhs3 (gassign *gs, tree rhs) |
00f4f705 | 2674 | { |
2ee9f21a | 2675 | gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4); |
2676 | gs->op[3] = rhs; | |
2677 | } | |
00f4f705 | 2678 | |
2ee9f21a | 2679 | static inline void |
42acab1c | 2680 | gimple_assign_set_rhs3 (gimple *gs, tree rhs) |
2ee9f21a | 2681 | { |
2682 | gassign *ass = GIMPLE_CHECK2<gassign *> (gs); | |
2683 | gimple_assign_set_rhs3 (ass, rhs); | |
00f4f705 | 2684 | } |
2685 | ||
2ee9f21a | 2686 | |
806413d2 | 2687 | /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers |
2688 | which expect to see only two operands. */ | |
00f4f705 | 2689 | |
2690 | static inline void | |
2691 | gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code, | |
2692 | tree op1, tree op2) | |
2693 | { | |
806413d2 | 2694 | gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL); |
2695 | } | |
2696 | ||
2697 | /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers | |
2698 | which expect to see only one operands. */ | |
2699 | ||
2700 | static inline void | |
2701 | gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code, | |
2702 | tree op1) | |
2703 | { | |
2704 | gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL); | |
00f4f705 | 2705 | } |
2706 | ||
75a70cf9 | 2707 | /* Returns true if GS is a nontemporal move. */ |
2708 | ||
2709 | static inline bool | |
1a91d914 | 2710 | gimple_assign_nontemporal_move_p (const gassign *gs) |
75a70cf9 | 2711 | { |
de6bd75e | 2712 | return gs->nontemporal_move; |
75a70cf9 | 2713 | } |
2714 | ||
2715 | /* Sets nontemporal move flag of GS to NONTEMPORAL. */ | |
2716 | ||
2717 | static inline void | |
42acab1c | 2718 | gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal) |
75a70cf9 | 2719 | { |
2720 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
de6bd75e | 2721 | gs->nontemporal_move = nontemporal; |
75a70cf9 | 2722 | } |
2723 | ||
2724 | ||
2725 | /* Return the code of the expression computed on the rhs of assignment | |
2726 | statement GS. In case that the RHS is a single object, returns the | |
2727 | tree code of the object. */ | |
2728 | ||
2729 | static inline enum tree_code | |
2ee9f21a | 2730 | gimple_assign_rhs_code (const gassign *gs) |
75a70cf9 | 2731 | { |
2ee9f21a | 2732 | enum tree_code code = (enum tree_code) gs->subcode; |
09937c79 | 2733 | /* While we initially set subcode to the TREE_CODE of the rhs for |
2734 | GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay | |
2735 | in sync when we rewrite stmts into SSA form or do SSA propagations. */ | |
75a70cf9 | 2736 | if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS) |
2ee9f21a | 2737 | code = TREE_CODE (gs->op[1]); |
75a70cf9 | 2738 | |
2739 | return code; | |
2740 | } | |
2741 | ||
2ee9f21a | 2742 | static inline enum tree_code |
42acab1c | 2743 | gimple_assign_rhs_code (const gimple *gs) |
2ee9f21a | 2744 | { |
2745 | const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs); | |
2746 | return gimple_assign_rhs_code (ass); | |
2747 | } | |
2748 | ||
75a70cf9 | 2749 | |
2750 | /* Set CODE to be the code for the expression computed on the RHS of | |
2751 | assignment S. */ | |
2752 | ||
2753 | static inline void | |
42acab1c | 2754 | gimple_assign_set_rhs_code (gimple *s, enum tree_code code) |
75a70cf9 | 2755 | { |
2756 | GIMPLE_CHECK (s, GIMPLE_ASSIGN); | |
de6bd75e | 2757 | s->subcode = code; |
75a70cf9 | 2758 | } |
2759 | ||
2760 | ||
b8747787 | 2761 | /* Return the gimple rhs class of the code of the expression computed on |
2762 | the rhs of assignment statement GS. | |
2763 | This will never return GIMPLE_INVALID_RHS. */ | |
2764 | ||
2765 | static inline enum gimple_rhs_class | |
42acab1c | 2766 | gimple_assign_rhs_class (const gimple *gs) |
b8747787 | 2767 | { |
2768 | return get_gimple_rhs_class (gimple_assign_rhs_code (gs)); | |
2769 | } | |
2770 | ||
09937c79 | 2771 | /* Return true if GS is an assignment with a singleton RHS, i.e., |
2772 | there is no operator associated with the assignment itself. | |
2773 | Unlike gimple_assign_copy_p, this predicate returns true for | |
2774 | any RHS operand, including those that perform an operation | |
2775 | and do not have the semantics of a copy, such as COND_EXPR. */ | |
2776 | ||
2777 | static inline bool | |
42acab1c | 2778 | gimple_assign_single_p (const gimple *gs) |
09937c79 | 2779 | { |
2780 | return (is_gimple_assign (gs) | |
2781 | && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS); | |
2782 | } | |
2783 | ||
58b83435 | 2784 | /* Return true if GS performs a store to its lhs. */ |
2785 | ||
2786 | static inline bool | |
42acab1c | 2787 | gimple_store_p (const gimple *gs) |
58b83435 | 2788 | { |
2789 | tree lhs = gimple_get_lhs (gs); | |
2790 | return lhs && !is_gimple_reg (lhs); | |
2791 | } | |
2792 | ||
2793 | /* Return true if GS is an assignment that loads from its rhs1. */ | |
2794 | ||
2795 | static inline bool | |
42acab1c | 2796 | gimple_assign_load_p (const gimple *gs) |
58b83435 | 2797 | { |
2798 | tree rhs; | |
2799 | if (!gimple_assign_single_p (gs)) | |
2800 | return false; | |
2801 | rhs = gimple_assign_rhs1 (gs); | |
2802 | if (TREE_CODE (rhs) == WITH_SIZE_EXPR) | |
2803 | return true; | |
2804 | rhs = get_base_address (rhs); | |
2805 | return (DECL_P (rhs) | |
2806 | || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF); | |
2807 | } | |
2808 | ||
b8747787 | 2809 | |
75a70cf9 | 2810 | /* Return true if S is a type-cast assignment. */ |
2811 | ||
2812 | static inline bool | |
42acab1c | 2813 | gimple_assign_cast_p (const gimple *s) |
75a70cf9 | 2814 | { |
2815 | if (is_gimple_assign (s)) | |
2816 | { | |
2817 | enum tree_code sc = gimple_assign_rhs_code (s); | |
d9659041 | 2818 | return CONVERT_EXPR_CODE_P (sc) |
75a70cf9 | 2819 | || sc == VIEW_CONVERT_EXPR |
2820 | || sc == FIX_TRUNC_EXPR; | |
2821 | } | |
2822 | ||
2823 | return false; | |
2824 | } | |
2825 | ||
3c25489e | 2826 | /* Return true if S is a clobber statement. */ |
2827 | ||
2828 | static inline bool | |
42acab1c | 2829 | gimple_clobber_p (const gimple *s) |
3c25489e | 2830 | { |
2831 | return gimple_assign_single_p (s) | |
2832 | && TREE_CLOBBER_P (gimple_assign_rhs1 (s)); | |
2833 | } | |
75a70cf9 | 2834 | |
2835 | /* Return true if GS is a GIMPLE_CALL. */ | |
2836 | ||
2837 | static inline bool | |
42acab1c | 2838 | is_gimple_call (const gimple *gs) |
75a70cf9 | 2839 | { |
2840 | return gimple_code (gs) == GIMPLE_CALL; | |
2841 | } | |
2842 | ||
2843 | /* Return the LHS of call statement GS. */ | |
2844 | ||
31d3df5c | 2845 | static inline tree |
2846 | gimple_call_lhs (const gcall *gs) | |
2847 | { | |
2848 | return gs->op[0]; | |
2849 | } | |
2850 | ||
75a70cf9 | 2851 | static inline tree |
42acab1c | 2852 | gimple_call_lhs (const gimple *gs) |
75a70cf9 | 2853 | { |
31d3df5c | 2854 | const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); |
2855 | return gimple_call_lhs (gc); | |
75a70cf9 | 2856 | } |
2857 | ||
2858 | ||
2859 | /* Return a pointer to the LHS of call statement GS. */ | |
2860 | ||
31d3df5c | 2861 | static inline tree * |
ad023323 | 2862 | gimple_call_lhs_ptr (gcall *gs) |
31d3df5c | 2863 | { |
ad023323 | 2864 | return &gs->op[0]; |
31d3df5c | 2865 | } |
2866 | ||
75a70cf9 | 2867 | static inline tree * |
ad023323 | 2868 | gimple_call_lhs_ptr (gimple *gs) |
75a70cf9 | 2869 | { |
ad023323 | 2870 | gcall *gc = GIMPLE_CHECK2<gcall *> (gs); |
31d3df5c | 2871 | return gimple_call_lhs_ptr (gc); |
75a70cf9 | 2872 | } |
2873 | ||
2874 | ||
2875 | /* Set LHS to be the LHS operand of call statement GS. */ | |
2876 | ||
2877 | static inline void | |
31d3df5c | 2878 | gimple_call_set_lhs (gcall *gs, tree lhs) |
75a70cf9 | 2879 | { |
31d3df5c | 2880 | gs->op[0] = lhs; |
75a70cf9 | 2881 | if (lhs && TREE_CODE (lhs) == SSA_NAME) |
2882 | SSA_NAME_DEF_STMT (lhs) = gs; | |
2883 | } | |
2884 | ||
31d3df5c | 2885 | static inline void |
42acab1c | 2886 | gimple_call_set_lhs (gimple *gs, tree lhs) |
31d3df5c | 2887 | { |
2888 | gcall *gc = GIMPLE_CHECK2<gcall *> (gs); | |
2889 | gimple_call_set_lhs (gc, lhs); | |
2890 | } | |
2891 | ||
75a70cf9 | 2892 | |
fb049fba | 2893 | /* Return true if call GS calls an internal-only function, as enumerated |
2894 | by internal_fn. */ | |
2895 | ||
2896 | static inline bool | |
31d3df5c | 2897 | gimple_call_internal_p (const gcall *gs) |
fb049fba | 2898 | { |
de6bd75e | 2899 | return (gs->subcode & GF_CALL_INTERNAL) != 0; |
fb049fba | 2900 | } |
2901 | ||
31d3df5c | 2902 | static inline bool |
42acab1c | 2903 | gimple_call_internal_p (const gimple *gs) |
31d3df5c | 2904 | { |
2905 | const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); | |
2906 | return gimple_call_internal_p (gc); | |
2907 | } | |
2908 | ||
3c0f15b4 | 2909 | /* Return true if call GS is marked as nocf_check. */ |
2910 | ||
2911 | static inline bool | |
2912 | gimple_call_nocf_check_p (const gcall *gs) | |
2913 | { | |
2914 | return (gs->subcode & GF_CALL_NOCF_CHECK) != 0; | |
2915 | } | |
2916 | ||
2917 | /* Mark statement GS as nocf_check call. */ | |
2918 | ||
2919 | static inline void | |
2920 | gimple_call_set_nocf_check (gcall *gs, bool nocf_check) | |
2921 | { | |
2922 | if (nocf_check) | |
2923 | gs->subcode |= GF_CALL_NOCF_CHECK; | |
2924 | else | |
2925 | gs->subcode &= ~GF_CALL_NOCF_CHECK; | |
2926 | } | |
2927 | ||
fb049fba | 2928 | /* Return the target of internal call GS. */ |
2929 | ||
2930 | static inline enum internal_fn | |
31d3df5c | 2931 | gimple_call_internal_fn (const gcall *gs) |
fb049fba | 2932 | { |
2933 | gcc_gimple_checking_assert (gimple_call_internal_p (gs)); | |
31d3df5c | 2934 | return gs->u.internal_fn; |
2935 | } | |
2936 | ||
2937 | static inline enum internal_fn | |
42acab1c | 2938 | gimple_call_internal_fn (const gimple *gs) |
31d3df5c | 2939 | { |
2940 | const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); | |
2941 | return gimple_call_internal_fn (gc); | |
fb049fba | 2942 | } |
2943 | ||
6c5c88f6 | 2944 | /* Return true, if this internal gimple call is unique. */ |
2945 | ||
2946 | static inline bool | |
2947 | gimple_call_internal_unique_p (const gcall *gs) | |
2948 | { | |
2949 | return gimple_call_internal_fn (gs) == IFN_UNIQUE; | |
2950 | } | |
2951 | ||
2952 | static inline bool | |
2953 | gimple_call_internal_unique_p (const gimple *gs) | |
2954 | { | |
2955 | const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); | |
2956 | return gimple_call_internal_unique_p (gc); | |
2957 | } | |
2958 | ||
3c77f69c | 2959 | /* Return true if GS is an internal function FN. */ |
2960 | ||
2961 | static inline bool | |
2962 | gimple_call_internal_p (const gimple *gs, internal_fn fn) | |
2963 | { | |
2964 | return (is_gimple_call (gs) | |
2965 | && gimple_call_internal_p (gs) | |
2966 | && gimple_call_internal_fn (gs) == fn); | |
2967 | } | |
2968 | ||
c1e02247 | 2969 | /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt |
2970 | that could alter control flow. */ | |
2971 | ||
2972 | static inline void | |
31d3df5c | 2973 | gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p) |
c1e02247 | 2974 | { |
c1e02247 | 2975 | if (ctrl_altering_p) |
2976 | s->subcode |= GF_CALL_CTRL_ALTERING; | |
2977 | else | |
2978 | s->subcode &= ~GF_CALL_CTRL_ALTERING; | |
2979 | } | |
2980 | ||
31d3df5c | 2981 | static inline void |
42acab1c | 2982 | gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p) |
31d3df5c | 2983 | { |
2984 | gcall *gc = GIMPLE_CHECK2<gcall *> (s); | |
2985 | gimple_call_set_ctrl_altering (gc, ctrl_altering_p); | |
2986 | } | |
2987 | ||
c1e02247 | 2988 | /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING |
2989 | flag is set. Such call could not be a stmt in the middle of a bb. */ | |
2990 | ||
2991 | static inline bool | |
31d3df5c | 2992 | gimple_call_ctrl_altering_p (const gcall *gs) |
c1e02247 | 2993 | { |
c1e02247 | 2994 | return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0; |
2995 | } | |
2996 | ||
31d3df5c | 2997 | static inline bool |
42acab1c | 2998 | gimple_call_ctrl_altering_p (const gimple *gs) |
31d3df5c | 2999 | { |
3000 | const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); | |
3001 | return gimple_call_ctrl_altering_p (gc); | |
3002 | } | |
3003 | ||
fb049fba | 3004 | |
39f59e65 | 3005 | /* Return the function type of the function called by GS. */ |
75a70cf9 | 3006 | |
3007 | static inline tree | |
31d3df5c | 3008 | gimple_call_fntype (const gcall *gs) |
75a70cf9 | 3009 | { |
fb049fba | 3010 | if (gimple_call_internal_p (gs)) |
3011 | return NULL_TREE; | |
31d3df5c | 3012 | return gs->u.fntype; |
3013 | } | |
3014 | ||
3015 | static inline tree | |
42acab1c | 3016 | gimple_call_fntype (const gimple *gs) |
31d3df5c | 3017 | { |
3018 | const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs); | |
3019 | return gimple_call_fntype (call_stmt); | |
75a70cf9 | 3020 | } |
3021 | ||
1a91d914 | 3022 | /* Set the type of the function called by CALL_STMT to FNTYPE. */ |
39f59e65 | 3023 | |
3024 | static inline void | |
1a91d914 | 3025 | gimple_call_set_fntype (gcall *call_stmt, tree fntype) |
39f59e65 | 3026 | { |
1a91d914 | 3027 | gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt)); |
de6bd75e | 3028 | call_stmt->u.fntype = fntype; |
39f59e65 | 3029 | } |
3030 | ||
3031 | ||
3032 | /* Return the tree node representing the function called by call | |
3033 | statement GS. */ | |
2de00a2d | 3034 | |
31d3df5c | 3035 | static inline tree |
3036 | gimple_call_fn (const gcall *gs) | |
3037 | { | |
3038 | return gs->op[1]; | |
3039 | } | |
3040 | ||
2de00a2d | 3041 | static inline tree |
42acab1c | 3042 | gimple_call_fn (const gimple *gs) |
2de00a2d | 3043 | { |
31d3df5c | 3044 | const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); |
3045 | return gimple_call_fn (gc); | |
2de00a2d | 3046 | } |
75a70cf9 | 3047 | |
3048 | /* Return a pointer to the tree node representing the function called by call | |
3049 | statement GS. */ | |
3050 | ||
31d3df5c | 3051 | static inline tree * |
ad023323 | 3052 | gimple_call_fn_ptr (gcall *gs) |
31d3df5c | 3053 | { |
ad023323 | 3054 | return &gs->op[1]; |
31d3df5c | 3055 | } |
3056 | ||
75a70cf9 | 3057 | static inline tree * |
ad023323 | 3058 | gimple_call_fn_ptr (gimple *gs) |
75a70cf9 | 3059 | { |
ad023323 | 3060 | gcall *gc = GIMPLE_CHECK2<gcall *> (gs); |
31d3df5c | 3061 | return gimple_call_fn_ptr (gc); |
75a70cf9 | 3062 | } |
3063 | ||
3064 | ||
3065 | /* Set FN to be the function called by call statement GS. */ | |
3066 | ||
3067 | static inline void | |
1a91d914 | 3068 | gimple_call_set_fn (gcall *gs, tree fn) |
75a70cf9 | 3069 | { |
fb049fba | 3070 | gcc_gimple_checking_assert (!gimple_call_internal_p (gs)); |
78e011ba | 3071 | gs->op[1] = fn; |
75a70cf9 | 3072 | } |
3073 | ||
3074 | ||
27de91b1 | 3075 | /* Set FNDECL to be the function called by call statement GS. */ |
3076 | ||
3077 | static inline void | |
31d3df5c | 3078 | gimple_call_set_fndecl (gcall *gs, tree decl) |
27de91b1 | 3079 | { |
27de91b1 | 3080 | gcc_gimple_checking_assert (!gimple_call_internal_p (gs)); |
31d3df5c | 3081 | gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR, |
3082 | build_pointer_type (TREE_TYPE (decl)), decl); | |
3083 | } | |
3084 | ||
3085 | static inline void | |
42acab1c | 3086 | gimple_call_set_fndecl (gimple *gs, tree decl) |
31d3df5c | 3087 | { |
3088 | gcall *gc = GIMPLE_CHECK2<gcall *> (gs); | |
3089 | gimple_call_set_fndecl (gc, decl); | |
27de91b1 | 3090 | } |
3091 | ||
3092 | ||
1a91d914 | 3093 | /* Set internal function FN to be the function called by call statement CALL_STMT. */ |
fb049fba | 3094 | |
3095 | static inline void | |
1a91d914 | 3096 | gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn) |
fb049fba | 3097 | { |
1a91d914 | 3098 | gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt)); |
de6bd75e | 3099 | call_stmt->u.internal_fn = fn; |
fb049fba | 3100 | } |
3101 | ||
3102 | ||
75a70cf9 | 3103 | /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it. |
3104 | Otherwise return NULL. This function is analogous to | |
3105 | get_callee_fndecl in tree land. */ | |
3106 | ||
3107 | static inline tree | |
31d3df5c | 3108 | gimple_call_fndecl (const gcall *gs) |
75a70cf9 | 3109 | { |
6fec5449 | 3110 | return gimple_call_addr_fndecl (gimple_call_fn (gs)); |
75a70cf9 | 3111 | } |
3112 | ||
31d3df5c | 3113 | static inline tree |
42acab1c | 3114 | gimple_call_fndecl (const gimple *gs) |
31d3df5c | 3115 | { |
3116 | const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); | |
3117 | return gimple_call_fndecl (gc); | |
3118 | } | |
3119 | ||
75a70cf9 | 3120 | |
3121 | /* Return the type returned by call statement GS. */ | |
3122 | ||
3123 | static inline tree | |
1a91d914 | 3124 | gimple_call_return_type (const gcall *gs) |
75a70cf9 | 3125 | { |
2de00a2d | 3126 | tree type = gimple_call_fntype (gs); |
75a70cf9 | 3127 | |
fb049fba | 3128 | if (type == NULL_TREE) |
3129 | return TREE_TYPE (gimple_call_lhs (gs)); | |
3130 | ||
2de00a2d | 3131 | /* The type returned by a function is the type of its |
75a70cf9 | 3132 | function type. */ |
3133 | return TREE_TYPE (type); | |
3134 | } | |
3135 | ||
3136 | ||
3137 | /* Return the static chain for call statement GS. */ | |
3138 | ||
31d3df5c | 3139 | static inline tree |
3140 | gimple_call_chain (const gcall *gs) | |
3141 | { | |
3142 | return gs->op[2]; | |
3143 | } | |
3144 | ||
75a70cf9 | 3145 | static inline tree |
42acab1c | 3146 | gimple_call_chain (const gimple *gs) |
75a70cf9 | 3147 | { |
31d3df5c | 3148 | const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); |
3149 | return gimple_call_chain (gc); | |
75a70cf9 | 3150 | } |
3151 | ||
3152 | ||
1a91d914 | 3153 | /* Return a pointer to the static chain for call statement CALL_STMT. */ |
75a70cf9 | 3154 | |
3155 | static inline tree * | |
ad023323 | 3156 | gimple_call_chain_ptr (gcall *call_stmt) |
75a70cf9 | 3157 | { |
ad023323 | 3158 | return &call_stmt->op[2]; |
75a70cf9 | 3159 | } |
3160 | ||
1a91d914 | 3161 | /* Set CHAIN to be the static chain for call statement CALL_STMT. */ |
75a70cf9 | 3162 | |
3163 | static inline void | |
1a91d914 | 3164 | gimple_call_set_chain (gcall *call_stmt, tree chain) |
75a70cf9 | 3165 | { |
78e011ba | 3166 | call_stmt->op[2] = chain; |
75a70cf9 | 3167 | } |
3168 | ||
3169 | ||
3170 | /* Return the number of arguments used by call statement GS. */ | |
3171 | ||
31d3df5c | 3172 | static inline unsigned |
3173 | gimple_call_num_args (const gcall *gs) | |
3174 | { | |
3175 | return gimple_num_ops (gs) - 3; | |
3176 | } | |
3177 | ||
75a70cf9 | 3178 | static inline unsigned |
42acab1c | 3179 | gimple_call_num_args (const gimple *gs) |
75a70cf9 | 3180 | { |
31d3df5c | 3181 | const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); |
3182 | return gimple_call_num_args (gc); | |
75a70cf9 | 3183 | } |
3184 | ||
3185 | ||
3186 | /* Return the argument at position INDEX for call statement GS. */ | |
3187 | ||
31d3df5c | 3188 | static inline tree |
3189 | gimple_call_arg (const gcall *gs, unsigned index) | |
3190 | { | |
3191 | gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3); | |
3192 | return gs->op[index + 3]; | |
3193 | } | |
3194 | ||
75a70cf9 | 3195 | static inline tree |
42acab1c | 3196 | gimple_call_arg (const gimple *gs, unsigned index) |
75a70cf9 | 3197 | { |
31d3df5c | 3198 | const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); |
3199 | return gimple_call_arg (gc, index); | |
75a70cf9 | 3200 | } |
3201 | ||
3202 | ||
3203 | /* Return a pointer to the argument at position INDEX for call | |
3204 | statement GS. */ | |
3205 | ||
31d3df5c | 3206 | static inline tree * |
ad023323 | 3207 | gimple_call_arg_ptr (gcall *gs, unsigned index) |
31d3df5c | 3208 | { |
3209 | gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3); | |
ad023323 | 3210 | return &gs->op[index + 3]; |
31d3df5c | 3211 | } |
3212 | ||
75a70cf9 | 3213 | static inline tree * |
ad023323 | 3214 | gimple_call_arg_ptr (gimple *gs, unsigned index) |
75a70cf9 | 3215 | { |
ad023323 | 3216 | gcall *gc = GIMPLE_CHECK2<gcall *> (gs); |
31d3df5c | 3217 | return gimple_call_arg_ptr (gc, index); |
75a70cf9 | 3218 | } |
3219 | ||
3220 | ||
3221 | /* Set ARG to be the argument at position INDEX for call statement GS. */ | |
3222 | ||
31d3df5c | 3223 | static inline void |
3224 | gimple_call_set_arg (gcall *gs, unsigned index, tree arg) | |
3225 | { | |
3226 | gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3); | |
3227 | gs->op[index + 3] = arg; | |
3228 | } | |
3229 | ||
75a70cf9 | 3230 | static inline void |
42acab1c | 3231 | gimple_call_set_arg (gimple *gs, unsigned index, tree arg) |
75a70cf9 | 3232 | { |
31d3df5c | 3233 | gcall *gc = GIMPLE_CHECK2<gcall *> (gs); |
3234 | gimple_call_set_arg (gc, index, arg); | |
75a70cf9 | 3235 | } |
3236 | ||
3237 | ||
3238 | /* If TAIL_P is true, mark call statement S as being a tail call | |
3239 | (i.e., a call just before the exit of a function). These calls are | |
3240 | candidate for tail call optimization. */ | |
3241 | ||
3242 | static inline void | |
1a91d914 | 3243 | gimple_call_set_tail (gcall *s, bool tail_p) |
75a70cf9 | 3244 | { |
75a70cf9 | 3245 | if (tail_p) |
de6bd75e | 3246 | s->subcode |= GF_CALL_TAILCALL; |
75a70cf9 | 3247 | else |
de6bd75e | 3248 | s->subcode &= ~GF_CALL_TAILCALL; |
75a70cf9 | 3249 | } |
3250 | ||
3251 | ||
3252 | /* Return true if GIMPLE_CALL S is marked as a tail call. */ | |
3253 | ||
3254 | static inline bool | |
1a91d914 | 3255 | gimple_call_tail_p (gcall *s) |
75a70cf9 | 3256 | { |
de6bd75e | 3257 | return (s->subcode & GF_CALL_TAILCALL) != 0; |
75a70cf9 | 3258 | } |
3259 | ||
b4a61e77 | 3260 | /* Mark (or clear) call statement S as requiring tail call optimization. */ |
3261 | ||
3262 | static inline void | |
3263 | gimple_call_set_must_tail (gcall *s, bool must_tail_p) | |
3264 | { | |
3265 | if (must_tail_p) | |
3266 | s->subcode |= GF_CALL_MUST_TAIL_CALL; | |
3267 | else | |
3268 | s->subcode &= ~GF_CALL_MUST_TAIL_CALL; | |
3269 | } | |
3270 | ||
3271 | /* Return true if call statement has been marked as requiring | |
3272 | tail call optimization. */ | |
3273 | ||
3274 | static inline bool | |
3275 | gimple_call_must_tail_p (const gcall *s) | |
3276 | { | |
3277 | return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0; | |
3278 | } | |
75a70cf9 | 3279 | |
75a70cf9 | 3280 | /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return |
3281 | slot optimization. This transformation uses the target of the call | |
3282 | expansion as the return slot for calls that return in memory. */ | |
3283 | ||
3284 | static inline void | |
1a91d914 | 3285 | gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p) |
75a70cf9 | 3286 | { |
75a70cf9 | 3287 | if (return_slot_opt_p) |
de6bd75e | 3288 | s->subcode |= GF_CALL_RETURN_SLOT_OPT; |
75a70cf9 | 3289 | else |
de6bd75e | 3290 | s->subcode &= ~GF_CALL_RETURN_SLOT_OPT; |
75a70cf9 | 3291 | } |
3292 | ||
3293 | ||
3294 | /* Return true if S is marked for return slot optimization. */ | |
3295 | ||
3296 | static inline bool | |
1a91d914 | 3297 | gimple_call_return_slot_opt_p (gcall *s) |
75a70cf9 | 3298 | { |
de6bd75e | 3299 | return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0; |
75a70cf9 | 3300 | } |
3301 | ||
3302 | ||
3303 | /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a | |
3304 | thunk to the thunked-to function. */ | |
3305 | ||
3306 | static inline void | |
1a91d914 | 3307 | gimple_call_set_from_thunk (gcall *s, bool from_thunk_p) |
75a70cf9 | 3308 | { |
75a70cf9 | 3309 | if (from_thunk_p) |
de6bd75e | 3310 | s->subcode |= GF_CALL_FROM_THUNK; |
75a70cf9 | 3311 | else |
de6bd75e | 3312 | s->subcode &= ~GF_CALL_FROM_THUNK; |
75a70cf9 | 3313 | } |
3314 | ||
3315 | ||
3316 | /* Return true if GIMPLE_CALL S is a jump from a thunk. */ | |
3317 | ||
3318 | static inline bool | |
1a91d914 | 3319 | gimple_call_from_thunk_p (gcall *s) |
75a70cf9 | 3320 | { |
de6bd75e | 3321 | return (s->subcode & GF_CALL_FROM_THUNK) != 0; |
75a70cf9 | 3322 | } |
3323 | ||
3324 | ||
3325 | /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the | |
3326 | argument pack in its argument list. */ | |
3327 | ||
3328 | static inline void | |
1a91d914 | 3329 | gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p) |
75a70cf9 | 3330 | { |
75a70cf9 | 3331 | if (pass_arg_pack_p) |
de6bd75e | 3332 | s->subcode |= GF_CALL_VA_ARG_PACK; |
75a70cf9 | 3333 | else |
de6bd75e | 3334 | s->subcode &= ~GF_CALL_VA_ARG_PACK; |
75a70cf9 | 3335 | } |
3336 | ||
3337 | ||
3338 | /* Return true if GIMPLE_CALL S is a stdarg call that needs the | |
3339 | argument pack in its argument list. */ | |
3340 | ||
3341 | static inline bool | |
1a91d914 | 3342 | gimple_call_va_arg_pack_p (gcall *s) |
75a70cf9 | 3343 | { |
de6bd75e | 3344 | return (s->subcode & GF_CALL_VA_ARG_PACK) != 0; |
75a70cf9 | 3345 | } |
3346 | ||
3347 | ||
3348 | /* Return true if S is a noreturn call. */ | |
3349 | ||
3350 | static inline bool | |
31d3df5c | 3351 | gimple_call_noreturn_p (const gcall *s) |
75a70cf9 | 3352 | { |
75a70cf9 | 3353 | return (gimple_call_flags (s) & ECF_NORETURN) != 0; |
3354 | } | |
3355 | ||
31d3df5c | 3356 | static inline bool |
42acab1c | 3357 | gimple_call_noreturn_p (const gimple *s) |
31d3df5c | 3358 | { |
3359 | const gcall *gc = GIMPLE_CHECK2<const gcall *> (s); | |
3360 | return gimple_call_noreturn_p (gc); | |
3361 | } | |
3362 | ||
75a70cf9 | 3363 | |
1d3f675f | 3364 | /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw |
3365 | even if the called function can throw in other cases. */ | |
3366 | ||
3367 | static inline void | |
1a91d914 | 3368 | gimple_call_set_nothrow (gcall *s, bool nothrow_p) |
1d3f675f | 3369 | { |
1d3f675f | 3370 | if (nothrow_p) |
de6bd75e | 3371 | s->subcode |= GF_CALL_NOTHROW; |
1d3f675f | 3372 | else |
de6bd75e | 3373 | s->subcode &= ~GF_CALL_NOTHROW; |
1d3f675f | 3374 | } |
3375 | ||
75a70cf9 | 3376 | /* Return true if S is a nothrow call. */ |
3377 | ||
3378 | static inline bool | |
1a91d914 | 3379 | gimple_call_nothrow_p (gcall *s) |
75a70cf9 | 3380 | { |
75a70cf9 | 3381 | return (gimple_call_flags (s) & ECF_NOTHROW) != 0; |
3382 | } | |
3383 | ||
a882d754 | 3384 | /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that |
3385 | is known to be emitted for VLA objects. Those are wrapped by | |
3386 | stack_save/stack_restore calls and hence can't lead to unbounded | |
3387 | stack growth even when they occur in loops. */ | |
3388 | ||
3389 | static inline void | |
1a91d914 | 3390 | gimple_call_set_alloca_for_var (gcall *s, bool for_var) |
a882d754 | 3391 | { |
a882d754 | 3392 | if (for_var) |
de6bd75e | 3393 | s->subcode |= GF_CALL_ALLOCA_FOR_VAR; |
a882d754 | 3394 | else |
de6bd75e | 3395 | s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR; |
a882d754 | 3396 | } |
3397 | ||
3398 | /* Return true of S is a call to builtin_alloca emitted for VLA objects. */ | |
3399 | ||
3400 | static inline bool | |
1a91d914 | 3401 | gimple_call_alloca_for_var_p (gcall *s) |
a882d754 | 3402 | { |
de6bd75e | 3403 | return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0; |
a882d754 | 3404 | } |
75a70cf9 | 3405 | |
a27e3913 | 3406 | /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which |
3407 | pointers to nested function are descriptors instead of trampolines. */ | |
3408 | ||
3409 | static inline void | |
3410 | gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p) | |
3411 | { | |
3412 | if (by_descriptor_p) | |
3413 | s->subcode |= GF_CALL_BY_DESCRIPTOR; | |
3414 | else | |
3415 | s->subcode &= ~GF_CALL_BY_DESCRIPTOR; | |
3416 | } | |
3417 | ||
3418 | /* Return true if S is a by-descriptor call. */ | |
3419 | ||
3420 | static inline bool | |
3421 | gimple_call_by_descriptor_p (gcall *s) | |
3422 | { | |
3423 | return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0; | |
3424 | } | |
3425 | ||
75a70cf9 | 3426 | /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */ |
3427 | ||
3428 | static inline void | |
1a91d914 | 3429 | gimple_call_copy_flags (gcall *dest_call, gcall *orig_call) |
75a70cf9 | 3430 | { |
de6bd75e | 3431 | dest_call->subcode = orig_call->subcode; |
75a70cf9 | 3432 | } |
3433 | ||
3434 | ||
cb245216 | 3435 | /* Return a pointer to the points-to solution for the set of call-used |
1a91d914 | 3436 | variables of the call CALL_STMT. */ |
cb245216 | 3437 | |
3438 | static inline struct pt_solution * | |
1a91d914 | 3439 | gimple_call_use_set (gcall *call_stmt) |
cb245216 | 3440 | { |
de6bd75e | 3441 | return &call_stmt->call_used; |
cb245216 | 3442 | } |
3443 | ||
3444 | ||
3445 | /* Return a pointer to the points-to solution for the set of call-used | |
1a91d914 | 3446 | variables of the call CALL_STMT. */ |
cb245216 | 3447 | |
3448 | static inline struct pt_solution * | |
1a91d914 | 3449 | gimple_call_clobber_set (gcall *call_stmt) |
cb245216 | 3450 | { |
de6bd75e | 3451 | return &call_stmt->call_clobbered; |
cb245216 | 3452 | } |
3453 | ||
3454 | ||
75a70cf9 | 3455 | /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a |
3456 | non-NULL lhs. */ | |
3457 | ||
3458 | static inline bool | |
42acab1c | 3459 | gimple_has_lhs (gimple *stmt) |
75a70cf9 | 3460 | { |
31d3df5c | 3461 | if (is_gimple_assign (stmt)) |
3462 | return true; | |
3463 | if (gcall *call = dyn_cast <gcall *> (stmt)) | |
3464 | return gimple_call_lhs (call) != NULL_TREE; | |
3465 | return false; | |
75a70cf9 | 3466 | } |
3467 | ||
3468 | ||
3469 | /* Return the code of the predicate computed by conditional statement GS. */ | |
3470 | ||
3471 | static inline enum tree_code | |
31d3df5c | 3472 | gimple_cond_code (const gcond *gs) |
75a70cf9 | 3473 | { |
de6bd75e | 3474 | return (enum tree_code) gs->subcode; |
75a70cf9 | 3475 | } |
3476 | ||
31d3df5c | 3477 | static inline enum tree_code |
42acab1c | 3478 | gimple_cond_code (const gimple *gs) |
31d3df5c | 3479 | { |
3480 | const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs); | |
3481 | return gimple_cond_code (gc); | |
3482 | } | |
3483 | ||
75a70cf9 | 3484 | |
3485 | /* Set CODE to be the predicate code for the conditional statement GS. */ | |
3486 | ||
3487 | static inline void | |
1a91d914 | 3488 | gimple_cond_set_code (gcond *gs, enum tree_code code) |
75a70cf9 | 3489 | { |
de6bd75e | 3490 | gs->subcode = code; |
75a70cf9 | 3491 | } |
3492 | ||
3493 | ||
3494 | /* Return the LHS of the predicate computed by conditional statement GS. */ | |
3495 | ||
31d3df5c | 3496 | static inline tree |
3497 | gimple_cond_lhs (const gcond *gs) | |
3498 | { | |
3499 | return gs->op[0]; | |
3500 | } | |
3501 | ||
75a70cf9 | 3502 | static inline tree |
42acab1c | 3503 | gimple_cond_lhs (const gimple *gs) |
75a70cf9 | 3504 | { |
31d3df5c | 3505 | const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs); |
3506 | return gimple_cond_lhs (gc); | |
75a70cf9 | 3507 | } |
3508 | ||
3509 | /* Return the pointer to the LHS of the predicate computed by conditional | |
3510 | statement GS. */ | |
3511 | ||
3512 | static inline tree * | |
ad023323 | 3513 | gimple_cond_lhs_ptr (gcond *gs) |
75a70cf9 | 3514 | { |
ad023323 | 3515 | return &gs->op[0]; |
75a70cf9 | 3516 | } |
3517 | ||
3518 | /* Set LHS to be the LHS operand of the predicate computed by | |
3519 | conditional statement GS. */ | |
3520 | ||
3521 | static inline void | |
1a91d914 | 3522 | gimple_cond_set_lhs (gcond *gs, tree lhs) |
75a70cf9 | 3523 | { |
78e011ba | 3524 | gs->op[0] = lhs; |
75a70cf9 | 3525 | } |
3526 | ||
3527 | ||
3528 | /* Return the RHS operand of the predicate computed by conditional GS. */ | |
3529 | ||
31d3df5c | 3530 | static inline tree |
3531 | gimple_cond_rhs (const gcond *gs) | |
3532 | { | |
3533 | return gs->op[1]; | |
3534 | } | |
3535 | ||
75a70cf9 | 3536 | static inline tree |
42acab1c | 3537 | gimple_cond_rhs (const gimple *gs) |
75a70cf9 | 3538 | { |
31d3df5c | 3539 | const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs); |
3540 | return gimple_cond_rhs (gc); | |
75a70cf9 | 3541 | } |
3542 | ||
3543 | /* Return the pointer to the RHS operand of the predicate computed by | |
3544 | conditional GS. */ | |
3545 | ||
3546 | static inline tree * | |
ad023323 | 3547 | gimple_cond_rhs_ptr (gcond *gs) |
75a70cf9 | 3548 | { |
ad023323 | 3549 | return &gs->op[1]; |
75a70cf9 | 3550 | } |
3551 | ||
3552 | ||
3553 | /* Set RHS to be the RHS operand of the predicate computed by | |
3554 | conditional statement GS. */ | |
3555 | ||
3556 | static inline void | |
1a91d914 | 3557 | gimple_cond_set_rhs (gcond *gs, tree rhs) |
75a70cf9 | 3558 | { |
78e011ba | 3559 | gs->op[1] = rhs; |
75a70cf9 | 3560 | } |
3561 | ||
3562 | ||
3563 | /* Return the label used by conditional statement GS when its | |
3564 | predicate evaluates to true. */ | |
3565 | ||
3566 | static inline tree | |
1a91d914 | 3567 | gimple_cond_true_label (const gcond *gs) |
75a70cf9 | 3568 | { |
78e011ba | 3569 | return gs->op[2]; |
75a70cf9 | 3570 | } |
3571 | ||
3572 | ||
3573 | /* Set LABEL to be the label used by conditional statement GS when its | |
3574 | predicate evaluates to true. */ | |
3575 | ||
3576 | static inline void | |
1a91d914 | 3577 | gimple_cond_set_true_label (gcond *gs, tree label) |
75a70cf9 | 3578 | { |
78e011ba | 3579 | gs->op[2] = label; |
75a70cf9 | 3580 | } |
3581 | ||
3582 | ||
3583 | /* Set LABEL to be the label used by conditional statement GS when its | |
3584 | predicate evaluates to false. */ | |
3585 | ||
3586 | static inline void | |
1a91d914 | 3587 | gimple_cond_set_false_label (gcond *gs, tree label) |
75a70cf9 | 3588 | { |
78e011ba | 3589 | gs->op[3] = label; |
75a70cf9 | 3590 | } |
3591 | ||
3592 | ||
3593 | /* Return the label used by conditional statement GS when its | |
3594 | predicate evaluates to false. */ | |
3595 | ||
3596 | static inline tree | |
1a91d914 | 3597 | gimple_cond_false_label (const gcond *gs) |
75a70cf9 | 3598 | { |
78e011ba | 3599 | return gs->op[3]; |
75a70cf9 | 3600 | } |
3601 | ||
3602 | ||
3603 | /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */ | |
3604 | ||
3605 | static inline void | |
1a91d914 | 3606 | gimple_cond_make_false (gcond *gs) |
75a70cf9 | 3607 | { |
43f467b0 | 3608 | gimple_cond_set_lhs (gs, boolean_false_node); |
75a70cf9 | 3609 | gimple_cond_set_rhs (gs, boolean_false_node); |
43f467b0 | 3610 | gs->subcode = NE_EXPR; |
75a70cf9 | 3611 | } |
3612 | ||
3613 | ||
3614 | /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */ | |
3615 | ||
3616 | static inline void | |
1a91d914 | 3617 | gimple_cond_make_true (gcond *gs) |
75a70cf9 | 3618 | { |
3619 | gimple_cond_set_lhs (gs, boolean_true_node); | |
43f467b0 | 3620 | gimple_cond_set_rhs (gs, boolean_false_node); |
3621 | gs->subcode = NE_EXPR; | |
75a70cf9 | 3622 | } |
3623 | ||
3624 | /* Check if conditional statemente GS is of the form 'if (1 == 1)', | |
3625 | 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */ | |
3626 | ||
3627 | static inline bool | |
1a91d914 | 3628 | gimple_cond_true_p (const gcond *gs) |
75a70cf9 | 3629 | { |
3630 | tree lhs = gimple_cond_lhs (gs); | |
3631 | tree rhs = gimple_cond_rhs (gs); | |
3632 | enum tree_code code = gimple_cond_code (gs); | |
3633 | ||
3634 | if (lhs != boolean_true_node && lhs != boolean_false_node) | |
3635 | return false; | |
3636 | ||
3637 | if (rhs != boolean_true_node && rhs != boolean_false_node) | |
3638 | return false; | |
3639 | ||
3640 | if (code == NE_EXPR && lhs != rhs) | |
3641 | return true; | |
3642 | ||
3643 | if (code == EQ_EXPR && lhs == rhs) | |
3644 | return true; | |
3645 | ||
3646 | return false; | |
3647 | } | |
3648 | ||
3649 | /* Check if conditional statement GS is of the form 'if (1 != 1)', | |
3650 | 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */ | |
3651 | ||
3652 | static inline bool | |
1a91d914 | 3653 | gimple_cond_false_p (const gcond *gs) |
75a70cf9 | 3654 | { |
3655 | tree lhs = gimple_cond_lhs (gs); | |
3656 | tree rhs = gimple_cond_rhs (gs); | |
3657 | enum tree_code code = gimple_cond_code (gs); | |
3658 | ||
3659 | if (lhs != boolean_true_node && lhs != boolean_false_node) | |
3660 | return false; | |
3661 | ||
3662 | if (rhs != boolean_true_node && rhs != boolean_false_node) | |
3663 | return false; | |
3664 | ||
3665 | if (code == NE_EXPR && lhs == rhs) | |
3666 | return true; | |
3667 | ||
3668 | if (code == EQ_EXPR && lhs != rhs) | |
3669 | return true; | |
3670 | ||
3671 | return false; | |
3672 | } | |
3673 | ||
75a70cf9 | 3674 | /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */ |
3675 | ||
3676 | static inline void | |
1a91d914 | 3677 | gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs, |
3678 | tree rhs) | |
75a70cf9 | 3679 | { |
3680 | gimple_cond_set_code (stmt, code); | |
3681 | gimple_cond_set_lhs (stmt, lhs); | |
3682 | gimple_cond_set_rhs (stmt, rhs); | |
3683 | } | |
3684 | ||
3685 | /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */ | |
3686 | ||
3687 | static inline tree | |
1a91d914 | 3688 | gimple_label_label (const glabel *gs) |
75a70cf9 | 3689 | { |
78e011ba | 3690 | return gs->op[0]; |
75a70cf9 | 3691 | } |
3692 | ||
3693 | ||
3694 | /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement | |
3695 | GS. */ | |
3696 | ||
3697 | static inline void | |
1a91d914 | 3698 | gimple_label_set_label (glabel *gs, tree label) |
75a70cf9 | 3699 | { |
78e011ba | 3700 | gs->op[0] = label; |
75a70cf9 | 3701 | } |
3702 | ||
3703 | ||
3704 | /* Return the destination of the unconditional jump GS. */ | |
3705 | ||
3706 | static inline tree | |
42acab1c | 3707 | gimple_goto_dest (const gimple *gs) |
75a70cf9 | 3708 | { |
3709 | GIMPLE_CHECK (gs, GIMPLE_GOTO); | |
3710 | return gimple_op (gs, 0); | |
3711 | } | |
3712 | ||
3713 | ||
3714 | /* Set DEST to be the destination of the unconditonal jump GS. */ | |
3715 | ||
48e1416a | 3716 | static inline void |
1a91d914 | 3717 | gimple_goto_set_dest (ggoto *gs, tree dest) |
75a70cf9 | 3718 | { |
78e011ba | 3719 | gs->op[0] = dest; |
75a70cf9 | 3720 | } |
3721 | ||
3722 | ||
3723 | /* Return the variables declared in the GIMPLE_BIND statement GS. */ | |
3724 | ||
3725 | static inline tree | |
1a91d914 | 3726 | gimple_bind_vars (const gbind *bind_stmt) |
75a70cf9 | 3727 | { |
de6bd75e | 3728 | return bind_stmt->vars; |
75a70cf9 | 3729 | } |
3730 | ||
3731 | ||
3732 | /* Set VARS to be the set of variables declared in the GIMPLE_BIND | |
3733 | statement GS. */ | |
3734 | ||
3735 | static inline void | |
1a91d914 | 3736 | gimple_bind_set_vars (gbind *bind_stmt, tree vars) |
75a70cf9 | 3737 | { |
de6bd75e | 3738 | bind_stmt->vars = vars; |
75a70cf9 | 3739 | } |
3740 | ||
3741 | ||
3742 | /* Append VARS to the set of variables declared in the GIMPLE_BIND | |
3743 | statement GS. */ | |
3744 | ||
3745 | static inline void | |
1a91d914 | 3746 | gimple_bind_append_vars (gbind *bind_stmt, tree vars) |
75a70cf9 | 3747 | { |
de6bd75e | 3748 | bind_stmt->vars = chainon (bind_stmt->vars, vars); |
75a70cf9 | 3749 | } |
3750 | ||
3751 | ||
e3a19533 | 3752 | static inline gimple_seq * |
1a91d914 | 3753 | gimple_bind_body_ptr (gbind *bind_stmt) |
e3a19533 | 3754 | { |
de6bd75e | 3755 | return &bind_stmt->body; |
e3a19533 | 3756 | } |
3757 | ||
75a70cf9 | 3758 | /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */ |
3759 | ||
3760 | static inline gimple_seq | |
1a91d914 | 3761 | gimple_bind_body (gbind *gs) |
75a70cf9 | 3762 | { |
e3a19533 | 3763 | return *gimple_bind_body_ptr (gs); |
75a70cf9 | 3764 | } |
3765 | ||
3766 | ||
3767 | /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND | |
3768 | statement GS. */ | |
3769 | ||
3770 | static inline void | |
1a91d914 | 3771 | gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq) |
75a70cf9 | 3772 | { |
de6bd75e | 3773 | bind_stmt->body = seq; |
75a70cf9 | 3774 | } |
3775 | ||
3776 | ||
3777 | /* Append a statement to the end of a GIMPLE_BIND's body. */ | |
3778 | ||
3779 | static inline void | |
42acab1c | 3780 | gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt) |
75a70cf9 | 3781 | { |
de6bd75e | 3782 | gimple_seq_add_stmt (&bind_stmt->body, stmt); |
75a70cf9 | 3783 | } |
3784 | ||
3785 | ||
3786 | /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */ | |
3787 | ||
3788 | static inline void | |
1a91d914 | 3789 | gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq) |
75a70cf9 | 3790 | { |
de6bd75e | 3791 | gimple_seq_add_seq (&bind_stmt->body, seq); |
75a70cf9 | 3792 | } |
3793 | ||
3794 | ||
3795 | /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement | |
3796 | GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */ | |
3797 | ||
3798 | static inline tree | |
1a91d914 | 3799 | gimple_bind_block (const gbind *bind_stmt) |
75a70cf9 | 3800 | { |
de6bd75e | 3801 | return bind_stmt->block; |
75a70cf9 | 3802 | } |
3803 | ||
3804 | ||
3805 | /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND | |
3806 | statement GS. */ | |
3807 | ||
3808 | static inline void | |
1a91d914 | 3809 | gimple_bind_set_block (gbind *bind_stmt, tree block) |
75a70cf9 | 3810 | { |
1e720c36 | 3811 | gcc_gimple_checking_assert (block == NULL_TREE |
3812 | || TREE_CODE (block) == BLOCK); | |
de6bd75e | 3813 | bind_stmt->block = block; |
75a70cf9 | 3814 | } |
3815 | ||
3816 | ||
1a91d914 | 3817 | /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */ |
75a70cf9 | 3818 | |
3819 | static inline unsigned | |
1a91d914 | 3820 | gimple_asm_ninputs (const gasm *asm_stmt) |
75a70cf9 | 3821 | { |
de6bd75e | 3822 | return asm_stmt->ni; |
75a70cf9 | 3823 | } |
3824 | ||
3825 | ||
1a91d914 | 3826 | /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */ |
75a70cf9 | 3827 | |
3828 | static inline unsigned | |
1a91d914 | 3829 | gimple_asm_noutputs (const gasm *asm_stmt) |
75a70cf9 | 3830 | { |
de6bd75e | 3831 | return asm_stmt->no; |
75a70cf9 | 3832 | } |
3833 | ||
3834 | ||
1a91d914 | 3835 | /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */ |
75a70cf9 | 3836 | |
3837 | static inline unsigned | |
1a91d914 | 3838 | gimple_asm_nclobbers (const gasm *asm_stmt) |
75a70cf9 | 3839 | { |
de6bd75e | 3840 | return asm_stmt->nc; |
75a70cf9 | 3841 | } |
3842 | ||
1a91d914 | 3843 | /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */ |
78f55ca8 | 3844 | |
3845 | static inline unsigned | |
1a91d914 | 3846 | gimple_asm_nlabels (const gasm *asm_stmt) |
78f55ca8 | 3847 | { |
de6bd75e | 3848 | return asm_stmt->nl; |
78f55ca8 | 3849 | } |
75a70cf9 | 3850 | |
1a91d914 | 3851 | /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */ |
75a70cf9 | 3852 | |
3853 | static inline tree | |
1a91d914 | 3854 | gimple_asm_input_op (const gasm *asm_stmt, unsigned index) |
75a70cf9 | 3855 | { |
de6bd75e | 3856 | gcc_gimple_checking_assert (index < asm_stmt->ni); |
78e011ba | 3857 | return asm_stmt->op[index + asm_stmt->no]; |
75a70cf9 | 3858 | } |
3859 | ||
1a91d914 | 3860 | /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */ |
75a70cf9 | 3861 | |
3862 | static inline void | |
1a91d914 | 3863 | gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op) |
75a70cf9 | 3864 | { |
de6bd75e | 3865 | gcc_gimple_checking_assert (index < asm_stmt->ni |
1e720c36 | 3866 | && TREE_CODE (in_op) == TREE_LIST); |
78e011ba | 3867 | asm_stmt->op[index + asm_stmt->no] = in_op; |
75a70cf9 | 3868 | } |
3869 | ||
3870 | ||
1a91d914 | 3871 | /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */ |
75a70cf9 | 3872 | |
3873 | static inline tree | |
1a91d914 | 3874 | gimple_asm_output_op (const gasm *asm_stmt, unsigned index) |
75a70cf9 | 3875 | { |
de6bd75e | 3876 | gcc_gimple_checking_assert (index < asm_stmt->no); |
78e011ba | 3877 | return asm_stmt->op[index]; |
75a70cf9 | 3878 | } |
3879 | ||
1a91d914 | 3880 | /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */ |
75a70cf9 | 3881 | |
3882 | static inline void | |
1a91d914 | 3883 | gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op) |
75a70cf9 | 3884 | { |
de6bd75e | 3885 | gcc_gimple_checking_assert (index < asm_stmt->no |
1e720c36 | 3886 | && TREE_CODE (out_op) == TREE_LIST); |
78e011ba | 3887 | asm_stmt->op[index] = out_op; |
75a70cf9 | 3888 | } |
3889 | ||
3890 | ||
1a91d914 | 3891 | /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */ |
75a70cf9 | 3892 | |
3893 | static inline tree | |
1a91d914 | 3894 | gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index) |
75a70cf9 | 3895 | { |
de6bd75e | 3896 | gcc_gimple_checking_assert (index < asm_stmt->nc); |
78e011ba | 3897 | return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no]; |
75a70cf9 | 3898 | } |
3899 | ||
3900 | ||
1a91d914 | 3901 | /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */ |
75a70cf9 | 3902 | |
3903 | static inline void | |
1a91d914 | 3904 | gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op) |
75a70cf9 | 3905 | { |
de6bd75e | 3906 | gcc_gimple_checking_assert (index < asm_stmt->nc |
1e720c36 | 3907 | && TREE_CODE (clobber_op) == TREE_LIST); |
78e011ba | 3908 | asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op; |
75a70cf9 | 3909 | } |
3910 | ||
1a91d914 | 3911 | /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */ |
78f55ca8 | 3912 | |
3913 | static inline tree | |
1a91d914 | 3914 | gimple_asm_label_op (const gasm *asm_stmt, unsigned index) |
78f55ca8 | 3915 | { |
de6bd75e | 3916 | gcc_gimple_checking_assert (index < asm_stmt->nl); |
78e011ba | 3917 | return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc]; |
78f55ca8 | 3918 | } |
3919 | ||
1a91d914 | 3920 | /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */ |
78f55ca8 | 3921 | |
3922 | static inline void | |
1a91d914 | 3923 | gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op) |
78f55ca8 | 3924 | { |
de6bd75e | 3925 | gcc_gimple_checking_assert (index < asm_stmt->nl |
1e720c36 | 3926 | && TREE_CODE (label_op) == TREE_LIST); |
78e011ba | 3927 | asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op; |
78f55ca8 | 3928 | } |
75a70cf9 | 3929 | |
3930 | /* Return the string representing the assembly instruction in | |
1a91d914 | 3931 | GIMPLE_ASM ASM_STMT. */ |
75a70cf9 | 3932 | |
3933 | static inline const char * | |
1a91d914 | 3934 | gimple_asm_string (const gasm *asm_stmt) |
75a70cf9 | 3935 | { |
de6bd75e | 3936 | return asm_stmt->string; |
75a70cf9 | 3937 | } |
3938 | ||
3939 | ||
6de46ad5 | 3940 | /* Return true if ASM_STMT is marked volatile. */ |
75a70cf9 | 3941 | |
3942 | static inline bool | |
1a91d914 | 3943 | gimple_asm_volatile_p (const gasm *asm_stmt) |
75a70cf9 | 3944 | { |
1a91d914 | 3945 | return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0; |
75a70cf9 | 3946 | } |
3947 | ||
3948 | ||
6de46ad5 | 3949 | /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */ |
75a70cf9 | 3950 | |
3951 | static inline void | |
1a91d914 | 3952 | gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p) |
75a70cf9 | 3953 | { |
75a70cf9 | 3954 | if (volatile_p) |
1a91d914 | 3955 | asm_stmt->subcode |= GF_ASM_VOLATILE; |
75a70cf9 | 3956 | else |
1a91d914 | 3957 | asm_stmt->subcode &= ~GF_ASM_VOLATILE; |
75a70cf9 | 3958 | } |
3959 | ||
3960 | ||
6de46ad5 | 3961 | /* Return true if ASM_STMT is marked inline. */ |
3962 | ||
3963 | static inline bool | |
3964 | gimple_asm_inline_p (const gasm *asm_stmt) | |
3965 | { | |
3966 | return (asm_stmt->subcode & GF_ASM_INLINE) != 0; | |
3967 | } | |
3968 | ||
3969 | ||
3970 | /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */ | |
3971 | ||
3972 | static inline void | |
3973 | gimple_asm_set_inline (gasm *asm_stmt, bool inline_p) | |
3974 | { | |
3975 | if (inline_p) | |
3976 | asm_stmt->subcode |= GF_ASM_INLINE; | |
3977 | else | |
3978 | asm_stmt->subcode &= ~GF_ASM_INLINE; | |
3979 | } | |
3980 | ||
3981 | ||
1a91d914 | 3982 | /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */ |
75a70cf9 | 3983 | |
3984 | static inline void | |
1a91d914 | 3985 | gimple_asm_set_input (gasm *asm_stmt, bool input_p) |
75a70cf9 | 3986 | { |
75a70cf9 | 3987 | if (input_p) |
1a91d914 | 3988 | asm_stmt->subcode |= GF_ASM_INPUT; |
75a70cf9 | 3989 | else |
1a91d914 | 3990 | asm_stmt->subcode &= ~GF_ASM_INPUT; |
75a70cf9 | 3991 | } |
3992 | ||
3993 | ||
1a91d914 | 3994 | /* Return true if asm ASM_STMT is an ASM_INPUT. */ |
75a70cf9 | 3995 | |
3996 | static inline bool | |
1a91d914 | 3997 | gimple_asm_input_p (const gasm *asm_stmt) |
75a70cf9 | 3998 | { |
1a91d914 | 3999 | return (asm_stmt->subcode & GF_ASM_INPUT) != 0; |
75a70cf9 | 4000 | } |
4001 | ||
4002 | ||
1a91d914 | 4003 | /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */ |
75a70cf9 | 4004 | |
4005 | static inline tree | |
1a91d914 | 4006 | gimple_catch_types (const gcatch *catch_stmt) |
75a70cf9 | 4007 | { |
de6bd75e | 4008 | return catch_stmt->types; |
75a70cf9 | 4009 | } |
4010 | ||
4011 | ||
1a91d914 | 4012 | /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */ |
75a70cf9 | 4013 | |
4014 | static inline tree * | |
1a91d914 | 4015 | gimple_catch_types_ptr (gcatch *catch_stmt) |
75a70cf9 | 4016 | { |
de6bd75e | 4017 | return &catch_stmt->types; |
75a70cf9 | 4018 | } |
4019 | ||
4020 | ||
75a70cf9 | 4021 | /* Return a pointer to the GIMPLE sequence representing the body of |
1a91d914 | 4022 | the handler of GIMPLE_CATCH statement CATCH_STMT. */ |
75a70cf9 | 4023 | |
4024 | static inline gimple_seq * | |
1a91d914 | 4025 | gimple_catch_handler_ptr (gcatch *catch_stmt) |
75a70cf9 | 4026 | { |
de6bd75e | 4027 | return &catch_stmt->handler; |
75a70cf9 | 4028 | } |
4029 | ||
4030 | ||
e3a19533 | 4031 | /* Return the GIMPLE sequence representing the body of the handler of |
1a91d914 | 4032 | GIMPLE_CATCH statement CATCH_STMT. */ |
e3a19533 | 4033 | |
4034 | static inline gimple_seq | |
1a91d914 | 4035 | gimple_catch_handler (gcatch *catch_stmt) |
e3a19533 | 4036 | { |
1a91d914 | 4037 | return *gimple_catch_handler_ptr (catch_stmt); |
e3a19533 | 4038 | } |
4039 | ||
4040 | ||
1a91d914 | 4041 | /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */ |
75a70cf9 | 4042 | |
4043 | static inline void | |
1a91d914 | 4044 | gimple_catch_set_types (gcatch *catch_stmt, tree t) |
75a70cf9 | 4045 | { |
de6bd75e | 4046 | catch_stmt->types = t; |
75a70cf9 | 4047 | } |
4048 | ||
4049 | ||
1a91d914 | 4050 | /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */ |
75a70cf9 | 4051 | |
4052 | static inline void | |
1a91d914 | 4053 | gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler) |
75a70cf9 | 4054 | { |
de6bd75e | 4055 | catch_stmt->handler = handler; |
75a70cf9 | 4056 | } |
4057 | ||
4058 | ||
4059 | /* Return the types handled by GIMPLE_EH_FILTER statement GS. */ | |
4060 | ||
4061 | static inline tree | |
42acab1c | 4062 | gimple_eh_filter_types (const gimple *gs) |
75a70cf9 | 4063 | { |
1a91d914 | 4064 | const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs); |
de6bd75e | 4065 | return eh_filter_stmt->types; |
75a70cf9 | 4066 | } |
4067 | ||
4068 | ||
4069 | /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement | |
4070 | GS. */ | |
4071 | ||
4072 | static inline tree * | |
42acab1c | 4073 | gimple_eh_filter_types_ptr (gimple *gs) |
75a70cf9 | 4074 | { |
1a91d914 | 4075 | geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs); |
de6bd75e | 4076 | return &eh_filter_stmt->types; |
75a70cf9 | 4077 | } |
4078 | ||
4079 | ||
e3a19533 | 4080 | /* Return a pointer to the sequence of statement to execute when |
4081 | GIMPLE_EH_FILTER statement fails. */ | |
4082 | ||
4083 | static inline gimple_seq * | |
42acab1c | 4084 | gimple_eh_filter_failure_ptr (gimple *gs) |
e3a19533 | 4085 | { |
1a91d914 | 4086 | geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs); |
de6bd75e | 4087 | return &eh_filter_stmt->failure; |
e3a19533 | 4088 | } |
4089 | ||
4090 | ||
75a70cf9 | 4091 | /* Return the sequence of statement to execute when GIMPLE_EH_FILTER |
4092 | statement fails. */ | |
4093 | ||
4094 | static inline gimple_seq | |
42acab1c | 4095 | gimple_eh_filter_failure (gimple *gs) |
75a70cf9 | 4096 | { |
e3a19533 | 4097 | return *gimple_eh_filter_failure_ptr (gs); |
75a70cf9 | 4098 | } |
4099 | ||
4100 | ||
1a91d914 | 4101 | /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER |
4102 | EH_FILTER_STMT. */ | |
75a70cf9 | 4103 | |
4104 | static inline void | |
1a91d914 | 4105 | gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types) |
75a70cf9 | 4106 | { |
de6bd75e | 4107 | eh_filter_stmt->types = types; |
75a70cf9 | 4108 | } |
4109 | ||
4110 | ||
4111 | /* Set FAILURE to be the sequence of statements to execute on failure | |
1a91d914 | 4112 | for GIMPLE_EH_FILTER EH_FILTER_STMT. */ |
75a70cf9 | 4113 | |
4114 | static inline void | |
1a91d914 | 4115 | gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt, |
4116 | gimple_seq failure) | |
75a70cf9 | 4117 | { |
de6bd75e | 4118 | eh_filter_stmt->failure = failure; |
75a70cf9 | 4119 | } |
4120 | ||
e38def9c | 4121 | /* Get the function decl to be called by the MUST_NOT_THROW region. */ |
75a70cf9 | 4122 | |
e38def9c | 4123 | static inline tree |
1a91d914 | 4124 | gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt) |
75a70cf9 | 4125 | { |
de6bd75e | 4126 | return eh_mnt_stmt->fndecl; |
75a70cf9 | 4127 | } |
4128 | ||
7bfefa9d | 4129 | /* Set the function decl to be called by GS to DECL. */ |
4130 | ||
4131 | static inline void | |
1a91d914 | 4132 | gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt, |
4133 | tree decl) | |
7bfefa9d | 4134 | { |
de6bd75e | 4135 | eh_mnt_stmt->fndecl = decl; |
7bfefa9d | 4136 | } |
4137 | ||
4c0315d0 | 4138 | /* GIMPLE_EH_ELSE accessors. */ |
4139 | ||
e3a19533 | 4140 | static inline gimple_seq * |
1a91d914 | 4141 | gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt) |
e3a19533 | 4142 | { |
de6bd75e | 4143 | return &eh_else_stmt->n_body; |
e3a19533 | 4144 | } |
4145 | ||
4c0315d0 | 4146 | static inline gimple_seq |
1a91d914 | 4147 | gimple_eh_else_n_body (geh_else *eh_else_stmt) |
e3a19533 | 4148 | { |
1a91d914 | 4149 | return *gimple_eh_else_n_body_ptr (eh_else_stmt); |
e3a19533 | 4150 | } |
4151 | ||
4152 | static inline gimple_seq * | |
1a91d914 | 4153 | gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt) |
4c0315d0 | 4154 | { |
de6bd75e | 4155 | return &eh_else_stmt->e_body; |
4c0315d0 | 4156 | } |
4157 | ||
4158 | static inline gimple_seq | |
1a91d914 | 4159 | gimple_eh_else_e_body (geh_else *eh_else_stmt) |
4c0315d0 | 4160 | { |
1a91d914 | 4161 | return *gimple_eh_else_e_body_ptr (eh_else_stmt); |
4c0315d0 | 4162 | } |
4163 | ||
4164 | static inline void | |
1a91d914 | 4165 | gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq) |
4c0315d0 | 4166 | { |
de6bd75e | 4167 | eh_else_stmt->n_body = seq; |
4c0315d0 | 4168 | } |
4169 | ||
4170 | static inline void | |
1a91d914 | 4171 | gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq) |
4c0315d0 | 4172 | { |
de6bd75e | 4173 | eh_else_stmt->e_body = seq; |
4c0315d0 | 4174 | } |
7bfefa9d | 4175 | |
75a70cf9 | 4176 | /* GIMPLE_TRY accessors. */ |
4177 | ||
4178 | /* Return the kind of try block represented by GIMPLE_TRY GS. This is | |
4179 | either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */ | |
4180 | ||
4181 | static inline enum gimple_try_flags | |
42acab1c | 4182 | gimple_try_kind (const gimple *gs) |
75a70cf9 | 4183 | { |
4184 | GIMPLE_CHECK (gs, GIMPLE_TRY); | |
de6bd75e | 4185 | return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND); |
75a70cf9 | 4186 | } |
4187 | ||
4188 | ||
4189 | /* Set the kind of try block represented by GIMPLE_TRY GS. */ | |
4190 | ||
4191 | static inline void | |
1a91d914 | 4192 | gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind) |
75a70cf9 | 4193 | { |
1e720c36 | 4194 | gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH |
4195 | || kind == GIMPLE_TRY_FINALLY); | |
75a70cf9 | 4196 | if (gimple_try_kind (gs) != kind) |
de6bd75e | 4197 | gs->subcode = (unsigned int) kind; |
75a70cf9 | 4198 | } |
4199 | ||
4200 | ||
4201 | /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */ | |
4202 | ||
4203 | static inline bool | |
42acab1c | 4204 | gimple_try_catch_is_cleanup (const gimple *gs) |
75a70cf9 | 4205 | { |
1e720c36 | 4206 | gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH); |
de6bd75e | 4207 | return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0; |
75a70cf9 | 4208 | } |
4209 | ||
4210 | ||
e3a19533 | 4211 | /* Return a pointer to the sequence of statements used as the |
4212 | body for GIMPLE_TRY GS. */ | |
4213 | ||
4214 | static inline gimple_seq * | |
42acab1c | 4215 | gimple_try_eval_ptr (gimple *gs) |
e3a19533 | 4216 | { |
1a91d914 | 4217 | gtry *try_stmt = as_a <gtry *> (gs); |
de6bd75e | 4218 | return &try_stmt->eval; |
e3a19533 | 4219 | } |
4220 | ||
4221 | ||
75a70cf9 | 4222 | /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */ |
4223 | ||
4224 | static inline gimple_seq | |
42acab1c | 4225 | gimple_try_eval (gimple *gs) |
e3a19533 | 4226 | { |
4227 | return *gimple_try_eval_ptr (gs); | |
4228 | } | |
4229 | ||
4230 | ||
4231 | /* Return a pointer to the sequence of statements used as the cleanup body for | |
4232 | GIMPLE_TRY GS. */ | |
4233 | ||
4234 | static inline gimple_seq * | |
42acab1c | 4235 | gimple_try_cleanup_ptr (gimple *gs) |
75a70cf9 | 4236 | { |
1a91d914 | 4237 | gtry *try_stmt = as_a <gtry *> (gs); |
de6bd75e | 4238 | return &try_stmt->cleanup; |
75a70cf9 | 4239 | } |
4240 | ||
4241 | ||
4242 | /* Return the sequence of statements used as the cleanup body for | |
4243 | GIMPLE_TRY GS. */ | |
4244 | ||
4245 | static inline gimple_seq | |
42acab1c | 4246 | gimple_try_cleanup (gimple *gs) |
75a70cf9 | 4247 | { |
e3a19533 | 4248 | return *gimple_try_cleanup_ptr (gs); |
75a70cf9 | 4249 | } |
4250 | ||
4251 | ||
4252 | /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */ | |
4253 | ||
4254 | static inline void | |
1a91d914 | 4255 | gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup) |
75a70cf9 | 4256 | { |
1e720c36 | 4257 | gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH); |
75a70cf9 | 4258 | if (catch_is_cleanup) |
de6bd75e | 4259 | g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP; |
75a70cf9 | 4260 | else |
de6bd75e | 4261 | g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP; |
75a70cf9 | 4262 | } |
4263 | ||
4264 | ||
4265 | /* Set EVAL to be the sequence of statements to use as the body for | |
1a91d914 | 4266 | GIMPLE_TRY TRY_STMT. */ |
75a70cf9 | 4267 | |
4268 | static inline void | |
1a91d914 | 4269 | gimple_try_set_eval (gtry *try_stmt, gimple_seq eval) |
75a70cf9 | 4270 | { |
de6bd75e | 4271 | try_stmt->eval = eval; |
75a70cf9 | 4272 | } |
4273 | ||
4274 | ||
4275 | /* Set CLEANUP to be the sequence of statements to use as the cleanup | |
1a91d914 | 4276 | body for GIMPLE_TRY TRY_STMT. */ |
75a70cf9 | 4277 | |
4278 | static inline void | |
1a91d914 | 4279 | gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup) |
75a70cf9 | 4280 | { |
de6bd75e | 4281 | try_stmt->cleanup = cleanup; |
75a70cf9 | 4282 | } |
4283 | ||
4284 | ||
e3a19533 | 4285 | /* Return a pointer to the cleanup sequence for cleanup statement GS. */ |
4286 | ||
4287 | static inline gimple_seq * | |
42acab1c | 4288 | gimple_wce_cleanup_ptr (gimple *gs) |
e3a19533 | 4289 | { |
13cbeaac | 4290 | gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs); |
de6bd75e | 4291 | return &wce_stmt->cleanup; |
e3a19533 | 4292 | } |
4293 | ||
4294 | ||
75a70cf9 | 4295 | /* Return the cleanup sequence for cleanup statement GS. */ |
4296 | ||
4297 | static inline gimple_seq | |
42acab1c | 4298 | gimple_wce_cleanup (gimple *gs) |
75a70cf9 | 4299 | { |
e3a19533 | 4300 | return *gimple_wce_cleanup_ptr (gs); |
75a70cf9 | 4301 | } |
4302 | ||
4303 | ||
4304 | /* Set CLEANUP to be the cleanup sequence for GS. */ | |
4305 | ||
4306 | static inline void | |
42acab1c | 4307 | gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup) |
75a70cf9 | 4308 | { |
13cbeaac | 4309 | gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs); |
de6bd75e | 4310 | wce_stmt->cleanup = cleanup; |
75a70cf9 | 4311 | } |
4312 | ||
4313 | ||
4314 | /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */ | |
4315 | ||
4316 | static inline bool | |
42acab1c | 4317 | gimple_wce_cleanup_eh_only (const gimple *gs) |
75a70cf9 | 4318 | { |
4319 | GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); | |
de6bd75e | 4320 | return gs->subcode != 0; |
75a70cf9 | 4321 | } |
4322 | ||
4323 | ||
4324 | /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */ | |
4325 | ||
4326 | static inline void | |
42acab1c | 4327 | gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p) |
75a70cf9 | 4328 | { |
4329 | GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); | |
de6bd75e | 4330 | gs->subcode = (unsigned int) eh_only_p; |
75a70cf9 | 4331 | } |
4332 | ||
4333 | ||
4334 | /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */ | |
4335 | ||
4336 | static inline unsigned | |
42acab1c | 4337 | gimple_phi_capacity (const gimple *gs) |
75a70cf9 | 4338 | { |
1a91d914 | 4339 | const gphi *phi_stmt = as_a <const gphi *> (gs); |
de6bd75e | 4340 | return phi_stmt->capacity; |
75a70cf9 | 4341 | } |
4342 | ||
4343 | ||
4344 | /* Return the number of arguments in GIMPLE_PHI GS. This must always | |
4345 | be exactly the number of incoming edges for the basic block holding | |
4346 | GS. */ | |
4347 | ||
4348 | static inline unsigned | |
42acab1c | 4349 | gimple_phi_num_args (const gimple *gs) |
75a70cf9 | 4350 | { |
1a91d914 | 4351 | const gphi *phi_stmt = as_a <const gphi *> (gs); |
de6bd75e | 4352 | return phi_stmt->nargs; |
75a70cf9 | 4353 | } |
4354 | ||
4355 | ||
4356 | /* Return the SSA name created by GIMPLE_PHI GS. */ | |
4357 | ||
a0a594a5 | 4358 | static inline tree |
4359 | gimple_phi_result (const gphi *gs) | |
4360 | { | |
4361 | return gs->result; | |
4362 | } | |
4363 | ||
75a70cf9 | 4364 | static inline tree |
42acab1c | 4365 | gimple_phi_result (const gimple *gs) |
75a70cf9 | 4366 | { |
1a91d914 | 4367 | const gphi *phi_stmt = as_a <const gphi *> (gs); |
a0a594a5 | 4368 | return gimple_phi_result (phi_stmt); |
75a70cf9 | 4369 | } |
4370 | ||
4371 | /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */ | |
4372 | ||
a0a594a5 | 4373 | static inline tree * |
4374 | gimple_phi_result_ptr (gphi *gs) | |
4375 | { | |
4376 | return &gs->result; | |
4377 | } | |
4378 | ||
75a70cf9 | 4379 | static inline tree * |
42acab1c | 4380 | gimple_phi_result_ptr (gimple *gs) |
75a70cf9 | 4381 | { |
1a91d914 | 4382 | gphi *phi_stmt = as_a <gphi *> (gs); |
a0a594a5 | 4383 | return gimple_phi_result_ptr (phi_stmt); |
75a70cf9 | 4384 | } |
4385 | ||
1a91d914 | 4386 | /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */ |
75a70cf9 | 4387 | |
4388 | static inline void | |
1a91d914 | 4389 | gimple_phi_set_result (gphi *phi, tree result) |
75a70cf9 | 4390 | { |
1a91d914 | 4391 | phi->result = result; |
9c06f260 | 4392 | if (result && TREE_CODE (result) == SSA_NAME) |
1a91d914 | 4393 | SSA_NAME_DEF_STMT (result) = phi; |
75a70cf9 | 4394 | } |
4395 | ||
4396 | ||
4397 | /* Return the PHI argument corresponding to incoming edge INDEX for | |
4398 | GIMPLE_PHI GS. */ | |
4399 | ||
a0a594a5 | 4400 | static inline struct phi_arg_d * |
4401 | gimple_phi_arg (gphi *gs, unsigned index) | |
4402 | { | |
4403 | gcc_gimple_checking_assert (index < gs->nargs); | |
4404 | return &(gs->args[index]); | |
4405 | } | |
4406 | ||
75a70cf9 | 4407 | static inline struct phi_arg_d * |
42acab1c | 4408 | gimple_phi_arg (gimple *gs, unsigned index) |
75a70cf9 | 4409 | { |
1a91d914 | 4410 | gphi *phi_stmt = as_a <gphi *> (gs); |
a0a594a5 | 4411 | return gimple_phi_arg (phi_stmt, index); |
75a70cf9 | 4412 | } |
4413 | ||
4414 | /* Set PHIARG to be the argument corresponding to incoming edge INDEX | |
1a91d914 | 4415 | for GIMPLE_PHI PHI. */ |
75a70cf9 | 4416 | |
4417 | static inline void | |
1a91d914 | 4418 | gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg) |
75a70cf9 | 4419 | { |
22966ae1 | 4420 | gcc_gimple_checking_assert (index < phi->nargs); |
1a91d914 | 4421 | phi->args[index] = *phiarg; |
75a70cf9 | 4422 | } |
4423 | ||
8f6fa493 | 4424 | /* Return the PHI nodes for basic block BB, or NULL if there are no |
4425 | PHI nodes. */ | |
4426 | ||
4427 | static inline gimple_seq | |
4428 | phi_nodes (const_basic_block bb) | |
4429 | { | |
4430 | gcc_checking_assert (!(bb->flags & BB_RTL)); | |
4431 | return bb->il.gimple.phi_nodes; | |
4432 | } | |
4433 | ||
4434 | /* Return a pointer to the PHI nodes for basic block BB. */ | |
4435 | ||
4436 | static inline gimple_seq * | |
4437 | phi_nodes_ptr (basic_block bb) | |
4438 | { | |
4439 | gcc_checking_assert (!(bb->flags & BB_RTL)); | |
4440 | return &bb->il.gimple.phi_nodes; | |
4441 | } | |
4442 | ||
4443 | /* Return the tree operand for argument I of PHI node GS. */ | |
4444 | ||
a0a594a5 | 4445 | static inline tree |
4446 | gimple_phi_arg_def (gphi *gs, size_t index) | |
4447 | { | |
4448 | return gimple_phi_arg (gs, index)->def; | |
4449 | } | |
4450 | ||
8f6fa493 | 4451 | static inline tree |
42acab1c | 4452 | gimple_phi_arg_def (gimple *gs, size_t index) |
8f6fa493 | 4453 | { |
4454 | return gimple_phi_arg (gs, index)->def; | |
4455 | } | |
4456 | ||
4457 | ||
1a91d914 | 4458 | /* Return a pointer to the tree operand for argument I of phi node PHI. */ |
8f6fa493 | 4459 | |
4460 | static inline tree * | |
1a91d914 | 4461 | gimple_phi_arg_def_ptr (gphi *phi, size_t index) |
8f6fa493 | 4462 | { |
1a91d914 | 4463 | return &gimple_phi_arg (phi, index)->def; |
8f6fa493 | 4464 | } |
4465 | ||
1a91d914 | 4466 | /* Return the edge associated with argument I of phi node PHI. */ |
8f6fa493 | 4467 | |
4468 | static inline edge | |
1a91d914 | 4469 | gimple_phi_arg_edge (gphi *phi, size_t i) |
8f6fa493 | 4470 | { |
1a91d914 | 4471 | return EDGE_PRED (gimple_bb (phi), i); |
8f6fa493 | 4472 | } |
4473 | ||
1a91d914 | 4474 | /* Return the source location of gimple argument I of phi node PHI. */ |
8f6fa493 | 4475 | |
be1e7283 | 4476 | static inline location_t |
1a91d914 | 4477 | gimple_phi_arg_location (gphi *phi, size_t i) |
8f6fa493 | 4478 | { |
1a91d914 | 4479 | return gimple_phi_arg (phi, i)->locus; |
8f6fa493 | 4480 | } |
4481 | ||
1a91d914 | 4482 | /* Return the source location of the argument on edge E of phi node PHI. */ |
8f6fa493 | 4483 | |
be1e7283 | 4484 | static inline location_t |
1a91d914 | 4485 | gimple_phi_arg_location_from_edge (gphi *phi, edge e) |
8f6fa493 | 4486 | { |
1a91d914 | 4487 | return gimple_phi_arg (phi, e->dest_idx)->locus; |
8f6fa493 | 4488 | } |
4489 | ||
1a91d914 | 4490 | /* Set the source location of gimple argument I of phi node PHI to LOC. */ |
8f6fa493 | 4491 | |
4492 | static inline void | |
be1e7283 | 4493 | gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc) |
8f6fa493 | 4494 | { |
1a91d914 | 4495 | gimple_phi_arg (phi, i)->locus = loc; |
8f6fa493 | 4496 | } |
4497 | ||
1a91d914 | 4498 | /* Return TRUE if argument I of phi node PHI has a location record. */ |
8f6fa493 | 4499 | |
4500 | static inline bool | |
1a91d914 | 4501 | gimple_phi_arg_has_location (gphi *phi, size_t i) |
8f6fa493 | 4502 | { |
1a91d914 | 4503 | return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION; |
8f6fa493 | 4504 | } |
4505 | ||
4506 | ||
1a91d914 | 4507 | /* Return the region number for GIMPLE_RESX RESX_STMT. */ |
75a70cf9 | 4508 | |
4509 | static inline int | |
1a91d914 | 4510 | gimple_resx_region (const gresx *resx_stmt) |
75a70cf9 | 4511 | { |
a9035320 | 4512 | return resx_stmt->region; |
75a70cf9 | 4513 | } |
4514 | ||
1a91d914 | 4515 | /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */ |
75a70cf9 | 4516 | |
4517 | static inline void | |
1a91d914 | 4518 | gimple_resx_set_region (gresx *resx_stmt, int region) |
75a70cf9 | 4519 | { |
a9035320 | 4520 | resx_stmt->region = region; |
75a70cf9 | 4521 | } |
4522 | ||
1a91d914 | 4523 | /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */ |
e38def9c | 4524 | |
4525 | static inline int | |
1a91d914 | 4526 | gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt) |
e38def9c | 4527 | { |
a9035320 | 4528 | return eh_dispatch_stmt->region; |
e38def9c | 4529 | } |
4530 | ||
1a91d914 | 4531 | /* Set REGION to be the region number for GIMPLE_EH_DISPATCH |
4532 | EH_DISPATCH_STMT. */ | |
e38def9c | 4533 | |
4534 | static inline void | |
1a91d914 | 4535 | gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region) |
e38def9c | 4536 | { |
a9035320 | 4537 | eh_dispatch_stmt->region = region; |
e38def9c | 4538 | } |
75a70cf9 | 4539 | |
4540 | /* Return the number of labels associated with the switch statement GS. */ | |
4541 | ||
4542 | static inline unsigned | |
1a91d914 | 4543 | gimple_switch_num_labels (const gswitch *gs) |
75a70cf9 | 4544 | { |
4545 | unsigned num_ops; | |
4546 | GIMPLE_CHECK (gs, GIMPLE_SWITCH); | |
4547 | num_ops = gimple_num_ops (gs); | |
1e720c36 | 4548 | gcc_gimple_checking_assert (num_ops > 1); |
75a70cf9 | 4549 | return num_ops - 1; |
4550 | } | |
4551 | ||
4552 | ||
4553 | /* Set NLABELS to be the number of labels for the switch statement GS. */ | |
4554 | ||
4555 | static inline void | |
1a91d914 | 4556 | gimple_switch_set_num_labels (gswitch *g, unsigned nlabels) |
75a70cf9 | 4557 | { |
4558 | GIMPLE_CHECK (g, GIMPLE_SWITCH); | |
4559 | gimple_set_num_ops (g, nlabels + 1); | |
4560 | } | |
4561 | ||
4562 | ||
4563 | /* Return the index variable used by the switch statement GS. */ | |
4564 | ||
4565 | static inline tree | |
1a91d914 | 4566 | gimple_switch_index (const gswitch *gs) |
75a70cf9 | 4567 | { |
78e011ba | 4568 | return gs->op[0]; |
75a70cf9 | 4569 | } |
4570 | ||
4571 | ||
4572 | /* Return a pointer to the index variable for the switch statement GS. */ | |
4573 | ||
4574 | static inline tree * | |
ad023323 | 4575 | gimple_switch_index_ptr (gswitch *gs) |
75a70cf9 | 4576 | { |
ad023323 | 4577 | return &gs->op[0]; |
75a70cf9 | 4578 | } |
4579 | ||
4580 | ||
4581 | /* Set INDEX to be the index variable for switch statement GS. */ | |
4582 | ||
4583 | static inline void | |
1a91d914 | 4584 | gimple_switch_set_index (gswitch *gs, tree index) |
75a70cf9 | 4585 | { |
1e720c36 | 4586 | gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index)); |
78e011ba | 4587 | gs->op[0] = index; |
75a70cf9 | 4588 | } |
4589 | ||
4590 | ||
4591 | /* Return the label numbered INDEX. The default label is 0, followed by any | |
4592 | labels in a switch statement. */ | |
4593 | ||
4594 | static inline tree | |
1a91d914 | 4595 | gimple_switch_label (const gswitch *gs, unsigned index) |
75a70cf9 | 4596 | { |
1e720c36 | 4597 | gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1); |
78e011ba | 4598 | return gs->op[index + 1]; |
75a70cf9 | 4599 | } |
4600 | ||
4601 | /* Set the label number INDEX to LABEL. 0 is always the default label. */ | |
4602 | ||
4603 | static inline void | |
1a91d914 | 4604 | gimple_switch_set_label (gswitch *gs, unsigned index, tree label) |
75a70cf9 | 4605 | { |
1e720c36 | 4606 | gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1 |
4607 | && (label == NULL_TREE | |
4608 | || TREE_CODE (label) == CASE_LABEL_EXPR)); | |
78e011ba | 4609 | gs->op[index + 1] = label; |
75a70cf9 | 4610 | } |
4611 | ||
4612 | /* Return the default label for a switch statement. */ | |
4613 | ||
4614 | static inline tree | |
1a91d914 | 4615 | gimple_switch_default_label (const gswitch *gs) |
75a70cf9 | 4616 | { |
49a70175 | 4617 | tree label = gimple_switch_label (gs, 0); |
4618 | gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label)); | |
4619 | return label; | |
75a70cf9 | 4620 | } |
4621 | ||
4622 | /* Set the default label for a switch statement. */ | |
4623 | ||
4624 | static inline void | |
1a91d914 | 4625 | gimple_switch_set_default_label (gswitch *gs, tree label) |
75a70cf9 | 4626 | { |
49a70175 | 4627 | gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label)); |
75a70cf9 | 4628 | gimple_switch_set_label (gs, 0, label); |
4629 | } | |
4630 | ||
9845d120 | 4631 | /* Return true if GS is a GIMPLE_DEBUG statement. */ |
4632 | ||
4633 | static inline bool | |
42acab1c | 4634 | is_gimple_debug (const gimple *gs) |
9845d120 | 4635 | { |
4636 | return gimple_code (gs) == GIMPLE_DEBUG; | |
4637 | } | |
4638 | ||
bce107d7 | 4639 | |
4640 | /* Return the last nondebug statement in GIMPLE sequence S. */ | |
4641 | ||
4642 | static inline gimple * | |
4643 | gimple_seq_last_nondebug_stmt (gimple_seq s) | |
4644 | { | |
4645 | gimple_seq_node n; | |
4646 | for (n = gimple_seq_last (s); | |
4647 | n && is_gimple_debug (n); | |
4648 | n = n->prev) | |
4649 | if (n->prev == s) | |
4650 | return NULL; | |
4651 | return n; | |
4652 | } | |
4653 | ||
4654 | ||
9845d120 | 4655 | /* Return true if S is a GIMPLE_DEBUG BIND statement. */ |
4656 | ||
4657 | static inline bool | |
42acab1c | 4658 | gimple_debug_bind_p (const gimple *s) |
9845d120 | 4659 | { |
4660 | if (is_gimple_debug (s)) | |
de6bd75e | 4661 | return s->subcode == GIMPLE_DEBUG_BIND; |
9845d120 | 4662 | |
4663 | return false; | |
4664 | } | |
4665 | ||
4666 | /* Return the variable bound in a GIMPLE_DEBUG bind statement. */ | |
4667 | ||
4668 | static inline tree | |
42acab1c | 4669 | gimple_debug_bind_get_var (gimple *dbg) |
9845d120 | 4670 | { |
4671 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
1e720c36 | 4672 | gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); |
9845d120 | 4673 | return gimple_op (dbg, 0); |
4674 | } | |
4675 | ||
4676 | /* Return the value bound to the variable in a GIMPLE_DEBUG bind | |
4677 | statement. */ | |
4678 | ||
4679 | static inline tree | |
42acab1c | 4680 | gimple_debug_bind_get_value (gimple *dbg) |
9845d120 | 4681 | { |
4682 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
1e720c36 | 4683 | gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); |
9845d120 | 4684 | return gimple_op (dbg, 1); |
4685 | } | |
4686 | ||
4687 | /* Return a pointer to the value bound to the variable in a | |
4688 | GIMPLE_DEBUG bind statement. */ | |
4689 | ||
4690 | static inline tree * | |
42acab1c | 4691 | gimple_debug_bind_get_value_ptr (gimple *dbg) |
9845d120 | 4692 | { |
4693 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
1e720c36 | 4694 | gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); |
9845d120 | 4695 | return gimple_op_ptr (dbg, 1); |
4696 | } | |
4697 | ||
4698 | /* Set the variable bound in a GIMPLE_DEBUG bind statement. */ | |
4699 | ||
4700 | static inline void | |
42acab1c | 4701 | gimple_debug_bind_set_var (gimple *dbg, tree var) |
9845d120 | 4702 | { |
4703 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
1e720c36 | 4704 | gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); |
9845d120 | 4705 | gimple_set_op (dbg, 0, var); |
4706 | } | |
4707 | ||
4708 | /* Set the value bound to the variable in a GIMPLE_DEBUG bind | |
4709 | statement. */ | |
4710 | ||
4711 | static inline void | |
42acab1c | 4712 | gimple_debug_bind_set_value (gimple *dbg, tree value) |
9845d120 | 4713 | { |
4714 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
1e720c36 | 4715 | gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); |
9845d120 | 4716 | gimple_set_op (dbg, 1, value); |
4717 | } | |
4718 | ||
4719 | /* The second operand of a GIMPLE_DEBUG_BIND, when the value was | |
4720 | optimized away. */ | |
4721 | #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */ | |
4722 | ||
4723 | /* Remove the value bound to the variable in a GIMPLE_DEBUG bind | |
4724 | statement. */ | |
4725 | ||
4726 | static inline void | |
42acab1c | 4727 | gimple_debug_bind_reset_value (gimple *dbg) |
9845d120 | 4728 | { |
4729 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
1e720c36 | 4730 | gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); |
9845d120 | 4731 | gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE); |
4732 | } | |
4733 | ||
4734 | /* Return true if the GIMPLE_DEBUG bind statement is bound to a | |
4735 | value. */ | |
4736 | ||
4737 | static inline bool | |
42acab1c | 4738 | gimple_debug_bind_has_value_p (gimple *dbg) |
9845d120 | 4739 | { |
4740 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
1e720c36 | 4741 | gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); |
9845d120 | 4742 | return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE; |
4743 | } | |
4744 | ||
4745 | #undef GIMPLE_DEBUG_BIND_NOVALUE | |
75a70cf9 | 4746 | |
841424cc | 4747 | /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */ |
4748 | ||
4749 | static inline bool | |
42acab1c | 4750 | gimple_debug_source_bind_p (const gimple *s) |
841424cc | 4751 | { |
4752 | if (is_gimple_debug (s)) | |
de6bd75e | 4753 | return s->subcode == GIMPLE_DEBUG_SOURCE_BIND; |
841424cc | 4754 | |
4755 | return false; | |
4756 | } | |
4757 | ||
4758 | /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */ | |
4759 | ||
4760 | static inline tree | |
42acab1c | 4761 | gimple_debug_source_bind_get_var (gimple *dbg) |
841424cc | 4762 | { |
4763 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
4764 | gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); | |
4765 | return gimple_op (dbg, 0); | |
4766 | } | |
4767 | ||
4768 | /* Return the value bound to the variable in a GIMPLE_DEBUG source bind | |
4769 | statement. */ | |
4770 | ||
4771 | static inline tree | |
42acab1c | 4772 | gimple_debug_source_bind_get_value (gimple *dbg) |
841424cc | 4773 | { |
4774 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
4775 | gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); | |
4776 | return gimple_op (dbg, 1); | |
4777 | } | |
4778 | ||
4779 | /* Return a pointer to the value bound to the variable in a | |
4780 | GIMPLE_DEBUG source bind statement. */ | |
4781 | ||
4782 | static inline tree * | |
42acab1c | 4783 | gimple_debug_source_bind_get_value_ptr (gimple *dbg) |
841424cc | 4784 | { |
4785 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
4786 | gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); | |
4787 | return gimple_op_ptr (dbg, 1); | |
4788 | } | |
4789 | ||
4790 | /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */ | |
4791 | ||
4792 | static inline void | |
42acab1c | 4793 | gimple_debug_source_bind_set_var (gimple *dbg, tree var) |
841424cc | 4794 | { |
4795 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
4796 | gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); | |
4797 | gimple_set_op (dbg, 0, var); | |
4798 | } | |
4799 | ||
4800 | /* Set the value bound to the variable in a GIMPLE_DEBUG source bind | |
4801 | statement. */ | |
4802 | ||
4803 | static inline void | |
42acab1c | 4804 | gimple_debug_source_bind_set_value (gimple *dbg, tree value) |
841424cc | 4805 | { |
4806 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
4807 | gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); | |
4808 | gimple_set_op (dbg, 1, value); | |
4809 | } | |
4810 | ||
c64f38bf | 4811 | /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */ |
4812 | ||
4813 | static inline bool | |
4814 | gimple_debug_begin_stmt_p (const gimple *s) | |
4815 | { | |
4816 | if (is_gimple_debug (s)) | |
4817 | return s->subcode == GIMPLE_DEBUG_BEGIN_STMT; | |
4818 | ||
4819 | return false; | |
4820 | } | |
4821 | ||
8f6f3638 | 4822 | /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */ |
4823 | ||
4824 | static inline bool | |
4825 | gimple_debug_inline_entry_p (const gimple *s) | |
4826 | { | |
4827 | if (is_gimple_debug (s)) | |
4828 | return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY; | |
4829 | ||
4830 | return false; | |
4831 | } | |
4832 | ||
c64f38bf | 4833 | /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */ |
4834 | ||
4835 | static inline bool | |
4836 | gimple_debug_nonbind_marker_p (const gimple *s) | |
4837 | { | |
4838 | if (is_gimple_debug (s)) | |
8f6f3638 | 4839 | return s->subcode == GIMPLE_DEBUG_BEGIN_STMT |
4840 | || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY; | |
c64f38bf | 4841 | |
4842 | return false; | |
4843 | } | |
4844 | ||
582791b0 | 4845 | /* Return the line number for EXPR, or return -1 if we have no line |
4846 | number information for it. */ | |
4847 | static inline int | |
42acab1c | 4848 | get_lineno (const gimple *stmt) |
582791b0 | 4849 | { |
4850 | location_t loc; | |
4851 | ||
4852 | if (!stmt) | |
4853 | return -1; | |
4854 | ||
4855 | loc = gimple_location (stmt); | |
4856 | if (loc == UNKNOWN_LOCATION) | |
4857 | return -1; | |
4858 | ||
4859 | return LOCATION_LINE (loc); | |
4860 | } | |
4861 | ||
e3a19533 | 4862 | /* Return a pointer to the body for the OMP statement GS. */ |
4863 | ||
4864 | static inline gimple_seq * | |
42acab1c | 4865 | gimple_omp_body_ptr (gimple *gs) |
e3a19533 | 4866 | { |
de6bd75e | 4867 | return &static_cast <gimple_statement_omp *> (gs)->body; |
e3a19533 | 4868 | } |
4869 | ||
75a70cf9 | 4870 | /* Return the body for the OMP statement GS. */ |
4871 | ||
48e1416a | 4872 | static inline gimple_seq |
42acab1c | 4873 | gimple_omp_body (gimple *gs) |
75a70cf9 | 4874 | { |
e3a19533 | 4875 | return *gimple_omp_body_ptr (gs); |
75a70cf9 | 4876 | } |
4877 | ||
4878 | /* Set BODY to be the body for the OMP statement GS. */ | |
4879 | ||
4880 | static inline void | |
42acab1c | 4881 | gimple_omp_set_body (gimple *gs, gimple_seq body) |
75a70cf9 | 4882 | { |
de6bd75e | 4883 | static_cast <gimple_statement_omp *> (gs)->body = body; |
75a70cf9 | 4884 | } |
4885 | ||
4886 | ||
1a91d914 | 4887 | /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */ |
75a70cf9 | 4888 | |
4889 | static inline tree | |
1a91d914 | 4890 | gimple_omp_critical_name (const gomp_critical *crit_stmt) |
75a70cf9 | 4891 | { |
1a91d914 | 4892 | return crit_stmt->name; |
75a70cf9 | 4893 | } |
4894 | ||
4895 | ||
43895be5 | 4896 | /* Return a pointer to the name associated with OMP critical statement |
4897 | CRIT_STMT. */ | |
75a70cf9 | 4898 | |
4899 | static inline tree * | |
1a91d914 | 4900 | gimple_omp_critical_name_ptr (gomp_critical *crit_stmt) |
75a70cf9 | 4901 | { |
1a91d914 | 4902 | return &crit_stmt->name; |
75a70cf9 | 4903 | } |
4904 | ||
4905 | ||
43895be5 | 4906 | /* Set NAME to be the name associated with OMP critical statement |
4907 | CRIT_STMT. */ | |
75a70cf9 | 4908 | |
4909 | static inline void | |
1a91d914 | 4910 | gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name) |
75a70cf9 | 4911 | { |
1a91d914 | 4912 | crit_stmt->name = name; |
75a70cf9 | 4913 | } |
4914 | ||
4915 | ||
43895be5 | 4916 | /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */ |
4917 | ||
4918 | static inline tree | |
4919 | gimple_omp_critical_clauses (const gomp_critical *crit_stmt) | |
4920 | { | |
4921 | return crit_stmt->clauses; | |
4922 | } | |
4923 | ||
4924 | ||
4925 | /* Return a pointer to the clauses associated with OMP critical statement | |
4926 | CRIT_STMT. */ | |
4927 | ||
4928 | static inline tree * | |
4929 | gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt) | |
4930 | { | |
4931 | return &crit_stmt->clauses; | |
4932 | } | |
4933 | ||
4934 | ||
4935 | /* Set CLAUSES to be the clauses associated with OMP critical statement | |
4936 | CRIT_STMT. */ | |
4937 | ||
4938 | static inline void | |
4939 | gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses) | |
4940 | { | |
4941 | crit_stmt->clauses = clauses; | |
4942 | } | |
4943 | ||
4944 | ||
4945 | /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */ | |
4946 | ||
4947 | static inline tree | |
4948 | gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt) | |
4949 | { | |
4950 | return ord_stmt->clauses; | |
4951 | } | |
4952 | ||
4953 | ||
4954 | /* Return a pointer to the clauses associated with OMP ordered statement | |
4955 | ORD_STMT. */ | |
4956 | ||
4957 | static inline tree * | |
4958 | gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt) | |
4959 | { | |
4960 | return &ord_stmt->clauses; | |
4961 | } | |
4962 | ||
4963 | ||
4964 | /* Set CLAUSES to be the clauses associated with OMP ordered statement | |
4965 | ORD_STMT. */ | |
4966 | ||
4967 | static inline void | |
4968 | gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses) | |
4969 | { | |
4970 | ord_stmt->clauses = clauses; | |
4971 | } | |
4972 | ||
4973 | ||
70a6624c | 4974 | /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */ |
4975 | ||
4976 | static inline tree | |
4977 | gimple_omp_scan_clauses (const gomp_scan *scan_stmt) | |
4978 | { | |
4979 | return scan_stmt->clauses; | |
4980 | } | |
4981 | ||
4982 | ||
4983 | /* Return a pointer to the clauses associated with OMP scan statement | |
4984 | ORD_STMT. */ | |
4985 | ||
4986 | static inline tree * | |
4987 | gimple_omp_scan_clauses_ptr (gomp_scan *scan_stmt) | |
4988 | { | |
4989 | return &scan_stmt->clauses; | |
4990 | } | |
4991 | ||
4992 | ||
4993 | /* Set CLAUSES to be the clauses associated with OMP scan statement | |
4994 | ORD_STMT. */ | |
4995 | ||
4996 | static inline void | |
4997 | gimple_omp_scan_set_clauses (gomp_scan *scan_stmt, tree clauses) | |
4998 | { | |
4999 | scan_stmt->clauses = clauses; | |
5000 | } | |
5001 | ||
5002 | ||
7e5a76c8 | 5003 | /* Return the clauses associated with OMP_TASKGROUP statement GS. */ |
5004 | ||
5005 | static inline tree | |
5006 | gimple_omp_taskgroup_clauses (const gimple *gs) | |
5007 | { | |
5008 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP); | |
5009 | return | |
5010 | static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses; | |
5011 | } | |
5012 | ||
5013 | ||
5014 | /* Return a pointer to the clauses associated with OMP taskgroup statement | |
5015 | GS. */ | |
5016 | ||
5017 | static inline tree * | |
5018 | gimple_omp_taskgroup_clauses_ptr (gimple *gs) | |
5019 | { | |
5020 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP); | |
5021 | return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses; | |
5022 | } | |
5023 | ||
5024 | ||
5025 | /* Set CLAUSES to be the clauses associated with OMP taskgroup statement | |
5026 | GS. */ | |
5027 | ||
5028 | static inline void | |
5029 | gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses) | |
5030 | { | |
5031 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP); | |
5032 | static_cast <gimple_statement_omp_single_layout *> (gs)->clauses | |
5033 | = clauses; | |
5034 | } | |
5035 | ||
5036 | ||
ca4c3545 | 5037 | /* Return the kind of the OMP_FOR statemement G. */ |
3d483a94 | 5038 | |
5039 | static inline int | |
42acab1c | 5040 | gimple_omp_for_kind (const gimple *g) |
3d483a94 | 5041 | { |
5042 | GIMPLE_CHECK (g, GIMPLE_OMP_FOR); | |
5043 | return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK); | |
5044 | } | |
5045 | ||
5046 | ||
ca4c3545 | 5047 | /* Set the kind of the OMP_FOR statement G. */ |
3d483a94 | 5048 | |
5049 | static inline void | |
1a91d914 | 5050 | gimple_omp_for_set_kind (gomp_for *g, int kind) |
3d483a94 | 5051 | { |
de6bd75e | 5052 | g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK) |
3d483a94 | 5053 | | (kind & GF_OMP_FOR_KIND_MASK); |
5054 | } | |
5055 | ||
5056 | ||
ca4c3545 | 5057 | /* Return true if OMP_FOR statement G has the |
bc7bff74 | 5058 | GF_OMP_FOR_COMBINED flag set. */ |
5059 | ||
5060 | static inline bool | |
42acab1c | 5061 | gimple_omp_for_combined_p (const gimple *g) |
bc7bff74 | 5062 | { |
5063 | GIMPLE_CHECK (g, GIMPLE_OMP_FOR); | |
5064 | return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0; | |
5065 | } | |
5066 | ||
5067 | ||
ca4c3545 | 5068 | /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on |
5069 | the boolean value of COMBINED_P. */ | |
bc7bff74 | 5070 | |
5071 | static inline void | |
1a91d914 | 5072 | gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p) |
bc7bff74 | 5073 | { |
bc7bff74 | 5074 | if (combined_p) |
de6bd75e | 5075 | g->subcode |= GF_OMP_FOR_COMBINED; |
bc7bff74 | 5076 | else |
de6bd75e | 5077 | g->subcode &= ~GF_OMP_FOR_COMBINED; |
bc7bff74 | 5078 | } |
5079 | ||
5080 | ||
ca4c3545 | 5081 | /* Return true if the OMP_FOR statement G has the |
bc7bff74 | 5082 | GF_OMP_FOR_COMBINED_INTO flag set. */ |
5083 | ||
5084 | static inline bool | |
42acab1c | 5085 | gimple_omp_for_combined_into_p (const gimple *g) |
bc7bff74 | 5086 | { |
5087 | GIMPLE_CHECK (g, GIMPLE_OMP_FOR); | |
5088 | return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0; | |
5089 | } | |
5090 | ||
5091 | ||
ca4c3545 | 5092 | /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending |
5093 | on the boolean value of COMBINED_P. */ | |
bc7bff74 | 5094 | |
5095 | static inline void | |
1a91d914 | 5096 | gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p) |
bc7bff74 | 5097 | { |
bc7bff74 | 5098 | if (combined_p) |
de6bd75e | 5099 | g->subcode |= GF_OMP_FOR_COMBINED_INTO; |
bc7bff74 | 5100 | else |
de6bd75e | 5101 | g->subcode &= ~GF_OMP_FOR_COMBINED_INTO; |
bc7bff74 | 5102 | } |
5103 | ||
5104 | ||
ca4c3545 | 5105 | /* Return the clauses associated with the OMP_FOR statement GS. */ |
75a70cf9 | 5106 | |
5107 | static inline tree | |
42acab1c | 5108 | gimple_omp_for_clauses (const gimple *gs) |
75a70cf9 | 5109 | { |
1a91d914 | 5110 | const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs); |
de6bd75e | 5111 | return omp_for_stmt->clauses; |
75a70cf9 | 5112 | } |
5113 | ||
5114 | ||
ca4c3545 | 5115 | /* Return a pointer to the clauses associated with the OMP_FOR statement |
5116 | GS. */ | |
75a70cf9 | 5117 | |
5118 | static inline tree * | |
42acab1c | 5119 | gimple_omp_for_clauses_ptr (gimple *gs) |
75a70cf9 | 5120 | { |
1a91d914 | 5121 | gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); |
de6bd75e | 5122 | return &omp_for_stmt->clauses; |
75a70cf9 | 5123 | } |
5124 | ||
5125 | ||
ca4c3545 | 5126 | /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement |
5127 | GS. */ | |
75a70cf9 | 5128 | |
5129 | static inline void | |
42acab1c | 5130 | gimple_omp_for_set_clauses (gimple *gs, tree clauses) |
75a70cf9 | 5131 | { |
1a91d914 | 5132 | gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); |
de6bd75e | 5133 | omp_for_stmt->clauses = clauses; |
75a70cf9 | 5134 | } |
5135 | ||
5136 | ||
ca4c3545 | 5137 | /* Get the collapse count of the OMP_FOR statement GS. */ |
75a70cf9 | 5138 | |
5139 | static inline size_t | |
42acab1c | 5140 | gimple_omp_for_collapse (gimple *gs) |
75a70cf9 | 5141 | { |
1a91d914 | 5142 | gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); |
de6bd75e | 5143 | return omp_for_stmt->collapse; |
75a70cf9 | 5144 | } |
5145 | ||
5146 | ||
ca4c3545 | 5147 | /* Return the condition code associated with the OMP_FOR statement GS. */ |
5148 | ||
5149 | static inline enum tree_code | |
42acab1c | 5150 | gimple_omp_for_cond (const gimple *gs, size_t i) |
ca4c3545 | 5151 | { |
5152 | const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs); | |
5153 | gcc_gimple_checking_assert (i < omp_for_stmt->collapse); | |
5154 | return omp_for_stmt->iter[i].cond; | |
5155 | } | |
5156 | ||
5157 | ||
5158 | /* Set COND to be the condition code for the OMP_FOR statement GS. */ | |
5159 | ||
5160 | static inline void | |
42acab1c | 5161 | gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond) |
ca4c3545 | 5162 | { |
5163 | gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); | |
5164 | gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison | |
5165 | && i < omp_for_stmt->collapse); | |
5166 | omp_for_stmt->iter[i].cond = cond; | |
5167 | } | |
5168 | ||
5169 | ||
5170 | /* Return the index variable for the OMP_FOR statement GS. */ | |
75a70cf9 | 5171 | |
5172 | static inline tree | |
42acab1c | 5173 | gimple_omp_for_index (const gimple *gs, size_t i) |
75a70cf9 | 5174 | { |
1a91d914 | 5175 | const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs); |
de6bd75e | 5176 | gcc_gimple_checking_assert (i < omp_for_stmt->collapse); |
5177 | return omp_for_stmt->iter[i].index; | |
75a70cf9 | 5178 | } |
5179 | ||
5180 | ||
ca4c3545 | 5181 | /* Return a pointer to the index variable for the OMP_FOR statement GS. */ |
75a70cf9 | 5182 | |
5183 | static inline tree * | |
42acab1c | 5184 | gimple_omp_for_index_ptr (gimple *gs, size_t i) |
75a70cf9 | 5185 | { |
1a91d914 | 5186 | gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); |
de6bd75e | 5187 | gcc_gimple_checking_assert (i < omp_for_stmt->collapse); |
5188 | return &omp_for_stmt->iter[i].index; | |
75a70cf9 | 5189 | } |
5190 | ||
5191 | ||
ca4c3545 | 5192 | /* Set INDEX to be the index variable for the OMP_FOR statement GS. */ |
75a70cf9 | 5193 | |
5194 | static inline void | |
42acab1c | 5195 | gimple_omp_for_set_index (gimple *gs, size_t i, tree index) |
75a70cf9 | 5196 | { |
1a91d914 | 5197 | gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); |
de6bd75e | 5198 | gcc_gimple_checking_assert (i < omp_for_stmt->collapse); |
5199 | omp_for_stmt->iter[i].index = index; | |
75a70cf9 | 5200 | } |
5201 | ||
5202 | ||
ca4c3545 | 5203 | /* Return the initial value for the OMP_FOR statement GS. */ |
75a70cf9 | 5204 | |
5205 | static inline tree | |
42acab1c | 5206 | gimple_omp_for_initial (const gimple *gs, size_t i) |
75a70cf9 | 5207 | { |
1a91d914 | 5208 | const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs); |
de6bd75e | 5209 | gcc_gimple_checking_assert (i < omp_for_stmt->collapse); |
5210 | return omp_for_stmt->iter[i].initial; | |
75a70cf9 | 5211 | } |
5212 | ||
5213 | ||
ca4c3545 | 5214 | /* Return a pointer to the initial value for the OMP_FOR statement GS. */ |
75a70cf9 | 5215 | |
5216 | static inline tree * | |
42acab1c | 5217 | gimple_omp_for_initial_ptr (gimple *gs, size_t i) |
75a70cf9 | 5218 | { |
1a91d914 | 5219 | gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); |
de6bd75e | 5220 | gcc_gimple_checking_assert (i < omp_for_stmt->collapse); |
5221 | return &omp_for_stmt->iter[i].initial; | |
75a70cf9 | 5222 | } |
5223 | ||
5224 | ||
ca4c3545 | 5225 | /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */ |
75a70cf9 | 5226 | |
5227 | static inline void | |
42acab1c | 5228 | gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial) |
75a70cf9 | 5229 | { |
1a91d914 | 5230 | gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); |
de6bd75e | 5231 | gcc_gimple_checking_assert (i < omp_for_stmt->collapse); |
5232 | omp_for_stmt->iter[i].initial = initial; | |
75a70cf9 | 5233 | } |
5234 | ||
5235 | ||
ca4c3545 | 5236 | /* Return the final value for the OMP_FOR statement GS. */ |
75a70cf9 | 5237 | |
5238 | static inline tree | |
42acab1c | 5239 | gimple_omp_for_final (const gimple *gs, size_t i) |
75a70cf9 | 5240 | { |
1a91d914 | 5241 | const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs); |
de6bd75e | 5242 | gcc_gimple_checking_assert (i < omp_for_stmt->collapse); |
5243 | return omp_for_stmt->iter[i].final; | |
75a70cf9 | 5244 | } |
5245 | ||
5246 | ||
ca4c3545 | 5247 | /* Return a pointer to the final value for the OMP_FOR statement GS. */ |
75a70cf9 | 5248 | |
5249 | static inline tree * | |
42acab1c | 5250 | gimple_omp_for_final_ptr (gimple *gs, size_t i) |
75a70cf9 | 5251 | { |
1a91d914 | 5252 | gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); |
de6bd75e | 5253 | gcc_gimple_checking_assert (i < omp_for_stmt->collapse); |
5254 | return &omp_for_stmt->iter[i].final; | |
75a70cf9 | 5255 | } |
5256 | ||
5257 | ||
ca4c3545 | 5258 | /* Set FINAL to be the final value for the OMP_FOR statement GS. */ |
75a70cf9 | 5259 | |
5260 | static inline void | |
42acab1c | 5261 | gimple_omp_for_set_final (gimple *gs, size_t i, tree final) |
75a70cf9 | 5262 | { |
1a91d914 | 5263 | gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); |
de6bd75e | 5264 | gcc_gimple_checking_assert (i < omp_for_stmt->collapse); |
5265 | omp_for_stmt->iter[i].final = final; | |
75a70cf9 | 5266 | } |
5267 | ||
5268 | ||
ca4c3545 | 5269 | /* Return the increment value for the OMP_FOR statement GS. */ |
75a70cf9 | 5270 | |
5271 | static inline tree | |
42acab1c | 5272 | gimple_omp_for_incr (const gimple *gs, size_t i) |
75a70cf9 | 5273 | { |
1a91d914 | 5274 | const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs); |
de6bd75e | 5275 | gcc_gimple_checking_assert (i < omp_for_stmt->collapse); |
5276 | return omp_for_stmt->iter[i].incr; | |
75a70cf9 | 5277 | } |
5278 | ||
5279 | ||
ca4c3545 | 5280 | /* Return a pointer to the increment value for the OMP_FOR statement GS. */ |
75a70cf9 | 5281 | |
5282 | static inline tree * | |
42acab1c | 5283 | gimple_omp_for_incr_ptr (gimple *gs, size_t i) |
75a70cf9 | 5284 | { |
1a91d914 | 5285 | gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); |
de6bd75e | 5286 | gcc_gimple_checking_assert (i < omp_for_stmt->collapse); |
5287 | return &omp_for_stmt->iter[i].incr; | |
75a70cf9 | 5288 | } |
5289 | ||
5290 | ||
ca4c3545 | 5291 | /* Set INCR to be the increment value for the OMP_FOR statement GS. */ |
75a70cf9 | 5292 | |
5293 | static inline void | |
42acab1c | 5294 | gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr) |
75a70cf9 | 5295 | { |
1a91d914 | 5296 | gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); |
de6bd75e | 5297 | gcc_gimple_checking_assert (i < omp_for_stmt->collapse); |
5298 | omp_for_stmt->iter[i].incr = incr; | |
75a70cf9 | 5299 | } |
5300 | ||
5301 | ||
e3a19533 | 5302 | /* Return a pointer to the sequence of statements to execute before the OMP_FOR |
5303 | statement GS starts. */ | |
5304 | ||
5305 | static inline gimple_seq * | |
42acab1c | 5306 | gimple_omp_for_pre_body_ptr (gimple *gs) |
e3a19533 | 5307 | { |
1a91d914 | 5308 | gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); |
de6bd75e | 5309 | return &omp_for_stmt->pre_body; |
e3a19533 | 5310 | } |
5311 | ||
5312 | ||
75a70cf9 | 5313 | /* Return the sequence of statements to execute before the OMP_FOR |
5314 | statement GS starts. */ | |
5315 | ||
5316 | static inline gimple_seq | |
42acab1c | 5317 | gimple_omp_for_pre_body (gimple *gs) |
75a70cf9 | 5318 | { |
e3a19533 | 5319 | return *gimple_omp_for_pre_body_ptr (gs); |
75a70cf9 | 5320 | } |
5321 | ||
5322 | ||
5323 | /* Set PRE_BODY to be the sequence of statements to execute before the | |
5324 | OMP_FOR statement GS starts. */ | |
5325 | ||
5326 | static inline void | |
42acab1c | 5327 | gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body) |
75a70cf9 | 5328 | { |
1a91d914 | 5329 | gomp_for *omp_for_stmt = as_a <gomp_for *> (gs); |
de6bd75e | 5330 | omp_for_stmt->pre_body = pre_body; |
75a70cf9 | 5331 | } |
5332 | ||
56686608 | 5333 | /* Return the kernel_phony of OMP_FOR statement. */ |
5334 | ||
5335 | static inline bool | |
5336 | gimple_omp_for_grid_phony (const gomp_for *omp_for) | |
5337 | { | |
da80a82f | 5338 | gcc_checking_assert (gimple_omp_for_kind (omp_for) |
5339 | != GF_OMP_FOR_KIND_GRID_LOOP); | |
56686608 | 5340 | return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0; |
5341 | } | |
5342 | ||
5343 | /* Set kernel_phony flag of OMP_FOR to VALUE. */ | |
5344 | ||
5345 | static inline void | |
5346 | gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value) | |
5347 | { | |
da80a82f | 5348 | gcc_checking_assert (gimple_omp_for_kind (omp_for) |
5349 | != GF_OMP_FOR_KIND_GRID_LOOP); | |
56686608 | 5350 | if (value) |
5351 | omp_for->subcode |= GF_OMP_FOR_GRID_PHONY; | |
5352 | else | |
5353 | omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY; | |
5354 | } | |
75a70cf9 | 5355 | |
da80a82f | 5356 | /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */ |
5357 | ||
5358 | static inline bool | |
5359 | gimple_omp_for_grid_intra_group (const gomp_for *omp_for) | |
5360 | { | |
5361 | gcc_checking_assert (gimple_omp_for_kind (omp_for) | |
5362 | == GF_OMP_FOR_KIND_GRID_LOOP); | |
5363 | return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_INTRA_GROUP) != 0; | |
5364 | } | |
5365 | ||
5366 | /* Set kernel_intra_group flag of OMP_FOR to VALUE. */ | |
5367 | ||
5368 | static inline void | |
5369 | gimple_omp_for_set_grid_intra_group (gomp_for *omp_for, bool value) | |
5370 | { | |
5371 | gcc_checking_assert (gimple_omp_for_kind (omp_for) | |
5372 | == GF_OMP_FOR_KIND_GRID_LOOP); | |
5373 | if (value) | |
5374 | omp_for->subcode |= GF_OMP_FOR_GRID_INTRA_GROUP; | |
5375 | else | |
5376 | omp_for->subcode &= ~GF_OMP_FOR_GRID_INTRA_GROUP; | |
5377 | } | |
5378 | ||
5379 | /* Return true if iterations of a grid OMP_FOR statement correspond to HSA | |
5380 | groups. */ | |
5381 | ||
5382 | static inline bool | |
5383 | gimple_omp_for_grid_group_iter (const gomp_for *omp_for) | |
5384 | { | |
5385 | gcc_checking_assert (gimple_omp_for_kind (omp_for) | |
5386 | == GF_OMP_FOR_KIND_GRID_LOOP); | |
5387 | return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_GROUP_ITER) != 0; | |
5388 | } | |
5389 | ||
5390 | /* Set group_iter flag of OMP_FOR to VALUE. */ | |
5391 | ||
5392 | static inline void | |
5393 | gimple_omp_for_set_grid_group_iter (gomp_for *omp_for, bool value) | |
5394 | { | |
5395 | gcc_checking_assert (gimple_omp_for_kind (omp_for) | |
5396 | == GF_OMP_FOR_KIND_GRID_LOOP); | |
5397 | if (value) | |
5398 | omp_for->subcode |= GF_OMP_FOR_GRID_GROUP_ITER; | |
5399 | else | |
5400 | omp_for->subcode &= ~GF_OMP_FOR_GRID_GROUP_ITER; | |
5401 | } | |
5402 | ||
75a70cf9 | 5403 | /* Return the clauses associated with OMP_PARALLEL GS. */ |
5404 | ||
5405 | static inline tree | |
42acab1c | 5406 | gimple_omp_parallel_clauses (const gimple *gs) |
75a70cf9 | 5407 | { |
1a91d914 | 5408 | const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs); |
de6bd75e | 5409 | return omp_parallel_stmt->clauses; |
75a70cf9 | 5410 | } |
5411 | ||
5412 | ||
1a91d914 | 5413 | /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */ |
75a70cf9 | 5414 | |
5415 | static inline tree * | |
1a91d914 | 5416 | gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt) |
75a70cf9 | 5417 | { |
de6bd75e | 5418 | return &omp_parallel_stmt->clauses; |
75a70cf9 | 5419 | } |
5420 | ||
5421 | ||
1a91d914 | 5422 | /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */ |
75a70cf9 | 5423 | |
5424 | static inline void | |
1a91d914 | 5425 | gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt, |
5426 | tree clauses) | |
75a70cf9 | 5427 | { |
de6bd75e | 5428 | omp_parallel_stmt->clauses = clauses; |
75a70cf9 | 5429 | } |
5430 | ||
5431 | ||
1a91d914 | 5432 | /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */ |
75a70cf9 | 5433 | |
5434 | static inline tree | |
1a91d914 | 5435 | gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt) |
75a70cf9 | 5436 | { |
de6bd75e | 5437 | return omp_parallel_stmt->child_fn; |
75a70cf9 | 5438 | } |
5439 | ||
5440 | /* Return a pointer to the child function used to hold the body of | |
1a91d914 | 5441 | OMP_PARALLEL_STMT. */ |
75a70cf9 | 5442 | |
5443 | static inline tree * | |
1a91d914 | 5444 | gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt) |
75a70cf9 | 5445 | { |
de6bd75e | 5446 | return &omp_parallel_stmt->child_fn; |
75a70cf9 | 5447 | } |
5448 | ||
5449 | ||
1a91d914 | 5450 | /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */ |
75a70cf9 | 5451 | |
5452 | static inline void | |
1a91d914 | 5453 | gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt, |
5454 | tree child_fn) | |
75a70cf9 | 5455 | { |
de6bd75e | 5456 | omp_parallel_stmt->child_fn = child_fn; |
75a70cf9 | 5457 | } |
5458 | ||
5459 | ||
5460 | /* Return the artificial argument used to send variables and values | |
1a91d914 | 5461 | from the parent to the children threads in OMP_PARALLEL_STMT. */ |
75a70cf9 | 5462 | |
5463 | static inline tree | |
1a91d914 | 5464 | gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt) |
75a70cf9 | 5465 | { |
de6bd75e | 5466 | return omp_parallel_stmt->data_arg; |
75a70cf9 | 5467 | } |
5468 | ||
5469 | ||
1a91d914 | 5470 | /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */ |
75a70cf9 | 5471 | |
5472 | static inline tree * | |
1a91d914 | 5473 | gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt) |
75a70cf9 | 5474 | { |
de6bd75e | 5475 | return &omp_parallel_stmt->data_arg; |
75a70cf9 | 5476 | } |
5477 | ||
5478 | ||
1a91d914 | 5479 | /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */ |
75a70cf9 | 5480 | |
5481 | static inline void | |
1a91d914 | 5482 | gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt, |
5483 | tree data_arg) | |
75a70cf9 | 5484 | { |
de6bd75e | 5485 | omp_parallel_stmt->data_arg = data_arg; |
75a70cf9 | 5486 | } |
5487 | ||
56686608 | 5488 | /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */ |
5489 | ||
5490 | static inline bool | |
5491 | gimple_omp_parallel_grid_phony (const gomp_parallel *stmt) | |
5492 | { | |
5493 | return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0; | |
5494 | } | |
5495 | ||
5496 | /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */ | |
5497 | ||
5498 | static inline void | |
5499 | gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value) | |
5500 | { | |
5501 | if (value) | |
5502 | stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY; | |
5503 | else | |
5504 | stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY; | |
5505 | } | |
75a70cf9 | 5506 | |
5507 | /* Return the clauses associated with OMP_TASK GS. */ | |
5508 | ||
5509 | static inline tree | |
42acab1c | 5510 | gimple_omp_task_clauses (const gimple *gs) |
75a70cf9 | 5511 | { |
1a91d914 | 5512 | const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs); |
de6bd75e | 5513 | return omp_task_stmt->clauses; |
75a70cf9 | 5514 | } |
5515 | ||
5516 | ||
5517 | /* Return a pointer to the clauses associated with OMP_TASK GS. */ | |
5518 | ||
5519 | static inline tree * | |
42acab1c | 5520 | gimple_omp_task_clauses_ptr (gimple *gs) |
75a70cf9 | 5521 | { |
1a91d914 | 5522 | gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); |
de6bd75e | 5523 | return &omp_task_stmt->clauses; |
75a70cf9 | 5524 | } |
5525 | ||
5526 | ||
5527 | /* Set CLAUSES to be the list of clauses associated with OMP_TASK | |
5528 | GS. */ | |
5529 | ||
5530 | static inline void | |
42acab1c | 5531 | gimple_omp_task_set_clauses (gimple *gs, tree clauses) |
75a70cf9 | 5532 | { |
1a91d914 | 5533 | gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); |
de6bd75e | 5534 | omp_task_stmt->clauses = clauses; |
75a70cf9 | 5535 | } |
5536 | ||
5537 | ||
43895be5 | 5538 | /* Return true if OMP task statement G has the |
5539 | GF_OMP_TASK_TASKLOOP flag set. */ | |
5540 | ||
5541 | static inline bool | |
5542 | gimple_omp_task_taskloop_p (const gimple *g) | |
5543 | { | |
5544 | GIMPLE_CHECK (g, GIMPLE_OMP_TASK); | |
5545 | return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0; | |
5546 | } | |
5547 | ||
5548 | ||
5549 | /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean | |
5550 | value of TASKLOOP_P. */ | |
5551 | ||
5552 | static inline void | |
5553 | gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p) | |
5554 | { | |
5555 | GIMPLE_CHECK (g, GIMPLE_OMP_TASK); | |
5556 | if (taskloop_p) | |
5557 | g->subcode |= GF_OMP_TASK_TASKLOOP; | |
5558 | else | |
5559 | g->subcode &= ~GF_OMP_TASK_TASKLOOP; | |
5560 | } | |
5561 | ||
5562 | ||
7e5a76c8 | 5563 | /* Return true if OMP task statement G has the |
5564 | GF_OMP_TASK_TASKWAIT flag set. */ | |
5565 | ||
5566 | static inline bool | |
5567 | gimple_omp_task_taskwait_p (const gimple *g) | |
5568 | { | |
5569 | GIMPLE_CHECK (g, GIMPLE_OMP_TASK); | |
5570 | return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKWAIT) != 0; | |
5571 | } | |
5572 | ||
5573 | ||
5574 | /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean | |
5575 | value of TASKWAIT_P. */ | |
5576 | ||
5577 | static inline void | |
5578 | gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p) | |
5579 | { | |
5580 | GIMPLE_CHECK (g, GIMPLE_OMP_TASK); | |
5581 | if (taskwait_p) | |
5582 | g->subcode |= GF_OMP_TASK_TASKWAIT; | |
5583 | else | |
5584 | g->subcode &= ~GF_OMP_TASK_TASKWAIT; | |
5585 | } | |
5586 | ||
5587 | ||
75a70cf9 | 5588 | /* Return the child function used to hold the body of OMP_TASK GS. */ |
5589 | ||
5590 | static inline tree | |
42acab1c | 5591 | gimple_omp_task_child_fn (const gimple *gs) |
75a70cf9 | 5592 | { |
1a91d914 | 5593 | const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs); |
de6bd75e | 5594 | return omp_task_stmt->child_fn; |
75a70cf9 | 5595 | } |
5596 | ||
5597 | /* Return a pointer to the child function used to hold the body of | |
5598 | OMP_TASK GS. */ | |
5599 | ||
5600 | static inline tree * | |
42acab1c | 5601 | gimple_omp_task_child_fn_ptr (gimple *gs) |
75a70cf9 | 5602 | { |
1a91d914 | 5603 | gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); |
de6bd75e | 5604 | return &omp_task_stmt->child_fn; |
75a70cf9 | 5605 | } |
5606 | ||
5607 | ||
5608 | /* Set CHILD_FN to be the child function for OMP_TASK GS. */ | |
5609 | ||
5610 | static inline void | |
42acab1c | 5611 | gimple_omp_task_set_child_fn (gimple *gs, tree child_fn) |
75a70cf9 | 5612 | { |
1a91d914 | 5613 | gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); |
de6bd75e | 5614 | omp_task_stmt->child_fn = child_fn; |
75a70cf9 | 5615 | } |
5616 | ||
5617 | ||
5618 | /* Return the artificial argument used to send variables and values | |
5619 | from the parent to the children threads in OMP_TASK GS. */ | |
5620 | ||
5621 | static inline tree | |
42acab1c | 5622 | gimple_omp_task_data_arg (const gimple *gs) |
75a70cf9 | 5623 | { |
1a91d914 | 5624 | const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs); |
de6bd75e | 5625 | return omp_task_stmt->data_arg; |
75a70cf9 | 5626 | } |
5627 | ||
5628 | ||
5629 | /* Return a pointer to the data argument for OMP_TASK GS. */ | |
5630 | ||
5631 | static inline tree * | |
42acab1c | 5632 | gimple_omp_task_data_arg_ptr (gimple *gs) |
75a70cf9 | 5633 | { |
1a91d914 | 5634 | gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); |
de6bd75e | 5635 | return &omp_task_stmt->data_arg; |
75a70cf9 | 5636 | } |
5637 | ||
5638 | ||
5639 | /* Set DATA_ARG to be the data argument for OMP_TASK GS. */ | |
5640 | ||
5641 | static inline void | |
42acab1c | 5642 | gimple_omp_task_set_data_arg (gimple *gs, tree data_arg) |
75a70cf9 | 5643 | { |
1a91d914 | 5644 | gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); |
de6bd75e | 5645 | omp_task_stmt->data_arg = data_arg; |
75a70cf9 | 5646 | } |
5647 | ||
5648 | ||
5649 | /* Return the clauses associated with OMP_TASK GS. */ | |
5650 | ||
5651 | static inline tree | |
42acab1c | 5652 | gimple_omp_taskreg_clauses (const gimple *gs) |
75a70cf9 | 5653 | { |
1a91d914 | 5654 | const gimple_statement_omp_taskreg *omp_taskreg_stmt |
5655 | = as_a <const gimple_statement_omp_taskreg *> (gs); | |
a9035320 | 5656 | return omp_taskreg_stmt->clauses; |
75a70cf9 | 5657 | } |
5658 | ||
5659 | ||
5660 | /* Return a pointer to the clauses associated with OMP_TASK GS. */ | |
5661 | ||
5662 | static inline tree * | |
42acab1c | 5663 | gimple_omp_taskreg_clauses_ptr (gimple *gs) |
75a70cf9 | 5664 | { |
1a91d914 | 5665 | gimple_statement_omp_taskreg *omp_taskreg_stmt |
5666 | = as_a <gimple_statement_omp_taskreg *> (gs); | |
a9035320 | 5667 | return &omp_taskreg_stmt->clauses; |
75a70cf9 | 5668 | } |
5669 | ||
5670 | ||
5671 | /* Set CLAUSES to be the list of clauses associated with OMP_TASK | |
5672 | GS. */ | |
5673 | ||
5674 | static inline void | |
42acab1c | 5675 | gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses) |
75a70cf9 | 5676 | { |
1a91d914 | 5677 | gimple_statement_omp_taskreg *omp_taskreg_stmt |
5678 | = as_a <gimple_statement_omp_taskreg *> (gs); | |
a9035320 | 5679 | omp_taskreg_stmt->clauses = clauses; |
75a70cf9 | 5680 | } |
5681 | ||
5682 | ||
5683 | /* Return the child function used to hold the body of OMP_TASK GS. */ | |
5684 | ||
5685 | static inline tree | |
42acab1c | 5686 | gimple_omp_taskreg_child_fn (const gimple *gs) |
75a70cf9 | 5687 | { |
1a91d914 | 5688 | const gimple_statement_omp_taskreg *omp_taskreg_stmt |
5689 | = as_a <const gimple_statement_omp_taskreg *> (gs); | |
a9035320 | 5690 | return omp_taskreg_stmt->child_fn; |
75a70cf9 | 5691 | } |
5692 | ||
5693 | /* Return a pointer to the child function used to hold the body of | |
5694 | OMP_TASK GS. */ | |
5695 | ||
5696 | static inline tree * | |
42acab1c | 5697 | gimple_omp_taskreg_child_fn_ptr (gimple *gs) |
75a70cf9 | 5698 | { |
1a91d914 | 5699 | gimple_statement_omp_taskreg *omp_taskreg_stmt |
5700 | = as_a <gimple_statement_omp_taskreg *> (gs); | |
a9035320 | 5701 | return &omp_taskreg_stmt->child_fn; |
75a70cf9 | 5702 | } |
5703 | ||
5704 | ||
5705 | /* Set CHILD_FN to be the child function for OMP_TASK GS. */ | |
5706 | ||
5707 | static inline void | |
42acab1c | 5708 | gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn) |
75a70cf9 | 5709 | { |
1a91d914 | 5710 | gimple_statement_omp_taskreg *omp_taskreg_stmt |
5711 | = as_a <gimple_statement_omp_taskreg *> (gs); | |
a9035320 | 5712 | omp_taskreg_stmt->child_fn = child_fn; |
75a70cf9 | 5713 | } |
5714 | ||
5715 | ||
5716 | /* Return the artificial argument used to send variables and values | |
5717 | from the parent to the children threads in OMP_TASK GS. */ | |
5718 | ||
5719 | static inline tree | |
42acab1c | 5720 | gimple_omp_taskreg_data_arg (const gimple *gs) |
75a70cf9 | 5721 | { |
1a91d914 | 5722 | const gimple_statement_omp_taskreg *omp_taskreg_stmt |
5723 | = as_a <const gimple_statement_omp_taskreg *> (gs); | |
a9035320 | 5724 | return omp_taskreg_stmt->data_arg; |
75a70cf9 | 5725 | } |
5726 | ||
5727 | ||
5728 | /* Return a pointer to the data argument for OMP_TASK GS. */ | |
5729 | ||
5730 | static inline tree * | |
42acab1c | 5731 | gimple_omp_taskreg_data_arg_ptr (gimple *gs) |
75a70cf9 | 5732 | { |
1a91d914 | 5733 | gimple_statement_omp_taskreg *omp_taskreg_stmt |
5734 | = as_a <gimple_statement_omp_taskreg *> (gs); | |
a9035320 | 5735 | return &omp_taskreg_stmt->data_arg; |
75a70cf9 | 5736 | } |
5737 | ||
5738 | ||
5739 | /* Set DATA_ARG to be the data argument for OMP_TASK GS. */ | |
5740 | ||
5741 | static inline void | |
42acab1c | 5742 | gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg) |
75a70cf9 | 5743 | { |
1a91d914 | 5744 | gimple_statement_omp_taskreg *omp_taskreg_stmt |
5745 | = as_a <gimple_statement_omp_taskreg *> (gs); | |
a9035320 | 5746 | omp_taskreg_stmt->data_arg = data_arg; |
75a70cf9 | 5747 | } |
5748 | ||
5749 | ||
5750 | /* Return the copy function used to hold the body of OMP_TASK GS. */ | |
5751 | ||
5752 | static inline tree | |
42acab1c | 5753 | gimple_omp_task_copy_fn (const gimple *gs) |
75a70cf9 | 5754 | { |
1a91d914 | 5755 | const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs); |
de6bd75e | 5756 | return omp_task_stmt->copy_fn; |
75a70cf9 | 5757 | } |
5758 | ||
5759 | /* Return a pointer to the copy function used to hold the body of | |
5760 | OMP_TASK GS. */ | |
5761 | ||
5762 | static inline tree * | |
42acab1c | 5763 | gimple_omp_task_copy_fn_ptr (gimple *gs) |
75a70cf9 | 5764 | { |
1a91d914 | 5765 | gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); |
de6bd75e | 5766 | return &omp_task_stmt->copy_fn; |
75a70cf9 | 5767 | } |
5768 | ||
5769 | ||
5770 | /* Set CHILD_FN to be the copy function for OMP_TASK GS. */ | |
5771 | ||
5772 | static inline void | |
42acab1c | 5773 | gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn) |
75a70cf9 | 5774 | { |
1a91d914 | 5775 | gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); |
de6bd75e | 5776 | omp_task_stmt->copy_fn = copy_fn; |
75a70cf9 | 5777 | } |
5778 | ||
5779 | ||
5780 | /* Return size of the data block in bytes in OMP_TASK GS. */ | |
5781 | ||
5782 | static inline tree | |
42acab1c | 5783 | gimple_omp_task_arg_size (const gimple *gs) |
75a70cf9 | 5784 | { |
1a91d914 | 5785 | const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs); |
de6bd75e | 5786 | return omp_task_stmt->arg_size; |
75a70cf9 | 5787 | } |
5788 | ||
5789 | ||
5790 | /* Return a pointer to the data block size for OMP_TASK GS. */ | |
5791 | ||
5792 | static inline tree * | |
42acab1c | 5793 | gimple_omp_task_arg_size_ptr (gimple *gs) |
75a70cf9 | 5794 | { |
1a91d914 | 5795 | gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); |
de6bd75e | 5796 | return &omp_task_stmt->arg_size; |
75a70cf9 | 5797 | } |
5798 | ||
5799 | ||
5800 | /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */ | |
5801 | ||
5802 | static inline void | |
42acab1c | 5803 | gimple_omp_task_set_arg_size (gimple *gs, tree arg_size) |
75a70cf9 | 5804 | { |
1a91d914 | 5805 | gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); |
de6bd75e | 5806 | omp_task_stmt->arg_size = arg_size; |
75a70cf9 | 5807 | } |
5808 | ||
5809 | ||
5810 | /* Return align of the data block in bytes in OMP_TASK GS. */ | |
5811 | ||
5812 | static inline tree | |
42acab1c | 5813 | gimple_omp_task_arg_align (const gimple *gs) |
75a70cf9 | 5814 | { |
1a91d914 | 5815 | const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs); |
de6bd75e | 5816 | return omp_task_stmt->arg_align; |
75a70cf9 | 5817 | } |
5818 | ||
5819 | ||
5820 | /* Return a pointer to the data block align for OMP_TASK GS. */ | |
5821 | ||
5822 | static inline tree * | |
42acab1c | 5823 | gimple_omp_task_arg_align_ptr (gimple *gs) |
75a70cf9 | 5824 | { |
1a91d914 | 5825 | gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); |
de6bd75e | 5826 | return &omp_task_stmt->arg_align; |
75a70cf9 | 5827 | } |
5828 | ||
5829 | ||
5830 | /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */ | |
5831 | ||
5832 | static inline void | |
42acab1c | 5833 | gimple_omp_task_set_arg_align (gimple *gs, tree arg_align) |
75a70cf9 | 5834 | { |
1a91d914 | 5835 | gomp_task *omp_task_stmt = as_a <gomp_task *> (gs); |
de6bd75e | 5836 | omp_task_stmt->arg_align = arg_align; |
75a70cf9 | 5837 | } |
5838 | ||
5839 | ||
5840 | /* Return the clauses associated with OMP_SINGLE GS. */ | |
5841 | ||
5842 | static inline tree | |
42acab1c | 5843 | gimple_omp_single_clauses (const gimple *gs) |
75a70cf9 | 5844 | { |
1a91d914 | 5845 | const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs); |
de6bd75e | 5846 | return omp_single_stmt->clauses; |
75a70cf9 | 5847 | } |
5848 | ||
5849 | ||
5850 | /* Return a pointer to the clauses associated with OMP_SINGLE GS. */ | |
5851 | ||
5852 | static inline tree * | |
42acab1c | 5853 | gimple_omp_single_clauses_ptr (gimple *gs) |
75a70cf9 | 5854 | { |
1a91d914 | 5855 | gomp_single *omp_single_stmt = as_a <gomp_single *> (gs); |
de6bd75e | 5856 | return &omp_single_stmt->clauses; |
75a70cf9 | 5857 | } |
5858 | ||
5859 | ||
1a91d914 | 5860 | /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */ |
75a70cf9 | 5861 | |
5862 | static inline void | |
1a91d914 | 5863 | gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses) |
75a70cf9 | 5864 | { |
de6bd75e | 5865 | omp_single_stmt->clauses = clauses; |
75a70cf9 | 5866 | } |
5867 | ||
5868 | ||
bc7bff74 | 5869 | /* Return the clauses associated with OMP_TARGET GS. */ |
5870 | ||
5871 | static inline tree | |
42acab1c | 5872 | gimple_omp_target_clauses (const gimple *gs) |
bc7bff74 | 5873 | { |
1a91d914 | 5874 | const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs); |
a9035320 | 5875 | return omp_target_stmt->clauses; |
bc7bff74 | 5876 | } |
5877 | ||
5878 | ||
5879 | /* Return a pointer to the clauses associated with OMP_TARGET GS. */ | |
5880 | ||
5881 | static inline tree * | |
42acab1c | 5882 | gimple_omp_target_clauses_ptr (gimple *gs) |
bc7bff74 | 5883 | { |
1a91d914 | 5884 | gomp_target *omp_target_stmt = as_a <gomp_target *> (gs); |
a9035320 | 5885 | return &omp_target_stmt->clauses; |
bc7bff74 | 5886 | } |
5887 | ||
5888 | ||
1a91d914 | 5889 | /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */ |
bc7bff74 | 5890 | |
5891 | static inline void | |
1a91d914 | 5892 | gimple_omp_target_set_clauses (gomp_target *omp_target_stmt, |
5893 | tree clauses) | |
bc7bff74 | 5894 | { |
a9035320 | 5895 | omp_target_stmt->clauses = clauses; |
bc7bff74 | 5896 | } |
5897 | ||
5898 | ||
ca4c3545 | 5899 | /* Return the kind of the OMP_TARGET G. */ |
bc7bff74 | 5900 | |
5901 | static inline int | |
42acab1c | 5902 | gimple_omp_target_kind (const gimple *g) |
bc7bff74 | 5903 | { |
5904 | GIMPLE_CHECK (g, GIMPLE_OMP_TARGET); | |
5905 | return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK); | |
5906 | } | |
5907 | ||
5908 | ||
ca4c3545 | 5909 | /* Set the kind of the OMP_TARGET G. */ |
bc7bff74 | 5910 | |
5911 | static inline void | |
1a91d914 | 5912 | gimple_omp_target_set_kind (gomp_target *g, int kind) |
bc7bff74 | 5913 | { |
de6bd75e | 5914 | g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK) |
bc7bff74 | 5915 | | (kind & GF_OMP_TARGET_KIND_MASK); |
5916 | } | |
5917 | ||
5918 | ||
1a91d914 | 5919 | /* Return the child function used to hold the body of OMP_TARGET_STMT. */ |
bc7bff74 | 5920 | |
5921 | static inline tree | |
1a91d914 | 5922 | gimple_omp_target_child_fn (const gomp_target *omp_target_stmt) |
bc7bff74 | 5923 | { |
a9035320 | 5924 | return omp_target_stmt->child_fn; |
bc7bff74 | 5925 | } |
5926 | ||
5927 | /* Return a pointer to the child function used to hold the body of | |
1a91d914 | 5928 | OMP_TARGET_STMT. */ |
bc7bff74 | 5929 | |
5930 | static inline tree * | |
1a91d914 | 5931 | gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt) |
bc7bff74 | 5932 | { |
a9035320 | 5933 | return &omp_target_stmt->child_fn; |
bc7bff74 | 5934 | } |
5935 | ||
5936 | ||
1a91d914 | 5937 | /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */ |
bc7bff74 | 5938 | |
5939 | static inline void | |
1a91d914 | 5940 | gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt, |
5941 | tree child_fn) | |
bc7bff74 | 5942 | { |
a9035320 | 5943 | omp_target_stmt->child_fn = child_fn; |
bc7bff74 | 5944 | } |
5945 | ||
5946 | ||
5947 | /* Return the artificial argument used to send variables and values | |
1a91d914 | 5948 | from the parent to the children threads in OMP_TARGET_STMT. */ |
bc7bff74 | 5949 | |
5950 | static inline tree | |
1a91d914 | 5951 | gimple_omp_target_data_arg (const gomp_target *omp_target_stmt) |
bc7bff74 | 5952 | { |
a9035320 | 5953 | return omp_target_stmt->data_arg; |
bc7bff74 | 5954 | } |
5955 | ||
5956 | ||
5957 | /* Return a pointer to the data argument for OMP_TARGET GS. */ | |
5958 | ||
5959 | static inline tree * | |
1a91d914 | 5960 | gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt) |
bc7bff74 | 5961 | { |
a9035320 | 5962 | return &omp_target_stmt->data_arg; |
bc7bff74 | 5963 | } |
5964 | ||
5965 | ||
1a91d914 | 5966 | /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */ |
bc7bff74 | 5967 | |
5968 | static inline void | |
1a91d914 | 5969 | gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt, |
5970 | tree data_arg) | |
bc7bff74 | 5971 | { |
a9035320 | 5972 | omp_target_stmt->data_arg = data_arg; |
bc7bff74 | 5973 | } |
5974 | ||
5975 | ||
5976 | /* Return the clauses associated with OMP_TEAMS GS. */ | |
5977 | ||
5978 | static inline tree | |
42acab1c | 5979 | gimple_omp_teams_clauses (const gimple *gs) |
bc7bff74 | 5980 | { |
1a91d914 | 5981 | const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs); |
a9035320 | 5982 | return omp_teams_stmt->clauses; |
bc7bff74 | 5983 | } |
5984 | ||
5985 | ||
5986 | /* Return a pointer to the clauses associated with OMP_TEAMS GS. */ | |
5987 | ||
5988 | static inline tree * | |
42acab1c | 5989 | gimple_omp_teams_clauses_ptr (gimple *gs) |
bc7bff74 | 5990 | { |
1a91d914 | 5991 | gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs); |
a9035320 | 5992 | return &omp_teams_stmt->clauses; |
bc7bff74 | 5993 | } |
5994 | ||
5995 | ||
1a91d914 | 5996 | /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */ |
bc7bff74 | 5997 | |
5998 | static inline void | |
1a91d914 | 5999 | gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses) |
bc7bff74 | 6000 | { |
a9035320 | 6001 | omp_teams_stmt->clauses = clauses; |
bc7bff74 | 6002 | } |
6003 | ||
7e5a76c8 | 6004 | /* Return the child function used to hold the body of OMP_TEAMS_STMT. */ |
6005 | ||
6006 | static inline tree | |
6007 | gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt) | |
6008 | { | |
6009 | return omp_teams_stmt->child_fn; | |
6010 | } | |
6011 | ||
6012 | /* Return a pointer to the child function used to hold the body of | |
6013 | OMP_TEAMS_STMT. */ | |
6014 | ||
6015 | static inline tree * | |
6016 | gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt) | |
6017 | { | |
6018 | return &omp_teams_stmt->child_fn; | |
6019 | } | |
6020 | ||
6021 | ||
6022 | /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */ | |
6023 | ||
6024 | static inline void | |
6025 | gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn) | |
6026 | { | |
6027 | omp_teams_stmt->child_fn = child_fn; | |
6028 | } | |
6029 | ||
6030 | ||
6031 | /* Return the artificial argument used to send variables and values | |
6032 | from the parent to the children threads in OMP_TEAMS_STMT. */ | |
6033 | ||
6034 | static inline tree | |
6035 | gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt) | |
6036 | { | |
6037 | return omp_teams_stmt->data_arg; | |
6038 | } | |
6039 | ||
6040 | ||
6041 | /* Return a pointer to the data argument for OMP_TEAMS_STMT. */ | |
6042 | ||
6043 | static inline tree * | |
6044 | gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt) | |
6045 | { | |
6046 | return &omp_teams_stmt->data_arg; | |
6047 | } | |
6048 | ||
6049 | ||
6050 | /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */ | |
6051 | ||
6052 | static inline void | |
6053 | gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg) | |
6054 | { | |
6055 | omp_teams_stmt->data_arg = data_arg; | |
6056 | } | |
6057 | ||
56686608 | 6058 | /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */ |
6059 | ||
6060 | static inline bool | |
6061 | gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt) | |
6062 | { | |
6063 | return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0; | |
6064 | } | |
6065 | ||
6066 | /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */ | |
6067 | ||
6068 | static inline void | |
6069 | gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value) | |
6070 | { | |
6071 | if (value) | |
6072 | omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY; | |
6073 | else | |
6074 | omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY; | |
6075 | } | |
bc7bff74 | 6076 | |
7e5a76c8 | 6077 | /* Return the host flag of an OMP_TEAMS_STMT. */ |
6078 | ||
6079 | static inline bool | |
6080 | gimple_omp_teams_host (const gomp_teams *omp_teams_stmt) | |
6081 | { | |
6082 | return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0; | |
6083 | } | |
6084 | ||
6085 | /* Set host flag of an OMP_TEAMS_STMT to VALUE. */ | |
6086 | ||
6087 | static inline void | |
6088 | gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value) | |
6089 | { | |
6090 | if (value) | |
6091 | omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST; | |
6092 | else | |
6093 | omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST; | |
6094 | } | |
6095 | ||
75a70cf9 | 6096 | /* Return the clauses associated with OMP_SECTIONS GS. */ |
6097 | ||
6098 | static inline tree | |
42acab1c | 6099 | gimple_omp_sections_clauses (const gimple *gs) |
75a70cf9 | 6100 | { |
1a91d914 | 6101 | const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs); |
de6bd75e | 6102 | return omp_sections_stmt->clauses; |
75a70cf9 | 6103 | } |
6104 | ||
6105 | ||
6106 | /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */ | |
6107 | ||
6108 | static inline tree * | |
42acab1c | 6109 | gimple_omp_sections_clauses_ptr (gimple *gs) |
75a70cf9 | 6110 | { |
1a91d914 | 6111 | gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs); |
de6bd75e | 6112 | return &omp_sections_stmt->clauses; |
75a70cf9 | 6113 | } |
6114 | ||
6115 | ||
6116 | /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS | |
6117 | GS. */ | |
6118 | ||
6119 | static inline void | |
42acab1c | 6120 | gimple_omp_sections_set_clauses (gimple *gs, tree clauses) |
75a70cf9 | 6121 | { |
1a91d914 | 6122 | gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs); |
de6bd75e | 6123 | omp_sections_stmt->clauses = clauses; |
75a70cf9 | 6124 | } |
6125 | ||
6126 | ||
6127 | /* Return the control variable associated with the GIMPLE_OMP_SECTIONS | |
6128 | in GS. */ | |
6129 | ||
6130 | static inline tree | |
42acab1c | 6131 | gimple_omp_sections_control (const gimple *gs) |
75a70cf9 | 6132 | { |
1a91d914 | 6133 | const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs); |
de6bd75e | 6134 | return omp_sections_stmt->control; |
75a70cf9 | 6135 | } |
6136 | ||
6137 | ||
6138 | /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS | |
6139 | GS. */ | |
6140 | ||
6141 | static inline tree * | |
42acab1c | 6142 | gimple_omp_sections_control_ptr (gimple *gs) |
75a70cf9 | 6143 | { |
1a91d914 | 6144 | gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs); |
de6bd75e | 6145 | return &omp_sections_stmt->control; |
75a70cf9 | 6146 | } |
6147 | ||
6148 | ||
6149 | /* Set CONTROL to be the set of clauses associated with the | |
6150 | GIMPLE_OMP_SECTIONS in GS. */ | |
6151 | ||
6152 | static inline void | |
42acab1c | 6153 | gimple_omp_sections_set_control (gimple *gs, tree control) |
75a70cf9 | 6154 | { |
1a91d914 | 6155 | gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs); |
de6bd75e | 6156 | omp_sections_stmt->control = control; |
75a70cf9 | 6157 | } |
6158 | ||
6159 | ||
75a70cf9 | 6160 | /* Set the value being stored in an atomic store. */ |
6161 | ||
6162 | static inline void | |
1a91d914 | 6163 | gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val) |
75a70cf9 | 6164 | { |
1a91d914 | 6165 | store_stmt->val = val; |
75a70cf9 | 6166 | } |
6167 | ||
6168 | ||
6169 | /* Return the value being stored in an atomic store. */ | |
6170 | ||
6171 | static inline tree | |
1a91d914 | 6172 | gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt) |
75a70cf9 | 6173 | { |
1a91d914 | 6174 | return store_stmt->val; |
75a70cf9 | 6175 | } |
6176 | ||
6177 | ||
6178 | /* Return a pointer to the value being stored in an atomic store. */ | |
6179 | ||
6180 | static inline tree * | |
1a91d914 | 6181 | gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt) |
75a70cf9 | 6182 | { |
1a91d914 | 6183 | return &store_stmt->val; |
75a70cf9 | 6184 | } |
6185 | ||
6186 | ||
6187 | /* Set the LHS of an atomic load. */ | |
6188 | ||
6189 | static inline void | |
1a91d914 | 6190 | gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs) |
75a70cf9 | 6191 | { |
1a91d914 | 6192 | load_stmt->lhs = lhs; |
75a70cf9 | 6193 | } |
6194 | ||
6195 | ||
6196 | /* Get the LHS of an atomic load. */ | |
6197 | ||
6198 | static inline tree | |
1a91d914 | 6199 | gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt) |
75a70cf9 | 6200 | { |
1a91d914 | 6201 | return load_stmt->lhs; |
75a70cf9 | 6202 | } |
6203 | ||
6204 | ||
6205 | /* Return a pointer to the LHS of an atomic load. */ | |
6206 | ||
6207 | static inline tree * | |
1a91d914 | 6208 | gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt) |
75a70cf9 | 6209 | { |
1a91d914 | 6210 | return &load_stmt->lhs; |
75a70cf9 | 6211 | } |
6212 | ||
6213 | ||
6214 | /* Set the RHS of an atomic load. */ | |
6215 | ||
6216 | static inline void | |
1a91d914 | 6217 | gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs) |
75a70cf9 | 6218 | { |
1a91d914 | 6219 | load_stmt->rhs = rhs; |
75a70cf9 | 6220 | } |
6221 | ||
6222 | ||
6223 | /* Get the RHS of an atomic load. */ | |
6224 | ||
6225 | static inline tree | |
1a91d914 | 6226 | gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt) |
75a70cf9 | 6227 | { |
1a91d914 | 6228 | return load_stmt->rhs; |
75a70cf9 | 6229 | } |
6230 | ||
6231 | ||
6232 | /* Return a pointer to the RHS of an atomic load. */ | |
6233 | ||
6234 | static inline tree * | |
1a91d914 | 6235 | gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt) |
75a70cf9 | 6236 | { |
1a91d914 | 6237 | return &load_stmt->rhs; |
75a70cf9 | 6238 | } |
6239 | ||
6240 | ||
6241 | /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */ | |
6242 | ||
6243 | static inline tree | |
1a91d914 | 6244 | gimple_omp_continue_control_def (const gomp_continue *cont_stmt) |
75a70cf9 | 6245 | { |
1a91d914 | 6246 | return cont_stmt->control_def; |
75a70cf9 | 6247 | } |
6248 | ||
6249 | /* The same as above, but return the address. */ | |
6250 | ||
6251 | static inline tree * | |
1a91d914 | 6252 | gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt) |
75a70cf9 | 6253 | { |
1a91d914 | 6254 | return &cont_stmt->control_def; |
75a70cf9 | 6255 | } |
6256 | ||
6257 | /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */ | |
6258 | ||
6259 | static inline void | |
1a91d914 | 6260 | gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def) |
75a70cf9 | 6261 | { |
1a91d914 | 6262 | cont_stmt->control_def = def; |
75a70cf9 | 6263 | } |
6264 | ||
6265 | ||
6266 | /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */ | |
6267 | ||
6268 | static inline tree | |
1a91d914 | 6269 | gimple_omp_continue_control_use (const gomp_continue *cont_stmt) |
75a70cf9 | 6270 | { |
1a91d914 | 6271 | return cont_stmt->control_use; |
75a70cf9 | 6272 | } |
6273 | ||
6274 | ||
6275 | /* The same as above, but return the address. */ | |
6276 | ||
6277 | static inline tree * | |
1a91d914 | 6278 | gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt) |
75a70cf9 | 6279 | { |
1a91d914 | 6280 | return &cont_stmt->control_use; |
75a70cf9 | 6281 | } |
6282 | ||
6283 | ||
6284 | /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */ | |
6285 | ||
6286 | static inline void | |
1a91d914 | 6287 | gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use) |
75a70cf9 | 6288 | { |
1a91d914 | 6289 | cont_stmt->control_use = use; |
75a70cf9 | 6290 | } |
6291 | ||
1a91d914 | 6292 | /* Return a pointer to the body for the GIMPLE_TRANSACTION statement |
6293 | TRANSACTION_STMT. */ | |
e3a19533 | 6294 | |
6295 | static inline gimple_seq * | |
1a91d914 | 6296 | gimple_transaction_body_ptr (gtransaction *transaction_stmt) |
e3a19533 | 6297 | { |
de6bd75e | 6298 | return &transaction_stmt->body; |
e3a19533 | 6299 | } |
6300 | ||
1a91d914 | 6301 | /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */ |
4c0315d0 | 6302 | |
6303 | static inline gimple_seq | |
1a91d914 | 6304 | gimple_transaction_body (gtransaction *transaction_stmt) |
4c0315d0 | 6305 | { |
a08574d7 | 6306 | return transaction_stmt->body; |
4c0315d0 | 6307 | } |
6308 | ||
6309 | /* Return the label associated with a GIMPLE_TRANSACTION. */ | |
6310 | ||
6311 | static inline tree | |
a08574d7 | 6312 | gimple_transaction_label_norm (const gtransaction *transaction_stmt) |
4c0315d0 | 6313 | { |
a08574d7 | 6314 | return transaction_stmt->label_norm; |
4c0315d0 | 6315 | } |
6316 | ||
6317 | static inline tree * | |
a08574d7 | 6318 | gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt) |
4c0315d0 | 6319 | { |
a08574d7 | 6320 | return &transaction_stmt->label_norm; |
6321 | } | |
6322 | ||
6323 | static inline tree | |
6324 | gimple_transaction_label_uninst (const gtransaction *transaction_stmt) | |
6325 | { | |
6326 | return transaction_stmt->label_uninst; | |
6327 | } | |
6328 | ||
6329 | static inline tree * | |
6330 | gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt) | |
6331 | { | |
6332 | return &transaction_stmt->label_uninst; | |
6333 | } | |
6334 | ||
6335 | static inline tree | |
6336 | gimple_transaction_label_over (const gtransaction *transaction_stmt) | |
6337 | { | |
6338 | return transaction_stmt->label_over; | |
6339 | } | |
6340 | ||
6341 | static inline tree * | |
6342 | gimple_transaction_label_over_ptr (gtransaction *transaction_stmt) | |
6343 | { | |
6344 | return &transaction_stmt->label_over; | |
4c0315d0 | 6345 | } |
6346 | ||
6347 | /* Return the subcode associated with a GIMPLE_TRANSACTION. */ | |
6348 | ||
6349 | static inline unsigned int | |
1a91d914 | 6350 | gimple_transaction_subcode (const gtransaction *transaction_stmt) |
4c0315d0 | 6351 | { |
1a91d914 | 6352 | return transaction_stmt->subcode; |
4c0315d0 | 6353 | } |
6354 | ||
1a91d914 | 6355 | /* Set BODY to be the body for the GIMPLE_TRANSACTION statement |
6356 | TRANSACTION_STMT. */ | |
4c0315d0 | 6357 | |
6358 | static inline void | |
1a91d914 | 6359 | gimple_transaction_set_body (gtransaction *transaction_stmt, |
6360 | gimple_seq body) | |
4c0315d0 | 6361 | { |
de6bd75e | 6362 | transaction_stmt->body = body; |
4c0315d0 | 6363 | } |
6364 | ||
6365 | /* Set the label associated with a GIMPLE_TRANSACTION. */ | |
6366 | ||
6367 | static inline void | |
a08574d7 | 6368 | gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label) |
6369 | { | |
6370 | transaction_stmt->label_norm = label; | |
6371 | } | |
6372 | ||
6373 | static inline void | |
6374 | gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label) | |
6375 | { | |
6376 | transaction_stmt->label_uninst = label; | |
6377 | } | |
6378 | ||
6379 | static inline void | |
6380 | gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label) | |
4c0315d0 | 6381 | { |
a08574d7 | 6382 | transaction_stmt->label_over = label; |
4c0315d0 | 6383 | } |
6384 | ||
6385 | /* Set the subcode associated with a GIMPLE_TRANSACTION. */ | |
6386 | ||
6387 | static inline void | |
1a91d914 | 6388 | gimple_transaction_set_subcode (gtransaction *transaction_stmt, |
6389 | unsigned int subcode) | |
4c0315d0 | 6390 | { |
1a91d914 | 6391 | transaction_stmt->subcode = subcode; |
4c0315d0 | 6392 | } |
6393 | ||
75a70cf9 | 6394 | /* Return a pointer to the return value for GIMPLE_RETURN GS. */ |
6395 | ||
6396 | static inline tree * | |
ad023323 | 6397 | gimple_return_retval_ptr (greturn *gs) |
75a70cf9 | 6398 | { |
ad023323 | 6399 | return &gs->op[0]; |
75a70cf9 | 6400 | } |
6401 | ||
6402 | /* Return the return value for GIMPLE_RETURN GS. */ | |
6403 | ||
6404 | static inline tree | |
1a91d914 | 6405 | gimple_return_retval (const greturn *gs) |
75a70cf9 | 6406 | { |
78e011ba | 6407 | return gs->op[0]; |
75a70cf9 | 6408 | } |
6409 | ||
6410 | ||
6411 | /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */ | |
6412 | ||
6413 | static inline void | |
1a91d914 | 6414 | gimple_return_set_retval (greturn *gs, tree retval) |
75a70cf9 | 6415 | { |
78e011ba | 6416 | gs->op[0] = retval; |
75a70cf9 | 6417 | } |
6418 | ||
6419 | ||
ca4c3545 | 6420 | /* Returns true when the gimple statement STMT is any of the OMP types. */ |
75a70cf9 | 6421 | |
1a9a4436 | 6422 | #define CASE_GIMPLE_OMP \ |
6423 | case GIMPLE_OMP_PARALLEL: \ | |
6424 | case GIMPLE_OMP_TASK: \ | |
6425 | case GIMPLE_OMP_FOR: \ | |
6426 | case GIMPLE_OMP_SECTIONS: \ | |
6427 | case GIMPLE_OMP_SECTIONS_SWITCH: \ | |
6428 | case GIMPLE_OMP_SINGLE: \ | |
bc7bff74 | 6429 | case GIMPLE_OMP_TARGET: \ |
6430 | case GIMPLE_OMP_TEAMS: \ | |
1a9a4436 | 6431 | case GIMPLE_OMP_SECTION: \ |
6432 | case GIMPLE_OMP_MASTER: \ | |
bc7bff74 | 6433 | case GIMPLE_OMP_TASKGROUP: \ |
1a9a4436 | 6434 | case GIMPLE_OMP_ORDERED: \ |
6435 | case GIMPLE_OMP_CRITICAL: \ | |
70a6624c | 6436 | case GIMPLE_OMP_SCAN: \ |
1a9a4436 | 6437 | case GIMPLE_OMP_RETURN: \ |
6438 | case GIMPLE_OMP_ATOMIC_LOAD: \ | |
6439 | case GIMPLE_OMP_ATOMIC_STORE: \ | |
56686608 | 6440 | case GIMPLE_OMP_CONTINUE: \ |
6441 | case GIMPLE_OMP_GRID_BODY | |
1a9a4436 | 6442 | |
75a70cf9 | 6443 | static inline bool |
42acab1c | 6444 | is_gimple_omp (const gimple *stmt) |
75a70cf9 | 6445 | { |
1a9a4436 | 6446 | switch (gimple_code (stmt)) |
6447 | { | |
6448 | CASE_GIMPLE_OMP: | |
6449 | return true; | |
6450 | default: | |
6451 | return false; | |
6452 | } | |
75a70cf9 | 6453 | } |
6454 | ||
ca4c3545 | 6455 | /* Return true if the OMP gimple statement STMT is any of the OpenACC types |
6456 | specifically. */ | |
6457 | ||
6458 | static inline bool | |
42acab1c | 6459 | is_gimple_omp_oacc (const gimple *stmt) |
ca4c3545 | 6460 | { |
6461 | gcc_assert (is_gimple_omp (stmt)); | |
6462 | switch (gimple_code (stmt)) | |
6463 | { | |
6464 | case GIMPLE_OMP_FOR: | |
6465 | switch (gimple_omp_for_kind (stmt)) | |
6466 | { | |
6467 | case GF_OMP_FOR_KIND_OACC_LOOP: | |
6468 | return true; | |
6469 | default: | |
6470 | return false; | |
6471 | } | |
6472 | case GIMPLE_OMP_TARGET: | |
6473 | switch (gimple_omp_target_kind (stmt)) | |
6474 | { | |
6475 | case GF_OMP_TARGET_KIND_OACC_PARALLEL: | |
6476 | case GF_OMP_TARGET_KIND_OACC_KERNELS: | |
6477 | case GF_OMP_TARGET_KIND_OACC_DATA: | |
6478 | case GF_OMP_TARGET_KIND_OACC_UPDATE: | |
6479 | case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA: | |
2fc5e987 | 6480 | case GF_OMP_TARGET_KIND_OACC_DECLARE: |
571b3486 | 6481 | case GF_OMP_TARGET_KIND_OACC_HOST_DATA: |
ca4c3545 | 6482 | return true; |
6483 | default: | |
6484 | return false; | |
6485 | } | |
6486 | default: | |
6487 | return false; | |
6488 | } | |
6489 | } | |
6490 | ||
6491 | ||
6492 | /* Return true if the OMP gimple statement STMT is offloaded. */ | |
6493 | ||
6494 | static inline bool | |
42acab1c | 6495 | is_gimple_omp_offloaded (const gimple *stmt) |
ca4c3545 | 6496 | { |
6497 | gcc_assert (is_gimple_omp (stmt)); | |
6498 | switch (gimple_code (stmt)) | |
6499 | { | |
6500 | case GIMPLE_OMP_TARGET: | |
6501 | switch (gimple_omp_target_kind (stmt)) | |
6502 | { | |
6503 | case GF_OMP_TARGET_KIND_REGION: | |
6504 | case GF_OMP_TARGET_KIND_OACC_PARALLEL: | |
6505 | case GF_OMP_TARGET_KIND_OACC_KERNELS: | |
6506 | return true; | |
6507 | default: | |
6508 | return false; | |
6509 | } | |
6510 | default: | |
6511 | return false; | |
6512 | } | |
6513 | } | |
6514 | ||
75a70cf9 | 6515 | |
6516 | /* Returns TRUE if statement G is a GIMPLE_NOP. */ | |
6517 | ||
6518 | static inline bool | |
42acab1c | 6519 | gimple_nop_p (const gimple *g) |
75a70cf9 | 6520 | { |
6521 | return gimple_code (g) == GIMPLE_NOP; | |
6522 | } | |
6523 | ||
6524 | ||
e38def9c | 6525 | /* Return true if GS is a GIMPLE_RESX. */ |
6526 | ||
6527 | static inline bool | |
42acab1c | 6528 | is_gimple_resx (const gimple *gs) |
e38def9c | 6529 | { |
6530 | return gimple_code (gs) == GIMPLE_RESX; | |
6531 | } | |
6532 | ||
a1157bfe | 6533 | /* Return the type of the main expression computed by STMT. Return |
6534 | void_type_node if the statement computes nothing. */ | |
6535 | ||
6536 | static inline tree | |
42acab1c | 6537 | gimple_expr_type (const gimple *stmt) |
a1157bfe | 6538 | { |
6539 | enum gimple_code code = gimple_code (stmt); | |
bb882464 | 6540 | /* In general we want to pass out a type that can be substituted |
6541 | for both the RHS and the LHS types if there is a possibly | |
6542 | useless conversion involved. That means returning the | |
6543 | original RHS type as far as we can reconstruct it. */ | |
6544 | if (code == GIMPLE_CALL) | |
a1157bfe | 6545 | { |
bb882464 | 6546 | const gcall *call_stmt = as_a <const gcall *> (stmt); |
0bf8b382 | 6547 | if (gimple_call_internal_p (call_stmt)) |
6548 | switch (gimple_call_internal_fn (call_stmt)) | |
6549 | { | |
6550 | case IFN_MASK_STORE: | |
6551 | case IFN_SCATTER_STORE: | |
6552 | return TREE_TYPE (gimple_call_arg (call_stmt, 3)); | |
6553 | case IFN_MASK_SCATTER_STORE: | |
6554 | return TREE_TYPE (gimple_call_arg (call_stmt, 4)); | |
6555 | default: | |
6556 | break; | |
6557 | } | |
6558 | return gimple_call_return_type (call_stmt); | |
bb882464 | 6559 | } |
6560 | else if (code == GIMPLE_ASSIGN) | |
6561 | { | |
6562 | if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR) | |
6563 | return TREE_TYPE (gimple_assign_rhs1 (stmt)); | |
a1157bfe | 6564 | else |
bb882464 | 6565 | /* As fallback use the type of the LHS. */ |
6566 | return TREE_TYPE (gimple_get_lhs (stmt)); | |
a1157bfe | 6567 | } |
6568 | else if (code == GIMPLE_COND) | |
6569 | return boolean_type_node; | |
6570 | else | |
6571 | return void_type_node; | |
6572 | } | |
6573 | ||
75a70cf9 | 6574 | /* Enum and arrays used for allocation stats. Keep in sync with |
6575 | gimple.c:gimple_alloc_kind_names. */ | |
6576 | enum gimple_alloc_kind | |
6577 | { | |
6578 | gimple_alloc_kind_assign, /* Assignments. */ | |
6579 | gimple_alloc_kind_phi, /* PHI nodes. */ | |
6580 | gimple_alloc_kind_cond, /* Conditionals. */ | |
75a70cf9 | 6581 | gimple_alloc_kind_rest, /* Everything else. */ |
6582 | gimple_alloc_kind_all | |
6583 | }; | |
6584 | ||
4d51df15 | 6585 | extern uint64_t gimple_alloc_counts[]; |
6586 | extern uint64_t gimple_alloc_sizes[]; | |
75a70cf9 | 6587 | |
6588 | /* Return the allocation kind for a given stmt CODE. */ | |
6589 | static inline enum gimple_alloc_kind | |
6590 | gimple_alloc_kind (enum gimple_code code) | |
6591 | { | |
6592 | switch (code) | |
6593 | { | |
6594 | case GIMPLE_ASSIGN: | |
6595 | return gimple_alloc_kind_assign; | |
6596 | case GIMPLE_PHI: | |
6597 | return gimple_alloc_kind_phi; | |
6598 | case GIMPLE_COND: | |
6599 | return gimple_alloc_kind_cond; | |
6600 | default: | |
6601 | return gimple_alloc_kind_rest; | |
6602 | } | |
6603 | } | |
75a70cf9 | 6604 | |
a8783bee | 6605 | /* Return true if a location should not be emitted for this statement |
6606 | by annotate_all_with_location. */ | |
6607 | ||
6608 | static inline bool | |
42acab1c | 6609 | gimple_do_not_emit_location_p (gimple *g) |
a8783bee | 6610 | { |
6611 | return gimple_plf (g, GF_PLF_1); | |
6612 | } | |
6613 | ||
6614 | /* Mark statement G so a location will not be emitted by | |
6615 | annotate_one_with_location. */ | |
6616 | ||
6617 | static inline void | |
42acab1c | 6618 | gimple_set_do_not_emit_location (gimple *g) |
a8783bee | 6619 | { |
6620 | /* The PLF flags are initialized to 0 when a new tuple is created, | |
6621 | so no need to initialize it anywhere. */ | |
6622 | gimple_set_plf (g, GF_PLF_1, true); | |
6623 | } | |
6624 | ||
75a70cf9 | 6625 | #endif /* GCC_GIMPLE_H */ |