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