re PR debug/51746 (Segfault in cselib_preserved_value_p)
[official-gcc.git] / gcc / gimple.h
blob484d1a0b407e50dc38d0ba69ede297a37d5beb23
1 /* Gimple IR definitions.
3 Copyright 2007, 2008, 2009, 2010, 2011, 2012 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_FROM_THUNK = 1 << 0,
101 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
102 GF_CALL_TAILCALL = 1 << 2,
103 GF_CALL_VA_ARG_PACK = 1 << 3,
104 GF_CALL_NOTHROW = 1 << 4,
105 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
106 GF_CALL_INTERNAL = 1 << 6,
107 GF_OMP_PARALLEL_COMBINED = 1 << 0,
109 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
110 a thread synchronization via some sort of barrier. The exact barrier
111 that would otherwise be emitted is dependent on the OMP statement with
112 which this return is associated. */
113 GF_OMP_RETURN_NOWAIT = 1 << 0,
115 GF_OMP_SECTION_LAST = 1 << 0,
116 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
117 GF_PREDICT_TAKEN = 1 << 15
120 /* Currently, there are only two types 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,
126 GIMPLE_DEBUG_SOURCE_BIND = 1
129 /* Masks for selecting a pass local flag (PLF) to work on. These
130 masks are used by gimple_set_plf and gimple_plf. */
131 enum plf_mask {
132 GF_PLF_1 = 1 << 0,
133 GF_PLF_2 = 1 << 1
136 /* A node in a gimple_seq_d. */
137 struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) gimple_seq_node_d {
138 gimple stmt;
139 struct gimple_seq_node_d *prev;
140 struct gimple_seq_node_d *next;
143 /* A double-linked sequence of gimple statements. */
144 struct GTY ((chain_next ("%h.next_free"))) gimple_seq_d {
145 /* First and last statements in the sequence. */
146 gimple_seq_node first;
147 gimple_seq_node last;
149 /* Sequences are created/destroyed frequently. To minimize
150 allocation activity, deallocated sequences are kept in a pool of
151 available sequences. This is the pointer to the next free
152 sequence in the pool. */
153 gimple_seq next_free;
157 /* Return the first node in GIMPLE sequence S. */
159 static inline gimple_seq_node
160 gimple_seq_first (const_gimple_seq s)
162 return s ? s->first : NULL;
166 /* Return the first statement in GIMPLE sequence S. */
168 static inline gimple
169 gimple_seq_first_stmt (const_gimple_seq s)
171 gimple_seq_node n = gimple_seq_first (s);
172 return (n) ? n->stmt : NULL;
176 /* Return the last node in GIMPLE sequence S. */
178 static inline gimple_seq_node
179 gimple_seq_last (const_gimple_seq s)
181 return s ? s->last : NULL;
185 /* Return the last statement in GIMPLE sequence S. */
187 static inline gimple
188 gimple_seq_last_stmt (const_gimple_seq s)
190 gimple_seq_node n = gimple_seq_last (s);
191 return (n) ? n->stmt : NULL;
195 /* Set the last node in GIMPLE sequence S to LAST. */
197 static inline void
198 gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
200 s->last = last;
204 /* Set the first node in GIMPLE sequence S to FIRST. */
206 static inline void
207 gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
209 s->first = first;
213 /* Return true if GIMPLE sequence S is empty. */
215 static inline bool
216 gimple_seq_empty_p (const_gimple_seq s)
218 return s == NULL || s->first == NULL;
222 void gimple_seq_add_stmt (gimple_seq *, gimple);
224 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
225 *SEQ_P is NULL, a new sequence is allocated. This function is
226 similar to gimple_seq_add_stmt, but does not scan the operands.
227 During gimplification, we need to manipulate statement sequences
228 before the def/use vectors have been constructed. */
229 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
231 /* Allocate a new sequence and initialize its first element with STMT. */
233 static inline gimple_seq
234 gimple_seq_alloc_with_stmt (gimple stmt)
236 gimple_seq seq = NULL;
237 gimple_seq_add_stmt (&seq, stmt);
238 return seq;
242 /* Returns the sequence of statements in BB. */
244 static inline gimple_seq
245 bb_seq (const_basic_block bb)
247 return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
251 /* Sets the sequence of statements in BB to SEQ. */
253 static inline void
254 set_bb_seq (basic_block bb, gimple_seq seq)
256 gcc_checking_assert (!(bb->flags & BB_RTL));
257 bb->il.gimple->seq = seq;
260 /* Iterator object for GIMPLE statement sequences. */
262 typedef struct
264 /* Sequence node holding the current statement. */
265 gimple_seq_node ptr;
267 /* Sequence and basic block holding the statement. These fields
268 are necessary to handle edge cases such as when statement is
269 added to an empty basic block or when the last statement of a
270 block/sequence is removed. */
271 gimple_seq seq;
272 basic_block bb;
273 } gimple_stmt_iterator;
276 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
277 are for 64 bit hosts. */
279 struct GTY(()) gimple_statement_base {
280 /* [ WORD 1 ]
281 Main identifying code for a tuple. */
282 ENUM_BITFIELD(gimple_code) code : 8;
284 /* Nonzero if a warning should not be emitted on this tuple. */
285 unsigned int no_warning : 1;
287 /* Nonzero if this tuple has been visited. Passes are responsible
288 for clearing this bit before using it. */
289 unsigned int visited : 1;
291 /* Nonzero if this tuple represents a non-temporal move. */
292 unsigned int nontemporal_move : 1;
294 /* Pass local flags. These flags are free for any pass to use as
295 they see fit. Passes should not assume that these flags contain
296 any useful value when the pass starts. Any initial state that
297 the pass requires should be set on entry to the pass. See
298 gimple_set_plf and gimple_plf for usage. */
299 unsigned int plf : 2;
301 /* Nonzero if this statement has been modified and needs to have its
302 operands rescanned. */
303 unsigned modified : 1;
305 /* Nonzero if this statement contains volatile operands. */
306 unsigned has_volatile_ops : 1;
308 /* Padding to get subcode to 16 bit alignment. */
309 unsigned pad : 1;
311 /* The SUBCODE field can be used for tuple-specific flags for tuples
312 that do not require subcodes. Note that SUBCODE should be at
313 least as wide as tree codes, as several tuples store tree codes
314 in there. */
315 unsigned int subcode : 16;
317 /* UID of this statement. This is used by passes that want to
318 assign IDs to statements. It must be assigned and used by each
319 pass. By default it should be assumed to contain garbage. */
320 unsigned uid;
322 /* [ WORD 2 ]
323 Locus information for debug info. */
324 location_t location;
326 /* Number of operands in this tuple. */
327 unsigned num_ops;
329 /* [ WORD 3 ]
330 Basic block holding this statement. */
331 struct basic_block_def *bb;
333 /* [ WORD 4 ]
334 Lexical block holding this statement. */
335 tree block;
339 /* Base structure for tuples with operands. */
341 struct GTY(()) gimple_statement_with_ops_base
343 /* [ WORD 1-4 ] */
344 struct gimple_statement_base gsbase;
346 /* [ WORD 5-6 ]
347 SSA operand vectors. NOTE: It should be possible to
348 amalgamate these vectors with the operand vector OP. However,
349 the SSA operand vectors are organized differently and contain
350 more information (like immediate use chaining). */
351 struct def_optype_d GTY((skip (""))) *def_ops;
352 struct use_optype_d GTY((skip (""))) *use_ops;
356 /* Statements that take register operands. */
358 struct GTY(()) gimple_statement_with_ops
360 /* [ WORD 1-6 ] */
361 struct gimple_statement_with_ops_base opbase;
363 /* [ WORD 7 ]
364 Operand vector. NOTE! This must always be the last field
365 of this structure. In particular, this means that this
366 structure cannot be embedded inside another one. */
367 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
371 /* Base for statements that take both memory and register operands. */
373 struct GTY(()) gimple_statement_with_memory_ops_base
375 /* [ WORD 1-6 ] */
376 struct gimple_statement_with_ops_base opbase;
378 /* [ WORD 7-8 ]
379 Virtual operands for this statement. The GC will pick them
380 up via the ssa_names array. */
381 tree GTY((skip (""))) vdef;
382 tree GTY((skip (""))) vuse;
386 /* Statements that take both memory and register operands. */
388 struct GTY(()) gimple_statement_with_memory_ops
390 /* [ WORD 1-8 ] */
391 struct gimple_statement_with_memory_ops_base membase;
393 /* [ WORD 9 ]
394 Operand vector. NOTE! This must always be the last field
395 of this structure. In particular, this means that this
396 structure cannot be embedded inside another one. */
397 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
401 /* Call statements that take both memory and register operands. */
403 struct GTY(()) gimple_statement_call
405 /* [ WORD 1-8 ] */
406 struct gimple_statement_with_memory_ops_base membase;
408 /* [ WORD 9-12 ] */
409 struct pt_solution call_used;
410 struct pt_solution call_clobbered;
412 /* [ WORD 13 ] */
413 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
414 tree GTY ((tag ("0"))) fntype;
415 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
416 } u;
418 /* [ WORD 14 ]
419 Operand vector. NOTE! This must always be the last field
420 of this structure. In particular, this means that this
421 structure cannot be embedded inside another one. */
422 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
426 /* OpenMP statements (#pragma omp). */
428 struct GTY(()) gimple_statement_omp {
429 /* [ WORD 1-4 ] */
430 struct gimple_statement_base gsbase;
432 /* [ WORD 5 ] */
433 gimple_seq body;
437 /* GIMPLE_BIND */
439 struct GTY(()) gimple_statement_bind {
440 /* [ WORD 1-4 ] */
441 struct gimple_statement_base gsbase;
443 /* [ WORD 5 ]
444 Variables declared in this scope. */
445 tree vars;
447 /* [ WORD 6 ]
448 This is different than the BLOCK field in gimple_statement_base,
449 which is analogous to TREE_BLOCK (i.e., the lexical block holding
450 this statement). This field is the equivalent of BIND_EXPR_BLOCK
451 in tree land (i.e., the lexical scope defined by this bind). See
452 gimple-low.c. */
453 tree block;
455 /* [ WORD 7 ] */
456 gimple_seq body;
460 /* GIMPLE_CATCH */
462 struct GTY(()) gimple_statement_catch {
463 /* [ WORD 1-4 ] */
464 struct gimple_statement_base gsbase;
466 /* [ WORD 5 ] */
467 tree types;
469 /* [ WORD 6 ] */
470 gimple_seq handler;
474 /* GIMPLE_EH_FILTER */
476 struct GTY(()) gimple_statement_eh_filter {
477 /* [ WORD 1-4 ] */
478 struct gimple_statement_base gsbase;
480 /* [ WORD 5 ]
481 Filter types. */
482 tree types;
484 /* [ WORD 6 ]
485 Failure actions. */
486 gimple_seq failure;
489 /* GIMPLE_EH_ELSE */
491 struct GTY(()) gimple_statement_eh_else {
492 /* [ WORD 1-4 ] */
493 struct gimple_statement_base gsbase;
495 /* [ WORD 5,6 ] */
496 gimple_seq n_body, e_body;
499 /* GIMPLE_EH_MUST_NOT_THROW */
501 struct GTY(()) gimple_statement_eh_mnt {
502 /* [ WORD 1-4 ] */
503 struct gimple_statement_base gsbase;
505 /* [ WORD 5 ] Abort function decl. */
506 tree fndecl;
509 /* GIMPLE_PHI */
511 struct GTY(()) gimple_statement_phi {
512 /* [ WORD 1-4 ] */
513 struct gimple_statement_base gsbase;
515 /* [ WORD 5 ] */
516 unsigned capacity;
517 unsigned nargs;
519 /* [ WORD 6 ] */
520 tree result;
522 /* [ WORD 7 ] */
523 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
527 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
529 struct GTY(()) gimple_statement_eh_ctrl
531 /* [ WORD 1-4 ] */
532 struct gimple_statement_base gsbase;
534 /* [ WORD 5 ]
535 Exception region number. */
536 int region;
540 /* GIMPLE_TRY */
542 struct GTY(()) gimple_statement_try {
543 /* [ WORD 1-4 ] */
544 struct gimple_statement_base gsbase;
546 /* [ WORD 5 ]
547 Expression to evaluate. */
548 gimple_seq eval;
550 /* [ WORD 6 ]
551 Cleanup expression. */
552 gimple_seq cleanup;
555 /* Kind of GIMPLE_TRY statements. */
556 enum gimple_try_flags
558 /* A try/catch. */
559 GIMPLE_TRY_CATCH = 1 << 0,
561 /* A try/finally. */
562 GIMPLE_TRY_FINALLY = 1 << 1,
563 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
565 /* Analogous to TRY_CATCH_IS_CLEANUP. */
566 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
569 /* GIMPLE_WITH_CLEANUP_EXPR */
571 struct GTY(()) gimple_statement_wce {
572 /* [ WORD 1-4 ] */
573 struct gimple_statement_base gsbase;
575 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
576 executed if an exception is thrown, not on normal exit of its
577 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
578 in TARGET_EXPRs. */
580 /* [ WORD 5 ]
581 Cleanup expression. */
582 gimple_seq cleanup;
586 /* GIMPLE_ASM */
588 struct GTY(()) gimple_statement_asm
590 /* [ WORD 1-8 ] */
591 struct gimple_statement_with_memory_ops_base membase;
593 /* [ WORD 9 ]
594 __asm__ statement. */
595 const char *string;
597 /* [ WORD 10 ]
598 Number of inputs, outputs, clobbers, labels. */
599 unsigned char ni;
600 unsigned char no;
601 unsigned char nc;
602 unsigned char nl;
604 /* [ WORD 11 ]
605 Operand vector. NOTE! This must always be the last field
606 of this structure. In particular, this means that this
607 structure cannot be embedded inside another one. */
608 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
611 /* GIMPLE_OMP_CRITICAL */
613 struct GTY(()) gimple_statement_omp_critical {
614 /* [ WORD 1-5 ] */
615 struct gimple_statement_omp omp;
617 /* [ WORD 6 ]
618 Critical section name. */
619 tree name;
623 struct GTY(()) gimple_omp_for_iter {
624 /* Condition code. */
625 enum tree_code cond;
627 /* Index variable. */
628 tree index;
630 /* Initial value. */
631 tree initial;
633 /* Final value. */
634 tree final;
636 /* Increment. */
637 tree incr;
640 /* GIMPLE_OMP_FOR */
642 struct GTY(()) gimple_statement_omp_for {
643 /* [ WORD 1-5 ] */
644 struct gimple_statement_omp omp;
646 /* [ WORD 6 ] */
647 tree clauses;
649 /* [ WORD 7 ]
650 Number of elements in iter array. */
651 size_t collapse;
653 /* [ WORD 8 ] */
654 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
656 /* [ WORD 9 ]
657 Pre-body evaluated before the loop body begins. */
658 gimple_seq pre_body;
662 /* GIMPLE_OMP_PARALLEL */
664 struct GTY(()) gimple_statement_omp_parallel {
665 /* [ WORD 1-5 ] */
666 struct gimple_statement_omp omp;
668 /* [ WORD 6 ]
669 Clauses. */
670 tree clauses;
672 /* [ WORD 7 ]
673 Child function holding the body of the parallel region. */
674 tree child_fn;
676 /* [ WORD 8 ]
677 Shared data argument. */
678 tree data_arg;
682 /* GIMPLE_OMP_TASK */
684 struct GTY(()) gimple_statement_omp_task {
685 /* [ WORD 1-8 ] */
686 struct gimple_statement_omp_parallel par;
688 /* [ WORD 9 ]
689 Child function holding firstprivate initialization if needed. */
690 tree copy_fn;
692 /* [ WORD 10-11 ]
693 Size and alignment in bytes of the argument data block. */
694 tree arg_size;
695 tree arg_align;
699 /* GIMPLE_OMP_SECTION */
700 /* Uses struct gimple_statement_omp. */
703 /* GIMPLE_OMP_SECTIONS */
705 struct GTY(()) gimple_statement_omp_sections {
706 /* [ WORD 1-5 ] */
707 struct gimple_statement_omp omp;
709 /* [ WORD 6 ] */
710 tree clauses;
712 /* [ WORD 7 ]
713 The control variable used for deciding which of the sections to
714 execute. */
715 tree control;
718 /* GIMPLE_OMP_CONTINUE.
720 Note: This does not inherit from gimple_statement_omp, because we
721 do not need the body field. */
723 struct GTY(()) gimple_statement_omp_continue {
724 /* [ WORD 1-4 ] */
725 struct gimple_statement_base gsbase;
727 /* [ WORD 5 ] */
728 tree control_def;
730 /* [ WORD 6 ] */
731 tree control_use;
734 /* GIMPLE_OMP_SINGLE */
736 struct GTY(()) gimple_statement_omp_single {
737 /* [ WORD 1-5 ] */
738 struct gimple_statement_omp omp;
740 /* [ WORD 6 ] */
741 tree clauses;
745 /* GIMPLE_OMP_ATOMIC_LOAD.
746 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
747 contains a sequence, which we don't need here. */
749 struct GTY(()) gimple_statement_omp_atomic_load {
750 /* [ WORD 1-4 ] */
751 struct gimple_statement_base gsbase;
753 /* [ WORD 5-6 ] */
754 tree rhs, lhs;
757 /* GIMPLE_OMP_ATOMIC_STORE.
758 See note on GIMPLE_OMP_ATOMIC_LOAD. */
760 struct GTY(()) gimple_statement_omp_atomic_store {
761 /* [ WORD 1-4 ] */
762 struct gimple_statement_base gsbase;
764 /* [ WORD 5 ] */
765 tree val;
768 /* GIMPLE_TRANSACTION. */
770 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
772 /* The __transaction_atomic was declared [[outer]] or it is
773 __transaction_relaxed. */
774 #define GTMA_IS_OUTER (1u << 0)
775 #define GTMA_IS_RELAXED (1u << 1)
776 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
778 /* The transaction is seen to not have an abort. */
779 #define GTMA_HAVE_ABORT (1u << 2)
780 /* The transaction is seen to have loads or stores. */
781 #define GTMA_HAVE_LOAD (1u << 3)
782 #define GTMA_HAVE_STORE (1u << 4)
783 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
784 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
785 /* The transaction WILL enter serial irrevocable mode.
786 An irrevocable block post-dominates the entire transaction, such
787 that all invocations of the transaction will go serial-irrevocable.
788 In such case, we don't bother instrumenting the transaction, and
789 tell the runtime that it should begin the transaction in
790 serial-irrevocable mode. */
791 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
793 struct GTY(()) gimple_statement_transaction
795 /* [ WORD 1-10 ] */
796 struct gimple_statement_with_memory_ops_base gsbase;
798 /* [ WORD 11 ] */
799 gimple_seq body;
801 /* [ WORD 12 ] */
802 tree label;
805 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
806 enum gimple_statement_structure_enum {
807 #include "gsstruct.def"
808 LAST_GSS_ENUM
810 #undef DEFGSSTRUCT
813 /* Define the overall contents of a gimple tuple. It may be any of the
814 structures declared above for various types of tuples. */
816 union GTY ((desc ("gimple_statement_structure (&%h)"), variable_size)) gimple_statement_d {
817 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
818 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
819 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
820 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
821 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
822 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
823 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
824 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
825 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
826 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
827 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
828 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
829 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
830 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
831 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
832 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
833 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
834 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
835 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
836 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
837 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
838 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
839 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
840 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
841 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
842 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
845 /* In gimple.c. */
847 /* Offset in bytes to the location of the operand vector.
848 Zero if there is no operand vector for this tuple structure. */
849 extern size_t const gimple_ops_offset_[];
851 /* Map GIMPLE codes to GSS codes. */
852 extern enum gimple_statement_structure_enum const gss_for_code_[];
854 /* This variable holds the currently expanded gimple statement for purposes
855 of comminucating the profile info to the builtin expanders. */
856 extern gimple currently_expanding_gimple_stmt;
858 gimple gimple_build_return (tree);
860 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
861 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
863 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
865 gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
866 tree, tree MEM_STAT_DECL);
867 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
868 gimple_build_assign_with_ops_stat (c, o1, o2, o3, NULL_TREE MEM_STAT_INFO)
869 #define gimple_build_assign_with_ops3(c,o1,o2,o3,o4) \
870 gimple_build_assign_with_ops_stat (c, o1, o2, o3, o4 MEM_STAT_INFO)
872 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
873 #define gimple_build_debug_bind(var,val,stmt) \
874 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
875 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
876 #define gimple_build_debug_source_bind(var,val,stmt) \
877 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
879 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
880 gimple gimple_build_call (tree, unsigned, ...);
881 gimple gimple_build_call_valist (tree, unsigned, va_list);
882 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
883 gimple gimple_build_call_internal_vec (enum internal_fn, VEC(tree, heap) *);
884 gimple gimple_build_call_from_tree (tree);
885 gimple gimplify_assign (tree, tree, gimple_seq *);
886 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
887 gimple gimple_build_label (tree label);
888 gimple gimple_build_goto (tree dest);
889 gimple gimple_build_nop (void);
890 gimple gimple_build_bind (tree, gimple_seq, tree);
891 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
892 VEC(tree,gc) *, VEC(tree,gc) *);
893 gimple gimple_build_catch (tree, gimple_seq);
894 gimple gimple_build_eh_filter (tree, gimple_seq);
895 gimple gimple_build_eh_must_not_throw (tree);
896 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
897 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
898 gimple gimple_build_wce (gimple_seq);
899 gimple gimple_build_resx (int);
900 gimple gimple_build_eh_dispatch (int);
901 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
902 gimple gimple_build_switch (unsigned, tree, tree, ...);
903 gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
904 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
905 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
906 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
907 gimple gimple_build_omp_critical (gimple_seq, tree);
908 gimple gimple_build_omp_section (gimple_seq);
909 gimple gimple_build_omp_continue (tree, tree);
910 gimple gimple_build_omp_master (gimple_seq);
911 gimple gimple_build_omp_return (bool);
912 gimple gimple_build_omp_ordered (gimple_seq);
913 gimple gimple_build_omp_sections (gimple_seq, tree);
914 gimple gimple_build_omp_sections_switch (void);
915 gimple gimple_build_omp_single (gimple_seq, tree);
916 gimple gimple_build_cdt (tree, tree);
917 gimple gimple_build_omp_atomic_load (tree, tree);
918 gimple gimple_build_omp_atomic_store (tree);
919 gimple gimple_build_transaction (gimple_seq, tree);
920 gimple gimple_build_predict (enum br_predictor, enum prediction);
921 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
922 void sort_case_labels (VEC(tree,heap) *);
923 void gimple_set_body (tree, gimple_seq);
924 gimple_seq gimple_body (tree);
925 bool gimple_has_body_p (tree);
926 gimple_seq gimple_seq_alloc (void);
927 void gimple_seq_free (gimple_seq);
928 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
929 gimple_seq gimple_seq_copy (gimple_seq);
930 bool gimple_call_same_target_p (const_gimple, const_gimple);
931 int gimple_call_flags (const_gimple);
932 int gimple_call_return_flags (const_gimple);
933 int gimple_call_arg_flags (const_gimple, unsigned);
934 void gimple_call_reset_alias_info (gimple);
935 bool gimple_assign_copy_p (gimple);
936 bool gimple_assign_ssa_name_copy_p (gimple);
937 bool gimple_assign_unary_nop_p (gimple);
938 void gimple_set_bb (gimple, struct basic_block_def *);
939 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
940 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
941 tree, tree, tree);
942 tree gimple_get_lhs (const_gimple);
943 void gimple_set_lhs (gimple, tree);
944 void gimple_replace_lhs (gimple, tree);
945 gimple gimple_copy (gimple);
946 void gimple_set_modified (gimple, bool);
947 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
948 gimple gimple_build_cond_from_tree (tree, tree, tree);
949 void gimple_cond_set_condition_from_tree (gimple, tree);
950 bool gimple_has_side_effects (const_gimple);
951 bool gimple_could_trap_p (gimple);
952 bool gimple_could_trap_p_1 (gimple, bool, bool);
953 bool gimple_assign_rhs_could_trap_p (gimple);
954 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
955 bool empty_body_p (gimple_seq);
956 unsigned get_gimple_rhs_num_ops (enum tree_code);
957 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
958 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
959 const char *gimple_decl_printable_name (tree, int);
960 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
961 void gimple_adjust_this_by_delta (gimple_stmt_iterator *, tree);
962 tree gimple_extract_devirt_binfo_from_cst (tree);
963 /* Returns true iff T is a valid GIMPLE statement. */
964 extern bool is_gimple_stmt (tree);
966 /* Returns true iff TYPE is a valid type for a scalar register variable. */
967 extern bool is_gimple_reg_type (tree);
968 /* Returns true iff T is a scalar register variable. */
969 extern bool is_gimple_reg (tree);
970 /* Returns true iff T is any sort of variable. */
971 extern bool is_gimple_variable (tree);
972 /* Returns true iff T is any sort of symbol. */
973 extern bool is_gimple_id (tree);
974 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
975 extern bool is_gimple_min_lval (tree);
976 /* Returns true iff T is something whose address can be taken. */
977 extern bool is_gimple_addressable (tree);
978 /* Returns true iff T is any valid GIMPLE lvalue. */
979 extern bool is_gimple_lvalue (tree);
981 /* Returns true iff T is a GIMPLE address. */
982 bool is_gimple_address (const_tree);
983 /* Returns true iff T is a GIMPLE invariant address. */
984 bool is_gimple_invariant_address (const_tree);
985 /* Returns true iff T is a GIMPLE invariant address at interprocedural
986 level. */
987 bool is_gimple_ip_invariant_address (const_tree);
988 /* Returns true iff T is a valid GIMPLE constant. */
989 bool is_gimple_constant (const_tree);
990 /* Returns true iff T is a GIMPLE restricted function invariant. */
991 extern bool is_gimple_min_invariant (const_tree);
992 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
993 extern bool is_gimple_ip_invariant (const_tree);
994 /* Returns true iff T is a GIMPLE rvalue. */
995 extern bool is_gimple_val (tree);
996 /* Returns true iff T is a GIMPLE asm statement input. */
997 extern bool is_gimple_asm_val (tree);
998 /* Returns true iff T is a valid address operand of a MEM_REF. */
999 bool is_gimple_mem_ref_addr (tree);
1000 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
1001 GIMPLE temporary, a renamed user variable, or something else,
1002 respectively. */
1003 extern bool is_gimple_reg_rhs (tree);
1004 extern bool is_gimple_mem_rhs (tree);
1006 /* Returns true iff T is a valid if-statement condition. */
1007 extern bool is_gimple_condexpr (tree);
1009 /* Returns true iff T is a variable that does not need to live in memory. */
1010 extern bool is_gimple_non_addressable (tree t);
1012 /* Returns true iff T is a valid call address expression. */
1013 extern bool is_gimple_call_addr (tree);
1015 extern void recalculate_side_effects (tree);
1016 extern bool gimple_compare_field_offset (tree, tree);
1017 extern tree gimple_register_type (tree);
1018 extern tree gimple_register_canonical_type (tree);
1019 extern void print_gimple_types_stats (void);
1020 extern void free_gimple_type_tables (void);
1021 extern tree gimple_unsigned_type (tree);
1022 extern tree gimple_signed_type (tree);
1023 extern alias_set_type gimple_get_alias_set (tree);
1024 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
1025 unsigned *);
1026 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
1027 bool (*)(gimple, tree, void *),
1028 bool (*)(gimple, tree, void *),
1029 bool (*)(gimple, tree, void *));
1030 extern bool walk_stmt_load_store_ops (gimple, void *,
1031 bool (*)(gimple, tree, void *),
1032 bool (*)(gimple, tree, void *));
1033 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1034 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
1035 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1037 /* In gimplify.c */
1038 extern tree create_tmp_var_raw (tree, const char *);
1039 extern tree create_tmp_var_name (const char *);
1040 extern tree create_tmp_var (tree, const char *);
1041 extern tree create_tmp_reg (tree, const char *);
1042 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
1043 extern tree get_formal_tmp_var (tree, gimple_seq *);
1044 extern void declare_vars (tree, gimple, bool);
1045 extern void annotate_all_with_location (gimple_seq, location_t);
1047 /* Validation of GIMPLE expressions. Note that these predicates only check
1048 the basic form of the expression, they don't recurse to make sure that
1049 underlying nodes are also of the right form. */
1050 typedef bool (*gimple_predicate)(tree);
1053 /* FIXME we should deduce this from the predicate. */
1054 enum fallback {
1055 fb_none = 0, /* Do not generate a temporary. */
1057 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
1058 gimplified expression. */
1060 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
1061 gimplified expression. */
1063 fb_mayfail = 4, /* Gimplification may fail. Error issued
1064 afterwards. */
1065 fb_either= fb_rvalue | fb_lvalue
1068 typedef int fallback_t;
1070 enum gimplify_status {
1071 GS_ERROR = -2, /* Something Bad Seen. */
1072 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
1073 GS_OK = 0, /* We did something, maybe more to do. */
1074 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1077 struct gimplify_ctx
1079 struct gimplify_ctx *prev_context;
1081 VEC(gimple,heap) *bind_expr_stack;
1082 tree temps;
1083 gimple_seq conditional_cleanups;
1084 tree exit_label;
1085 tree return_temp;
1087 VEC(tree,heap) *case_labels;
1088 /* The formal temporary table. Should this be persistent? */
1089 htab_t temp_htab;
1091 int conditions;
1092 bool save_stack;
1093 bool into_ssa;
1094 bool allow_rhs_cond_expr;
1095 bool in_cleanup_point_expr;
1098 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1099 bool (*) (tree), fallback_t);
1100 extern void gimplify_type_sizes (tree, gimple_seq *);
1101 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1102 extern bool gimplify_stmt (tree *, gimple_seq *);
1103 extern gimple gimplify_body (tree *, tree, bool);
1104 extern void push_gimplify_context (struct gimplify_ctx *);
1105 extern void pop_gimplify_context (gimple);
1106 extern void gimplify_and_add (tree, gimple_seq *);
1108 /* Miscellaneous helpers. */
1109 extern void gimple_add_tmp_var (tree);
1110 extern gimple gimple_current_bind_expr (void);
1111 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1112 extern tree voidify_wrapper_expr (tree, tree);
1113 extern tree build_and_jump (tree *);
1114 extern tree force_labels_r (tree *, int *, void *);
1115 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1116 gimple_seq *);
1117 struct gimplify_omp_ctx;
1118 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1119 extern tree gimple_boolify (tree);
1120 extern gimple_predicate rhs_predicate_for (tree);
1121 extern tree canonicalize_cond_expr_cond (tree);
1123 /* In omp-low.c. */
1124 extern tree omp_reduction_init (tree, tree);
1126 /* In trans-mem.c. */
1127 extern void diagnose_tm_safe_errors (tree);
1129 /* In tree-nested.c. */
1130 extern void lower_nested_functions (tree);
1131 extern void insert_field_into_struct (tree, tree);
1133 /* In gimplify.c. */
1134 extern void gimplify_function_tree (tree);
1136 /* In cfgexpand.c. */
1137 extern tree gimple_assign_rhs_to_tree (gimple);
1139 /* In builtins.c */
1140 extern bool validate_gimple_arglist (const_gimple, ...);
1142 /* In tree-ssa.c */
1143 extern bool tree_ssa_useless_type_conversion (tree);
1144 extern tree tree_ssa_strip_useless_type_conversions (tree);
1145 extern bool useless_type_conversion_p (tree, tree);
1146 extern bool types_compatible_p (tree, tree);
1148 /* Return the code for GIMPLE statement G. */
1150 static inline enum gimple_code
1151 gimple_code (const_gimple g)
1153 return g->gsbase.code;
1157 /* Return the GSS code used by a GIMPLE code. */
1159 static inline enum gimple_statement_structure_enum
1160 gss_for_code (enum gimple_code code)
1162 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1163 return gss_for_code_[code];
1167 /* Return which GSS code is used by GS. */
1169 static inline enum gimple_statement_structure_enum
1170 gimple_statement_structure (gimple gs)
1172 return gss_for_code (gimple_code (gs));
1176 /* Return true if statement G has sub-statements. This is only true for
1177 High GIMPLE statements. */
1179 static inline bool
1180 gimple_has_substatements (gimple g)
1182 switch (gimple_code (g))
1184 case GIMPLE_BIND:
1185 case GIMPLE_CATCH:
1186 case GIMPLE_EH_FILTER:
1187 case GIMPLE_EH_ELSE:
1188 case GIMPLE_TRY:
1189 case GIMPLE_OMP_FOR:
1190 case GIMPLE_OMP_MASTER:
1191 case GIMPLE_OMP_ORDERED:
1192 case GIMPLE_OMP_SECTION:
1193 case GIMPLE_OMP_PARALLEL:
1194 case GIMPLE_OMP_TASK:
1195 case GIMPLE_OMP_SECTIONS:
1196 case GIMPLE_OMP_SINGLE:
1197 case GIMPLE_OMP_CRITICAL:
1198 case GIMPLE_WITH_CLEANUP_EXPR:
1199 case GIMPLE_TRANSACTION:
1200 return true;
1202 default:
1203 return false;
1208 /* Return the basic block holding statement G. */
1210 static inline struct basic_block_def *
1211 gimple_bb (const_gimple g)
1213 return g->gsbase.bb;
1217 /* Return the lexical scope block holding statement G. */
1219 static inline tree
1220 gimple_block (const_gimple g)
1222 return g->gsbase.block;
1226 /* Set BLOCK to be the lexical scope block holding statement G. */
1228 static inline void
1229 gimple_set_block (gimple g, tree block)
1231 g->gsbase.block = block;
1235 /* Return location information for statement G. */
1237 static inline location_t
1238 gimple_location (const_gimple g)
1240 return g->gsbase.location;
1243 /* Return pointer to location information for statement G. */
1245 static inline const location_t *
1246 gimple_location_ptr (const_gimple g)
1248 return &g->gsbase.location;
1252 /* Set location information for statement G. */
1254 static inline void
1255 gimple_set_location (gimple g, location_t location)
1257 g->gsbase.location = location;
1261 /* Return true if G contains location information. */
1263 static inline bool
1264 gimple_has_location (const_gimple g)
1266 return gimple_location (g) != UNKNOWN_LOCATION;
1270 /* Return the file name of the location of STMT. */
1272 static inline const char *
1273 gimple_filename (const_gimple stmt)
1275 return LOCATION_FILE (gimple_location (stmt));
1279 /* Return the line number of the location of STMT. */
1281 static inline int
1282 gimple_lineno (const_gimple stmt)
1284 return LOCATION_LINE (gimple_location (stmt));
1288 /* Determine whether SEQ is a singleton. */
1290 static inline bool
1291 gimple_seq_singleton_p (gimple_seq seq)
1293 return ((gimple_seq_first (seq) != NULL)
1294 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1297 /* Return true if no warnings should be emitted for statement STMT. */
1299 static inline bool
1300 gimple_no_warning_p (const_gimple stmt)
1302 return stmt->gsbase.no_warning;
1305 /* Set the no_warning flag of STMT to NO_WARNING. */
1307 static inline void
1308 gimple_set_no_warning (gimple stmt, bool no_warning)
1310 stmt->gsbase.no_warning = (unsigned) no_warning;
1313 /* Set the visited status on statement STMT to VISITED_P. */
1315 static inline void
1316 gimple_set_visited (gimple stmt, bool visited_p)
1318 stmt->gsbase.visited = (unsigned) visited_p;
1322 /* Return the visited status for statement STMT. */
1324 static inline bool
1325 gimple_visited_p (gimple stmt)
1327 return stmt->gsbase.visited;
1331 /* Set pass local flag PLF on statement STMT to VAL_P. */
1333 static inline void
1334 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1336 if (val_p)
1337 stmt->gsbase.plf |= (unsigned int) plf;
1338 else
1339 stmt->gsbase.plf &= ~((unsigned int) plf);
1343 /* Return the value of pass local flag PLF on statement STMT. */
1345 static inline unsigned int
1346 gimple_plf (gimple stmt, enum plf_mask plf)
1348 return stmt->gsbase.plf & ((unsigned int) plf);
1352 /* Set the UID of statement. */
1354 static inline void
1355 gimple_set_uid (gimple g, unsigned uid)
1357 g->gsbase.uid = uid;
1361 /* Return the UID of statement. */
1363 static inline unsigned
1364 gimple_uid (const_gimple g)
1366 return g->gsbase.uid;
1370 /* Return true if GIMPLE statement G has register or memory operands. */
1372 static inline bool
1373 gimple_has_ops (const_gimple g)
1375 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1379 /* Return true if GIMPLE statement G has memory operands. */
1381 static inline bool
1382 gimple_has_mem_ops (const_gimple g)
1384 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1388 /* Return the set of DEF operands for statement G. */
1390 static inline struct def_optype_d *
1391 gimple_def_ops (const_gimple g)
1393 if (!gimple_has_ops (g))
1394 return NULL;
1395 return g->gsops.opbase.def_ops;
1399 /* Set DEF to be the set of DEF operands for statement G. */
1401 static inline void
1402 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1404 gcc_gimple_checking_assert (gimple_has_ops (g));
1405 g->gsops.opbase.def_ops = def;
1409 /* Return the set of USE operands for statement G. */
1411 static inline struct use_optype_d *
1412 gimple_use_ops (const_gimple g)
1414 if (!gimple_has_ops (g))
1415 return NULL;
1416 return g->gsops.opbase.use_ops;
1420 /* Set USE to be the set of USE operands for statement G. */
1422 static inline void
1423 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1425 gcc_gimple_checking_assert (gimple_has_ops (g));
1426 g->gsops.opbase.use_ops = use;
1430 /* Return the set of VUSE operand for statement G. */
1432 static inline use_operand_p
1433 gimple_vuse_op (const_gimple g)
1435 struct use_optype_d *ops;
1436 if (!gimple_has_mem_ops (g))
1437 return NULL_USE_OPERAND_P;
1438 ops = g->gsops.opbase.use_ops;
1439 if (ops
1440 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1441 return USE_OP_PTR (ops);
1442 return NULL_USE_OPERAND_P;
1445 /* Return the set of VDEF operand for statement G. */
1447 static inline def_operand_p
1448 gimple_vdef_op (const_gimple g)
1450 struct def_optype_d *ops;
1451 if (!gimple_has_mem_ops (g))
1452 return NULL_DEF_OPERAND_P;
1453 ops = g->gsops.opbase.def_ops;
1454 if (ops
1455 && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1456 return DEF_OP_PTR (ops);
1457 return NULL_DEF_OPERAND_P;
1461 /* Return the single VUSE operand of the statement G. */
1463 static inline tree
1464 gimple_vuse (const_gimple g)
1466 if (!gimple_has_mem_ops (g))
1467 return NULL_TREE;
1468 return g->gsmembase.vuse;
1471 /* Return the single VDEF operand of the statement G. */
1473 static inline tree
1474 gimple_vdef (const_gimple g)
1476 if (!gimple_has_mem_ops (g))
1477 return NULL_TREE;
1478 return g->gsmembase.vdef;
1481 /* Return the single VUSE operand of the statement G. */
1483 static inline tree *
1484 gimple_vuse_ptr (gimple g)
1486 if (!gimple_has_mem_ops (g))
1487 return NULL;
1488 return &g->gsmembase.vuse;
1491 /* Return the single VDEF operand of the statement G. */
1493 static inline tree *
1494 gimple_vdef_ptr (gimple g)
1496 if (!gimple_has_mem_ops (g))
1497 return NULL;
1498 return &g->gsmembase.vdef;
1501 /* Set the single VUSE operand of the statement G. */
1503 static inline void
1504 gimple_set_vuse (gimple g, tree vuse)
1506 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1507 g->gsmembase.vuse = vuse;
1510 /* Set the single VDEF operand of the statement G. */
1512 static inline void
1513 gimple_set_vdef (gimple g, tree vdef)
1515 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1516 g->gsmembase.vdef = vdef;
1520 /* Return true if statement G has operands and the modified field has
1521 been set. */
1523 static inline bool
1524 gimple_modified_p (const_gimple g)
1526 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1530 /* Return the tree code for the expression computed by STMT. This is
1531 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1532 GIMPLE_CALL, return CALL_EXPR as the expression code for
1533 consistency. This is useful when the caller needs to deal with the
1534 three kinds of computation that GIMPLE supports. */
1536 static inline enum tree_code
1537 gimple_expr_code (const_gimple stmt)
1539 enum gimple_code code = gimple_code (stmt);
1540 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1541 return (enum tree_code) stmt->gsbase.subcode;
1542 else
1544 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1545 return CALL_EXPR;
1550 /* Mark statement S as modified, and update it. */
1552 static inline void
1553 update_stmt (gimple s)
1555 if (gimple_has_ops (s))
1557 gimple_set_modified (s, true);
1558 update_stmt_operands (s);
1562 /* Update statement S if it has been optimized. */
1564 static inline void
1565 update_stmt_if_modified (gimple s)
1567 if (gimple_modified_p (s))
1568 update_stmt_operands (s);
1571 /* Return true if statement STMT contains volatile operands. */
1573 static inline bool
1574 gimple_has_volatile_ops (const_gimple stmt)
1576 if (gimple_has_mem_ops (stmt))
1577 return stmt->gsbase.has_volatile_ops;
1578 else
1579 return false;
1583 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1585 static inline void
1586 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1588 if (gimple_has_mem_ops (stmt))
1589 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1593 /* Return true if statement STMT may access memory. */
1595 static inline bool
1596 gimple_references_memory_p (gimple stmt)
1598 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1602 /* Return the subcode for OMP statement S. */
1604 static inline unsigned
1605 gimple_omp_subcode (const_gimple s)
1607 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1608 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1609 return s->gsbase.subcode;
1612 /* Set the subcode for OMP statement S to SUBCODE. */
1614 static inline void
1615 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1617 /* We only have 16 bits for the subcode. Assert that we are not
1618 overflowing it. */
1619 gcc_gimple_checking_assert (subcode < (1 << 16));
1620 s->gsbase.subcode = subcode;
1623 /* Set the nowait flag on OMP_RETURN statement S. */
1625 static inline void
1626 gimple_omp_return_set_nowait (gimple s)
1628 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1629 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1633 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1634 flag set. */
1636 static inline bool
1637 gimple_omp_return_nowait_p (const_gimple g)
1639 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1640 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1644 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1645 flag set. */
1647 static inline bool
1648 gimple_omp_section_last_p (const_gimple g)
1650 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1651 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1655 /* Set the GF_OMP_SECTION_LAST flag on G. */
1657 static inline void
1658 gimple_omp_section_set_last (gimple g)
1660 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1661 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1665 /* Return true if OMP parallel statement G has the
1666 GF_OMP_PARALLEL_COMBINED flag set. */
1668 static inline bool
1669 gimple_omp_parallel_combined_p (const_gimple g)
1671 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1672 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1676 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1677 value of COMBINED_P. */
1679 static inline void
1680 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1682 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1683 if (combined_p)
1684 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1685 else
1686 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1690 /* Return true if OMP atomic load/store statement G has the
1691 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1693 static inline bool
1694 gimple_omp_atomic_need_value_p (const_gimple g)
1696 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1697 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1698 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1702 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1704 static inline void
1705 gimple_omp_atomic_set_need_value (gimple g)
1707 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1708 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1709 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1713 /* Return the number of operands for statement GS. */
1715 static inline unsigned
1716 gimple_num_ops (const_gimple gs)
1718 return gs->gsbase.num_ops;
1722 /* Set the number of operands for statement GS. */
1724 static inline void
1725 gimple_set_num_ops (gimple gs, unsigned num_ops)
1727 gs->gsbase.num_ops = num_ops;
1731 /* Return the array of operands for statement GS. */
1733 static inline tree *
1734 gimple_ops (gimple gs)
1736 size_t off;
1738 /* All the tuples have their operand vector at the very bottom
1739 of the structure. Note that those structures that do not
1740 have an operand vector have a zero offset. */
1741 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1742 gcc_gimple_checking_assert (off != 0);
1744 return (tree *) ((char *) gs + off);
1748 /* Return operand I for statement GS. */
1750 static inline tree
1751 gimple_op (const_gimple gs, unsigned i)
1753 if (gimple_has_ops (gs))
1755 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1756 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1758 else
1759 return NULL_TREE;
1762 /* Return a pointer to operand I for statement GS. */
1764 static inline tree *
1765 gimple_op_ptr (const_gimple gs, unsigned i)
1767 if (gimple_has_ops (gs))
1769 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1770 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1772 else
1773 return NULL;
1776 /* Set operand I of statement GS to OP. */
1778 static inline void
1779 gimple_set_op (gimple gs, unsigned i, tree op)
1781 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1783 /* Note. It may be tempting to assert that OP matches
1784 is_gimple_operand, but that would be wrong. Different tuples
1785 accept slightly different sets of tree operands. Each caller
1786 should perform its own validation. */
1787 gimple_ops (gs)[i] = op;
1790 /* Return true if GS is a GIMPLE_ASSIGN. */
1792 static inline bool
1793 is_gimple_assign (const_gimple gs)
1795 return gimple_code (gs) == GIMPLE_ASSIGN;
1798 /* Determine if expression CODE is one of the valid expressions that can
1799 be used on the RHS of GIMPLE assignments. */
1801 static inline enum gimple_rhs_class
1802 get_gimple_rhs_class (enum tree_code code)
1804 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1807 /* Return the LHS of assignment statement GS. */
1809 static inline tree
1810 gimple_assign_lhs (const_gimple gs)
1812 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1813 return gimple_op (gs, 0);
1817 /* Return a pointer to the LHS of assignment statement GS. */
1819 static inline tree *
1820 gimple_assign_lhs_ptr (const_gimple gs)
1822 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1823 return gimple_op_ptr (gs, 0);
1827 /* Set LHS to be the LHS operand of assignment statement GS. */
1829 static inline void
1830 gimple_assign_set_lhs (gimple gs, tree lhs)
1832 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1833 gimple_set_op (gs, 0, lhs);
1835 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1836 SSA_NAME_DEF_STMT (lhs) = gs;
1840 /* Return the first operand on the RHS of assignment statement GS. */
1842 static inline tree
1843 gimple_assign_rhs1 (const_gimple gs)
1845 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1846 return gimple_op (gs, 1);
1850 /* Return a pointer to the first operand on the RHS of assignment
1851 statement GS. */
1853 static inline tree *
1854 gimple_assign_rhs1_ptr (const_gimple gs)
1856 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1857 return gimple_op_ptr (gs, 1);
1860 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1862 static inline void
1863 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1865 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1867 gimple_set_op (gs, 1, rhs);
1871 /* Return the second operand on the RHS of assignment statement GS.
1872 If GS does not have two operands, NULL is returned instead. */
1874 static inline tree
1875 gimple_assign_rhs2 (const_gimple gs)
1877 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1879 if (gimple_num_ops (gs) >= 3)
1880 return gimple_op (gs, 2);
1881 else
1882 return NULL_TREE;
1886 /* Return a pointer to the second operand on the RHS of assignment
1887 statement GS. */
1889 static inline tree *
1890 gimple_assign_rhs2_ptr (const_gimple gs)
1892 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1893 return gimple_op_ptr (gs, 2);
1897 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1899 static inline void
1900 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1902 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1904 gimple_set_op (gs, 2, rhs);
1907 /* Return the third operand on the RHS of assignment statement GS.
1908 If GS does not have two operands, NULL is returned instead. */
1910 static inline tree
1911 gimple_assign_rhs3 (const_gimple gs)
1913 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1915 if (gimple_num_ops (gs) >= 4)
1916 return gimple_op (gs, 3);
1917 else
1918 return NULL_TREE;
1921 /* Return a pointer to the third operand on the RHS of assignment
1922 statement GS. */
1924 static inline tree *
1925 gimple_assign_rhs3_ptr (const_gimple gs)
1927 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1928 return gimple_op_ptr (gs, 3);
1932 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1934 static inline void
1935 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1937 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1939 gimple_set_op (gs, 3, rhs);
1942 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1943 to see only a maximum of two operands. */
1945 static inline void
1946 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1947 tree op1, tree op2)
1949 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1952 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1953 to see only a maximum of two operands. */
1955 static inline void
1956 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1957 tree *op1)
1959 tree op2;
1960 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1961 gcc_assert (op2 == NULL_TREE);
1964 /* Returns true if GS is a nontemporal move. */
1966 static inline bool
1967 gimple_assign_nontemporal_move_p (const_gimple gs)
1969 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1970 return gs->gsbase.nontemporal_move;
1973 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1975 static inline void
1976 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1978 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1979 gs->gsbase.nontemporal_move = nontemporal;
1983 /* Return the code of the expression computed on the rhs of assignment
1984 statement GS. In case that the RHS is a single object, returns the
1985 tree code of the object. */
1987 static inline enum tree_code
1988 gimple_assign_rhs_code (const_gimple gs)
1990 enum tree_code code;
1991 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1993 code = (enum tree_code) gs->gsbase.subcode;
1994 /* While we initially set subcode to the TREE_CODE of the rhs for
1995 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
1996 in sync when we rewrite stmts into SSA form or do SSA propagations. */
1997 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1998 code = TREE_CODE (gimple_assign_rhs1 (gs));
2000 return code;
2004 /* Set CODE to be the code for the expression computed on the RHS of
2005 assignment S. */
2007 static inline void
2008 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2010 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2011 s->gsbase.subcode = code;
2015 /* Return the gimple rhs class of the code of the expression computed on
2016 the rhs of assignment statement GS.
2017 This will never return GIMPLE_INVALID_RHS. */
2019 static inline enum gimple_rhs_class
2020 gimple_assign_rhs_class (const_gimple gs)
2022 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2025 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2026 there is no operator associated with the assignment itself.
2027 Unlike gimple_assign_copy_p, this predicate returns true for
2028 any RHS operand, including those that perform an operation
2029 and do not have the semantics of a copy, such as COND_EXPR. */
2031 static inline bool
2032 gimple_assign_single_p (gimple gs)
2034 return (is_gimple_assign (gs)
2035 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2039 /* Return true if S is a type-cast assignment. */
2041 static inline bool
2042 gimple_assign_cast_p (gimple s)
2044 if (is_gimple_assign (s))
2046 enum tree_code sc = gimple_assign_rhs_code (s);
2047 return CONVERT_EXPR_CODE_P (sc)
2048 || sc == VIEW_CONVERT_EXPR
2049 || sc == FIX_TRUNC_EXPR;
2052 return false;
2055 /* Return true if S is a clobber statement. */
2057 static inline bool
2058 gimple_clobber_p (gimple s)
2060 return gimple_assign_single_p (s)
2061 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2064 /* Return true if GS is a GIMPLE_CALL. */
2066 static inline bool
2067 is_gimple_call (const_gimple gs)
2069 return gimple_code (gs) == GIMPLE_CALL;
2072 /* Return the LHS of call statement GS. */
2074 static inline tree
2075 gimple_call_lhs (const_gimple gs)
2077 GIMPLE_CHECK (gs, GIMPLE_CALL);
2078 return gimple_op (gs, 0);
2082 /* Return a pointer to the LHS of call statement GS. */
2084 static inline tree *
2085 gimple_call_lhs_ptr (const_gimple gs)
2087 GIMPLE_CHECK (gs, GIMPLE_CALL);
2088 return gimple_op_ptr (gs, 0);
2092 /* Set LHS to be the LHS operand of call statement GS. */
2094 static inline void
2095 gimple_call_set_lhs (gimple gs, tree lhs)
2097 GIMPLE_CHECK (gs, GIMPLE_CALL);
2098 gimple_set_op (gs, 0, lhs);
2099 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2100 SSA_NAME_DEF_STMT (lhs) = gs;
2104 /* Return true if call GS calls an internal-only function, as enumerated
2105 by internal_fn. */
2107 static inline bool
2108 gimple_call_internal_p (const_gimple gs)
2110 GIMPLE_CHECK (gs, GIMPLE_CALL);
2111 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2115 /* Return the target of internal call GS. */
2117 static inline enum internal_fn
2118 gimple_call_internal_fn (const_gimple gs)
2120 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2121 return gs->gimple_call.u.internal_fn;
2125 /* Return the function type of the function called by GS. */
2127 static inline tree
2128 gimple_call_fntype (const_gimple gs)
2130 GIMPLE_CHECK (gs, GIMPLE_CALL);
2131 if (gimple_call_internal_p (gs))
2132 return NULL_TREE;
2133 return gs->gimple_call.u.fntype;
2136 /* Set the type of the function called by GS to FNTYPE. */
2138 static inline void
2139 gimple_call_set_fntype (gimple gs, tree fntype)
2141 GIMPLE_CHECK (gs, GIMPLE_CALL);
2142 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2143 gs->gimple_call.u.fntype = fntype;
2147 /* Return the tree node representing the function called by call
2148 statement GS. */
2150 static inline tree
2151 gimple_call_fn (const_gimple gs)
2153 GIMPLE_CHECK (gs, GIMPLE_CALL);
2154 return gimple_op (gs, 1);
2157 /* Return a pointer to the tree node representing the function called by call
2158 statement GS. */
2160 static inline tree *
2161 gimple_call_fn_ptr (const_gimple gs)
2163 GIMPLE_CHECK (gs, GIMPLE_CALL);
2164 return gimple_op_ptr (gs, 1);
2168 /* Set FN to be the function called by call statement GS. */
2170 static inline void
2171 gimple_call_set_fn (gimple gs, tree fn)
2173 GIMPLE_CHECK (gs, GIMPLE_CALL);
2174 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2175 gimple_set_op (gs, 1, fn);
2179 /* Set FNDECL to be the function called by call statement GS. */
2181 static inline void
2182 gimple_call_set_fndecl (gimple gs, tree decl)
2184 GIMPLE_CHECK (gs, GIMPLE_CALL);
2185 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2186 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2190 /* Set internal function FN to be the function called by call statement GS. */
2192 static inline void
2193 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2195 GIMPLE_CHECK (gs, GIMPLE_CALL);
2196 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2197 gs->gimple_call.u.internal_fn = fn;
2201 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2202 associated with the callee if known. Otherwise return NULL_TREE. */
2204 static inline tree
2205 gimple_call_addr_fndecl (const_tree fn)
2207 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2209 tree fndecl = TREE_OPERAND (fn, 0);
2210 if (TREE_CODE (fndecl) == MEM_REF
2211 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2212 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2213 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2214 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2215 return fndecl;
2217 return NULL_TREE;
2220 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2221 Otherwise return NULL. This function is analogous to
2222 get_callee_fndecl in tree land. */
2224 static inline tree
2225 gimple_call_fndecl (const_gimple gs)
2227 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2231 /* Return the type returned by call statement GS. */
2233 static inline tree
2234 gimple_call_return_type (const_gimple gs)
2236 tree type = gimple_call_fntype (gs);
2238 if (type == NULL_TREE)
2239 return TREE_TYPE (gimple_call_lhs (gs));
2241 /* The type returned by a function is the type of its
2242 function type. */
2243 return TREE_TYPE (type);
2247 /* Return the static chain for call statement GS. */
2249 static inline tree
2250 gimple_call_chain (const_gimple gs)
2252 GIMPLE_CHECK (gs, GIMPLE_CALL);
2253 return gimple_op (gs, 2);
2257 /* Return a pointer to the static chain for call statement GS. */
2259 static inline tree *
2260 gimple_call_chain_ptr (const_gimple gs)
2262 GIMPLE_CHECK (gs, GIMPLE_CALL);
2263 return gimple_op_ptr (gs, 2);
2266 /* Set CHAIN to be the static chain for call statement GS. */
2268 static inline void
2269 gimple_call_set_chain (gimple gs, tree chain)
2271 GIMPLE_CHECK (gs, GIMPLE_CALL);
2273 gimple_set_op (gs, 2, chain);
2277 /* Return the number of arguments used by call statement GS. */
2279 static inline unsigned
2280 gimple_call_num_args (const_gimple gs)
2282 unsigned num_ops;
2283 GIMPLE_CHECK (gs, GIMPLE_CALL);
2284 num_ops = gimple_num_ops (gs);
2285 return num_ops - 3;
2289 /* Return the argument at position INDEX for call statement GS. */
2291 static inline tree
2292 gimple_call_arg (const_gimple gs, unsigned index)
2294 GIMPLE_CHECK (gs, GIMPLE_CALL);
2295 return gimple_op (gs, index + 3);
2299 /* Return a pointer to the argument at position INDEX for call
2300 statement GS. */
2302 static inline tree *
2303 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2305 GIMPLE_CHECK (gs, GIMPLE_CALL);
2306 return gimple_op_ptr (gs, index + 3);
2310 /* Set ARG to be the argument at position INDEX for call statement GS. */
2312 static inline void
2313 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2315 GIMPLE_CHECK (gs, GIMPLE_CALL);
2316 gimple_set_op (gs, index + 3, arg);
2320 /* If TAIL_P is true, mark call statement S as being a tail call
2321 (i.e., a call just before the exit of a function). These calls are
2322 candidate for tail call optimization. */
2324 static inline void
2325 gimple_call_set_tail (gimple s, bool tail_p)
2327 GIMPLE_CHECK (s, GIMPLE_CALL);
2328 if (tail_p)
2329 s->gsbase.subcode |= GF_CALL_TAILCALL;
2330 else
2331 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2335 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2337 static inline bool
2338 gimple_call_tail_p (gimple s)
2340 GIMPLE_CHECK (s, GIMPLE_CALL);
2341 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2345 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2346 slot optimization. This transformation uses the target of the call
2347 expansion as the return slot for calls that return in memory. */
2349 static inline void
2350 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2352 GIMPLE_CHECK (s, GIMPLE_CALL);
2353 if (return_slot_opt_p)
2354 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2355 else
2356 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2360 /* Return true if S is marked for return slot optimization. */
2362 static inline bool
2363 gimple_call_return_slot_opt_p (gimple s)
2365 GIMPLE_CHECK (s, GIMPLE_CALL);
2366 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2370 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2371 thunk to the thunked-to function. */
2373 static inline void
2374 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2376 GIMPLE_CHECK (s, GIMPLE_CALL);
2377 if (from_thunk_p)
2378 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2379 else
2380 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2384 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2386 static inline bool
2387 gimple_call_from_thunk_p (gimple s)
2389 GIMPLE_CHECK (s, GIMPLE_CALL);
2390 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2394 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2395 argument pack in its argument list. */
2397 static inline void
2398 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2400 GIMPLE_CHECK (s, GIMPLE_CALL);
2401 if (pass_arg_pack_p)
2402 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2403 else
2404 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2408 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2409 argument pack in its argument list. */
2411 static inline bool
2412 gimple_call_va_arg_pack_p (gimple s)
2414 GIMPLE_CHECK (s, GIMPLE_CALL);
2415 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2419 /* Return true if S is a noreturn call. */
2421 static inline bool
2422 gimple_call_noreturn_p (gimple s)
2424 GIMPLE_CHECK (s, GIMPLE_CALL);
2425 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2429 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2430 even if the called function can throw in other cases. */
2432 static inline void
2433 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2435 GIMPLE_CHECK (s, GIMPLE_CALL);
2436 if (nothrow_p)
2437 s->gsbase.subcode |= GF_CALL_NOTHROW;
2438 else
2439 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2442 /* Return true if S is a nothrow call. */
2444 static inline bool
2445 gimple_call_nothrow_p (gimple s)
2447 GIMPLE_CHECK (s, GIMPLE_CALL);
2448 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2451 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2452 is known to be emitted for VLA objects. Those are wrapped by
2453 stack_save/stack_restore calls and hence can't lead to unbounded
2454 stack growth even when they occur in loops. */
2456 static inline void
2457 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2459 GIMPLE_CHECK (s, GIMPLE_CALL);
2460 if (for_var)
2461 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2462 else
2463 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2466 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2468 static inline bool
2469 gimple_call_alloca_for_var_p (gimple s)
2471 GIMPLE_CHECK (s, GIMPLE_CALL);
2472 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2475 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2477 static inline void
2478 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2480 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2481 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2482 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2486 /* Return a pointer to the points-to solution for the set of call-used
2487 variables of the call CALL. */
2489 static inline struct pt_solution *
2490 gimple_call_use_set (gimple call)
2492 GIMPLE_CHECK (call, GIMPLE_CALL);
2493 return &call->gimple_call.call_used;
2497 /* Return a pointer to the points-to solution for the set of call-used
2498 variables of the call CALL. */
2500 static inline struct pt_solution *
2501 gimple_call_clobber_set (gimple call)
2503 GIMPLE_CHECK (call, GIMPLE_CALL);
2504 return &call->gimple_call.call_clobbered;
2508 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2509 non-NULL lhs. */
2511 static inline bool
2512 gimple_has_lhs (gimple stmt)
2514 return (is_gimple_assign (stmt)
2515 || (is_gimple_call (stmt)
2516 && gimple_call_lhs (stmt) != NULL_TREE));
2520 /* Return the code of the predicate computed by conditional statement GS. */
2522 static inline enum tree_code
2523 gimple_cond_code (const_gimple gs)
2525 GIMPLE_CHECK (gs, GIMPLE_COND);
2526 return (enum tree_code) gs->gsbase.subcode;
2530 /* Set CODE to be the predicate code for the conditional statement GS. */
2532 static inline void
2533 gimple_cond_set_code (gimple gs, enum tree_code code)
2535 GIMPLE_CHECK (gs, GIMPLE_COND);
2536 gs->gsbase.subcode = code;
2540 /* Return the LHS of the predicate computed by conditional statement GS. */
2542 static inline tree
2543 gimple_cond_lhs (const_gimple gs)
2545 GIMPLE_CHECK (gs, GIMPLE_COND);
2546 return gimple_op (gs, 0);
2549 /* Return the pointer to the LHS of the predicate computed by conditional
2550 statement GS. */
2552 static inline tree *
2553 gimple_cond_lhs_ptr (const_gimple gs)
2555 GIMPLE_CHECK (gs, GIMPLE_COND);
2556 return gimple_op_ptr (gs, 0);
2559 /* Set LHS to be the LHS operand of the predicate computed by
2560 conditional statement GS. */
2562 static inline void
2563 gimple_cond_set_lhs (gimple gs, tree lhs)
2565 GIMPLE_CHECK (gs, GIMPLE_COND);
2566 gimple_set_op (gs, 0, lhs);
2570 /* Return the RHS operand of the predicate computed by conditional GS. */
2572 static inline tree
2573 gimple_cond_rhs (const_gimple gs)
2575 GIMPLE_CHECK (gs, GIMPLE_COND);
2576 return gimple_op (gs, 1);
2579 /* Return the pointer to the RHS operand of the predicate computed by
2580 conditional GS. */
2582 static inline tree *
2583 gimple_cond_rhs_ptr (const_gimple gs)
2585 GIMPLE_CHECK (gs, GIMPLE_COND);
2586 return gimple_op_ptr (gs, 1);
2590 /* Set RHS to be the RHS operand of the predicate computed by
2591 conditional statement GS. */
2593 static inline void
2594 gimple_cond_set_rhs (gimple gs, tree rhs)
2596 GIMPLE_CHECK (gs, GIMPLE_COND);
2597 gimple_set_op (gs, 1, rhs);
2601 /* Return the label used by conditional statement GS when its
2602 predicate evaluates to true. */
2604 static inline tree
2605 gimple_cond_true_label (const_gimple gs)
2607 GIMPLE_CHECK (gs, GIMPLE_COND);
2608 return gimple_op (gs, 2);
2612 /* Set LABEL to be the label used by conditional statement GS when its
2613 predicate evaluates to true. */
2615 static inline void
2616 gimple_cond_set_true_label (gimple gs, tree label)
2618 GIMPLE_CHECK (gs, GIMPLE_COND);
2619 gimple_set_op (gs, 2, label);
2623 /* Set LABEL to be the label used by conditional statement GS when its
2624 predicate evaluates to false. */
2626 static inline void
2627 gimple_cond_set_false_label (gimple gs, tree label)
2629 GIMPLE_CHECK (gs, GIMPLE_COND);
2630 gimple_set_op (gs, 3, label);
2634 /* Return the label used by conditional statement GS when its
2635 predicate evaluates to false. */
2637 static inline tree
2638 gimple_cond_false_label (const_gimple gs)
2640 GIMPLE_CHECK (gs, GIMPLE_COND);
2641 return gimple_op (gs, 3);
2645 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2647 static inline void
2648 gimple_cond_make_false (gimple gs)
2650 gimple_cond_set_lhs (gs, boolean_true_node);
2651 gimple_cond_set_rhs (gs, boolean_false_node);
2652 gs->gsbase.subcode = EQ_EXPR;
2656 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2658 static inline void
2659 gimple_cond_make_true (gimple gs)
2661 gimple_cond_set_lhs (gs, boolean_true_node);
2662 gimple_cond_set_rhs (gs, boolean_true_node);
2663 gs->gsbase.subcode = EQ_EXPR;
2666 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2667 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2669 static inline bool
2670 gimple_cond_true_p (const_gimple gs)
2672 tree lhs = gimple_cond_lhs (gs);
2673 tree rhs = gimple_cond_rhs (gs);
2674 enum tree_code code = gimple_cond_code (gs);
2676 if (lhs != boolean_true_node && lhs != boolean_false_node)
2677 return false;
2679 if (rhs != boolean_true_node && rhs != boolean_false_node)
2680 return false;
2682 if (code == NE_EXPR && lhs != rhs)
2683 return true;
2685 if (code == EQ_EXPR && lhs == rhs)
2686 return true;
2688 return false;
2691 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2692 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2694 static inline bool
2695 gimple_cond_false_p (const_gimple gs)
2697 tree lhs = gimple_cond_lhs (gs);
2698 tree rhs = gimple_cond_rhs (gs);
2699 enum tree_code code = gimple_cond_code (gs);
2701 if (lhs != boolean_true_node && lhs != boolean_false_node)
2702 return false;
2704 if (rhs != boolean_true_node && rhs != boolean_false_node)
2705 return false;
2707 if (code == NE_EXPR && lhs == rhs)
2708 return true;
2710 if (code == EQ_EXPR && lhs != rhs)
2711 return true;
2713 return false;
2716 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2717 'if (var == 1)' */
2719 static inline bool
2720 gimple_cond_single_var_p (gimple gs)
2722 if (gimple_cond_code (gs) == NE_EXPR
2723 && gimple_cond_rhs (gs) == boolean_false_node)
2724 return true;
2726 if (gimple_cond_code (gs) == EQ_EXPR
2727 && gimple_cond_rhs (gs) == boolean_true_node)
2728 return true;
2730 return false;
2733 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2735 static inline void
2736 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2738 gimple_cond_set_code (stmt, code);
2739 gimple_cond_set_lhs (stmt, lhs);
2740 gimple_cond_set_rhs (stmt, rhs);
2743 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2745 static inline tree
2746 gimple_label_label (const_gimple gs)
2748 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2749 return gimple_op (gs, 0);
2753 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2754 GS. */
2756 static inline void
2757 gimple_label_set_label (gimple gs, tree label)
2759 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2760 gimple_set_op (gs, 0, label);
2764 /* Return the destination of the unconditional jump GS. */
2766 static inline tree
2767 gimple_goto_dest (const_gimple gs)
2769 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2770 return gimple_op (gs, 0);
2774 /* Set DEST to be the destination of the unconditonal jump GS. */
2776 static inline void
2777 gimple_goto_set_dest (gimple gs, tree dest)
2779 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2780 gimple_set_op (gs, 0, dest);
2784 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2786 static inline tree
2787 gimple_bind_vars (const_gimple gs)
2789 GIMPLE_CHECK (gs, GIMPLE_BIND);
2790 return gs->gimple_bind.vars;
2794 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2795 statement GS. */
2797 static inline void
2798 gimple_bind_set_vars (gimple gs, tree vars)
2800 GIMPLE_CHECK (gs, GIMPLE_BIND);
2801 gs->gimple_bind.vars = vars;
2805 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2806 statement GS. */
2808 static inline void
2809 gimple_bind_append_vars (gimple gs, tree vars)
2811 GIMPLE_CHECK (gs, GIMPLE_BIND);
2812 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2816 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2818 static inline gimple_seq
2819 gimple_bind_body (gimple gs)
2821 GIMPLE_CHECK (gs, GIMPLE_BIND);
2822 return gs->gimple_bind.body;
2826 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2827 statement GS. */
2829 static inline void
2830 gimple_bind_set_body (gimple gs, gimple_seq seq)
2832 GIMPLE_CHECK (gs, GIMPLE_BIND);
2833 gs->gimple_bind.body = seq;
2837 /* Append a statement to the end of a GIMPLE_BIND's body. */
2839 static inline void
2840 gimple_bind_add_stmt (gimple gs, gimple stmt)
2842 GIMPLE_CHECK (gs, GIMPLE_BIND);
2843 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2847 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2849 static inline void
2850 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2852 GIMPLE_CHECK (gs, GIMPLE_BIND);
2853 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2857 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2858 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2860 static inline tree
2861 gimple_bind_block (const_gimple gs)
2863 GIMPLE_CHECK (gs, GIMPLE_BIND);
2864 return gs->gimple_bind.block;
2868 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2869 statement GS. */
2871 static inline void
2872 gimple_bind_set_block (gimple gs, tree block)
2874 GIMPLE_CHECK (gs, GIMPLE_BIND);
2875 gcc_gimple_checking_assert (block == NULL_TREE
2876 || TREE_CODE (block) == BLOCK);
2877 gs->gimple_bind.block = block;
2881 /* Return the number of input operands for GIMPLE_ASM GS. */
2883 static inline unsigned
2884 gimple_asm_ninputs (const_gimple gs)
2886 GIMPLE_CHECK (gs, GIMPLE_ASM);
2887 return gs->gimple_asm.ni;
2891 /* Return the number of output operands for GIMPLE_ASM GS. */
2893 static inline unsigned
2894 gimple_asm_noutputs (const_gimple gs)
2896 GIMPLE_CHECK (gs, GIMPLE_ASM);
2897 return gs->gimple_asm.no;
2901 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2903 static inline unsigned
2904 gimple_asm_nclobbers (const_gimple gs)
2906 GIMPLE_CHECK (gs, GIMPLE_ASM);
2907 return gs->gimple_asm.nc;
2910 /* Return the number of label operands for GIMPLE_ASM GS. */
2912 static inline unsigned
2913 gimple_asm_nlabels (const_gimple gs)
2915 GIMPLE_CHECK (gs, GIMPLE_ASM);
2916 return gs->gimple_asm.nl;
2919 /* Return input operand INDEX of GIMPLE_ASM GS. */
2921 static inline tree
2922 gimple_asm_input_op (const_gimple gs, unsigned index)
2924 GIMPLE_CHECK (gs, GIMPLE_ASM);
2925 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2926 return gimple_op (gs, index);
2929 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2931 static inline tree *
2932 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2934 GIMPLE_CHECK (gs, GIMPLE_ASM);
2935 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2936 return gimple_op_ptr (gs, index);
2940 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2942 static inline void
2943 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2945 GIMPLE_CHECK (gs, GIMPLE_ASM);
2946 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
2947 && TREE_CODE (in_op) == TREE_LIST);
2948 gimple_set_op (gs, index, in_op);
2952 /* Return output operand INDEX of GIMPLE_ASM GS. */
2954 static inline tree
2955 gimple_asm_output_op (const_gimple gs, unsigned index)
2957 GIMPLE_CHECK (gs, GIMPLE_ASM);
2958 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2959 return gimple_op (gs, index + gs->gimple_asm.ni);
2962 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2964 static inline tree *
2965 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2967 GIMPLE_CHECK (gs, GIMPLE_ASM);
2968 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2969 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2973 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2975 static inline void
2976 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2978 GIMPLE_CHECK (gs, GIMPLE_ASM);
2979 gcc_gimple_checking_assert (index <= gs->gimple_asm.no
2980 && TREE_CODE (out_op) == TREE_LIST);
2981 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2985 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2987 static inline tree
2988 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2990 GIMPLE_CHECK (gs, GIMPLE_ASM);
2991 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
2992 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2996 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2998 static inline void
2999 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3001 GIMPLE_CHECK (gs, GIMPLE_ASM);
3002 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
3003 && TREE_CODE (clobber_op) == TREE_LIST);
3004 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3007 /* Return label operand INDEX of GIMPLE_ASM GS. */
3009 static inline tree
3010 gimple_asm_label_op (const_gimple gs, unsigned index)
3012 GIMPLE_CHECK (gs, GIMPLE_ASM);
3013 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
3014 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3017 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3019 static inline void
3020 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3022 GIMPLE_CHECK (gs, GIMPLE_ASM);
3023 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
3024 && TREE_CODE (label_op) == TREE_LIST);
3025 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3028 /* Return the string representing the assembly instruction in
3029 GIMPLE_ASM GS. */
3031 static inline const char *
3032 gimple_asm_string (const_gimple gs)
3034 GIMPLE_CHECK (gs, GIMPLE_ASM);
3035 return gs->gimple_asm.string;
3039 /* Return true if GS is an asm statement marked volatile. */
3041 static inline bool
3042 gimple_asm_volatile_p (const_gimple gs)
3044 GIMPLE_CHECK (gs, GIMPLE_ASM);
3045 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3049 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3051 static inline void
3052 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3054 GIMPLE_CHECK (gs, GIMPLE_ASM);
3055 if (volatile_p)
3056 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3057 else
3058 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3062 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3064 static inline void
3065 gimple_asm_set_input (gimple gs, bool input_p)
3067 GIMPLE_CHECK (gs, GIMPLE_ASM);
3068 if (input_p)
3069 gs->gsbase.subcode |= GF_ASM_INPUT;
3070 else
3071 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3075 /* Return true if asm GS is an ASM_INPUT. */
3077 static inline bool
3078 gimple_asm_input_p (const_gimple gs)
3080 GIMPLE_CHECK (gs, GIMPLE_ASM);
3081 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3085 /* Return the types handled by GIMPLE_CATCH statement GS. */
3087 static inline tree
3088 gimple_catch_types (const_gimple gs)
3090 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3091 return gs->gimple_catch.types;
3095 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3097 static inline tree *
3098 gimple_catch_types_ptr (gimple gs)
3100 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3101 return &gs->gimple_catch.types;
3105 /* Return the GIMPLE sequence representing the body of the handler of
3106 GIMPLE_CATCH statement GS. */
3108 static inline gimple_seq
3109 gimple_catch_handler (gimple gs)
3111 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3112 return gs->gimple_catch.handler;
3116 /* Return a pointer to the GIMPLE sequence representing the body of
3117 the handler of GIMPLE_CATCH statement GS. */
3119 static inline gimple_seq *
3120 gimple_catch_handler_ptr (gimple gs)
3122 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3123 return &gs->gimple_catch.handler;
3127 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3129 static inline void
3130 gimple_catch_set_types (gimple gs, tree t)
3132 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3133 gs->gimple_catch.types = t;
3137 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3139 static inline void
3140 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3142 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3143 gs->gimple_catch.handler = handler;
3147 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3149 static inline tree
3150 gimple_eh_filter_types (const_gimple gs)
3152 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3153 return gs->gimple_eh_filter.types;
3157 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3158 GS. */
3160 static inline tree *
3161 gimple_eh_filter_types_ptr (gimple gs)
3163 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3164 return &gs->gimple_eh_filter.types;
3168 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3169 statement fails. */
3171 static inline gimple_seq
3172 gimple_eh_filter_failure (gimple gs)
3174 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3175 return gs->gimple_eh_filter.failure;
3179 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3181 static inline void
3182 gimple_eh_filter_set_types (gimple gs, tree types)
3184 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3185 gs->gimple_eh_filter.types = types;
3189 /* Set FAILURE to be the sequence of statements to execute on failure
3190 for GIMPLE_EH_FILTER GS. */
3192 static inline void
3193 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3195 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3196 gs->gimple_eh_filter.failure = failure;
3199 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3201 static inline tree
3202 gimple_eh_must_not_throw_fndecl (gimple gs)
3204 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3205 return gs->gimple_eh_mnt.fndecl;
3208 /* Set the function decl to be called by GS to DECL. */
3210 static inline void
3211 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3213 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3214 gs->gimple_eh_mnt.fndecl = decl;
3217 /* GIMPLE_EH_ELSE accessors. */
3219 static inline gimple_seq
3220 gimple_eh_else_n_body (gimple gs)
3222 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3223 return gs->gimple_eh_else.n_body;
3226 static inline gimple_seq
3227 gimple_eh_else_e_body (gimple gs)
3229 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3230 return gs->gimple_eh_else.e_body;
3233 static inline void
3234 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3236 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3237 gs->gimple_eh_else.n_body = seq;
3240 static inline void
3241 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3243 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3244 gs->gimple_eh_else.e_body = seq;
3247 /* GIMPLE_TRY accessors. */
3249 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3250 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3252 static inline enum gimple_try_flags
3253 gimple_try_kind (const_gimple gs)
3255 GIMPLE_CHECK (gs, GIMPLE_TRY);
3256 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3260 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3262 static inline void
3263 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3265 GIMPLE_CHECK (gs, GIMPLE_TRY);
3266 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3267 || kind == GIMPLE_TRY_FINALLY);
3268 if (gimple_try_kind (gs) != kind)
3269 gs->gsbase.subcode = (unsigned int) kind;
3273 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3275 static inline bool
3276 gimple_try_catch_is_cleanup (const_gimple gs)
3278 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3279 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3283 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3285 static inline gimple_seq
3286 gimple_try_eval (gimple gs)
3288 GIMPLE_CHECK (gs, GIMPLE_TRY);
3289 return gs->gimple_try.eval;
3293 /* Return the sequence of statements used as the cleanup body for
3294 GIMPLE_TRY GS. */
3296 static inline gimple_seq
3297 gimple_try_cleanup (gimple gs)
3299 GIMPLE_CHECK (gs, GIMPLE_TRY);
3300 return gs->gimple_try.cleanup;
3304 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3306 static inline void
3307 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3309 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3310 if (catch_is_cleanup)
3311 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3312 else
3313 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3317 /* Set EVAL to be the sequence of statements to use as the body for
3318 GIMPLE_TRY GS. */
3320 static inline void
3321 gimple_try_set_eval (gimple gs, gimple_seq eval)
3323 GIMPLE_CHECK (gs, GIMPLE_TRY);
3324 gs->gimple_try.eval = eval;
3328 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3329 body for GIMPLE_TRY GS. */
3331 static inline void
3332 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3334 GIMPLE_CHECK (gs, GIMPLE_TRY);
3335 gs->gimple_try.cleanup = cleanup;
3339 /* Return the cleanup sequence for cleanup statement GS. */
3341 static inline gimple_seq
3342 gimple_wce_cleanup (gimple gs)
3344 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3345 return gs->gimple_wce.cleanup;
3349 /* Set CLEANUP to be the cleanup sequence for GS. */
3351 static inline void
3352 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3354 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3355 gs->gimple_wce.cleanup = cleanup;
3359 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3361 static inline bool
3362 gimple_wce_cleanup_eh_only (const_gimple gs)
3364 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3365 return gs->gsbase.subcode != 0;
3369 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3371 static inline void
3372 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3374 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3375 gs->gsbase.subcode = (unsigned int) eh_only_p;
3379 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3381 static inline unsigned
3382 gimple_phi_capacity (const_gimple gs)
3384 GIMPLE_CHECK (gs, GIMPLE_PHI);
3385 return gs->gimple_phi.capacity;
3389 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3390 be exactly the number of incoming edges for the basic block holding
3391 GS. */
3393 static inline unsigned
3394 gimple_phi_num_args (const_gimple gs)
3396 GIMPLE_CHECK (gs, GIMPLE_PHI);
3397 return gs->gimple_phi.nargs;
3401 /* Return the SSA name created by GIMPLE_PHI GS. */
3403 static inline tree
3404 gimple_phi_result (const_gimple gs)
3406 GIMPLE_CHECK (gs, GIMPLE_PHI);
3407 return gs->gimple_phi.result;
3410 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3412 static inline tree *
3413 gimple_phi_result_ptr (gimple gs)
3415 GIMPLE_CHECK (gs, GIMPLE_PHI);
3416 return &gs->gimple_phi.result;
3419 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3421 static inline void
3422 gimple_phi_set_result (gimple gs, tree result)
3424 GIMPLE_CHECK (gs, GIMPLE_PHI);
3425 gs->gimple_phi.result = result;
3429 /* Return the PHI argument corresponding to incoming edge INDEX for
3430 GIMPLE_PHI GS. */
3432 static inline struct phi_arg_d *
3433 gimple_phi_arg (gimple gs, unsigned index)
3435 GIMPLE_CHECK (gs, GIMPLE_PHI);
3436 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3437 return &(gs->gimple_phi.args[index]);
3440 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3441 for GIMPLE_PHI GS. */
3443 static inline void
3444 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3446 GIMPLE_CHECK (gs, GIMPLE_PHI);
3447 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3448 gs->gimple_phi.args[index] = *phiarg;
3451 /* Return the region number for GIMPLE_RESX GS. */
3453 static inline int
3454 gimple_resx_region (const_gimple gs)
3456 GIMPLE_CHECK (gs, GIMPLE_RESX);
3457 return gs->gimple_eh_ctrl.region;
3460 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3462 static inline void
3463 gimple_resx_set_region (gimple gs, int region)
3465 GIMPLE_CHECK (gs, GIMPLE_RESX);
3466 gs->gimple_eh_ctrl.region = region;
3469 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3471 static inline int
3472 gimple_eh_dispatch_region (const_gimple gs)
3474 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3475 return gs->gimple_eh_ctrl.region;
3478 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3480 static inline void
3481 gimple_eh_dispatch_set_region (gimple gs, int region)
3483 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3484 gs->gimple_eh_ctrl.region = region;
3487 /* Return the number of labels associated with the switch statement GS. */
3489 static inline unsigned
3490 gimple_switch_num_labels (const_gimple gs)
3492 unsigned num_ops;
3493 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3494 num_ops = gimple_num_ops (gs);
3495 gcc_gimple_checking_assert (num_ops > 1);
3496 return num_ops - 1;
3500 /* Set NLABELS to be the number of labels for the switch statement GS. */
3502 static inline void
3503 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3505 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3506 gimple_set_num_ops (g, nlabels + 1);
3510 /* Return the index variable used by the switch statement GS. */
3512 static inline tree
3513 gimple_switch_index (const_gimple gs)
3515 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3516 return gimple_op (gs, 0);
3520 /* Return a pointer to the index variable for the switch statement GS. */
3522 static inline tree *
3523 gimple_switch_index_ptr (const_gimple gs)
3525 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3526 return gimple_op_ptr (gs, 0);
3530 /* Set INDEX to be the index variable for switch statement GS. */
3532 static inline void
3533 gimple_switch_set_index (gimple gs, tree index)
3535 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3536 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3537 gimple_set_op (gs, 0, index);
3541 /* Return the label numbered INDEX. The default label is 0, followed by any
3542 labels in a switch statement. */
3544 static inline tree
3545 gimple_switch_label (const_gimple gs, unsigned index)
3547 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3548 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3549 return gimple_op (gs, index + 1);
3552 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3554 static inline void
3555 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3557 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3558 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3559 && (label == NULL_TREE
3560 || TREE_CODE (label) == CASE_LABEL_EXPR));
3561 gimple_set_op (gs, index + 1, label);
3564 /* Return the default label for a switch statement. */
3566 static inline tree
3567 gimple_switch_default_label (const_gimple gs)
3569 return gimple_switch_label (gs, 0);
3572 /* Set the default label for a switch statement. */
3574 static inline void
3575 gimple_switch_set_default_label (gimple gs, tree label)
3577 gimple_switch_set_label (gs, 0, label);
3580 /* Return true if GS is a GIMPLE_DEBUG statement. */
3582 static inline bool
3583 is_gimple_debug (const_gimple gs)
3585 return gimple_code (gs) == GIMPLE_DEBUG;
3588 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3590 static inline bool
3591 gimple_debug_bind_p (const_gimple s)
3593 if (is_gimple_debug (s))
3594 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3596 return false;
3599 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3601 static inline tree
3602 gimple_debug_bind_get_var (gimple dbg)
3604 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3605 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3606 return gimple_op (dbg, 0);
3609 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3610 statement. */
3612 static inline tree
3613 gimple_debug_bind_get_value (gimple dbg)
3615 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3616 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3617 return gimple_op (dbg, 1);
3620 /* Return a pointer to the value bound to the variable in a
3621 GIMPLE_DEBUG bind statement. */
3623 static inline tree *
3624 gimple_debug_bind_get_value_ptr (gimple dbg)
3626 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3627 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3628 return gimple_op_ptr (dbg, 1);
3631 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3633 static inline void
3634 gimple_debug_bind_set_var (gimple dbg, tree var)
3636 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3637 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3638 gimple_set_op (dbg, 0, var);
3641 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3642 statement. */
3644 static inline void
3645 gimple_debug_bind_set_value (gimple dbg, tree value)
3647 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3648 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3649 gimple_set_op (dbg, 1, value);
3652 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3653 optimized away. */
3654 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3656 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3657 statement. */
3659 static inline void
3660 gimple_debug_bind_reset_value (gimple dbg)
3662 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3663 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3664 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3667 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3668 value. */
3670 static inline bool
3671 gimple_debug_bind_has_value_p (gimple dbg)
3673 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3674 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3675 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3678 #undef GIMPLE_DEBUG_BIND_NOVALUE
3680 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3682 static inline bool
3683 gimple_debug_source_bind_p (const_gimple s)
3685 if (is_gimple_debug (s))
3686 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3688 return false;
3691 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3693 static inline tree
3694 gimple_debug_source_bind_get_var (gimple dbg)
3696 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3697 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3698 return gimple_op (dbg, 0);
3701 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3702 statement. */
3704 static inline tree
3705 gimple_debug_source_bind_get_value (gimple dbg)
3707 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3708 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3709 return gimple_op (dbg, 1);
3712 /* Return a pointer to the value bound to the variable in a
3713 GIMPLE_DEBUG source bind statement. */
3715 static inline tree *
3716 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3718 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3719 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3720 return gimple_op_ptr (dbg, 1);
3723 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3725 static inline void
3726 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3728 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3729 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3730 gimple_set_op (dbg, 0, var);
3733 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3734 statement. */
3736 static inline void
3737 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3739 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3740 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3741 gimple_set_op (dbg, 1, value);
3744 /* Return the body for the OMP statement GS. */
3746 static inline gimple_seq
3747 gimple_omp_body (gimple gs)
3749 return gs->omp.body;
3752 /* Set BODY to be the body for the OMP statement GS. */
3754 static inline void
3755 gimple_omp_set_body (gimple gs, gimple_seq body)
3757 gs->omp.body = body;
3761 /* Return the name associated with OMP_CRITICAL statement GS. */
3763 static inline tree
3764 gimple_omp_critical_name (const_gimple gs)
3766 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3767 return gs->gimple_omp_critical.name;
3771 /* Return a pointer to the name associated with OMP critical statement GS. */
3773 static inline tree *
3774 gimple_omp_critical_name_ptr (gimple gs)
3776 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3777 return &gs->gimple_omp_critical.name;
3781 /* Set NAME to be the name associated with OMP critical statement GS. */
3783 static inline void
3784 gimple_omp_critical_set_name (gimple gs, tree name)
3786 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3787 gs->gimple_omp_critical.name = name;
3791 /* Return the clauses associated with OMP_FOR GS. */
3793 static inline tree
3794 gimple_omp_for_clauses (const_gimple gs)
3796 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3797 return gs->gimple_omp_for.clauses;
3801 /* Return a pointer to the OMP_FOR GS. */
3803 static inline tree *
3804 gimple_omp_for_clauses_ptr (gimple gs)
3806 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3807 return &gs->gimple_omp_for.clauses;
3811 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3813 static inline void
3814 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3816 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3817 gs->gimple_omp_for.clauses = clauses;
3821 /* Get the collapse count of OMP_FOR GS. */
3823 static inline size_t
3824 gimple_omp_for_collapse (gimple gs)
3826 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3827 return gs->gimple_omp_for.collapse;
3831 /* Return the index variable for OMP_FOR GS. */
3833 static inline tree
3834 gimple_omp_for_index (const_gimple gs, size_t i)
3836 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3837 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3838 return gs->gimple_omp_for.iter[i].index;
3842 /* Return a pointer to the index variable for OMP_FOR GS. */
3844 static inline tree *
3845 gimple_omp_for_index_ptr (gimple gs, size_t i)
3847 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3848 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3849 return &gs->gimple_omp_for.iter[i].index;
3853 /* Set INDEX to be the index variable for OMP_FOR GS. */
3855 static inline void
3856 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3858 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3859 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3860 gs->gimple_omp_for.iter[i].index = index;
3864 /* Return the initial value for OMP_FOR GS. */
3866 static inline tree
3867 gimple_omp_for_initial (const_gimple gs, size_t i)
3869 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3870 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3871 return gs->gimple_omp_for.iter[i].initial;
3875 /* Return a pointer to the initial value for OMP_FOR GS. */
3877 static inline tree *
3878 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3880 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3881 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3882 return &gs->gimple_omp_for.iter[i].initial;
3886 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3888 static inline void
3889 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3891 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3892 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3893 gs->gimple_omp_for.iter[i].initial = initial;
3897 /* Return the final value for OMP_FOR GS. */
3899 static inline tree
3900 gimple_omp_for_final (const_gimple gs, size_t i)
3902 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3903 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3904 return gs->gimple_omp_for.iter[i].final;
3908 /* Return a pointer to the final value for OMP_FOR GS. */
3910 static inline tree *
3911 gimple_omp_for_final_ptr (gimple gs, size_t i)
3913 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3914 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3915 return &gs->gimple_omp_for.iter[i].final;
3919 /* Set FINAL to be the final value for OMP_FOR GS. */
3921 static inline void
3922 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3924 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3925 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3926 gs->gimple_omp_for.iter[i].final = final;
3930 /* Return the increment value for OMP_FOR GS. */
3932 static inline tree
3933 gimple_omp_for_incr (const_gimple gs, size_t i)
3935 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3936 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3937 return gs->gimple_omp_for.iter[i].incr;
3941 /* Return a pointer to the increment value for OMP_FOR GS. */
3943 static inline tree *
3944 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3946 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3947 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3948 return &gs->gimple_omp_for.iter[i].incr;
3952 /* Set INCR to be the increment value for OMP_FOR GS. */
3954 static inline void
3955 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3957 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3958 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3959 gs->gimple_omp_for.iter[i].incr = incr;
3963 /* Return the sequence of statements to execute before the OMP_FOR
3964 statement GS starts. */
3966 static inline gimple_seq
3967 gimple_omp_for_pre_body (gimple gs)
3969 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3970 return gs->gimple_omp_for.pre_body;
3974 /* Set PRE_BODY to be the sequence of statements to execute before the
3975 OMP_FOR statement GS starts. */
3977 static inline void
3978 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3980 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3981 gs->gimple_omp_for.pre_body = pre_body;
3985 /* Return the clauses associated with OMP_PARALLEL GS. */
3987 static inline tree
3988 gimple_omp_parallel_clauses (const_gimple gs)
3990 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3991 return gs->gimple_omp_parallel.clauses;
3995 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3997 static inline tree *
3998 gimple_omp_parallel_clauses_ptr (gimple gs)
4000 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4001 return &gs->gimple_omp_parallel.clauses;
4005 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4006 GS. */
4008 static inline void
4009 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4011 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4012 gs->gimple_omp_parallel.clauses = clauses;
4016 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4018 static inline tree
4019 gimple_omp_parallel_child_fn (const_gimple gs)
4021 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4022 return gs->gimple_omp_parallel.child_fn;
4025 /* Return a pointer to the child function used to hold the body of
4026 OMP_PARALLEL GS. */
4028 static inline tree *
4029 gimple_omp_parallel_child_fn_ptr (gimple gs)
4031 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4032 return &gs->gimple_omp_parallel.child_fn;
4036 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4038 static inline void
4039 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4041 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4042 gs->gimple_omp_parallel.child_fn = child_fn;
4046 /* Return the artificial argument used to send variables and values
4047 from the parent to the children threads in OMP_PARALLEL GS. */
4049 static inline tree
4050 gimple_omp_parallel_data_arg (const_gimple gs)
4052 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4053 return gs->gimple_omp_parallel.data_arg;
4057 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4059 static inline tree *
4060 gimple_omp_parallel_data_arg_ptr (gimple gs)
4062 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4063 return &gs->gimple_omp_parallel.data_arg;
4067 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4069 static inline void
4070 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4072 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4073 gs->gimple_omp_parallel.data_arg = data_arg;
4077 /* Return the clauses associated with OMP_TASK GS. */
4079 static inline tree
4080 gimple_omp_task_clauses (const_gimple gs)
4082 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4083 return gs->gimple_omp_parallel.clauses;
4087 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4089 static inline tree *
4090 gimple_omp_task_clauses_ptr (gimple gs)
4092 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4093 return &gs->gimple_omp_parallel.clauses;
4097 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4098 GS. */
4100 static inline void
4101 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4103 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4104 gs->gimple_omp_parallel.clauses = clauses;
4108 /* Return the child function used to hold the body of OMP_TASK GS. */
4110 static inline tree
4111 gimple_omp_task_child_fn (const_gimple gs)
4113 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4114 return gs->gimple_omp_parallel.child_fn;
4117 /* Return a pointer to the child function used to hold the body of
4118 OMP_TASK GS. */
4120 static inline tree *
4121 gimple_omp_task_child_fn_ptr (gimple gs)
4123 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4124 return &gs->gimple_omp_parallel.child_fn;
4128 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4130 static inline void
4131 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4133 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4134 gs->gimple_omp_parallel.child_fn = child_fn;
4138 /* Return the artificial argument used to send variables and values
4139 from the parent to the children threads in OMP_TASK GS. */
4141 static inline tree
4142 gimple_omp_task_data_arg (const_gimple gs)
4144 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4145 return gs->gimple_omp_parallel.data_arg;
4149 /* Return a pointer to the data argument for OMP_TASK GS. */
4151 static inline tree *
4152 gimple_omp_task_data_arg_ptr (gimple gs)
4154 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4155 return &gs->gimple_omp_parallel.data_arg;
4159 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4161 static inline void
4162 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4164 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4165 gs->gimple_omp_parallel.data_arg = data_arg;
4169 /* Return the clauses associated with OMP_TASK GS. */
4171 static inline tree
4172 gimple_omp_taskreg_clauses (const_gimple gs)
4174 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4175 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4176 return gs->gimple_omp_parallel.clauses;
4180 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4182 static inline tree *
4183 gimple_omp_taskreg_clauses_ptr (gimple gs)
4185 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4186 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4187 return &gs->gimple_omp_parallel.clauses;
4191 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4192 GS. */
4194 static inline void
4195 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4197 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4198 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4199 gs->gimple_omp_parallel.clauses = clauses;
4203 /* Return the child function used to hold the body of OMP_TASK GS. */
4205 static inline tree
4206 gimple_omp_taskreg_child_fn (const_gimple gs)
4208 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4209 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4210 return gs->gimple_omp_parallel.child_fn;
4213 /* Return a pointer to the child function used to hold the body of
4214 OMP_TASK GS. */
4216 static inline tree *
4217 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4219 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4220 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4221 return &gs->gimple_omp_parallel.child_fn;
4225 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4227 static inline void
4228 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4230 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4231 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4232 gs->gimple_omp_parallel.child_fn = child_fn;
4236 /* Return the artificial argument used to send variables and values
4237 from the parent to the children threads in OMP_TASK GS. */
4239 static inline tree
4240 gimple_omp_taskreg_data_arg (const_gimple gs)
4242 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4243 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4244 return gs->gimple_omp_parallel.data_arg;
4248 /* Return a pointer to the data argument for OMP_TASK GS. */
4250 static inline tree *
4251 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4253 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4254 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4255 return &gs->gimple_omp_parallel.data_arg;
4259 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4261 static inline void
4262 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4264 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4265 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4266 gs->gimple_omp_parallel.data_arg = data_arg;
4270 /* Return the copy function used to hold the body of OMP_TASK GS. */
4272 static inline tree
4273 gimple_omp_task_copy_fn (const_gimple gs)
4275 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4276 return gs->gimple_omp_task.copy_fn;
4279 /* Return a pointer to the copy function used to hold the body of
4280 OMP_TASK GS. */
4282 static inline tree *
4283 gimple_omp_task_copy_fn_ptr (gimple gs)
4285 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4286 return &gs->gimple_omp_task.copy_fn;
4290 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4292 static inline void
4293 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4295 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4296 gs->gimple_omp_task.copy_fn = copy_fn;
4300 /* Return size of the data block in bytes in OMP_TASK GS. */
4302 static inline tree
4303 gimple_omp_task_arg_size (const_gimple gs)
4305 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4306 return gs->gimple_omp_task.arg_size;
4310 /* Return a pointer to the data block size for OMP_TASK GS. */
4312 static inline tree *
4313 gimple_omp_task_arg_size_ptr (gimple gs)
4315 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4316 return &gs->gimple_omp_task.arg_size;
4320 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4322 static inline void
4323 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4325 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4326 gs->gimple_omp_task.arg_size = arg_size;
4330 /* Return align of the data block in bytes in OMP_TASK GS. */
4332 static inline tree
4333 gimple_omp_task_arg_align (const_gimple gs)
4335 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4336 return gs->gimple_omp_task.arg_align;
4340 /* Return a pointer to the data block align for OMP_TASK GS. */
4342 static inline tree *
4343 gimple_omp_task_arg_align_ptr (gimple gs)
4345 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4346 return &gs->gimple_omp_task.arg_align;
4350 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4352 static inline void
4353 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4355 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4356 gs->gimple_omp_task.arg_align = arg_align;
4360 /* Return the clauses associated with OMP_SINGLE GS. */
4362 static inline tree
4363 gimple_omp_single_clauses (const_gimple gs)
4365 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4366 return gs->gimple_omp_single.clauses;
4370 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4372 static inline tree *
4373 gimple_omp_single_clauses_ptr (gimple gs)
4375 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4376 return &gs->gimple_omp_single.clauses;
4380 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4382 static inline void
4383 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4385 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4386 gs->gimple_omp_single.clauses = clauses;
4390 /* Return the clauses associated with OMP_SECTIONS GS. */
4392 static inline tree
4393 gimple_omp_sections_clauses (const_gimple gs)
4395 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4396 return gs->gimple_omp_sections.clauses;
4400 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4402 static inline tree *
4403 gimple_omp_sections_clauses_ptr (gimple gs)
4405 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4406 return &gs->gimple_omp_sections.clauses;
4410 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4411 GS. */
4413 static inline void
4414 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4416 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4417 gs->gimple_omp_sections.clauses = clauses;
4421 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4422 in GS. */
4424 static inline tree
4425 gimple_omp_sections_control (const_gimple gs)
4427 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4428 return gs->gimple_omp_sections.control;
4432 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4433 GS. */
4435 static inline tree *
4436 gimple_omp_sections_control_ptr (gimple gs)
4438 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4439 return &gs->gimple_omp_sections.control;
4443 /* Set CONTROL to be the set of clauses associated with the
4444 GIMPLE_OMP_SECTIONS in GS. */
4446 static inline void
4447 gimple_omp_sections_set_control (gimple gs, tree control)
4449 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4450 gs->gimple_omp_sections.control = control;
4454 /* Set COND to be the condition code for OMP_FOR GS. */
4456 static inline void
4457 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4459 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4460 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4461 && i < gs->gimple_omp_for.collapse);
4462 gs->gimple_omp_for.iter[i].cond = cond;
4466 /* Return the condition code associated with OMP_FOR GS. */
4468 static inline enum tree_code
4469 gimple_omp_for_cond (const_gimple gs, size_t i)
4471 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4472 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4473 return gs->gimple_omp_for.iter[i].cond;
4477 /* Set the value being stored in an atomic store. */
4479 static inline void
4480 gimple_omp_atomic_store_set_val (gimple g, tree val)
4482 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4483 g->gimple_omp_atomic_store.val = val;
4487 /* Return the value being stored in an atomic store. */
4489 static inline tree
4490 gimple_omp_atomic_store_val (const_gimple g)
4492 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4493 return g->gimple_omp_atomic_store.val;
4497 /* Return a pointer to the value being stored in an atomic store. */
4499 static inline tree *
4500 gimple_omp_atomic_store_val_ptr (gimple g)
4502 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4503 return &g->gimple_omp_atomic_store.val;
4507 /* Set the LHS of an atomic load. */
4509 static inline void
4510 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4512 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4513 g->gimple_omp_atomic_load.lhs = lhs;
4517 /* Get the LHS of an atomic load. */
4519 static inline tree
4520 gimple_omp_atomic_load_lhs (const_gimple g)
4522 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4523 return g->gimple_omp_atomic_load.lhs;
4527 /* Return a pointer to the LHS of an atomic load. */
4529 static inline tree *
4530 gimple_omp_atomic_load_lhs_ptr (gimple g)
4532 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4533 return &g->gimple_omp_atomic_load.lhs;
4537 /* Set the RHS of an atomic load. */
4539 static inline void
4540 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4542 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4543 g->gimple_omp_atomic_load.rhs = rhs;
4547 /* Get the RHS of an atomic load. */
4549 static inline tree
4550 gimple_omp_atomic_load_rhs (const_gimple g)
4552 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4553 return g->gimple_omp_atomic_load.rhs;
4557 /* Return a pointer to the RHS of an atomic load. */
4559 static inline tree *
4560 gimple_omp_atomic_load_rhs_ptr (gimple g)
4562 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4563 return &g->gimple_omp_atomic_load.rhs;
4567 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4569 static inline tree
4570 gimple_omp_continue_control_def (const_gimple g)
4572 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4573 return g->gimple_omp_continue.control_def;
4576 /* The same as above, but return the address. */
4578 static inline tree *
4579 gimple_omp_continue_control_def_ptr (gimple g)
4581 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4582 return &g->gimple_omp_continue.control_def;
4585 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4587 static inline void
4588 gimple_omp_continue_set_control_def (gimple g, tree def)
4590 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4591 g->gimple_omp_continue.control_def = def;
4595 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4597 static inline tree
4598 gimple_omp_continue_control_use (const_gimple g)
4600 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4601 return g->gimple_omp_continue.control_use;
4605 /* The same as above, but return the address. */
4607 static inline tree *
4608 gimple_omp_continue_control_use_ptr (gimple g)
4610 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4611 return &g->gimple_omp_continue.control_use;
4615 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4617 static inline void
4618 gimple_omp_continue_set_control_use (gimple g, tree use)
4620 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4621 g->gimple_omp_continue.control_use = use;
4624 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4626 static inline gimple_seq
4627 gimple_transaction_body (gimple gs)
4629 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4630 return gs->gimple_transaction.body;
4633 /* Return the label associated with a GIMPLE_TRANSACTION. */
4635 static inline tree
4636 gimple_transaction_label (const_gimple gs)
4638 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4639 return gs->gimple_transaction.label;
4642 static inline tree *
4643 gimple_transaction_label_ptr (gimple gs)
4645 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4646 return &gs->gimple_transaction.label;
4649 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4651 static inline unsigned int
4652 gimple_transaction_subcode (const_gimple gs)
4654 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4655 return gs->gsbase.subcode;
4658 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4660 static inline void
4661 gimple_transaction_set_body (gimple gs, gimple_seq body)
4663 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4664 gs->gimple_transaction.body = body;
4667 /* Set the label associated with a GIMPLE_TRANSACTION. */
4669 static inline void
4670 gimple_transaction_set_label (gimple gs, tree label)
4672 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4673 gs->gimple_transaction.label = label;
4676 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4678 static inline void
4679 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4681 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4682 gs->gsbase.subcode = subcode;
4686 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4688 static inline tree *
4689 gimple_return_retval_ptr (const_gimple gs)
4691 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4692 return gimple_op_ptr (gs, 0);
4695 /* Return the return value for GIMPLE_RETURN GS. */
4697 static inline tree
4698 gimple_return_retval (const_gimple gs)
4700 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4701 return gimple_op (gs, 0);
4705 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4707 static inline void
4708 gimple_return_set_retval (gimple gs, tree retval)
4710 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4711 gimple_set_op (gs, 0, retval);
4715 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4717 #define CASE_GIMPLE_OMP \
4718 case GIMPLE_OMP_PARALLEL: \
4719 case GIMPLE_OMP_TASK: \
4720 case GIMPLE_OMP_FOR: \
4721 case GIMPLE_OMP_SECTIONS: \
4722 case GIMPLE_OMP_SECTIONS_SWITCH: \
4723 case GIMPLE_OMP_SINGLE: \
4724 case GIMPLE_OMP_SECTION: \
4725 case GIMPLE_OMP_MASTER: \
4726 case GIMPLE_OMP_ORDERED: \
4727 case GIMPLE_OMP_CRITICAL: \
4728 case GIMPLE_OMP_RETURN: \
4729 case GIMPLE_OMP_ATOMIC_LOAD: \
4730 case GIMPLE_OMP_ATOMIC_STORE: \
4731 case GIMPLE_OMP_CONTINUE
4733 static inline bool
4734 is_gimple_omp (const_gimple stmt)
4736 switch (gimple_code (stmt))
4738 CASE_GIMPLE_OMP:
4739 return true;
4740 default:
4741 return false;
4746 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4748 static inline bool
4749 gimple_nop_p (const_gimple g)
4751 return gimple_code (g) == GIMPLE_NOP;
4755 /* Return true if GS is a GIMPLE_RESX. */
4757 static inline bool
4758 is_gimple_resx (const_gimple gs)
4760 return gimple_code (gs) == GIMPLE_RESX;
4763 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4765 static inline enum br_predictor
4766 gimple_predict_predictor (gimple gs)
4768 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4769 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4773 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4775 static inline void
4776 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4778 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4779 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4780 | (unsigned) predictor;
4784 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4786 static inline enum prediction
4787 gimple_predict_outcome (gimple gs)
4789 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4790 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4794 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4796 static inline void
4797 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4799 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4800 if (outcome == TAKEN)
4801 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4802 else
4803 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4807 /* Return the type of the main expression computed by STMT. Return
4808 void_type_node if the statement computes nothing. */
4810 static inline tree
4811 gimple_expr_type (const_gimple stmt)
4813 enum gimple_code code = gimple_code (stmt);
4815 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4817 tree type;
4818 /* In general we want to pass out a type that can be substituted
4819 for both the RHS and the LHS types if there is a possibly
4820 useless conversion involved. That means returning the
4821 original RHS type as far as we can reconstruct it. */
4822 if (code == GIMPLE_CALL)
4823 type = gimple_call_return_type (stmt);
4824 else
4825 switch (gimple_assign_rhs_code (stmt))
4827 case POINTER_PLUS_EXPR:
4828 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4829 break;
4831 default:
4832 /* As fallback use the type of the LHS. */
4833 type = TREE_TYPE (gimple_get_lhs (stmt));
4834 break;
4836 return type;
4838 else if (code == GIMPLE_COND)
4839 return boolean_type_node;
4840 else
4841 return void_type_node;
4845 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4847 static inline gimple_stmt_iterator
4848 gsi_start (gimple_seq seq)
4850 gimple_stmt_iterator i;
4852 i.ptr = gimple_seq_first (seq);
4853 i.seq = seq;
4854 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4856 return i;
4860 /* Return a new iterator pointing to the first statement in basic block BB. */
4862 static inline gimple_stmt_iterator
4863 gsi_start_bb (basic_block bb)
4865 gimple_stmt_iterator i;
4866 gimple_seq seq;
4868 seq = bb_seq (bb);
4869 i.ptr = gimple_seq_first (seq);
4870 i.seq = seq;
4871 i.bb = bb;
4873 return i;
4877 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4879 static inline gimple_stmt_iterator
4880 gsi_last (gimple_seq seq)
4882 gimple_stmt_iterator i;
4884 i.ptr = gimple_seq_last (seq);
4885 i.seq = seq;
4886 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4888 return i;
4892 /* Return a new iterator pointing to the last statement in basic block BB. */
4894 static inline gimple_stmt_iterator
4895 gsi_last_bb (basic_block bb)
4897 gimple_stmt_iterator i;
4898 gimple_seq seq;
4900 seq = bb_seq (bb);
4901 i.ptr = gimple_seq_last (seq);
4902 i.seq = seq;
4903 i.bb = bb;
4905 return i;
4909 /* Return true if I is at the end of its sequence. */
4911 static inline bool
4912 gsi_end_p (gimple_stmt_iterator i)
4914 return i.ptr == NULL;
4918 /* Return true if I is one statement before the end of its sequence. */
4920 static inline bool
4921 gsi_one_before_end_p (gimple_stmt_iterator i)
4923 return i.ptr != NULL && i.ptr->next == NULL;
4927 /* Advance the iterator to the next gimple statement. */
4929 static inline void
4930 gsi_next (gimple_stmt_iterator *i)
4932 i->ptr = i->ptr->next;
4935 /* Advance the iterator to the previous gimple statement. */
4937 static inline void
4938 gsi_prev (gimple_stmt_iterator *i)
4940 i->ptr = i->ptr->prev;
4943 /* Return the current stmt. */
4945 static inline gimple
4946 gsi_stmt (gimple_stmt_iterator i)
4948 return i.ptr->stmt;
4951 /* Return a block statement iterator that points to the first non-label
4952 statement in block BB. */
4954 static inline gimple_stmt_iterator
4955 gsi_after_labels (basic_block bb)
4957 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4959 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4960 gsi_next (&gsi);
4962 return gsi;
4965 /* Advance the iterator to the next non-debug gimple statement. */
4967 static inline void
4968 gsi_next_nondebug (gimple_stmt_iterator *i)
4972 gsi_next (i);
4974 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4977 /* Advance the iterator to the next non-debug gimple statement. */
4979 static inline void
4980 gsi_prev_nondebug (gimple_stmt_iterator *i)
4984 gsi_prev (i);
4986 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4989 /* Return a new iterator pointing to the first non-debug statement in
4990 basic block BB. */
4992 static inline gimple_stmt_iterator
4993 gsi_start_nondebug_bb (basic_block bb)
4995 gimple_stmt_iterator i = gsi_start_bb (bb);
4997 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4998 gsi_next_nondebug (&i);
5000 return i;
5003 /* Return a new iterator pointing to the last non-debug statement in
5004 basic block BB. */
5006 static inline gimple_stmt_iterator
5007 gsi_last_nondebug_bb (basic_block bb)
5009 gimple_stmt_iterator i = gsi_last_bb (bb);
5011 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5012 gsi_prev_nondebug (&i);
5014 return i;
5017 /* Return a pointer to the current stmt.
5019 NOTE: You may want to use gsi_replace on the iterator itself,
5020 as this performs additional bookkeeping that will not be done
5021 if you simply assign through a pointer returned by gsi_stmt_ptr. */
5023 static inline gimple *
5024 gsi_stmt_ptr (gimple_stmt_iterator *i)
5026 return &i->ptr->stmt;
5030 /* Return the basic block associated with this iterator. */
5032 static inline basic_block
5033 gsi_bb (gimple_stmt_iterator i)
5035 return i.bb;
5039 /* Return the sequence associated with this iterator. */
5041 static inline gimple_seq
5042 gsi_seq (gimple_stmt_iterator i)
5044 return i.seq;
5048 enum gsi_iterator_update
5050 GSI_NEW_STMT, /* Only valid when single statement is added, move
5051 iterator to it. */
5052 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5053 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5054 for linking other statements in the same
5055 direction. */
5058 /* In gimple-iterator.c */
5059 gimple_stmt_iterator gsi_start_phis (basic_block);
5060 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5061 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
5062 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5063 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5064 enum gsi_iterator_update);
5065 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5066 enum gsi_iterator_update);
5067 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5068 enum gsi_iterator_update);
5069 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5070 enum gsi_iterator_update);
5071 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5072 enum gsi_iterator_update);
5073 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5074 enum gsi_iterator_update);
5075 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5076 enum gsi_iterator_update);
5077 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5078 enum gsi_iterator_update);
5079 void gsi_remove (gimple_stmt_iterator *, bool);
5080 gimple_stmt_iterator gsi_for_stmt (gimple);
5081 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5082 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5083 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
5084 void gsi_insert_on_edge (edge, gimple);
5085 void gsi_insert_seq_on_edge (edge, gimple_seq);
5086 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5087 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5088 void gsi_commit_one_edge_insert (edge, basic_block *);
5089 void gsi_commit_edge_inserts (void);
5090 gimple gimple_call_copy_skip_args (gimple, bitmap);
5093 /* Convenience routines to walk all statements of a gimple function.
5094 Note that this is useful exclusively before the code is converted
5095 into SSA form. Once the program is in SSA form, the standard
5096 operand interface should be used to analyze/modify statements. */
5097 struct walk_stmt_info
5099 /* Points to the current statement being walked. */
5100 gimple_stmt_iterator gsi;
5102 /* Additional data that the callback functions may want to carry
5103 through the recursion. */
5104 void *info;
5106 /* Pointer map used to mark visited tree nodes when calling
5107 walk_tree on each operand. If set to NULL, duplicate tree nodes
5108 will be visited more than once. */
5109 struct pointer_set_t *pset;
5111 /* Operand returned by the callbacks. This is set when calling
5112 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5113 returns non-NULL, this field will contain the tree returned by
5114 the last callback. */
5115 tree callback_result;
5117 /* Indicates whether the operand being examined may be replaced
5118 with something that matches is_gimple_val (if true) or something
5119 slightly more complicated (if false). "Something" technically
5120 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5121 but we never try to form anything more complicated than that, so
5122 we don't bother checking.
5124 Also note that CALLBACK should update this flag while walking the
5125 sub-expressions of a statement. For instance, when walking the
5126 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5127 to true, however, when walking &var, the operand of that
5128 ADDR_EXPR does not need to be a GIMPLE value. */
5129 BOOL_BITFIELD val_only : 1;
5131 /* True if we are currently walking the LHS of an assignment. */
5132 BOOL_BITFIELD is_lhs : 1;
5134 /* Optional. Set to true by the callback functions if they made any
5135 changes. */
5136 BOOL_BITFIELD changed : 1;
5138 /* True if we're interested in location information. */
5139 BOOL_BITFIELD want_locations : 1;
5141 /* True if we've removed the statement that was processed. */
5142 BOOL_BITFIELD removed_stmt : 1;
5145 /* Callback for walk_gimple_stmt. Called for every statement found
5146 during traversal. The first argument points to the statement to
5147 walk. The second argument is a flag that the callback sets to
5148 'true' if it the callback handled all the operands and
5149 sub-statements of the statement (the default value of this flag is
5150 'false'). The third argument is an anonymous pointer to data
5151 to be used by the callback. */
5152 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5153 struct walk_stmt_info *);
5155 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5156 struct walk_stmt_info *);
5157 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5158 struct walk_stmt_info *);
5159 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5161 #ifdef GATHER_STATISTICS
5162 /* Enum and arrays used for allocation stats. Keep in sync with
5163 gimple.c:gimple_alloc_kind_names. */
5164 enum gimple_alloc_kind
5166 gimple_alloc_kind_assign, /* Assignments. */
5167 gimple_alloc_kind_phi, /* PHI nodes. */
5168 gimple_alloc_kind_cond, /* Conditionals. */
5169 gimple_alloc_kind_seq, /* Sequences. */
5170 gimple_alloc_kind_rest, /* Everything else. */
5171 gimple_alloc_kind_all
5174 extern int gimple_alloc_counts[];
5175 extern int gimple_alloc_sizes[];
5177 /* Return the allocation kind for a given stmt CODE. */
5178 static inline enum gimple_alloc_kind
5179 gimple_alloc_kind (enum gimple_code code)
5181 switch (code)
5183 case GIMPLE_ASSIGN:
5184 return gimple_alloc_kind_assign;
5185 case GIMPLE_PHI:
5186 return gimple_alloc_kind_phi;
5187 case GIMPLE_COND:
5188 return gimple_alloc_kind_cond;
5189 default:
5190 return gimple_alloc_kind_rest;
5193 #endif /* GATHER_STATISTICS */
5195 extern void dump_gimple_statistics (void);
5197 /* In gimple-fold.c. */
5198 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5199 tree gimple_fold_builtin (gimple);
5200 bool fold_stmt (gimple_stmt_iterator *);
5201 bool fold_stmt_inplace (gimple_stmt_iterator *);
5202 tree get_symbol_constant_value (tree);
5203 tree canonicalize_constructor_val (tree);
5204 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5205 enum tree_code, tree, tree);
5206 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5207 enum tree_code, tree, tree);
5209 bool gimple_val_nonnegative_real_p (tree);
5210 #endif /* GCC_GIMPLE_H */