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