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