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