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