new tests
[official-gcc.git] / gcc / gimple.h
bloba5374a9620ce82588f0e3922a240ba1b6fe0e9c7
1 /* Gimple IR definitions.
3 Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "pointer-set.h"
26 #include "vec.h"
27 #include "vecprim.h"
28 #include "vecir.h"
29 #include "ggc.h"
30 #include "basic-block.h"
31 #include "tree-ssa-operands.h"
32 #include "tree-ssa-alias.h"
33 #include "internal-fn.h"
35 struct gimple_seq_node_d;
36 typedef struct gimple_seq_node_d *gimple_seq_node;
37 typedef const struct gimple_seq_node_d *const_gimple_seq_node;
39 /* For each block, the PHI nodes that need to be rewritten are stored into
40 these vectors. */
41 typedef VEC(gimple, heap) *gimple_vec;
42 DEF_VEC_P (gimple_vec);
43 DEF_VEC_ALLOC_P (gimple_vec, heap);
45 enum gimple_code {
46 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
47 #include "gimple.def"
48 #undef DEFGSCODE
49 LAST_AND_UNUSED_GIMPLE_CODE
52 extern const char *const gimple_code_name[];
53 extern const unsigned char gimple_rhs_class_table[];
55 /* Error out if a gimple tuple is addressed incorrectly. */
56 #if defined ENABLE_GIMPLE_CHECKING
57 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
58 extern void gimple_check_failed (const_gimple, const char *, int, \
59 const char *, enum gimple_code, \
60 enum tree_code) ATTRIBUTE_NORETURN;
62 #define GIMPLE_CHECK(GS, CODE) \
63 do { \
64 const_gimple __gs = (GS); \
65 if (gimple_code (__gs) != (CODE)) \
66 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
67 (CODE), ERROR_MARK); \
68 } while (0)
69 #else /* not ENABLE_GIMPLE_CHECKING */
70 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
71 #define GIMPLE_CHECK(GS, CODE) (void)0
72 #endif
74 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
75 get_gimple_rhs_class. */
76 enum gimple_rhs_class
78 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
79 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
80 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
81 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
82 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
83 name, a _DECL, a _REF, etc. */
86 /* Specific flags for individual GIMPLE statements. These flags are
87 always stored in gimple_statement_base.subcode and they may only be
88 defined for statement codes that do not use sub-codes.
90 Values for the masks can overlap as long as the overlapping values
91 are never used in the same statement class.
93 The maximum mask value that can be defined is 1 << 15 (i.e., each
94 statement code can hold up to 16 bitflags).
96 Keep this list sorted. */
97 enum gf_mask {
98 GF_ASM_INPUT = 1 << 0,
99 GF_ASM_VOLATILE = 1 << 1,
100 GF_CALL_CANNOT_INLINE = 1 << 0,
101 GF_CALL_FROM_THUNK = 1 << 1,
102 GF_CALL_RETURN_SLOT_OPT = 1 << 2,
103 GF_CALL_TAILCALL = 1 << 3,
104 GF_CALL_VA_ARG_PACK = 1 << 4,
105 GF_CALL_NOTHROW = 1 << 5,
106 GF_CALL_ALLOCA_FOR_VAR = 1 << 6,
107 GF_CALL_INTERNAL = 1 << 7,
108 GF_OMP_PARALLEL_COMBINED = 1 << 0,
110 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
111 a thread synchronization via some sort of barrier. The exact barrier
112 that would otherwise be emitted is dependent on the OMP statement with
113 which this return is associated. */
114 GF_OMP_RETURN_NOWAIT = 1 << 0,
116 GF_OMP_SECTION_LAST = 1 << 0,
117 GF_PREDICT_TAKEN = 1 << 15
120 /* Currently, there's only one type of gimple debug stmt. Others are
121 envisioned, for example, to enable the generation of is_stmt notes
122 in line number information, to mark sequence points, etc. This
123 subcode is to be used to tell them apart. */
124 enum gimple_debug_subcode {
125 GIMPLE_DEBUG_BIND = 0
128 /* Masks for selecting a pass local flag (PLF) to work on. These
129 masks are used by gimple_set_plf and gimple_plf. */
130 enum plf_mask {
131 GF_PLF_1 = 1 << 0,
132 GF_PLF_2 = 1 << 1
135 /* A node in a gimple_seq_d. */
136 struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) gimple_seq_node_d {
137 gimple stmt;
138 struct gimple_seq_node_d *prev;
139 struct gimple_seq_node_d *next;
142 /* A double-linked sequence of gimple statements. */
143 struct GTY ((chain_next ("%h.next_free"))) gimple_seq_d {
144 /* First and last statements in the sequence. */
145 gimple_seq_node first;
146 gimple_seq_node last;
148 /* Sequences are created/destroyed frequently. To minimize
149 allocation activity, deallocated sequences are kept in a pool of
150 available sequences. This is the pointer to the next free
151 sequence in the pool. */
152 gimple_seq next_free;
156 /* Return the first node in GIMPLE sequence S. */
158 static inline gimple_seq_node
159 gimple_seq_first (const_gimple_seq s)
161 return s ? s->first : NULL;
165 /* Return the first statement in GIMPLE sequence S. */
167 static inline gimple
168 gimple_seq_first_stmt (const_gimple_seq s)
170 gimple_seq_node n = gimple_seq_first (s);
171 return (n) ? n->stmt : NULL;
175 /* Return the last node in GIMPLE sequence S. */
177 static inline gimple_seq_node
178 gimple_seq_last (const_gimple_seq s)
180 return s ? s->last : NULL;
184 /* Return the last statement in GIMPLE sequence S. */
186 static inline gimple
187 gimple_seq_last_stmt (const_gimple_seq s)
189 gimple_seq_node n = gimple_seq_last (s);
190 return (n) ? n->stmt : NULL;
194 /* Set the last node in GIMPLE sequence S to LAST. */
196 static inline void
197 gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
199 s->last = last;
203 /* Set the first node in GIMPLE sequence S to FIRST. */
205 static inline void
206 gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
208 s->first = first;
212 /* Return true if GIMPLE sequence S is empty. */
214 static inline bool
215 gimple_seq_empty_p (const_gimple_seq s)
217 return s == NULL || s->first == NULL;
221 void gimple_seq_add_stmt (gimple_seq *, gimple);
223 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
224 *SEQ_P is NULL, a new sequence is allocated. This function is
225 similar to gimple_seq_add_stmt, but does not scan the operands.
226 During gimplification, we need to manipulate statement sequences
227 before the def/use vectors have been constructed. */
228 void gimplify_seq_add_stmt (gimple_seq *, gimple);
230 /* Allocate a new sequence and initialize its first element with STMT. */
232 static inline gimple_seq
233 gimple_seq_alloc_with_stmt (gimple stmt)
235 gimple_seq seq = NULL;
236 gimple_seq_add_stmt (&seq, stmt);
237 return seq;
241 /* Returns the sequence of statements in BB. */
243 static inline gimple_seq
244 bb_seq (const_basic_block bb)
246 return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
250 /* Sets the sequence of statements in BB to SEQ. */
252 static inline void
253 set_bb_seq (basic_block bb, gimple_seq seq)
255 gcc_checking_assert (!(bb->flags & BB_RTL));
256 bb->il.gimple->seq = seq;
259 /* Iterator object for GIMPLE statement sequences. */
261 typedef struct
263 /* Sequence node holding the current statement. */
264 gimple_seq_node ptr;
266 /* Sequence and basic block holding the statement. These fields
267 are necessary to handle edge cases such as when statement is
268 added to an empty basic block or when the last statement of a
269 block/sequence is removed. */
270 gimple_seq seq;
271 basic_block bb;
272 } gimple_stmt_iterator;
275 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
276 are for 64 bit hosts. */
278 struct GTY(()) gimple_statement_base {
279 /* [ WORD 1 ]
280 Main identifying code for a tuple. */
281 ENUM_BITFIELD(gimple_code) code : 8;
283 /* Nonzero if a warning should not be emitted on this tuple. */
284 unsigned int no_warning : 1;
286 /* Nonzero if this tuple has been visited. Passes are responsible
287 for clearing this bit before using it. */
288 unsigned int visited : 1;
290 /* Nonzero if this tuple represents a non-temporal move. */
291 unsigned int nontemporal_move : 1;
293 /* Pass local flags. These flags are free for any pass to use as
294 they see fit. Passes should not assume that these flags contain
295 any useful value when the pass starts. Any initial state that
296 the pass requires should be set on entry to the pass. See
297 gimple_set_plf and gimple_plf for usage. */
298 unsigned int plf : 2;
300 /* Nonzero if this statement has been modified and needs to have its
301 operands rescanned. */
302 unsigned modified : 1;
304 /* Nonzero if this statement contains volatile operands. */
305 unsigned has_volatile_ops : 1;
307 /* Padding to get subcode to 16 bit alignment. */
308 unsigned pad : 1;
310 /* The SUBCODE field can be used for tuple-specific flags for tuples
311 that do not require subcodes. Note that SUBCODE should be at
312 least as wide as tree codes, as several tuples store tree codes
313 in there. */
314 unsigned int subcode : 16;
316 /* UID of this statement. This is used by passes that want to
317 assign IDs to statements. It must be assigned and used by each
318 pass. By default it should be assumed to contain garbage. */
319 unsigned uid;
321 /* [ WORD 2 ]
322 Locus information for debug info. */
323 location_t location;
325 /* Number of operands in this tuple. */
326 unsigned num_ops;
328 /* [ WORD 3 ]
329 Basic block holding this statement. */
330 struct basic_block_def *bb;
332 /* [ WORD 4 ]
333 Lexical block holding this statement. */
334 tree block;
338 /* Base structure for tuples with operands. */
340 struct GTY(()) gimple_statement_with_ops_base
342 /* [ WORD 1-4 ] */
343 struct gimple_statement_base gsbase;
345 /* [ WORD 5-6 ]
346 SSA operand vectors. NOTE: It should be possible to
347 amalgamate these vectors with the operand vector OP. However,
348 the SSA operand vectors are organized differently and contain
349 more information (like immediate use chaining). */
350 struct def_optype_d GTY((skip (""))) *def_ops;
351 struct use_optype_d GTY((skip (""))) *use_ops;
355 /* Statements that take register operands. */
357 struct GTY(()) gimple_statement_with_ops
359 /* [ WORD 1-6 ] */
360 struct gimple_statement_with_ops_base opbase;
362 /* [ WORD 7 ]
363 Operand vector. NOTE! This must always be the last field
364 of this structure. In particular, this means that this
365 structure cannot be embedded inside another one. */
366 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
370 /* Base for statements that take both memory and register operands. */
372 struct GTY(()) gimple_statement_with_memory_ops_base
374 /* [ WORD 1-6 ] */
375 struct gimple_statement_with_ops_base opbase;
377 /* [ WORD 7-8 ]
378 Virtual operands for this statement. The GC will pick them
379 up via the ssa_names array. */
380 tree GTY((skip (""))) vdef;
381 tree GTY((skip (""))) vuse;
385 /* Statements that take both memory and register operands. */
387 struct GTY(()) gimple_statement_with_memory_ops
389 /* [ WORD 1-8 ] */
390 struct gimple_statement_with_memory_ops_base membase;
392 /* [ WORD 9 ]
393 Operand vector. NOTE! This must always be the last field
394 of this structure. In particular, this means that this
395 structure cannot be embedded inside another one. */
396 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
400 /* Call statements that take both memory and register operands. */
402 struct GTY(()) gimple_statement_call
404 /* [ WORD 1-8 ] */
405 struct gimple_statement_with_memory_ops_base membase;
407 /* [ WORD 9-12 ] */
408 struct pt_solution call_used;
409 struct pt_solution call_clobbered;
411 /* [ WORD 13 ] */
412 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
413 tree GTY ((tag ("0"))) fntype;
414 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
415 } u;
417 /* [ WORD 14 ]
418 Operand vector. NOTE! This must always be the last field
419 of this structure. In particular, this means that this
420 structure cannot be embedded inside another one. */
421 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
425 /* OpenMP statements (#pragma omp). */
427 struct GTY(()) gimple_statement_omp {
428 /* [ WORD 1-4 ] */
429 struct gimple_statement_base gsbase;
431 /* [ WORD 5 ] */
432 gimple_seq body;
436 /* GIMPLE_BIND */
438 struct GTY(()) gimple_statement_bind {
439 /* [ WORD 1-4 ] */
440 struct gimple_statement_base gsbase;
442 /* [ WORD 5 ]
443 Variables declared in this scope. */
444 tree vars;
446 /* [ WORD 6 ]
447 This is different than the BLOCK field in gimple_statement_base,
448 which is analogous to TREE_BLOCK (i.e., the lexical block holding
449 this statement). This field is the equivalent of BIND_EXPR_BLOCK
450 in tree land (i.e., the lexical scope defined by this bind). See
451 gimple-low.c. */
452 tree block;
454 /* [ WORD 7 ] */
455 gimple_seq body;
459 /* GIMPLE_CATCH */
461 struct GTY(()) gimple_statement_catch {
462 /* [ WORD 1-4 ] */
463 struct gimple_statement_base gsbase;
465 /* [ WORD 5 ] */
466 tree types;
468 /* [ WORD 6 ] */
469 gimple_seq handler;
473 /* GIMPLE_EH_FILTER */
475 struct GTY(()) gimple_statement_eh_filter {
476 /* [ WORD 1-4 ] */
477 struct gimple_statement_base gsbase;
479 /* [ WORD 5 ]
480 Filter types. */
481 tree types;
483 /* [ WORD 6 ]
484 Failure actions. */
485 gimple_seq failure;
489 /* GIMPLE_EH_MUST_NOT_THROW */
491 struct GTY(()) gimple_statement_eh_mnt {
492 /* [ WORD 1-4 ] */
493 struct gimple_statement_base gsbase;
495 /* [ WORD 5 ] Abort function decl. */
496 tree fndecl;
499 /* GIMPLE_PHI */
501 struct GTY(()) gimple_statement_phi {
502 /* [ WORD 1-4 ] */
503 struct gimple_statement_base gsbase;
505 /* [ WORD 5 ] */
506 unsigned capacity;
507 unsigned nargs;
509 /* [ WORD 6 ] */
510 tree result;
512 /* [ WORD 7 ] */
513 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
517 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
519 struct GTY(()) gimple_statement_eh_ctrl
521 /* [ WORD 1-4 ] */
522 struct gimple_statement_base gsbase;
524 /* [ WORD 5 ]
525 Exception region number. */
526 int region;
530 /* GIMPLE_TRY */
532 struct GTY(()) gimple_statement_try {
533 /* [ WORD 1-4 ] */
534 struct gimple_statement_base gsbase;
536 /* [ WORD 5 ]
537 Expression to evaluate. */
538 gimple_seq eval;
540 /* [ WORD 6 ]
541 Cleanup expression. */
542 gimple_seq cleanup;
545 /* Kind of GIMPLE_TRY statements. */
546 enum gimple_try_flags
548 /* A try/catch. */
549 GIMPLE_TRY_CATCH = 1 << 0,
551 /* A try/finally. */
552 GIMPLE_TRY_FINALLY = 1 << 1,
553 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
555 /* Analogous to TRY_CATCH_IS_CLEANUP. */
556 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
559 /* GIMPLE_WITH_CLEANUP_EXPR */
561 struct GTY(()) gimple_statement_wce {
562 /* [ WORD 1-4 ] */
563 struct gimple_statement_base gsbase;
565 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
566 executed if an exception is thrown, not on normal exit of its
567 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
568 in TARGET_EXPRs. */
570 /* [ WORD 5 ]
571 Cleanup expression. */
572 gimple_seq cleanup;
576 /* GIMPLE_ASM */
578 struct GTY(()) gimple_statement_asm
580 /* [ WORD 1-8 ] */
581 struct gimple_statement_with_memory_ops_base membase;
583 /* [ WORD 9 ]
584 __asm__ statement. */
585 const char *string;
587 /* [ WORD 10 ]
588 Number of inputs, outputs, clobbers, labels. */
589 unsigned char ni;
590 unsigned char no;
591 unsigned char nc;
592 unsigned char nl;
594 /* [ WORD 11 ]
595 Operand vector. NOTE! This must always be the last field
596 of this structure. In particular, this means that this
597 structure cannot be embedded inside another one. */
598 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
601 /* GIMPLE_OMP_CRITICAL */
603 struct GTY(()) gimple_statement_omp_critical {
604 /* [ WORD 1-5 ] */
605 struct gimple_statement_omp omp;
607 /* [ WORD 6 ]
608 Critical section name. */
609 tree name;
613 struct GTY(()) gimple_omp_for_iter {
614 /* Condition code. */
615 enum tree_code cond;
617 /* Index variable. */
618 tree index;
620 /* Initial value. */
621 tree initial;
623 /* Final value. */
624 tree final;
626 /* Increment. */
627 tree incr;
630 /* GIMPLE_OMP_FOR */
632 struct GTY(()) gimple_statement_omp_for {
633 /* [ WORD 1-5 ] */
634 struct gimple_statement_omp omp;
636 /* [ WORD 6 ] */
637 tree clauses;
639 /* [ WORD 7 ]
640 Number of elements in iter array. */
641 size_t collapse;
643 /* [ WORD 8 ] */
644 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
646 /* [ WORD 9 ]
647 Pre-body evaluated before the loop body begins. */
648 gimple_seq pre_body;
652 /* GIMPLE_OMP_PARALLEL */
654 struct GTY(()) gimple_statement_omp_parallel {
655 /* [ WORD 1-5 ] */
656 struct gimple_statement_omp omp;
658 /* [ WORD 6 ]
659 Clauses. */
660 tree clauses;
662 /* [ WORD 7 ]
663 Child function holding the body of the parallel region. */
664 tree child_fn;
666 /* [ WORD 8 ]
667 Shared data argument. */
668 tree data_arg;
672 /* GIMPLE_OMP_TASK */
674 struct GTY(()) gimple_statement_omp_task {
675 /* [ WORD 1-8 ] */
676 struct gimple_statement_omp_parallel par;
678 /* [ WORD 9 ]
679 Child function holding firstprivate initialization if needed. */
680 tree copy_fn;
682 /* [ WORD 10-11 ]
683 Size and alignment in bytes of the argument data block. */
684 tree arg_size;
685 tree arg_align;
689 /* GIMPLE_OMP_SECTION */
690 /* Uses struct gimple_statement_omp. */
693 /* GIMPLE_OMP_SECTIONS */
695 struct GTY(()) gimple_statement_omp_sections {
696 /* [ WORD 1-5 ] */
697 struct gimple_statement_omp omp;
699 /* [ WORD 6 ] */
700 tree clauses;
702 /* [ WORD 7 ]
703 The control variable used for deciding which of the sections to
704 execute. */
705 tree control;
708 /* GIMPLE_OMP_CONTINUE.
710 Note: This does not inherit from gimple_statement_omp, because we
711 do not need the body field. */
713 struct GTY(()) gimple_statement_omp_continue {
714 /* [ WORD 1-4 ] */
715 struct gimple_statement_base gsbase;
717 /* [ WORD 5 ] */
718 tree control_def;
720 /* [ WORD 6 ] */
721 tree control_use;
724 /* GIMPLE_OMP_SINGLE */
726 struct GTY(()) gimple_statement_omp_single {
727 /* [ WORD 1-5 ] */
728 struct gimple_statement_omp omp;
730 /* [ WORD 6 ] */
731 tree clauses;
735 /* GIMPLE_OMP_ATOMIC_LOAD.
736 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
737 contains a sequence, which we don't need here. */
739 struct GTY(()) gimple_statement_omp_atomic_load {
740 /* [ WORD 1-4 ] */
741 struct gimple_statement_base gsbase;
743 /* [ WORD 5-6 ] */
744 tree rhs, lhs;
747 /* GIMPLE_OMP_ATOMIC_STORE.
748 See note on GIMPLE_OMP_ATOMIC_LOAD. */
750 struct GTY(()) gimple_statement_omp_atomic_store {
751 /* [ WORD 1-4 ] */
752 struct gimple_statement_base gsbase;
754 /* [ WORD 5 ] */
755 tree val;
758 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
759 enum gimple_statement_structure_enum {
760 #include "gsstruct.def"
761 LAST_GSS_ENUM
763 #undef DEFGSSTRUCT
766 /* Define the overall contents of a gimple tuple. It may be any of the
767 structures declared above for various types of tuples. */
769 union GTY ((desc ("gimple_statement_structure (&%h)"), variable_size)) gimple_statement_d {
770 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
771 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
772 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
773 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
774 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
775 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
776 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
777 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
778 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
779 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
780 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
781 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
782 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
783 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
784 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
785 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
786 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
787 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
788 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
789 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
790 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
791 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
792 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
793 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
796 /* In gimple.c. */
798 /* Offset in bytes to the location of the operand vector.
799 Zero if there is no operand vector for this tuple structure. */
800 extern size_t const gimple_ops_offset_[];
802 /* Map GIMPLE codes to GSS codes. */
803 extern enum gimple_statement_structure_enum const gss_for_code_[];
805 /* This variable holds the currently expanded gimple statement for purposes
806 of comminucating the profile info to the builtin expanders. */
807 extern gimple currently_expanding_gimple_stmt;
809 gimple gimple_build_return (tree);
811 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
812 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
814 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
816 gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
817 tree, tree MEM_STAT_DECL);
818 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
819 gimple_build_assign_with_ops_stat (c, o1, o2, o3, NULL_TREE MEM_STAT_INFO)
820 #define gimple_build_assign_with_ops3(c,o1,o2,o3,o4) \
821 gimple_build_assign_with_ops_stat (c, o1, o2, o3, o4 MEM_STAT_INFO)
823 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
824 #define gimple_build_debug_bind(var,val,stmt) \
825 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
827 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
828 gimple gimple_build_call (tree, unsigned, ...);
829 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
830 gimple gimple_build_call_internal_vec (enum internal_fn, VEC(tree, heap) *);
831 gimple gimple_build_call_from_tree (tree);
832 gimple gimplify_assign (tree, tree, gimple_seq *);
833 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
834 gimple gimple_build_label (tree label);
835 gimple gimple_build_goto (tree dest);
836 gimple gimple_build_nop (void);
837 gimple gimple_build_bind (tree, gimple_seq, tree);
838 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
839 VEC(tree,gc) *, VEC(tree,gc) *);
840 gimple gimple_build_catch (tree, gimple_seq);
841 gimple gimple_build_eh_filter (tree, gimple_seq);
842 gimple gimple_build_eh_must_not_throw (tree);
843 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
844 gimple gimple_build_wce (gimple_seq);
845 gimple gimple_build_resx (int);
846 gimple gimple_build_eh_dispatch (int);
847 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
848 gimple gimple_build_switch (unsigned, tree, tree, ...);
849 gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
850 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
851 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
852 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
853 gimple gimple_build_omp_critical (gimple_seq, tree);
854 gimple gimple_build_omp_section (gimple_seq);
855 gimple gimple_build_omp_continue (tree, tree);
856 gimple gimple_build_omp_master (gimple_seq);
857 gimple gimple_build_omp_return (bool);
858 gimple gimple_build_omp_ordered (gimple_seq);
859 gimple gimple_build_omp_sections (gimple_seq, tree);
860 gimple gimple_build_omp_sections_switch (void);
861 gimple gimple_build_omp_single (gimple_seq, tree);
862 gimple gimple_build_cdt (tree, tree);
863 gimple gimple_build_omp_atomic_load (tree, tree);
864 gimple gimple_build_omp_atomic_store (tree);
865 gimple gimple_build_predict (enum br_predictor, enum prediction);
866 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
867 void sort_case_labels (VEC(tree,heap) *);
868 void gimple_set_body (tree, gimple_seq);
869 gimple_seq gimple_body (tree);
870 bool gimple_has_body_p (tree);
871 gimple_seq gimple_seq_alloc (void);
872 void gimple_seq_free (gimple_seq);
873 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
874 gimple_seq gimple_seq_copy (gimple_seq);
875 bool gimple_call_same_target_p (const_gimple, const_gimple);
876 int gimple_call_flags (const_gimple);
877 int gimple_call_return_flags (const_gimple);
878 int gimple_call_arg_flags (const_gimple, unsigned);
879 void gimple_call_reset_alias_info (gimple);
880 bool gimple_assign_copy_p (gimple);
881 bool gimple_assign_ssa_name_copy_p (gimple);
882 bool gimple_assign_unary_nop_p (gimple);
883 void gimple_set_bb (gimple, struct basic_block_def *);
884 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
885 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
886 tree, tree, tree);
887 tree gimple_get_lhs (const_gimple);
888 void gimple_set_lhs (gimple, tree);
889 void gimple_replace_lhs (gimple, tree);
890 gimple gimple_copy (gimple);
891 void gimple_set_modified (gimple, bool);
892 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
893 gimple gimple_build_cond_from_tree (tree, tree, tree);
894 void gimple_cond_set_condition_from_tree (gimple, tree);
895 bool gimple_has_side_effects (const_gimple);
896 bool gimple_rhs_has_side_effects (const_gimple);
897 bool gimple_could_trap_p (gimple);
898 bool gimple_could_trap_p_1 (gimple, bool, bool);
899 bool gimple_assign_rhs_could_trap_p (gimple);
900 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
901 bool empty_body_p (gimple_seq);
902 unsigned get_gimple_rhs_num_ops (enum tree_code);
903 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
904 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
905 const char *gimple_decl_printable_name (tree, int);
906 bool gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace);
907 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree, tree *, bool);
908 void gimple_adjust_this_by_delta (gimple_stmt_iterator *, tree);
909 tree gimple_extract_devirt_binfo_from_cst (tree);
910 /* Returns true iff T is a valid GIMPLE statement. */
911 extern bool is_gimple_stmt (tree);
913 /* Returns true iff TYPE is a valid type for a scalar register variable. */
914 extern bool is_gimple_reg_type (tree);
915 /* Returns true iff T is a scalar register variable. */
916 extern bool is_gimple_reg (tree);
917 /* Returns true iff T is any sort of variable. */
918 extern bool is_gimple_variable (tree);
919 /* Returns true iff T is any sort of symbol. */
920 extern bool is_gimple_id (tree);
921 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
922 extern bool is_gimple_min_lval (tree);
923 /* Returns true iff T is something whose address can be taken. */
924 extern bool is_gimple_addressable (tree);
925 /* Returns true iff T is any valid GIMPLE lvalue. */
926 extern bool is_gimple_lvalue (tree);
928 /* Returns true iff T is a GIMPLE address. */
929 bool is_gimple_address (const_tree);
930 /* Returns true iff T is a GIMPLE invariant address. */
931 bool is_gimple_invariant_address (const_tree);
932 /* Returns true iff T is a GIMPLE invariant address at interprocedural
933 level. */
934 bool is_gimple_ip_invariant_address (const_tree);
935 /* Returns true iff T is a valid GIMPLE constant. */
936 bool is_gimple_constant (const_tree);
937 /* Returns true iff T is a GIMPLE restricted function invariant. */
938 extern bool is_gimple_min_invariant (const_tree);
939 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
940 extern bool is_gimple_ip_invariant (const_tree);
941 /* Returns true iff T is a GIMPLE rvalue. */
942 extern bool is_gimple_val (tree);
943 /* Returns true iff T is a GIMPLE asm statement input. */
944 extern bool is_gimple_asm_val (tree);
945 /* Returns true iff T is a valid address operand of a MEM_REF. */
946 bool is_gimple_mem_ref_addr (tree);
947 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
948 GIMPLE temporary, a renamed user variable, or something else,
949 respectively. */
950 extern bool is_gimple_reg_rhs (tree);
951 extern bool is_gimple_mem_rhs (tree);
953 /* Returns true iff T is a valid if-statement condition. */
954 extern bool is_gimple_condexpr (tree);
956 /* Returns true iff T is a variable that does not need to live in memory. */
957 extern bool is_gimple_non_addressable (tree t);
959 /* Returns true iff T is a valid call address expression. */
960 extern bool is_gimple_call_addr (tree);
961 /* If T makes a function call, returns the CALL_EXPR operand. */
962 extern tree get_call_expr_in (tree t);
964 extern void recalculate_side_effects (tree);
965 extern bool gimple_compare_field_offset (tree, tree);
966 extern tree gimple_register_type (tree);
967 extern tree gimple_register_canonical_type (tree);
968 enum gtc_mode { GTC_MERGE = 0, GTC_DIAG = 1 };
969 extern bool gimple_types_compatible_p (tree, tree, enum gtc_mode);
970 extern void print_gimple_types_stats (void);
971 extern void free_gimple_type_tables (void);
972 extern tree gimple_unsigned_type (tree);
973 extern tree gimple_signed_type (tree);
974 extern alias_set_type gimple_get_alias_set (tree);
975 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
976 unsigned *);
977 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
978 bool (*)(gimple, tree, void *),
979 bool (*)(gimple, tree, void *),
980 bool (*)(gimple, tree, void *));
981 extern bool walk_stmt_load_store_ops (gimple, void *,
982 bool (*)(gimple, tree, void *),
983 bool (*)(gimple, tree, void *));
984 extern bool gimple_ior_addresses_taken (bitmap, gimple);
985 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
986 extern bool gimple_asm_clobbers_memory_p (const_gimple);
988 /* In gimplify.c */
989 extern tree create_tmp_var_raw (tree, const char *);
990 extern tree create_tmp_var_name (const char *);
991 extern tree create_tmp_var (tree, const char *);
992 extern tree create_tmp_reg (tree, const char *);
993 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
994 extern tree get_formal_tmp_var (tree, gimple_seq *);
995 extern void declare_vars (tree, gimple, bool);
996 extern void annotate_all_with_location (gimple_seq, location_t);
998 /* Validation of GIMPLE expressions. Note that these predicates only check
999 the basic form of the expression, they don't recurse to make sure that
1000 underlying nodes are also of the right form. */
1001 typedef bool (*gimple_predicate)(tree);
1004 /* FIXME we should deduce this from the predicate. */
1005 enum fallback {
1006 fb_none = 0, /* Do not generate a temporary. */
1008 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
1009 gimplified expression. */
1011 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
1012 gimplified expression. */
1014 fb_mayfail = 4, /* Gimplification may fail. Error issued
1015 afterwards. */
1016 fb_either= fb_rvalue | fb_lvalue
1019 typedef int fallback_t;
1021 enum gimplify_status {
1022 GS_ERROR = -2, /* Something Bad Seen. */
1023 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
1024 GS_OK = 0, /* We did something, maybe more to do. */
1025 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1028 struct gimplify_ctx
1030 struct gimplify_ctx *prev_context;
1032 VEC(gimple,heap) *bind_expr_stack;
1033 tree temps;
1034 gimple_seq conditional_cleanups;
1035 tree exit_label;
1036 tree return_temp;
1038 VEC(tree,heap) *case_labels;
1039 /* The formal temporary table. Should this be persistent? */
1040 htab_t temp_htab;
1042 int conditions;
1043 bool save_stack;
1044 bool into_ssa;
1045 bool allow_rhs_cond_expr;
1048 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1049 bool (*) (tree), fallback_t);
1050 extern void gimplify_type_sizes (tree, gimple_seq *);
1051 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1052 extern bool gimplify_stmt (tree *, gimple_seq *);
1053 extern gimple gimplify_body (tree *, tree, bool);
1054 extern void push_gimplify_context (struct gimplify_ctx *);
1055 extern void pop_gimplify_context (gimple);
1056 extern void gimplify_and_add (tree, gimple_seq *);
1058 /* Miscellaneous helpers. */
1059 extern void gimple_add_tmp_var (tree);
1060 extern gimple gimple_current_bind_expr (void);
1061 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1062 extern tree voidify_wrapper_expr (tree, tree);
1063 extern tree build_and_jump (tree *);
1064 extern tree force_labels_r (tree *, int *, void *);
1065 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1066 gimple_seq *);
1067 struct gimplify_omp_ctx;
1068 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1069 extern tree gimple_boolify (tree);
1070 extern gimple_predicate rhs_predicate_for (tree);
1071 extern tree canonicalize_cond_expr_cond (tree);
1073 /* In omp-low.c. */
1074 extern tree omp_reduction_init (tree, tree);
1076 /* In tree-nested.c. */
1077 extern void lower_nested_functions (tree);
1078 extern void insert_field_into_struct (tree, tree);
1080 /* In gimplify.c. */
1081 extern void gimplify_function_tree (tree);
1083 /* In cfgexpand.c. */
1084 extern tree gimple_assign_rhs_to_tree (gimple);
1086 /* In builtins.c */
1087 extern bool validate_gimple_arglist (const_gimple, ...);
1089 /* In tree-ssa.c */
1090 extern bool tree_ssa_useless_type_conversion (tree);
1091 extern tree tree_ssa_strip_useless_type_conversions (tree);
1092 extern bool useless_type_conversion_p (tree, tree);
1093 extern bool types_compatible_p (tree, tree);
1095 /* Return the code for GIMPLE statement G. */
1097 static inline enum gimple_code
1098 gimple_code (const_gimple g)
1100 return g->gsbase.code;
1104 /* Return the GSS code used by a GIMPLE code. */
1106 static inline enum gimple_statement_structure_enum
1107 gss_for_code (enum gimple_code code)
1109 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1110 return gss_for_code_[code];
1114 /* Return which GSS code is used by GS. */
1116 static inline enum gimple_statement_structure_enum
1117 gimple_statement_structure (gimple gs)
1119 return gss_for_code (gimple_code (gs));
1123 /* Return true if statement G has sub-statements. This is only true for
1124 High GIMPLE statements. */
1126 static inline bool
1127 gimple_has_substatements (gimple g)
1129 switch (gimple_code (g))
1131 case GIMPLE_BIND:
1132 case GIMPLE_CATCH:
1133 case GIMPLE_EH_FILTER:
1134 case GIMPLE_TRY:
1135 case GIMPLE_OMP_FOR:
1136 case GIMPLE_OMP_MASTER:
1137 case GIMPLE_OMP_ORDERED:
1138 case GIMPLE_OMP_SECTION:
1139 case GIMPLE_OMP_PARALLEL:
1140 case GIMPLE_OMP_TASK:
1141 case GIMPLE_OMP_SECTIONS:
1142 case GIMPLE_OMP_SINGLE:
1143 case GIMPLE_OMP_CRITICAL:
1144 case GIMPLE_WITH_CLEANUP_EXPR:
1145 return true;
1147 default:
1148 return false;
1153 /* Return the basic block holding statement G. */
1155 static inline struct basic_block_def *
1156 gimple_bb (const_gimple g)
1158 return g->gsbase.bb;
1162 /* Return the lexical scope block holding statement G. */
1164 static inline tree
1165 gimple_block (const_gimple g)
1167 return g->gsbase.block;
1171 /* Set BLOCK to be the lexical scope block holding statement G. */
1173 static inline void
1174 gimple_set_block (gimple g, tree block)
1176 g->gsbase.block = block;
1180 /* Return location information for statement G. */
1182 static inline location_t
1183 gimple_location (const_gimple g)
1185 return g->gsbase.location;
1188 /* Return pointer to location information for statement G. */
1190 static inline const location_t *
1191 gimple_location_ptr (const_gimple g)
1193 return &g->gsbase.location;
1197 /* Set location information for statement G. */
1199 static inline void
1200 gimple_set_location (gimple g, location_t location)
1202 g->gsbase.location = location;
1206 /* Return true if G contains location information. */
1208 static inline bool
1209 gimple_has_location (const_gimple g)
1211 return gimple_location (g) != UNKNOWN_LOCATION;
1215 /* Return the file name of the location of STMT. */
1217 static inline const char *
1218 gimple_filename (const_gimple stmt)
1220 return LOCATION_FILE (gimple_location (stmt));
1224 /* Return the line number of the location of STMT. */
1226 static inline int
1227 gimple_lineno (const_gimple stmt)
1229 return LOCATION_LINE (gimple_location (stmt));
1233 /* Determine whether SEQ is a singleton. */
1235 static inline bool
1236 gimple_seq_singleton_p (gimple_seq seq)
1238 return ((gimple_seq_first (seq) != NULL)
1239 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1242 /* Return true if no warnings should be emitted for statement STMT. */
1244 static inline bool
1245 gimple_no_warning_p (const_gimple stmt)
1247 return stmt->gsbase.no_warning;
1250 /* Set the no_warning flag of STMT to NO_WARNING. */
1252 static inline void
1253 gimple_set_no_warning (gimple stmt, bool no_warning)
1255 stmt->gsbase.no_warning = (unsigned) no_warning;
1258 /* Set the visited status on statement STMT to VISITED_P. */
1260 static inline void
1261 gimple_set_visited (gimple stmt, bool visited_p)
1263 stmt->gsbase.visited = (unsigned) visited_p;
1267 /* Return the visited status for statement STMT. */
1269 static inline bool
1270 gimple_visited_p (gimple stmt)
1272 return stmt->gsbase.visited;
1276 /* Set pass local flag PLF on statement STMT to VAL_P. */
1278 static inline void
1279 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1281 if (val_p)
1282 stmt->gsbase.plf |= (unsigned int) plf;
1283 else
1284 stmt->gsbase.plf &= ~((unsigned int) plf);
1288 /* Return the value of pass local flag PLF on statement STMT. */
1290 static inline unsigned int
1291 gimple_plf (gimple stmt, enum plf_mask plf)
1293 return stmt->gsbase.plf & ((unsigned int) plf);
1297 /* Set the UID of statement. */
1299 static inline void
1300 gimple_set_uid (gimple g, unsigned uid)
1302 g->gsbase.uid = uid;
1306 /* Return the UID of statement. */
1308 static inline unsigned
1309 gimple_uid (const_gimple g)
1311 return g->gsbase.uid;
1315 /* Return true if GIMPLE statement G has register or memory operands. */
1317 static inline bool
1318 gimple_has_ops (const_gimple g)
1320 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1324 /* Return true if GIMPLE statement G has memory operands. */
1326 static inline bool
1327 gimple_has_mem_ops (const_gimple g)
1329 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1333 /* Return the set of DEF operands for statement G. */
1335 static inline struct def_optype_d *
1336 gimple_def_ops (const_gimple g)
1338 if (!gimple_has_ops (g))
1339 return NULL;
1340 return g->gsops.opbase.def_ops;
1344 /* Set DEF to be the set of DEF operands for statement G. */
1346 static inline void
1347 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1349 gcc_gimple_checking_assert (gimple_has_ops (g));
1350 g->gsops.opbase.def_ops = def;
1354 /* Return the set of USE operands for statement G. */
1356 static inline struct use_optype_d *
1357 gimple_use_ops (const_gimple g)
1359 if (!gimple_has_ops (g))
1360 return NULL;
1361 return g->gsops.opbase.use_ops;
1365 /* Set USE to be the set of USE operands for statement G. */
1367 static inline void
1368 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1370 gcc_gimple_checking_assert (gimple_has_ops (g));
1371 g->gsops.opbase.use_ops = use;
1375 /* Return the set of VUSE operand for statement G. */
1377 static inline use_operand_p
1378 gimple_vuse_op (const_gimple g)
1380 struct use_optype_d *ops;
1381 if (!gimple_has_mem_ops (g))
1382 return NULL_USE_OPERAND_P;
1383 ops = g->gsops.opbase.use_ops;
1384 if (ops
1385 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1386 return USE_OP_PTR (ops);
1387 return NULL_USE_OPERAND_P;
1390 /* Return the set of VDEF operand for statement G. */
1392 static inline def_operand_p
1393 gimple_vdef_op (const_gimple g)
1395 struct def_optype_d *ops;
1396 if (!gimple_has_mem_ops (g))
1397 return NULL_DEF_OPERAND_P;
1398 ops = g->gsops.opbase.def_ops;
1399 if (ops
1400 && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1401 return DEF_OP_PTR (ops);
1402 return NULL_DEF_OPERAND_P;
1406 /* Return the single VUSE operand of the statement G. */
1408 static inline tree
1409 gimple_vuse (const_gimple g)
1411 if (!gimple_has_mem_ops (g))
1412 return NULL_TREE;
1413 return g->gsmembase.vuse;
1416 /* Return the single VDEF operand of the statement G. */
1418 static inline tree
1419 gimple_vdef (const_gimple g)
1421 if (!gimple_has_mem_ops (g))
1422 return NULL_TREE;
1423 return g->gsmembase.vdef;
1426 /* Return the single VUSE operand of the statement G. */
1428 static inline tree *
1429 gimple_vuse_ptr (gimple g)
1431 if (!gimple_has_mem_ops (g))
1432 return NULL;
1433 return &g->gsmembase.vuse;
1436 /* Return the single VDEF operand of the statement G. */
1438 static inline tree *
1439 gimple_vdef_ptr (gimple g)
1441 if (!gimple_has_mem_ops (g))
1442 return NULL;
1443 return &g->gsmembase.vdef;
1446 /* Set the single VUSE operand of the statement G. */
1448 static inline void
1449 gimple_set_vuse (gimple g, tree vuse)
1451 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1452 g->gsmembase.vuse = vuse;
1455 /* Set the single VDEF operand of the statement G. */
1457 static inline void
1458 gimple_set_vdef (gimple g, tree vdef)
1460 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1461 g->gsmembase.vdef = vdef;
1465 /* Return true if statement G has operands and the modified field has
1466 been set. */
1468 static inline bool
1469 gimple_modified_p (const_gimple g)
1471 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1475 /* Return the tree code for the expression computed by STMT. This is
1476 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1477 GIMPLE_CALL, return CALL_EXPR as the expression code for
1478 consistency. This is useful when the caller needs to deal with the
1479 three kinds of computation that GIMPLE supports. */
1481 static inline enum tree_code
1482 gimple_expr_code (const_gimple stmt)
1484 enum gimple_code code = gimple_code (stmt);
1485 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1486 return (enum tree_code) stmt->gsbase.subcode;
1487 else
1489 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1490 return CALL_EXPR;
1495 /* Mark statement S as modified, and update it. */
1497 static inline void
1498 update_stmt (gimple s)
1500 if (gimple_has_ops (s))
1502 gimple_set_modified (s, true);
1503 update_stmt_operands (s);
1507 /* Update statement S if it has been optimized. */
1509 static inline void
1510 update_stmt_if_modified (gimple s)
1512 if (gimple_modified_p (s))
1513 update_stmt_operands (s);
1516 /* Return true if statement STMT contains volatile operands. */
1518 static inline bool
1519 gimple_has_volatile_ops (const_gimple stmt)
1521 if (gimple_has_mem_ops (stmt))
1522 return stmt->gsbase.has_volatile_ops;
1523 else
1524 return false;
1528 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1530 static inline void
1531 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1533 if (gimple_has_mem_ops (stmt))
1534 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1538 /* Return true if statement STMT may access memory. */
1540 static inline bool
1541 gimple_references_memory_p (gimple stmt)
1543 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1547 /* Return the subcode for OMP statement S. */
1549 static inline unsigned
1550 gimple_omp_subcode (const_gimple s)
1552 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1553 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1554 return s->gsbase.subcode;
1557 /* Set the subcode for OMP statement S to SUBCODE. */
1559 static inline void
1560 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1562 /* We only have 16 bits for the subcode. Assert that we are not
1563 overflowing it. */
1564 gcc_gimple_checking_assert (subcode < (1 << 16));
1565 s->gsbase.subcode = subcode;
1568 /* Set the nowait flag on OMP_RETURN statement S. */
1570 static inline void
1571 gimple_omp_return_set_nowait (gimple s)
1573 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1574 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1578 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1579 flag set. */
1581 static inline bool
1582 gimple_omp_return_nowait_p (const_gimple g)
1584 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1585 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1589 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1590 flag set. */
1592 static inline bool
1593 gimple_omp_section_last_p (const_gimple g)
1595 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1596 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1600 /* Set the GF_OMP_SECTION_LAST flag on G. */
1602 static inline void
1603 gimple_omp_section_set_last (gimple g)
1605 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1606 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1610 /* Return true if OMP parallel statement G has the
1611 GF_OMP_PARALLEL_COMBINED flag set. */
1613 static inline bool
1614 gimple_omp_parallel_combined_p (const_gimple g)
1616 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1617 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1621 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1622 value of COMBINED_P. */
1624 static inline void
1625 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1627 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1628 if (combined_p)
1629 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1630 else
1631 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1635 /* Return the number of operands for statement GS. */
1637 static inline unsigned
1638 gimple_num_ops (const_gimple gs)
1640 return gs->gsbase.num_ops;
1644 /* Set the number of operands for statement GS. */
1646 static inline void
1647 gimple_set_num_ops (gimple gs, unsigned num_ops)
1649 gs->gsbase.num_ops = num_ops;
1653 /* Return the array of operands for statement GS. */
1655 static inline tree *
1656 gimple_ops (gimple gs)
1658 size_t off;
1660 /* All the tuples have their operand vector at the very bottom
1661 of the structure. Note that those structures that do not
1662 have an operand vector have a zero offset. */
1663 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1664 gcc_gimple_checking_assert (off != 0);
1666 return (tree *) ((char *) gs + off);
1670 /* Return operand I for statement GS. */
1672 static inline tree
1673 gimple_op (const_gimple gs, unsigned i)
1675 if (gimple_has_ops (gs))
1677 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1678 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1680 else
1681 return NULL_TREE;
1684 /* Return a pointer to operand I for statement GS. */
1686 static inline tree *
1687 gimple_op_ptr (const_gimple gs, unsigned i)
1689 if (gimple_has_ops (gs))
1691 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1692 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1694 else
1695 return NULL;
1698 /* Set operand I of statement GS to OP. */
1700 static inline void
1701 gimple_set_op (gimple gs, unsigned i, tree op)
1703 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1705 /* Note. It may be tempting to assert that OP matches
1706 is_gimple_operand, but that would be wrong. Different tuples
1707 accept slightly different sets of tree operands. Each caller
1708 should perform its own validation. */
1709 gimple_ops (gs)[i] = op;
1712 /* Return true if GS is a GIMPLE_ASSIGN. */
1714 static inline bool
1715 is_gimple_assign (const_gimple gs)
1717 return gimple_code (gs) == GIMPLE_ASSIGN;
1720 /* Determine if expression CODE is one of the valid expressions that can
1721 be used on the RHS of GIMPLE assignments. */
1723 static inline enum gimple_rhs_class
1724 get_gimple_rhs_class (enum tree_code code)
1726 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1729 /* Return the LHS of assignment statement GS. */
1731 static inline tree
1732 gimple_assign_lhs (const_gimple gs)
1734 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1735 return gimple_op (gs, 0);
1739 /* Return a pointer to the LHS of assignment statement GS. */
1741 static inline tree *
1742 gimple_assign_lhs_ptr (const_gimple gs)
1744 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1745 return gimple_op_ptr (gs, 0);
1749 /* Set LHS to be the LHS operand of assignment statement GS. */
1751 static inline void
1752 gimple_assign_set_lhs (gimple gs, tree lhs)
1754 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1755 gimple_set_op (gs, 0, lhs);
1757 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1758 SSA_NAME_DEF_STMT (lhs) = gs;
1762 /* Return the first operand on the RHS of assignment statement GS. */
1764 static inline tree
1765 gimple_assign_rhs1 (const_gimple gs)
1767 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1768 return gimple_op (gs, 1);
1772 /* Return a pointer to the first operand on the RHS of assignment
1773 statement GS. */
1775 static inline tree *
1776 gimple_assign_rhs1_ptr (const_gimple gs)
1778 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1779 return gimple_op_ptr (gs, 1);
1782 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1784 static inline void
1785 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1787 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1789 gimple_set_op (gs, 1, rhs);
1793 /* Return the second operand on the RHS of assignment statement GS.
1794 If GS does not have two operands, NULL is returned instead. */
1796 static inline tree
1797 gimple_assign_rhs2 (const_gimple gs)
1799 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1801 if (gimple_num_ops (gs) >= 3)
1802 return gimple_op (gs, 2);
1803 else
1804 return NULL_TREE;
1808 /* Return a pointer to the second operand on the RHS of assignment
1809 statement GS. */
1811 static inline tree *
1812 gimple_assign_rhs2_ptr (const_gimple gs)
1814 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1815 return gimple_op_ptr (gs, 2);
1819 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1821 static inline void
1822 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1824 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1826 gimple_set_op (gs, 2, rhs);
1829 /* Return the third operand on the RHS of assignment statement GS.
1830 If GS does not have two operands, NULL is returned instead. */
1832 static inline tree
1833 gimple_assign_rhs3 (const_gimple gs)
1835 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1837 if (gimple_num_ops (gs) >= 4)
1838 return gimple_op (gs, 3);
1839 else
1840 return NULL_TREE;
1843 /* Return a pointer to the third operand on the RHS of assignment
1844 statement GS. */
1846 static inline tree *
1847 gimple_assign_rhs3_ptr (const_gimple gs)
1849 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1850 return gimple_op_ptr (gs, 3);
1854 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1856 static inline void
1857 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1859 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1861 gimple_set_op (gs, 3, rhs);
1864 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1865 to see only a maximum of two operands. */
1867 static inline void
1868 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1869 tree op1, tree op2)
1871 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1874 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1875 to see only a maximum of two operands. */
1877 static inline void
1878 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1879 tree *op1)
1881 tree op2;
1882 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1883 gcc_assert (op2 == NULL_TREE);
1886 /* Returns true if GS is a nontemporal move. */
1888 static inline bool
1889 gimple_assign_nontemporal_move_p (const_gimple gs)
1891 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1892 return gs->gsbase.nontemporal_move;
1895 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1897 static inline void
1898 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1900 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1901 gs->gsbase.nontemporal_move = nontemporal;
1905 /* Return the code of the expression computed on the rhs of assignment
1906 statement GS. In case that the RHS is a single object, returns the
1907 tree code of the object. */
1909 static inline enum tree_code
1910 gimple_assign_rhs_code (const_gimple gs)
1912 enum tree_code code;
1913 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1915 code = (enum tree_code) gs->gsbase.subcode;
1916 /* While we initially set subcode to the TREE_CODE of the rhs for
1917 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
1918 in sync when we rewrite stmts into SSA form or do SSA propagations. */
1919 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1920 code = TREE_CODE (gimple_assign_rhs1 (gs));
1922 return code;
1926 /* Set CODE to be the code for the expression computed on the RHS of
1927 assignment S. */
1929 static inline void
1930 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
1932 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
1933 s->gsbase.subcode = code;
1937 /* Return the gimple rhs class of the code of the expression computed on
1938 the rhs of assignment statement GS.
1939 This will never return GIMPLE_INVALID_RHS. */
1941 static inline enum gimple_rhs_class
1942 gimple_assign_rhs_class (const_gimple gs)
1944 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
1947 /* Return true if GS is an assignment with a singleton RHS, i.e.,
1948 there is no operator associated with the assignment itself.
1949 Unlike gimple_assign_copy_p, this predicate returns true for
1950 any RHS operand, including those that perform an operation
1951 and do not have the semantics of a copy, such as COND_EXPR. */
1953 static inline bool
1954 gimple_assign_single_p (gimple gs)
1956 return (is_gimple_assign (gs)
1957 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
1961 /* Return true if S is a type-cast assignment. */
1963 static inline bool
1964 gimple_assign_cast_p (gimple s)
1966 if (is_gimple_assign (s))
1968 enum tree_code sc = gimple_assign_rhs_code (s);
1969 return CONVERT_EXPR_CODE_P (sc)
1970 || sc == VIEW_CONVERT_EXPR
1971 || sc == FIX_TRUNC_EXPR;
1974 return false;
1978 /* Return true if GS is a GIMPLE_CALL. */
1980 static inline bool
1981 is_gimple_call (const_gimple gs)
1983 return gimple_code (gs) == GIMPLE_CALL;
1986 /* Return the LHS of call statement GS. */
1988 static inline tree
1989 gimple_call_lhs (const_gimple gs)
1991 GIMPLE_CHECK (gs, GIMPLE_CALL);
1992 return gimple_op (gs, 0);
1996 /* Return a pointer to the LHS of call statement GS. */
1998 static inline tree *
1999 gimple_call_lhs_ptr (const_gimple gs)
2001 GIMPLE_CHECK (gs, GIMPLE_CALL);
2002 return gimple_op_ptr (gs, 0);
2006 /* Set LHS to be the LHS operand of call statement GS. */
2008 static inline void
2009 gimple_call_set_lhs (gimple gs, tree lhs)
2011 GIMPLE_CHECK (gs, GIMPLE_CALL);
2012 gimple_set_op (gs, 0, lhs);
2013 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2014 SSA_NAME_DEF_STMT (lhs) = gs;
2018 /* Return true if call GS calls an internal-only function, as enumerated
2019 by internal_fn. */
2021 static inline bool
2022 gimple_call_internal_p (const_gimple gs)
2024 GIMPLE_CHECK (gs, GIMPLE_CALL);
2025 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2029 /* Return the target of internal call GS. */
2031 static inline enum internal_fn
2032 gimple_call_internal_fn (const_gimple gs)
2034 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2035 return gs->gimple_call.u.internal_fn;
2039 /* Return the function type of the function called by GS. */
2041 static inline tree
2042 gimple_call_fntype (const_gimple gs)
2044 GIMPLE_CHECK (gs, GIMPLE_CALL);
2045 if (gimple_call_internal_p (gs))
2046 return NULL_TREE;
2047 return gs->gimple_call.u.fntype;
2050 /* Set the type of the function called by GS to FNTYPE. */
2052 static inline void
2053 gimple_call_set_fntype (gimple gs, tree fntype)
2055 GIMPLE_CHECK (gs, GIMPLE_CALL);
2056 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2057 gs->gimple_call.u.fntype = fntype;
2061 /* Return the tree node representing the function called by call
2062 statement GS. */
2064 static inline tree
2065 gimple_call_fn (const_gimple gs)
2067 GIMPLE_CHECK (gs, GIMPLE_CALL);
2068 return gimple_op (gs, 1);
2071 /* Return a pointer to the tree node representing the function called by call
2072 statement GS. */
2074 static inline tree *
2075 gimple_call_fn_ptr (const_gimple gs)
2077 GIMPLE_CHECK (gs, GIMPLE_CALL);
2078 return gimple_op_ptr (gs, 1);
2082 /* Set FN to be the function called by call statement GS. */
2084 static inline void
2085 gimple_call_set_fn (gimple gs, tree fn)
2087 GIMPLE_CHECK (gs, GIMPLE_CALL);
2088 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2089 gimple_set_op (gs, 1, fn);
2093 /* Set FNDECL to be the function called by call statement GS. */
2095 static inline void
2096 gimple_call_set_fndecl (gimple gs, tree decl)
2098 GIMPLE_CHECK (gs, GIMPLE_CALL);
2099 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2100 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2104 /* Set internal function FN to be the function called by call statement GS. */
2106 static inline void
2107 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2109 GIMPLE_CHECK (gs, GIMPLE_CALL);
2110 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2111 gs->gimple_call.u.internal_fn = fn;
2115 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2116 associated with the callee if known. Otherwise return NULL_TREE. */
2118 static inline tree
2119 gimple_call_addr_fndecl (const_tree fn)
2121 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2123 tree fndecl = TREE_OPERAND (fn, 0);
2124 if (TREE_CODE (fndecl) == MEM_REF
2125 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2126 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2127 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2128 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2129 return fndecl;
2131 return NULL_TREE;
2134 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2135 Otherwise return NULL. This function is analogous to
2136 get_callee_fndecl in tree land. */
2138 static inline tree
2139 gimple_call_fndecl (const_gimple gs)
2141 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2145 /* Return the type returned by call statement GS. */
2147 static inline tree
2148 gimple_call_return_type (const_gimple gs)
2150 tree type = gimple_call_fntype (gs);
2152 if (type == NULL_TREE)
2153 return TREE_TYPE (gimple_call_lhs (gs));
2155 /* The type returned by a function is the type of its
2156 function type. */
2157 return TREE_TYPE (type);
2161 /* Return the static chain for call statement GS. */
2163 static inline tree
2164 gimple_call_chain (const_gimple gs)
2166 GIMPLE_CHECK (gs, GIMPLE_CALL);
2167 return gimple_op (gs, 2);
2171 /* Return a pointer to the static chain for call statement GS. */
2173 static inline tree *
2174 gimple_call_chain_ptr (const_gimple gs)
2176 GIMPLE_CHECK (gs, GIMPLE_CALL);
2177 return gimple_op_ptr (gs, 2);
2180 /* Set CHAIN to be the static chain for call statement GS. */
2182 static inline void
2183 gimple_call_set_chain (gimple gs, tree chain)
2185 GIMPLE_CHECK (gs, GIMPLE_CALL);
2187 gimple_set_op (gs, 2, chain);
2191 /* Return the number of arguments used by call statement GS. */
2193 static inline unsigned
2194 gimple_call_num_args (const_gimple gs)
2196 unsigned num_ops;
2197 GIMPLE_CHECK (gs, GIMPLE_CALL);
2198 num_ops = gimple_num_ops (gs);
2199 return num_ops - 3;
2203 /* Return the argument at position INDEX for call statement GS. */
2205 static inline tree
2206 gimple_call_arg (const_gimple gs, unsigned index)
2208 GIMPLE_CHECK (gs, GIMPLE_CALL);
2209 return gimple_op (gs, index + 3);
2213 /* Return a pointer to the argument at position INDEX for call
2214 statement GS. */
2216 static inline tree *
2217 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2219 GIMPLE_CHECK (gs, GIMPLE_CALL);
2220 return gimple_op_ptr (gs, index + 3);
2224 /* Set ARG to be the argument at position INDEX for call statement GS. */
2226 static inline void
2227 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2229 GIMPLE_CHECK (gs, GIMPLE_CALL);
2230 gimple_set_op (gs, index + 3, arg);
2234 /* If TAIL_P is true, mark call statement S as being a tail call
2235 (i.e., a call just before the exit of a function). These calls are
2236 candidate for tail call optimization. */
2238 static inline void
2239 gimple_call_set_tail (gimple s, bool tail_p)
2241 GIMPLE_CHECK (s, GIMPLE_CALL);
2242 if (tail_p)
2243 s->gsbase.subcode |= GF_CALL_TAILCALL;
2244 else
2245 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2249 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2251 static inline bool
2252 gimple_call_tail_p (gimple s)
2254 GIMPLE_CHECK (s, GIMPLE_CALL);
2255 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2259 /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
2261 static inline void
2262 gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
2264 GIMPLE_CHECK (s, GIMPLE_CALL);
2265 if (inlinable_p)
2266 s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
2267 else
2268 s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
2272 /* Return true if GIMPLE_CALL S cannot be inlined. */
2274 static inline bool
2275 gimple_call_cannot_inline_p (gimple s)
2277 GIMPLE_CHECK (s, GIMPLE_CALL);
2278 return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0;
2282 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2283 slot optimization. This transformation uses the target of the call
2284 expansion as the return slot for calls that return in memory. */
2286 static inline void
2287 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2289 GIMPLE_CHECK (s, GIMPLE_CALL);
2290 if (return_slot_opt_p)
2291 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2292 else
2293 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2297 /* Return true if S is marked for return slot optimization. */
2299 static inline bool
2300 gimple_call_return_slot_opt_p (gimple s)
2302 GIMPLE_CHECK (s, GIMPLE_CALL);
2303 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2307 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2308 thunk to the thunked-to function. */
2310 static inline void
2311 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2313 GIMPLE_CHECK (s, GIMPLE_CALL);
2314 if (from_thunk_p)
2315 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2316 else
2317 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2321 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2323 static inline bool
2324 gimple_call_from_thunk_p (gimple s)
2326 GIMPLE_CHECK (s, GIMPLE_CALL);
2327 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2331 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2332 argument pack in its argument list. */
2334 static inline void
2335 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2337 GIMPLE_CHECK (s, GIMPLE_CALL);
2338 if (pass_arg_pack_p)
2339 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2340 else
2341 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2345 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2346 argument pack in its argument list. */
2348 static inline bool
2349 gimple_call_va_arg_pack_p (gimple s)
2351 GIMPLE_CHECK (s, GIMPLE_CALL);
2352 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2356 /* Return true if S is a noreturn call. */
2358 static inline bool
2359 gimple_call_noreturn_p (gimple s)
2361 GIMPLE_CHECK (s, GIMPLE_CALL);
2362 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2366 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2367 even if the called function can throw in other cases. */
2369 static inline void
2370 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2372 GIMPLE_CHECK (s, GIMPLE_CALL);
2373 if (nothrow_p)
2374 s->gsbase.subcode |= GF_CALL_NOTHROW;
2375 else
2376 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2379 /* Return true if S is a nothrow call. */
2381 static inline bool
2382 gimple_call_nothrow_p (gimple s)
2384 GIMPLE_CHECK (s, GIMPLE_CALL);
2385 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2388 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2389 is known to be emitted for VLA objects. Those are wrapped by
2390 stack_save/stack_restore calls and hence can't lead to unbounded
2391 stack growth even when they occur in loops. */
2393 static inline void
2394 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2396 GIMPLE_CHECK (s, GIMPLE_CALL);
2397 if (for_var)
2398 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2399 else
2400 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2403 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2405 static inline bool
2406 gimple_call_alloca_for_var_p (gimple s)
2408 GIMPLE_CHECK (s, GIMPLE_CALL);
2409 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2412 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2414 static inline void
2415 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2417 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2418 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2419 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2423 /* Return a pointer to the points-to solution for the set of call-used
2424 variables of the call CALL. */
2426 static inline struct pt_solution *
2427 gimple_call_use_set (gimple call)
2429 GIMPLE_CHECK (call, GIMPLE_CALL);
2430 return &call->gimple_call.call_used;
2434 /* Return a pointer to the points-to solution for the set of call-used
2435 variables of the call CALL. */
2437 static inline struct pt_solution *
2438 gimple_call_clobber_set (gimple call)
2440 GIMPLE_CHECK (call, GIMPLE_CALL);
2441 return &call->gimple_call.call_clobbered;
2445 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2446 non-NULL lhs. */
2448 static inline bool
2449 gimple_has_lhs (gimple stmt)
2451 return (is_gimple_assign (stmt)
2452 || (is_gimple_call (stmt)
2453 && gimple_call_lhs (stmt) != NULL_TREE));
2457 /* Return the code of the predicate computed by conditional statement GS. */
2459 static inline enum tree_code
2460 gimple_cond_code (const_gimple gs)
2462 GIMPLE_CHECK (gs, GIMPLE_COND);
2463 return (enum tree_code) gs->gsbase.subcode;
2467 /* Set CODE to be the predicate code for the conditional statement GS. */
2469 static inline void
2470 gimple_cond_set_code (gimple gs, enum tree_code code)
2472 GIMPLE_CHECK (gs, GIMPLE_COND);
2473 gs->gsbase.subcode = code;
2477 /* Return the LHS of the predicate computed by conditional statement GS. */
2479 static inline tree
2480 gimple_cond_lhs (const_gimple gs)
2482 GIMPLE_CHECK (gs, GIMPLE_COND);
2483 return gimple_op (gs, 0);
2486 /* Return the pointer to the LHS of the predicate computed by conditional
2487 statement GS. */
2489 static inline tree *
2490 gimple_cond_lhs_ptr (const_gimple gs)
2492 GIMPLE_CHECK (gs, GIMPLE_COND);
2493 return gimple_op_ptr (gs, 0);
2496 /* Set LHS to be the LHS operand of the predicate computed by
2497 conditional statement GS. */
2499 static inline void
2500 gimple_cond_set_lhs (gimple gs, tree lhs)
2502 GIMPLE_CHECK (gs, GIMPLE_COND);
2503 gimple_set_op (gs, 0, lhs);
2507 /* Return the RHS operand of the predicate computed by conditional GS. */
2509 static inline tree
2510 gimple_cond_rhs (const_gimple gs)
2512 GIMPLE_CHECK (gs, GIMPLE_COND);
2513 return gimple_op (gs, 1);
2516 /* Return the pointer to the RHS operand of the predicate computed by
2517 conditional GS. */
2519 static inline tree *
2520 gimple_cond_rhs_ptr (const_gimple gs)
2522 GIMPLE_CHECK (gs, GIMPLE_COND);
2523 return gimple_op_ptr (gs, 1);
2527 /* Set RHS to be the RHS operand of the predicate computed by
2528 conditional statement GS. */
2530 static inline void
2531 gimple_cond_set_rhs (gimple gs, tree rhs)
2533 GIMPLE_CHECK (gs, GIMPLE_COND);
2534 gimple_set_op (gs, 1, rhs);
2538 /* Return the label used by conditional statement GS when its
2539 predicate evaluates to true. */
2541 static inline tree
2542 gimple_cond_true_label (const_gimple gs)
2544 GIMPLE_CHECK (gs, GIMPLE_COND);
2545 return gimple_op (gs, 2);
2549 /* Set LABEL to be the label used by conditional statement GS when its
2550 predicate evaluates to true. */
2552 static inline void
2553 gimple_cond_set_true_label (gimple gs, tree label)
2555 GIMPLE_CHECK (gs, GIMPLE_COND);
2556 gimple_set_op (gs, 2, label);
2560 /* Set LABEL to be the label used by conditional statement GS when its
2561 predicate evaluates to false. */
2563 static inline void
2564 gimple_cond_set_false_label (gimple gs, tree label)
2566 GIMPLE_CHECK (gs, GIMPLE_COND);
2567 gimple_set_op (gs, 3, label);
2571 /* Return the label used by conditional statement GS when its
2572 predicate evaluates to false. */
2574 static inline tree
2575 gimple_cond_false_label (const_gimple gs)
2577 GIMPLE_CHECK (gs, GIMPLE_COND);
2578 return gimple_op (gs, 3);
2582 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2584 static inline void
2585 gimple_cond_make_false (gimple gs)
2587 gimple_cond_set_lhs (gs, boolean_true_node);
2588 gimple_cond_set_rhs (gs, boolean_false_node);
2589 gs->gsbase.subcode = EQ_EXPR;
2593 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2595 static inline void
2596 gimple_cond_make_true (gimple gs)
2598 gimple_cond_set_lhs (gs, boolean_true_node);
2599 gimple_cond_set_rhs (gs, boolean_true_node);
2600 gs->gsbase.subcode = EQ_EXPR;
2603 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2604 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2606 static inline bool
2607 gimple_cond_true_p (const_gimple gs)
2609 tree lhs = gimple_cond_lhs (gs);
2610 tree rhs = gimple_cond_rhs (gs);
2611 enum tree_code code = gimple_cond_code (gs);
2613 if (lhs != boolean_true_node && lhs != boolean_false_node)
2614 return false;
2616 if (rhs != boolean_true_node && rhs != boolean_false_node)
2617 return false;
2619 if (code == NE_EXPR && lhs != rhs)
2620 return true;
2622 if (code == EQ_EXPR && lhs == rhs)
2623 return true;
2625 return false;
2628 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2629 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2631 static inline bool
2632 gimple_cond_false_p (const_gimple gs)
2634 tree lhs = gimple_cond_lhs (gs);
2635 tree rhs = gimple_cond_rhs (gs);
2636 enum tree_code code = gimple_cond_code (gs);
2638 if (lhs != boolean_true_node && lhs != boolean_false_node)
2639 return false;
2641 if (rhs != boolean_true_node && rhs != boolean_false_node)
2642 return false;
2644 if (code == NE_EXPR && lhs == rhs)
2645 return true;
2647 if (code == EQ_EXPR && lhs != rhs)
2648 return true;
2650 return false;
2653 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2654 'if (var == 1)' */
2656 static inline bool
2657 gimple_cond_single_var_p (gimple gs)
2659 if (gimple_cond_code (gs) == NE_EXPR
2660 && gimple_cond_rhs (gs) == boolean_false_node)
2661 return true;
2663 if (gimple_cond_code (gs) == EQ_EXPR
2664 && gimple_cond_rhs (gs) == boolean_true_node)
2665 return true;
2667 return false;
2670 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2672 static inline void
2673 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2675 gimple_cond_set_code (stmt, code);
2676 gimple_cond_set_lhs (stmt, lhs);
2677 gimple_cond_set_rhs (stmt, rhs);
2680 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2682 static inline tree
2683 gimple_label_label (const_gimple gs)
2685 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2686 return gimple_op (gs, 0);
2690 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2691 GS. */
2693 static inline void
2694 gimple_label_set_label (gimple gs, tree label)
2696 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2697 gimple_set_op (gs, 0, label);
2701 /* Return the destination of the unconditional jump GS. */
2703 static inline tree
2704 gimple_goto_dest (const_gimple gs)
2706 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2707 return gimple_op (gs, 0);
2711 /* Set DEST to be the destination of the unconditonal jump GS. */
2713 static inline void
2714 gimple_goto_set_dest (gimple gs, tree dest)
2716 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2717 gimple_set_op (gs, 0, dest);
2721 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2723 static inline tree
2724 gimple_bind_vars (const_gimple gs)
2726 GIMPLE_CHECK (gs, GIMPLE_BIND);
2727 return gs->gimple_bind.vars;
2731 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2732 statement GS. */
2734 static inline void
2735 gimple_bind_set_vars (gimple gs, tree vars)
2737 GIMPLE_CHECK (gs, GIMPLE_BIND);
2738 gs->gimple_bind.vars = vars;
2742 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2743 statement GS. */
2745 static inline void
2746 gimple_bind_append_vars (gimple gs, tree vars)
2748 GIMPLE_CHECK (gs, GIMPLE_BIND);
2749 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2753 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2755 static inline gimple_seq
2756 gimple_bind_body (gimple gs)
2758 GIMPLE_CHECK (gs, GIMPLE_BIND);
2759 return gs->gimple_bind.body;
2763 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2764 statement GS. */
2766 static inline void
2767 gimple_bind_set_body (gimple gs, gimple_seq seq)
2769 GIMPLE_CHECK (gs, GIMPLE_BIND);
2770 gs->gimple_bind.body = seq;
2774 /* Append a statement to the end of a GIMPLE_BIND's body. */
2776 static inline void
2777 gimple_bind_add_stmt (gimple gs, gimple stmt)
2779 GIMPLE_CHECK (gs, GIMPLE_BIND);
2780 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2784 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2786 static inline void
2787 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2789 GIMPLE_CHECK (gs, GIMPLE_BIND);
2790 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2794 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2795 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2797 static inline tree
2798 gimple_bind_block (const_gimple gs)
2800 GIMPLE_CHECK (gs, GIMPLE_BIND);
2801 return gs->gimple_bind.block;
2805 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2806 statement GS. */
2808 static inline void
2809 gimple_bind_set_block (gimple gs, tree block)
2811 GIMPLE_CHECK (gs, GIMPLE_BIND);
2812 gcc_gimple_checking_assert (block == NULL_TREE
2813 || TREE_CODE (block) == BLOCK);
2814 gs->gimple_bind.block = block;
2818 /* Return the number of input operands for GIMPLE_ASM GS. */
2820 static inline unsigned
2821 gimple_asm_ninputs (const_gimple gs)
2823 GIMPLE_CHECK (gs, GIMPLE_ASM);
2824 return gs->gimple_asm.ni;
2828 /* Return the number of output operands for GIMPLE_ASM GS. */
2830 static inline unsigned
2831 gimple_asm_noutputs (const_gimple gs)
2833 GIMPLE_CHECK (gs, GIMPLE_ASM);
2834 return gs->gimple_asm.no;
2838 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2840 static inline unsigned
2841 gimple_asm_nclobbers (const_gimple gs)
2843 GIMPLE_CHECK (gs, GIMPLE_ASM);
2844 return gs->gimple_asm.nc;
2847 /* Return the number of label operands for GIMPLE_ASM GS. */
2849 static inline unsigned
2850 gimple_asm_nlabels (const_gimple gs)
2852 GIMPLE_CHECK (gs, GIMPLE_ASM);
2853 return gs->gimple_asm.nl;
2856 /* Return input operand INDEX of GIMPLE_ASM GS. */
2858 static inline tree
2859 gimple_asm_input_op (const_gimple gs, unsigned index)
2861 GIMPLE_CHECK (gs, GIMPLE_ASM);
2862 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2863 return gimple_op (gs, index);
2866 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2868 static inline tree *
2869 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2871 GIMPLE_CHECK (gs, GIMPLE_ASM);
2872 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2873 return gimple_op_ptr (gs, index);
2877 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2879 static inline void
2880 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2882 GIMPLE_CHECK (gs, GIMPLE_ASM);
2883 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
2884 && TREE_CODE (in_op) == TREE_LIST);
2885 gimple_set_op (gs, index, in_op);
2889 /* Return output operand INDEX of GIMPLE_ASM GS. */
2891 static inline tree
2892 gimple_asm_output_op (const_gimple gs, unsigned index)
2894 GIMPLE_CHECK (gs, GIMPLE_ASM);
2895 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2896 return gimple_op (gs, index + gs->gimple_asm.ni);
2899 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2901 static inline tree *
2902 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2904 GIMPLE_CHECK (gs, GIMPLE_ASM);
2905 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2906 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2910 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2912 static inline void
2913 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2915 GIMPLE_CHECK (gs, GIMPLE_ASM);
2916 gcc_gimple_checking_assert (index <= gs->gimple_asm.no
2917 && TREE_CODE (out_op) == TREE_LIST);
2918 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2922 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2924 static inline tree
2925 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2927 GIMPLE_CHECK (gs, GIMPLE_ASM);
2928 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
2929 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2933 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2935 static inline void
2936 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2938 GIMPLE_CHECK (gs, GIMPLE_ASM);
2939 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
2940 && TREE_CODE (clobber_op) == TREE_LIST);
2941 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2944 /* Return label operand INDEX of GIMPLE_ASM GS. */
2946 static inline tree
2947 gimple_asm_label_op (const_gimple gs, unsigned index)
2949 GIMPLE_CHECK (gs, GIMPLE_ASM);
2950 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
2951 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
2954 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
2956 static inline void
2957 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
2959 GIMPLE_CHECK (gs, GIMPLE_ASM);
2960 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
2961 && TREE_CODE (label_op) == TREE_LIST);
2962 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
2965 /* Return the string representing the assembly instruction in
2966 GIMPLE_ASM GS. */
2968 static inline const char *
2969 gimple_asm_string (const_gimple gs)
2971 GIMPLE_CHECK (gs, GIMPLE_ASM);
2972 return gs->gimple_asm.string;
2976 /* Return true if GS is an asm statement marked volatile. */
2978 static inline bool
2979 gimple_asm_volatile_p (const_gimple gs)
2981 GIMPLE_CHECK (gs, GIMPLE_ASM);
2982 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
2986 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
2988 static inline void
2989 gimple_asm_set_volatile (gimple gs, bool volatile_p)
2991 GIMPLE_CHECK (gs, GIMPLE_ASM);
2992 if (volatile_p)
2993 gs->gsbase.subcode |= GF_ASM_VOLATILE;
2994 else
2995 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
2999 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3001 static inline void
3002 gimple_asm_set_input (gimple gs, bool input_p)
3004 GIMPLE_CHECK (gs, GIMPLE_ASM);
3005 if (input_p)
3006 gs->gsbase.subcode |= GF_ASM_INPUT;
3007 else
3008 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3012 /* Return true if asm GS is an ASM_INPUT. */
3014 static inline bool
3015 gimple_asm_input_p (const_gimple gs)
3017 GIMPLE_CHECK (gs, GIMPLE_ASM);
3018 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3022 /* Return the types handled by GIMPLE_CATCH statement GS. */
3024 static inline tree
3025 gimple_catch_types (const_gimple gs)
3027 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3028 return gs->gimple_catch.types;
3032 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3034 static inline tree *
3035 gimple_catch_types_ptr (gimple gs)
3037 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3038 return &gs->gimple_catch.types;
3042 /* Return the GIMPLE sequence representing the body of the handler of
3043 GIMPLE_CATCH statement GS. */
3045 static inline gimple_seq
3046 gimple_catch_handler (gimple gs)
3048 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3049 return gs->gimple_catch.handler;
3053 /* Return a pointer to the GIMPLE sequence representing the body of
3054 the handler of GIMPLE_CATCH statement GS. */
3056 static inline gimple_seq *
3057 gimple_catch_handler_ptr (gimple gs)
3059 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3060 return &gs->gimple_catch.handler;
3064 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3066 static inline void
3067 gimple_catch_set_types (gimple gs, tree t)
3069 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3070 gs->gimple_catch.types = t;
3074 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3076 static inline void
3077 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3079 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3080 gs->gimple_catch.handler = handler;
3084 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3086 static inline tree
3087 gimple_eh_filter_types (const_gimple gs)
3089 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3090 return gs->gimple_eh_filter.types;
3094 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3095 GS. */
3097 static inline tree *
3098 gimple_eh_filter_types_ptr (gimple gs)
3100 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3101 return &gs->gimple_eh_filter.types;
3105 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3106 statement fails. */
3108 static inline gimple_seq
3109 gimple_eh_filter_failure (gimple gs)
3111 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3112 return gs->gimple_eh_filter.failure;
3116 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3118 static inline void
3119 gimple_eh_filter_set_types (gimple gs, tree types)
3121 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3122 gs->gimple_eh_filter.types = types;
3126 /* Set FAILURE to be the sequence of statements to execute on failure
3127 for GIMPLE_EH_FILTER GS. */
3129 static inline void
3130 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3132 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3133 gs->gimple_eh_filter.failure = failure;
3136 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3138 static inline tree
3139 gimple_eh_must_not_throw_fndecl (gimple gs)
3141 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3142 return gs->gimple_eh_mnt.fndecl;
3145 /* Set the function decl to be called by GS to DECL. */
3147 static inline void
3148 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3150 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3151 gs->gimple_eh_mnt.fndecl = decl;
3155 /* GIMPLE_TRY accessors. */
3157 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3158 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3160 static inline enum gimple_try_flags
3161 gimple_try_kind (const_gimple gs)
3163 GIMPLE_CHECK (gs, GIMPLE_TRY);
3164 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3168 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3170 static inline void
3171 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3173 GIMPLE_CHECK (gs, GIMPLE_TRY);
3174 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3175 || kind == GIMPLE_TRY_FINALLY);
3176 if (gimple_try_kind (gs) != kind)
3177 gs->gsbase.subcode = (unsigned int) kind;
3181 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3183 static inline bool
3184 gimple_try_catch_is_cleanup (const_gimple gs)
3186 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3187 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3191 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3193 static inline gimple_seq
3194 gimple_try_eval (gimple gs)
3196 GIMPLE_CHECK (gs, GIMPLE_TRY);
3197 return gs->gimple_try.eval;
3201 /* Return the sequence of statements used as the cleanup body for
3202 GIMPLE_TRY GS. */
3204 static inline gimple_seq
3205 gimple_try_cleanup (gimple gs)
3207 GIMPLE_CHECK (gs, GIMPLE_TRY);
3208 return gs->gimple_try.cleanup;
3212 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3214 static inline void
3215 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3217 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3218 if (catch_is_cleanup)
3219 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3220 else
3221 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3225 /* Set EVAL to be the sequence of statements to use as the body for
3226 GIMPLE_TRY GS. */
3228 static inline void
3229 gimple_try_set_eval (gimple gs, gimple_seq eval)
3231 GIMPLE_CHECK (gs, GIMPLE_TRY);
3232 gs->gimple_try.eval = eval;
3236 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3237 body for GIMPLE_TRY GS. */
3239 static inline void
3240 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3242 GIMPLE_CHECK (gs, GIMPLE_TRY);
3243 gs->gimple_try.cleanup = cleanup;
3247 /* Return the cleanup sequence for cleanup statement GS. */
3249 static inline gimple_seq
3250 gimple_wce_cleanup (gimple gs)
3252 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3253 return gs->gimple_wce.cleanup;
3257 /* Set CLEANUP to be the cleanup sequence for GS. */
3259 static inline void
3260 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3262 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3263 gs->gimple_wce.cleanup = cleanup;
3267 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3269 static inline bool
3270 gimple_wce_cleanup_eh_only (const_gimple gs)
3272 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3273 return gs->gsbase.subcode != 0;
3277 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3279 static inline void
3280 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3282 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3283 gs->gsbase.subcode = (unsigned int) eh_only_p;
3287 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3289 static inline unsigned
3290 gimple_phi_capacity (const_gimple gs)
3292 GIMPLE_CHECK (gs, GIMPLE_PHI);
3293 return gs->gimple_phi.capacity;
3297 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3298 be exactly the number of incoming edges for the basic block holding
3299 GS. */
3301 static inline unsigned
3302 gimple_phi_num_args (const_gimple gs)
3304 GIMPLE_CHECK (gs, GIMPLE_PHI);
3305 return gs->gimple_phi.nargs;
3309 /* Return the SSA name created by GIMPLE_PHI GS. */
3311 static inline tree
3312 gimple_phi_result (const_gimple gs)
3314 GIMPLE_CHECK (gs, GIMPLE_PHI);
3315 return gs->gimple_phi.result;
3318 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3320 static inline tree *
3321 gimple_phi_result_ptr (gimple gs)
3323 GIMPLE_CHECK (gs, GIMPLE_PHI);
3324 return &gs->gimple_phi.result;
3327 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3329 static inline void
3330 gimple_phi_set_result (gimple gs, tree result)
3332 GIMPLE_CHECK (gs, GIMPLE_PHI);
3333 gs->gimple_phi.result = result;
3337 /* Return the PHI argument corresponding to incoming edge INDEX for
3338 GIMPLE_PHI GS. */
3340 static inline struct phi_arg_d *
3341 gimple_phi_arg (gimple gs, unsigned index)
3343 GIMPLE_CHECK (gs, GIMPLE_PHI);
3344 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3345 return &(gs->gimple_phi.args[index]);
3348 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3349 for GIMPLE_PHI GS. */
3351 static inline void
3352 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3354 GIMPLE_CHECK (gs, GIMPLE_PHI);
3355 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3356 gs->gimple_phi.args[index] = *phiarg;
3359 /* Return the region number for GIMPLE_RESX GS. */
3361 static inline int
3362 gimple_resx_region (const_gimple gs)
3364 GIMPLE_CHECK (gs, GIMPLE_RESX);
3365 return gs->gimple_eh_ctrl.region;
3368 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3370 static inline void
3371 gimple_resx_set_region (gimple gs, int region)
3373 GIMPLE_CHECK (gs, GIMPLE_RESX);
3374 gs->gimple_eh_ctrl.region = region;
3377 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3379 static inline int
3380 gimple_eh_dispatch_region (const_gimple gs)
3382 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3383 return gs->gimple_eh_ctrl.region;
3386 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3388 static inline void
3389 gimple_eh_dispatch_set_region (gimple gs, int region)
3391 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3392 gs->gimple_eh_ctrl.region = region;
3395 /* Return the number of labels associated with the switch statement GS. */
3397 static inline unsigned
3398 gimple_switch_num_labels (const_gimple gs)
3400 unsigned num_ops;
3401 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3402 num_ops = gimple_num_ops (gs);
3403 gcc_gimple_checking_assert (num_ops > 1);
3404 return num_ops - 1;
3408 /* Set NLABELS to be the number of labels for the switch statement GS. */
3410 static inline void
3411 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3413 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3414 gimple_set_num_ops (g, nlabels + 1);
3418 /* Return the index variable used by the switch statement GS. */
3420 static inline tree
3421 gimple_switch_index (const_gimple gs)
3423 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3424 return gimple_op (gs, 0);
3428 /* Return a pointer to the index variable for the switch statement GS. */
3430 static inline tree *
3431 gimple_switch_index_ptr (const_gimple gs)
3433 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3434 return gimple_op_ptr (gs, 0);
3438 /* Set INDEX to be the index variable for switch statement GS. */
3440 static inline void
3441 gimple_switch_set_index (gimple gs, tree index)
3443 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3444 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3445 gimple_set_op (gs, 0, index);
3449 /* Return the label numbered INDEX. The default label is 0, followed by any
3450 labels in a switch statement. */
3452 static inline tree
3453 gimple_switch_label (const_gimple gs, unsigned index)
3455 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3456 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3457 return gimple_op (gs, index + 1);
3460 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3462 static inline void
3463 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3465 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3466 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3467 && (label == NULL_TREE
3468 || TREE_CODE (label) == CASE_LABEL_EXPR));
3469 gimple_set_op (gs, index + 1, label);
3472 /* Return the default label for a switch statement. */
3474 static inline tree
3475 gimple_switch_default_label (const_gimple gs)
3477 return gimple_switch_label (gs, 0);
3480 /* Set the default label for a switch statement. */
3482 static inline void
3483 gimple_switch_set_default_label (gimple gs, tree label)
3485 gimple_switch_set_label (gs, 0, label);
3488 /* Return true if GS is a GIMPLE_DEBUG statement. */
3490 static inline bool
3491 is_gimple_debug (const_gimple gs)
3493 return gimple_code (gs) == GIMPLE_DEBUG;
3496 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3498 static inline bool
3499 gimple_debug_bind_p (const_gimple s)
3501 if (is_gimple_debug (s))
3502 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3504 return false;
3507 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3509 static inline tree
3510 gimple_debug_bind_get_var (gimple dbg)
3512 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3513 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3514 return gimple_op (dbg, 0);
3517 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3518 statement. */
3520 static inline tree
3521 gimple_debug_bind_get_value (gimple dbg)
3523 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3524 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3525 return gimple_op (dbg, 1);
3528 /* Return a pointer to the value bound to the variable in a
3529 GIMPLE_DEBUG bind statement. */
3531 static inline tree *
3532 gimple_debug_bind_get_value_ptr (gimple dbg)
3534 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3535 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3536 return gimple_op_ptr (dbg, 1);
3539 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3541 static inline void
3542 gimple_debug_bind_set_var (gimple dbg, tree var)
3544 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3545 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3546 gimple_set_op (dbg, 0, var);
3549 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3550 statement. */
3552 static inline void
3553 gimple_debug_bind_set_value (gimple dbg, tree value)
3555 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3556 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3557 gimple_set_op (dbg, 1, value);
3560 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3561 optimized away. */
3562 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3564 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3565 statement. */
3567 static inline void
3568 gimple_debug_bind_reset_value (gimple dbg)
3570 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3571 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3572 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3575 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3576 value. */
3578 static inline bool
3579 gimple_debug_bind_has_value_p (gimple dbg)
3581 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3582 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3583 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3586 #undef GIMPLE_DEBUG_BIND_NOVALUE
3588 /* Return the body for the OMP statement GS. */
3590 static inline gimple_seq
3591 gimple_omp_body (gimple gs)
3593 return gs->omp.body;
3596 /* Set BODY to be the body for the OMP statement GS. */
3598 static inline void
3599 gimple_omp_set_body (gimple gs, gimple_seq body)
3601 gs->omp.body = body;
3605 /* Return the name associated with OMP_CRITICAL statement GS. */
3607 static inline tree
3608 gimple_omp_critical_name (const_gimple gs)
3610 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3611 return gs->gimple_omp_critical.name;
3615 /* Return a pointer to the name associated with OMP critical statement GS. */
3617 static inline tree *
3618 gimple_omp_critical_name_ptr (gimple gs)
3620 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3621 return &gs->gimple_omp_critical.name;
3625 /* Set NAME to be the name associated with OMP critical statement GS. */
3627 static inline void
3628 gimple_omp_critical_set_name (gimple gs, tree name)
3630 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3631 gs->gimple_omp_critical.name = name;
3635 /* Return the clauses associated with OMP_FOR GS. */
3637 static inline tree
3638 gimple_omp_for_clauses (const_gimple gs)
3640 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3641 return gs->gimple_omp_for.clauses;
3645 /* Return a pointer to the OMP_FOR GS. */
3647 static inline tree *
3648 gimple_omp_for_clauses_ptr (gimple gs)
3650 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3651 return &gs->gimple_omp_for.clauses;
3655 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3657 static inline void
3658 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3660 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3661 gs->gimple_omp_for.clauses = clauses;
3665 /* Get the collapse count of OMP_FOR GS. */
3667 static inline size_t
3668 gimple_omp_for_collapse (gimple gs)
3670 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3671 return gs->gimple_omp_for.collapse;
3675 /* Return the index variable for OMP_FOR GS. */
3677 static inline tree
3678 gimple_omp_for_index (const_gimple gs, size_t i)
3680 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3681 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3682 return gs->gimple_omp_for.iter[i].index;
3686 /* Return a pointer to the index variable for OMP_FOR GS. */
3688 static inline tree *
3689 gimple_omp_for_index_ptr (gimple gs, size_t i)
3691 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3692 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3693 return &gs->gimple_omp_for.iter[i].index;
3697 /* Set INDEX to be the index variable for OMP_FOR GS. */
3699 static inline void
3700 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3702 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3703 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3704 gs->gimple_omp_for.iter[i].index = index;
3708 /* Return the initial value for OMP_FOR GS. */
3710 static inline tree
3711 gimple_omp_for_initial (const_gimple gs, size_t i)
3713 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3714 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3715 return gs->gimple_omp_for.iter[i].initial;
3719 /* Return a pointer to the initial value for OMP_FOR GS. */
3721 static inline tree *
3722 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3724 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3725 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3726 return &gs->gimple_omp_for.iter[i].initial;
3730 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3732 static inline void
3733 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3735 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3736 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3737 gs->gimple_omp_for.iter[i].initial = initial;
3741 /* Return the final value for OMP_FOR GS. */
3743 static inline tree
3744 gimple_omp_for_final (const_gimple gs, size_t i)
3746 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3747 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3748 return gs->gimple_omp_for.iter[i].final;
3752 /* Return a pointer to the final value for OMP_FOR GS. */
3754 static inline tree *
3755 gimple_omp_for_final_ptr (gimple gs, size_t i)
3757 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3758 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3759 return &gs->gimple_omp_for.iter[i].final;
3763 /* Set FINAL to be the final value for OMP_FOR GS. */
3765 static inline void
3766 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3768 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3769 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3770 gs->gimple_omp_for.iter[i].final = final;
3774 /* Return the increment value for OMP_FOR GS. */
3776 static inline tree
3777 gimple_omp_for_incr (const_gimple gs, size_t i)
3779 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3780 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3781 return gs->gimple_omp_for.iter[i].incr;
3785 /* Return a pointer to the increment value for OMP_FOR GS. */
3787 static inline tree *
3788 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3790 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3791 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3792 return &gs->gimple_omp_for.iter[i].incr;
3796 /* Set INCR to be the increment value for OMP_FOR GS. */
3798 static inline void
3799 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3801 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3802 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3803 gs->gimple_omp_for.iter[i].incr = incr;
3807 /* Return the sequence of statements to execute before the OMP_FOR
3808 statement GS starts. */
3810 static inline gimple_seq
3811 gimple_omp_for_pre_body (gimple gs)
3813 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3814 return gs->gimple_omp_for.pre_body;
3818 /* Set PRE_BODY to be the sequence of statements to execute before the
3819 OMP_FOR statement GS starts. */
3821 static inline void
3822 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3824 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3825 gs->gimple_omp_for.pre_body = pre_body;
3829 /* Return the clauses associated with OMP_PARALLEL GS. */
3831 static inline tree
3832 gimple_omp_parallel_clauses (const_gimple gs)
3834 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3835 return gs->gimple_omp_parallel.clauses;
3839 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3841 static inline tree *
3842 gimple_omp_parallel_clauses_ptr (gimple gs)
3844 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3845 return &gs->gimple_omp_parallel.clauses;
3849 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
3850 GS. */
3852 static inline void
3853 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
3855 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3856 gs->gimple_omp_parallel.clauses = clauses;
3860 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
3862 static inline tree
3863 gimple_omp_parallel_child_fn (const_gimple gs)
3865 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3866 return gs->gimple_omp_parallel.child_fn;
3869 /* Return a pointer to the child function used to hold the body of
3870 OMP_PARALLEL GS. */
3872 static inline tree *
3873 gimple_omp_parallel_child_fn_ptr (gimple gs)
3875 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3876 return &gs->gimple_omp_parallel.child_fn;
3880 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
3882 static inline void
3883 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
3885 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3886 gs->gimple_omp_parallel.child_fn = child_fn;
3890 /* Return the artificial argument used to send variables and values
3891 from the parent to the children threads in OMP_PARALLEL GS. */
3893 static inline tree
3894 gimple_omp_parallel_data_arg (const_gimple gs)
3896 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3897 return gs->gimple_omp_parallel.data_arg;
3901 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
3903 static inline tree *
3904 gimple_omp_parallel_data_arg_ptr (gimple gs)
3906 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3907 return &gs->gimple_omp_parallel.data_arg;
3911 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
3913 static inline void
3914 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
3916 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3917 gs->gimple_omp_parallel.data_arg = data_arg;
3921 /* Return the clauses associated with OMP_TASK GS. */
3923 static inline tree
3924 gimple_omp_task_clauses (const_gimple gs)
3926 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3927 return gs->gimple_omp_parallel.clauses;
3931 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3933 static inline tree *
3934 gimple_omp_task_clauses_ptr (gimple gs)
3936 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3937 return &gs->gimple_omp_parallel.clauses;
3941 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3942 GS. */
3944 static inline void
3945 gimple_omp_task_set_clauses (gimple gs, tree clauses)
3947 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3948 gs->gimple_omp_parallel.clauses = clauses;
3952 /* Return the child function used to hold the body of OMP_TASK GS. */
3954 static inline tree
3955 gimple_omp_task_child_fn (const_gimple gs)
3957 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3958 return gs->gimple_omp_parallel.child_fn;
3961 /* Return a pointer to the child function used to hold the body of
3962 OMP_TASK GS. */
3964 static inline tree *
3965 gimple_omp_task_child_fn_ptr (gimple gs)
3967 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3968 return &gs->gimple_omp_parallel.child_fn;
3972 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3974 static inline void
3975 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
3977 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3978 gs->gimple_omp_parallel.child_fn = child_fn;
3982 /* Return the artificial argument used to send variables and values
3983 from the parent to the children threads in OMP_TASK GS. */
3985 static inline tree
3986 gimple_omp_task_data_arg (const_gimple gs)
3988 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3989 return gs->gimple_omp_parallel.data_arg;
3993 /* Return a pointer to the data argument for OMP_TASK GS. */
3995 static inline tree *
3996 gimple_omp_task_data_arg_ptr (gimple gs)
3998 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3999 return &gs->gimple_omp_parallel.data_arg;
4003 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4005 static inline void
4006 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4008 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4009 gs->gimple_omp_parallel.data_arg = data_arg;
4013 /* Return the clauses associated with OMP_TASK GS. */
4015 static inline tree
4016 gimple_omp_taskreg_clauses (const_gimple gs)
4018 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4019 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4020 return gs->gimple_omp_parallel.clauses;
4024 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4026 static inline tree *
4027 gimple_omp_taskreg_clauses_ptr (gimple gs)
4029 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4030 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4031 return &gs->gimple_omp_parallel.clauses;
4035 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4036 GS. */
4038 static inline void
4039 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4041 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4042 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4043 gs->gimple_omp_parallel.clauses = clauses;
4047 /* Return the child function used to hold the body of OMP_TASK GS. */
4049 static inline tree
4050 gimple_omp_taskreg_child_fn (const_gimple gs)
4052 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4053 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4054 return gs->gimple_omp_parallel.child_fn;
4057 /* Return a pointer to the child function used to hold the body of
4058 OMP_TASK GS. */
4060 static inline tree *
4061 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4063 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4064 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4065 return &gs->gimple_omp_parallel.child_fn;
4069 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4071 static inline void
4072 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4074 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4075 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4076 gs->gimple_omp_parallel.child_fn = child_fn;
4080 /* Return the artificial argument used to send variables and values
4081 from the parent to the children threads in OMP_TASK GS. */
4083 static inline tree
4084 gimple_omp_taskreg_data_arg (const_gimple gs)
4086 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4087 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4088 return gs->gimple_omp_parallel.data_arg;
4092 /* Return a pointer to the data argument for OMP_TASK GS. */
4094 static inline tree *
4095 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4097 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4098 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4099 return &gs->gimple_omp_parallel.data_arg;
4103 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4105 static inline void
4106 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4108 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4109 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4110 gs->gimple_omp_parallel.data_arg = data_arg;
4114 /* Return the copy function used to hold the body of OMP_TASK GS. */
4116 static inline tree
4117 gimple_omp_task_copy_fn (const_gimple gs)
4119 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4120 return gs->gimple_omp_task.copy_fn;
4123 /* Return a pointer to the copy function used to hold the body of
4124 OMP_TASK GS. */
4126 static inline tree *
4127 gimple_omp_task_copy_fn_ptr (gimple gs)
4129 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4130 return &gs->gimple_omp_task.copy_fn;
4134 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4136 static inline void
4137 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4139 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4140 gs->gimple_omp_task.copy_fn = copy_fn;
4144 /* Return size of the data block in bytes in OMP_TASK GS. */
4146 static inline tree
4147 gimple_omp_task_arg_size (const_gimple gs)
4149 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4150 return gs->gimple_omp_task.arg_size;
4154 /* Return a pointer to the data block size for OMP_TASK GS. */
4156 static inline tree *
4157 gimple_omp_task_arg_size_ptr (gimple gs)
4159 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4160 return &gs->gimple_omp_task.arg_size;
4164 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4166 static inline void
4167 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4169 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4170 gs->gimple_omp_task.arg_size = arg_size;
4174 /* Return align of the data block in bytes in OMP_TASK GS. */
4176 static inline tree
4177 gimple_omp_task_arg_align (const_gimple gs)
4179 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4180 return gs->gimple_omp_task.arg_align;
4184 /* Return a pointer to the data block align for OMP_TASK GS. */
4186 static inline tree *
4187 gimple_omp_task_arg_align_ptr (gimple gs)
4189 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4190 return &gs->gimple_omp_task.arg_align;
4194 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4196 static inline void
4197 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4199 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4200 gs->gimple_omp_task.arg_align = arg_align;
4204 /* Return the clauses associated with OMP_SINGLE GS. */
4206 static inline tree
4207 gimple_omp_single_clauses (const_gimple gs)
4209 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4210 return gs->gimple_omp_single.clauses;
4214 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4216 static inline tree *
4217 gimple_omp_single_clauses_ptr (gimple gs)
4219 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4220 return &gs->gimple_omp_single.clauses;
4224 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4226 static inline void
4227 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4229 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4230 gs->gimple_omp_single.clauses = clauses;
4234 /* Return the clauses associated with OMP_SECTIONS GS. */
4236 static inline tree
4237 gimple_omp_sections_clauses (const_gimple gs)
4239 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4240 return gs->gimple_omp_sections.clauses;
4244 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4246 static inline tree *
4247 gimple_omp_sections_clauses_ptr (gimple gs)
4249 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4250 return &gs->gimple_omp_sections.clauses;
4254 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4255 GS. */
4257 static inline void
4258 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4260 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4261 gs->gimple_omp_sections.clauses = clauses;
4265 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4266 in GS. */
4268 static inline tree
4269 gimple_omp_sections_control (const_gimple gs)
4271 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4272 return gs->gimple_omp_sections.control;
4276 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4277 GS. */
4279 static inline tree *
4280 gimple_omp_sections_control_ptr (gimple gs)
4282 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4283 return &gs->gimple_omp_sections.control;
4287 /* Set CONTROL to be the set of clauses associated with the
4288 GIMPLE_OMP_SECTIONS in GS. */
4290 static inline void
4291 gimple_omp_sections_set_control (gimple gs, tree control)
4293 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4294 gs->gimple_omp_sections.control = control;
4298 /* Set COND to be the condition code for OMP_FOR GS. */
4300 static inline void
4301 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4303 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4304 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4305 && i < gs->gimple_omp_for.collapse);
4306 gs->gimple_omp_for.iter[i].cond = cond;
4310 /* Return the condition code associated with OMP_FOR GS. */
4312 static inline enum tree_code
4313 gimple_omp_for_cond (const_gimple gs, size_t i)
4315 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4316 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4317 return gs->gimple_omp_for.iter[i].cond;
4321 /* Set the value being stored in an atomic store. */
4323 static inline void
4324 gimple_omp_atomic_store_set_val (gimple g, tree val)
4326 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4327 g->gimple_omp_atomic_store.val = val;
4331 /* Return the value being stored in an atomic store. */
4333 static inline tree
4334 gimple_omp_atomic_store_val (const_gimple g)
4336 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4337 return g->gimple_omp_atomic_store.val;
4341 /* Return a pointer to the value being stored in an atomic store. */
4343 static inline tree *
4344 gimple_omp_atomic_store_val_ptr (gimple g)
4346 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4347 return &g->gimple_omp_atomic_store.val;
4351 /* Set the LHS of an atomic load. */
4353 static inline void
4354 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4356 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4357 g->gimple_omp_atomic_load.lhs = lhs;
4361 /* Get the LHS of an atomic load. */
4363 static inline tree
4364 gimple_omp_atomic_load_lhs (const_gimple g)
4366 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4367 return g->gimple_omp_atomic_load.lhs;
4371 /* Return a pointer to the LHS of an atomic load. */
4373 static inline tree *
4374 gimple_omp_atomic_load_lhs_ptr (gimple g)
4376 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4377 return &g->gimple_omp_atomic_load.lhs;
4381 /* Set the RHS of an atomic load. */
4383 static inline void
4384 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4386 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4387 g->gimple_omp_atomic_load.rhs = rhs;
4391 /* Get the RHS of an atomic load. */
4393 static inline tree
4394 gimple_omp_atomic_load_rhs (const_gimple g)
4396 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4397 return g->gimple_omp_atomic_load.rhs;
4401 /* Return a pointer to the RHS of an atomic load. */
4403 static inline tree *
4404 gimple_omp_atomic_load_rhs_ptr (gimple g)
4406 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4407 return &g->gimple_omp_atomic_load.rhs;
4411 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4413 static inline tree
4414 gimple_omp_continue_control_def (const_gimple g)
4416 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4417 return g->gimple_omp_continue.control_def;
4420 /* The same as above, but return the address. */
4422 static inline tree *
4423 gimple_omp_continue_control_def_ptr (gimple g)
4425 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4426 return &g->gimple_omp_continue.control_def;
4429 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4431 static inline void
4432 gimple_omp_continue_set_control_def (gimple g, tree def)
4434 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4435 g->gimple_omp_continue.control_def = def;
4439 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4441 static inline tree
4442 gimple_omp_continue_control_use (const_gimple g)
4444 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4445 return g->gimple_omp_continue.control_use;
4449 /* The same as above, but return the address. */
4451 static inline tree *
4452 gimple_omp_continue_control_use_ptr (gimple g)
4454 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4455 return &g->gimple_omp_continue.control_use;
4459 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4461 static inline void
4462 gimple_omp_continue_set_control_use (gimple g, tree use)
4464 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4465 g->gimple_omp_continue.control_use = use;
4469 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4471 static inline tree *
4472 gimple_return_retval_ptr (const_gimple gs)
4474 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4475 return gimple_op_ptr (gs, 0);
4478 /* Return the return value for GIMPLE_RETURN GS. */
4480 static inline tree
4481 gimple_return_retval (const_gimple gs)
4483 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4484 return gimple_op (gs, 0);
4488 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4490 static inline void
4491 gimple_return_set_retval (gimple gs, tree retval)
4493 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4494 gimple_set_op (gs, 0, retval);
4498 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4500 #define CASE_GIMPLE_OMP \
4501 case GIMPLE_OMP_PARALLEL: \
4502 case GIMPLE_OMP_TASK: \
4503 case GIMPLE_OMP_FOR: \
4504 case GIMPLE_OMP_SECTIONS: \
4505 case GIMPLE_OMP_SECTIONS_SWITCH: \
4506 case GIMPLE_OMP_SINGLE: \
4507 case GIMPLE_OMP_SECTION: \
4508 case GIMPLE_OMP_MASTER: \
4509 case GIMPLE_OMP_ORDERED: \
4510 case GIMPLE_OMP_CRITICAL: \
4511 case GIMPLE_OMP_RETURN: \
4512 case GIMPLE_OMP_ATOMIC_LOAD: \
4513 case GIMPLE_OMP_ATOMIC_STORE: \
4514 case GIMPLE_OMP_CONTINUE
4516 static inline bool
4517 is_gimple_omp (const_gimple stmt)
4519 switch (gimple_code (stmt))
4521 CASE_GIMPLE_OMP:
4522 return true;
4523 default:
4524 return false;
4529 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4531 static inline bool
4532 gimple_nop_p (const_gimple g)
4534 return gimple_code (g) == GIMPLE_NOP;
4538 /* Return true if GS is a GIMPLE_RESX. */
4540 static inline bool
4541 is_gimple_resx (const_gimple gs)
4543 return gimple_code (gs) == GIMPLE_RESX;
4546 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4548 static inline enum br_predictor
4549 gimple_predict_predictor (gimple gs)
4551 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4552 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4556 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4558 static inline void
4559 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4561 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4562 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4563 | (unsigned) predictor;
4567 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4569 static inline enum prediction
4570 gimple_predict_outcome (gimple gs)
4572 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4573 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4577 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4579 static inline void
4580 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4582 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4583 if (outcome == TAKEN)
4584 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4585 else
4586 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4590 /* Return the type of the main expression computed by STMT. Return
4591 void_type_node if the statement computes nothing. */
4593 static inline tree
4594 gimple_expr_type (const_gimple stmt)
4596 enum gimple_code code = gimple_code (stmt);
4598 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4600 tree type;
4601 /* In general we want to pass out a type that can be substituted
4602 for both the RHS and the LHS types if there is a possibly
4603 useless conversion involved. That means returning the
4604 original RHS type as far as we can reconstruct it. */
4605 if (code == GIMPLE_CALL)
4606 type = gimple_call_return_type (stmt);
4607 else
4608 switch (gimple_assign_rhs_code (stmt))
4610 case POINTER_PLUS_EXPR:
4611 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4612 break;
4614 default:
4615 /* As fallback use the type of the LHS. */
4616 type = TREE_TYPE (gimple_get_lhs (stmt));
4617 break;
4619 return type;
4621 else if (code == GIMPLE_COND)
4622 return boolean_type_node;
4623 else
4624 return void_type_node;
4628 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4630 static inline gimple_stmt_iterator
4631 gsi_start (gimple_seq seq)
4633 gimple_stmt_iterator i;
4635 i.ptr = gimple_seq_first (seq);
4636 i.seq = seq;
4637 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4639 return i;
4643 /* Return a new iterator pointing to the first statement in basic block BB. */
4645 static inline gimple_stmt_iterator
4646 gsi_start_bb (basic_block bb)
4648 gimple_stmt_iterator i;
4649 gimple_seq seq;
4651 seq = bb_seq (bb);
4652 i.ptr = gimple_seq_first (seq);
4653 i.seq = seq;
4654 i.bb = bb;
4656 return i;
4660 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4662 static inline gimple_stmt_iterator
4663 gsi_last (gimple_seq seq)
4665 gimple_stmt_iterator i;
4667 i.ptr = gimple_seq_last (seq);
4668 i.seq = seq;
4669 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4671 return i;
4675 /* Return a new iterator pointing to the last statement in basic block BB. */
4677 static inline gimple_stmt_iterator
4678 gsi_last_bb (basic_block bb)
4680 gimple_stmt_iterator i;
4681 gimple_seq seq;
4683 seq = bb_seq (bb);
4684 i.ptr = gimple_seq_last (seq);
4685 i.seq = seq;
4686 i.bb = bb;
4688 return i;
4692 /* Return true if I is at the end of its sequence. */
4694 static inline bool
4695 gsi_end_p (gimple_stmt_iterator i)
4697 return i.ptr == NULL;
4701 /* Return true if I is one statement before the end of its sequence. */
4703 static inline bool
4704 gsi_one_before_end_p (gimple_stmt_iterator i)
4706 return i.ptr != NULL && i.ptr->next == NULL;
4710 /* Advance the iterator to the next gimple statement. */
4712 static inline void
4713 gsi_next (gimple_stmt_iterator *i)
4715 i->ptr = i->ptr->next;
4718 /* Advance the iterator to the previous gimple statement. */
4720 static inline void
4721 gsi_prev (gimple_stmt_iterator *i)
4723 i->ptr = i->ptr->prev;
4726 /* Return the current stmt. */
4728 static inline gimple
4729 gsi_stmt (gimple_stmt_iterator i)
4731 return i.ptr->stmt;
4734 /* Return a block statement iterator that points to the first non-label
4735 statement in block BB. */
4737 static inline gimple_stmt_iterator
4738 gsi_after_labels (basic_block bb)
4740 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4742 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4743 gsi_next (&gsi);
4745 return gsi;
4748 /* Advance the iterator to the next non-debug gimple statement. */
4750 static inline void
4751 gsi_next_nondebug (gimple_stmt_iterator *i)
4755 gsi_next (i);
4757 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4760 /* Advance the iterator to the next non-debug gimple statement. */
4762 static inline void
4763 gsi_prev_nondebug (gimple_stmt_iterator *i)
4767 gsi_prev (i);
4769 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4772 /* Return a new iterator pointing to the first non-debug statement in
4773 basic block BB. */
4775 static inline gimple_stmt_iterator
4776 gsi_start_nondebug_bb (basic_block bb)
4778 gimple_stmt_iterator i = gsi_start_bb (bb);
4780 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4781 gsi_next_nondebug (&i);
4783 return i;
4786 /* Return a new iterator pointing to the last non-debug statement in
4787 basic block BB. */
4789 static inline gimple_stmt_iterator
4790 gsi_last_nondebug_bb (basic_block bb)
4792 gimple_stmt_iterator i = gsi_last_bb (bb);
4794 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4795 gsi_prev_nondebug (&i);
4797 return i;
4800 /* Return a pointer to the current stmt.
4802 NOTE: You may want to use gsi_replace on the iterator itself,
4803 as this performs additional bookkeeping that will not be done
4804 if you simply assign through a pointer returned by gsi_stmt_ptr. */
4806 static inline gimple *
4807 gsi_stmt_ptr (gimple_stmt_iterator *i)
4809 return &i->ptr->stmt;
4813 /* Return the basic block associated with this iterator. */
4815 static inline basic_block
4816 gsi_bb (gimple_stmt_iterator i)
4818 return i.bb;
4822 /* Return the sequence associated with this iterator. */
4824 static inline gimple_seq
4825 gsi_seq (gimple_stmt_iterator i)
4827 return i.seq;
4831 enum gsi_iterator_update
4833 GSI_NEW_STMT, /* Only valid when single statement is added, move
4834 iterator to it. */
4835 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
4836 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
4837 for linking other statements in the same
4838 direction. */
4841 /* In gimple-iterator.c */
4842 gimple_stmt_iterator gsi_start_phis (basic_block);
4843 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
4844 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
4845 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
4846 void gsi_insert_before (gimple_stmt_iterator *, gimple,
4847 enum gsi_iterator_update);
4848 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
4849 enum gsi_iterator_update);
4850 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
4851 enum gsi_iterator_update);
4852 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
4853 enum gsi_iterator_update);
4854 void gsi_insert_after (gimple_stmt_iterator *, gimple,
4855 enum gsi_iterator_update);
4856 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
4857 enum gsi_iterator_update);
4858 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
4859 enum gsi_iterator_update);
4860 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
4861 enum gsi_iterator_update);
4862 void gsi_remove (gimple_stmt_iterator *, bool);
4863 gimple_stmt_iterator gsi_for_stmt (gimple);
4864 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
4865 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
4866 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
4867 void gsi_insert_on_edge (edge, gimple);
4868 void gsi_insert_seq_on_edge (edge, gimple_seq);
4869 basic_block gsi_insert_on_edge_immediate (edge, gimple);
4870 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
4871 void gsi_commit_one_edge_insert (edge, basic_block *);
4872 void gsi_commit_edge_inserts (void);
4873 gimple gimple_call_copy_skip_args (gimple, bitmap);
4876 /* Convenience routines to walk all statements of a gimple function.
4877 Note that this is useful exclusively before the code is converted
4878 into SSA form. Once the program is in SSA form, the standard
4879 operand interface should be used to analyze/modify statements. */
4880 struct walk_stmt_info
4882 /* Points to the current statement being walked. */
4883 gimple_stmt_iterator gsi;
4885 /* Additional data that the callback functions may want to carry
4886 through the recursion. */
4887 void *info;
4889 /* Pointer map used to mark visited tree nodes when calling
4890 walk_tree on each operand. If set to NULL, duplicate tree nodes
4891 will be visited more than once. */
4892 struct pointer_set_t *pset;
4894 /* Indicates whether the operand being examined may be replaced
4895 with something that matches is_gimple_val (if true) or something
4896 slightly more complicated (if false). "Something" technically
4897 means the common subset of is_gimple_lvalue and is_gimple_rhs,
4898 but we never try to form anything more complicated than that, so
4899 we don't bother checking.
4901 Also note that CALLBACK should update this flag while walking the
4902 sub-expressions of a statement. For instance, when walking the
4903 statement 'foo (&var)', the flag VAL_ONLY will initially be set
4904 to true, however, when walking &var, the operand of that
4905 ADDR_EXPR does not need to be a GIMPLE value. */
4906 bool val_only;
4908 /* True if we are currently walking the LHS of an assignment. */
4909 bool is_lhs;
4911 /* Optional. Set to true by the callback functions if they made any
4912 changes. */
4913 bool changed;
4915 /* True if we're interested in location information. */
4916 bool want_locations;
4918 /* Operand returned by the callbacks. This is set when calling
4919 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
4920 returns non-NULL, this field will contain the tree returned by
4921 the last callback. */
4922 tree callback_result;
4925 /* Callback for walk_gimple_stmt. Called for every statement found
4926 during traversal. The first argument points to the statement to
4927 walk. The second argument is a flag that the callback sets to
4928 'true' if it the callback handled all the operands and
4929 sub-statements of the statement (the default value of this flag is
4930 'false'). The third argument is an anonymous pointer to data
4931 to be used by the callback. */
4932 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
4933 struct walk_stmt_info *);
4935 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
4936 struct walk_stmt_info *);
4937 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
4938 struct walk_stmt_info *);
4939 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
4941 #ifdef GATHER_STATISTICS
4942 /* Enum and arrays used for allocation stats. Keep in sync with
4943 gimple.c:gimple_alloc_kind_names. */
4944 enum gimple_alloc_kind
4946 gimple_alloc_kind_assign, /* Assignments. */
4947 gimple_alloc_kind_phi, /* PHI nodes. */
4948 gimple_alloc_kind_cond, /* Conditionals. */
4949 gimple_alloc_kind_seq, /* Sequences. */
4950 gimple_alloc_kind_rest, /* Everything else. */
4951 gimple_alloc_kind_all
4954 extern int gimple_alloc_counts[];
4955 extern int gimple_alloc_sizes[];
4957 /* Return the allocation kind for a given stmt CODE. */
4958 static inline enum gimple_alloc_kind
4959 gimple_alloc_kind (enum gimple_code code)
4961 switch (code)
4963 case GIMPLE_ASSIGN:
4964 return gimple_alloc_kind_assign;
4965 case GIMPLE_PHI:
4966 return gimple_alloc_kind_phi;
4967 case GIMPLE_COND:
4968 return gimple_alloc_kind_cond;
4969 default:
4970 return gimple_alloc_kind_rest;
4973 #endif /* GATHER_STATISTICS */
4975 extern void dump_gimple_statistics (void);
4977 /* In gimple-fold.c. */
4978 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
4979 tree gimple_fold_builtin (gimple);
4980 bool fold_stmt (gimple_stmt_iterator *);
4981 bool fold_stmt_inplace (gimple);
4982 tree maybe_fold_offset_to_address (location_t, tree, tree, tree);
4983 tree maybe_fold_offset_to_reference (location_t, tree, tree, tree);
4984 tree maybe_fold_stmt_addition (location_t, tree, tree, tree);
4985 tree get_symbol_constant_value (tree);
4986 tree canonicalize_constructor_val (tree);
4987 bool may_propagate_address_into_dereference (tree, tree);
4988 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
4989 enum tree_code, tree, tree);
4990 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
4991 enum tree_code, tree, tree);
4993 #endif /* GCC_GIMPLE_H */