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