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