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