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