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