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