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