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