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