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