* gimplify.c (gimplify_modify_expr_rhs): Don't return GS_OK for
[official-gcc/constexpr.git] / gcc / gimple.h
blob3daaa9e3c401871efcb236db11ccfe80bd9355d9
1 /* Gimple IR definitions.
3 Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "pointer-set.h"
26 #include "vec.h"
27 #include "ggc.h"
28 #include "tm.h"
29 #include "hard-reg-set.h"
30 #include "basic-block.h"
31 #include "tree-ssa-operands.h"
32 #include "tree-ssa-alias.h"
34 DEF_VEC_P(gimple);
35 DEF_VEC_ALLOC_P(gimple,heap);
36 DEF_VEC_ALLOC_P(gimple,gc);
38 typedef gimple *gimple_p;
39 DEF_VEC_P(gimple_p);
40 DEF_VEC_ALLOC_P(gimple_p,heap);
42 DEF_VEC_P(gimple_seq);
43 DEF_VEC_ALLOC_P(gimple_seq,gc);
44 DEF_VEC_ALLOC_P(gimple_seq,heap);
46 /* For each block, the PHI nodes that need to be rewritten are stored into
47 these vectors. */
48 typedef VEC(gimple, heap) *gimple_vec;
49 DEF_VEC_P (gimple_vec);
50 DEF_VEC_ALLOC_P (gimple_vec, heap);
52 enum gimple_code {
53 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
54 #include "gimple.def"
55 #undef DEFGSCODE
56 LAST_AND_UNUSED_GIMPLE_CODE
59 extern const char *const gimple_code_name[];
60 extern const unsigned char gimple_rhs_class_table[];
62 /* Error out if a gimple tuple is addressed incorrectly. */
63 #if defined ENABLE_GIMPLE_CHECKING
64 extern void gimple_check_failed (const_gimple, const char *, int, \
65 const char *, enum gimple_code, \
66 enum tree_code) ATTRIBUTE_NORETURN;
68 #define GIMPLE_CHECK(GS, CODE) \
69 do { \
70 const_gimple __gs = (GS); \
71 if (gimple_code (__gs) != (CODE)) \
72 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
73 (CODE), ERROR_MARK); \
74 } while (0)
75 #else /* not ENABLE_GIMPLE_CHECKING */
76 #define GIMPLE_CHECK(GS, CODE) (void)0
77 #endif
79 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
80 get_gimple_rhs_class. */
81 enum gimple_rhs_class
83 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
84 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
85 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
86 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
87 name, a _DECL, a _REF, etc. */
90 /* Specific flags for individual GIMPLE statements. These flags are
91 always stored in gimple_statement_base.subcode and they may only be
92 defined for statement codes that do not use sub-codes.
94 Values for the masks can overlap as long as the overlapping values
95 are never used in the same statement class.
97 The maximum mask value that can be defined is 1 << 15 (i.e., each
98 statement code can hold up to 16 bitflags).
100 Keep this list sorted. */
101 enum gf_mask {
102 GF_ASM_INPUT = 1 << 0,
103 GF_ASM_VOLATILE = 1 << 1,
104 GF_CALL_CANNOT_INLINE = 1 << 0,
105 GF_CALL_FROM_THUNK = 1 << 1,
106 GF_CALL_RETURN_SLOT_OPT = 1 << 2,
107 GF_CALL_TAILCALL = 1 << 3,
108 GF_CALL_VA_ARG_PACK = 1 << 4,
109 GF_OMP_PARALLEL_COMBINED = 1 << 0,
111 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
112 a thread synchronization via some sort of barrier. The exact barrier
113 that would otherwise be emitted is dependent on the OMP statement with
114 which this return is associated. */
115 GF_OMP_RETURN_NOWAIT = 1 << 0,
117 GF_OMP_SECTION_LAST = 1 << 0,
118 GF_PREDICT_TAKEN = 1 << 15
121 /* Currently, there's only one type of gimple debug stmt. Others are
122 envisioned, for example, to enable the generation of is_stmt notes
123 in line number information, to mark sequence points, etc. This
124 subcode is to be used to tell them apart. */
125 enum gimple_debug_subcode {
126 GIMPLE_DEBUG_BIND = 0
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 /* Allocate a new sequence and initialize its first element with STMT. */
226 static inline gimple_seq
227 gimple_seq_alloc_with_stmt (gimple stmt)
229 gimple_seq seq = NULL;
230 gimple_seq_add_stmt (&seq, stmt);
231 return seq;
235 /* Returns the sequence of statements in BB. */
237 static inline gimple_seq
238 bb_seq (const_basic_block bb)
240 return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
244 /* Sets the sequence of statements in BB to SEQ. */
246 static inline void
247 set_bb_seq (basic_block bb, gimple_seq seq)
249 gcc_assert (!(bb->flags & BB_RTL));
250 bb->il.gimple->seq = seq;
253 /* Iterator object for GIMPLE statement sequences. */
255 typedef struct
257 /* Sequence node holding the current statement. */
258 gimple_seq_node ptr;
260 /* Sequence and basic block holding the statement. These fields
261 are necessary to handle edge cases such as when statement is
262 added to an empty basic block or when the last statement of a
263 block/sequence is removed. */
264 gimple_seq seq;
265 basic_block bb;
266 } gimple_stmt_iterator;
269 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
270 are for 64 bit hosts. */
272 struct GTY(()) gimple_statement_base {
273 /* [ WORD 1 ]
274 Main identifying code for a tuple. */
275 ENUM_BITFIELD(gimple_code) code : 8;
277 /* Nonzero if a warning should not be emitted on this tuple. */
278 unsigned int no_warning : 1;
280 /* Nonzero if this tuple has been visited. Passes are responsible
281 for clearing this bit before using it. */
282 unsigned int visited : 1;
284 /* Nonzero if this tuple represents a non-temporal move. */
285 unsigned int nontemporal_move : 1;
287 /* Pass local flags. These flags are free for any pass to use as
288 they see fit. Passes should not assume that these flags contain
289 any useful value when the pass starts. Any initial state that
290 the pass requires should be set on entry to the pass. See
291 gimple_set_plf and gimple_plf for usage. */
292 unsigned int plf : 2;
294 /* Nonzero if this statement has been modified and needs to have its
295 operands rescanned. */
296 unsigned modified : 1;
298 /* Nonzero if this statement contains volatile operands. */
299 unsigned has_volatile_ops : 1;
301 /* Padding to get subcode to 16 bit alignment. */
302 unsigned pad : 1;
304 /* The SUBCODE field can be used for tuple-specific flags for tuples
305 that do not require subcodes. Note that SUBCODE should be at
306 least as wide as tree codes, as several tuples store tree codes
307 in there. */
308 unsigned int subcode : 16;
310 /* UID of this statement. This is used by passes that want to
311 assign IDs to statements. It must be assigned and used by each
312 pass. By default it should be assumed to contain garbage. */
313 unsigned uid;
315 /* [ WORD 2 ]
316 Locus information for debug info. */
317 location_t location;
319 /* Number of operands in this tuple. */
320 unsigned num_ops;
322 /* [ WORD 3 ]
323 Basic block holding this statement. */
324 struct basic_block_def *bb;
326 /* [ WORD 4 ]
327 Lexical block holding this statement. */
328 tree block;
332 /* Base structure for tuples with operands. */
334 struct GTY(()) gimple_statement_with_ops_base
336 /* [ WORD 1-4 ] */
337 struct gimple_statement_base gsbase;
339 /* [ WORD 5-6 ]
340 SSA operand vectors. NOTE: It should be possible to
341 amalgamate these vectors with the operand vector OP. However,
342 the SSA operand vectors are organized differently and contain
343 more information (like immediate use chaining). */
344 struct def_optype_d GTY((skip (""))) *def_ops;
345 struct use_optype_d GTY((skip (""))) *use_ops;
349 /* Statements that take register operands. */
351 struct GTY(()) gimple_statement_with_ops
353 /* [ WORD 1-6 ] */
354 struct gimple_statement_with_ops_base opbase;
356 /* [ WORD 7 ]
357 Operand vector. NOTE! This must always be the last field
358 of this structure. In particular, this means that this
359 structure cannot be embedded inside another one. */
360 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
364 /* Base for statements that take both memory and register operands. */
366 struct GTY(()) gimple_statement_with_memory_ops_base
368 /* [ WORD 1-6 ] */
369 struct gimple_statement_with_ops_base opbase;
371 /* [ WORD 7-8 ]
372 Virtual operands for this statement. The GC will pick them
373 up via the ssa_names array. */
374 tree GTY((skip (""))) vdef;
375 tree GTY((skip (""))) vuse;
379 /* Statements that take both memory and register operands. */
381 struct GTY(()) gimple_statement_with_memory_ops
383 /* [ WORD 1-8 ] */
384 struct gimple_statement_with_memory_ops_base membase;
386 /* [ WORD 9 ]
387 Operand vector. NOTE! This must always be the last field
388 of this structure. In particular, this means that this
389 structure cannot be embedded inside another one. */
390 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
394 /* Call statements that take both memory and register operands. */
396 struct GTY(()) gimple_statement_call
398 /* [ WORD 1-8 ] */
399 struct gimple_statement_with_memory_ops_base membase;
401 /* [ WORD 9-12 ] */
402 struct pt_solution call_used;
403 struct pt_solution call_clobbered;
405 /* [ WORD 13 ]
406 Operand vector. NOTE! This must always be the last field
407 of this structure. In particular, this means that this
408 structure cannot be embedded inside another one. */
409 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
413 /* OpenMP statements (#pragma omp). */
415 struct GTY(()) gimple_statement_omp {
416 /* [ WORD 1-4 ] */
417 struct gimple_statement_base gsbase;
419 /* [ WORD 5 ] */
420 gimple_seq body;
424 /* GIMPLE_BIND */
426 struct GTY(()) gimple_statement_bind {
427 /* [ WORD 1-4 ] */
428 struct gimple_statement_base gsbase;
430 /* [ WORD 5 ]
431 Variables declared in this scope. */
432 tree vars;
434 /* [ WORD 6 ]
435 This is different than the BLOCK field in gimple_statement_base,
436 which is analogous to TREE_BLOCK (i.e., the lexical block holding
437 this statement). This field is the equivalent of BIND_EXPR_BLOCK
438 in tree land (i.e., the lexical scope defined by this bind). See
439 gimple-low.c. */
440 tree block;
442 /* [ WORD 7 ] */
443 gimple_seq body;
447 /* GIMPLE_CATCH */
449 struct GTY(()) gimple_statement_catch {
450 /* [ WORD 1-4 ] */
451 struct gimple_statement_base gsbase;
453 /* [ WORD 5 ] */
454 tree types;
456 /* [ WORD 6 ] */
457 gimple_seq handler;
461 /* GIMPLE_EH_FILTER */
463 struct GTY(()) gimple_statement_eh_filter {
464 /* [ WORD 1-4 ] */
465 struct gimple_statement_base gsbase;
467 /* [ WORD 5 ]
468 Filter types. */
469 tree types;
471 /* [ WORD 6 ]
472 Failure actions. */
473 gimple_seq failure;
477 /* GIMPLE_EH_MUST_NOT_THROW */
479 struct GTY(()) gimple_statement_eh_mnt {
480 /* [ WORD 1-4 ] */
481 struct gimple_statement_base gsbase;
483 /* [ WORD 5 ] Abort function decl. */
484 tree fndecl;
487 /* GIMPLE_PHI */
489 struct GTY(()) gimple_statement_phi {
490 /* [ WORD 1-4 ] */
491 struct gimple_statement_base gsbase;
493 /* [ WORD 5 ] */
494 unsigned capacity;
495 unsigned nargs;
497 /* [ WORD 6 ] */
498 tree result;
500 /* [ WORD 7 ] */
501 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
505 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
507 struct GTY(()) gimple_statement_eh_ctrl
509 /* [ WORD 1-4 ] */
510 struct gimple_statement_base gsbase;
512 /* [ WORD 5 ]
513 Exception region number. */
514 int region;
518 /* GIMPLE_TRY */
520 struct GTY(()) gimple_statement_try {
521 /* [ WORD 1-4 ] */
522 struct gimple_statement_base gsbase;
524 /* [ WORD 5 ]
525 Expression to evaluate. */
526 gimple_seq eval;
528 /* [ WORD 6 ]
529 Cleanup expression. */
530 gimple_seq cleanup;
533 /* Kind of GIMPLE_TRY statements. */
534 enum gimple_try_flags
536 /* A try/catch. */
537 GIMPLE_TRY_CATCH = 1 << 0,
539 /* A try/finally. */
540 GIMPLE_TRY_FINALLY = 1 << 1,
541 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
543 /* Analogous to TRY_CATCH_IS_CLEANUP. */
544 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
547 /* GIMPLE_WITH_CLEANUP_EXPR */
549 struct GTY(()) gimple_statement_wce {
550 /* [ WORD 1-4 ] */
551 struct gimple_statement_base gsbase;
553 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
554 executed if an exception is thrown, not on normal exit of its
555 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
556 in TARGET_EXPRs. */
558 /* [ WORD 5 ]
559 Cleanup expression. */
560 gimple_seq cleanup;
564 /* GIMPLE_ASM */
566 struct GTY(()) gimple_statement_asm
568 /* [ WORD 1-8 ] */
569 struct gimple_statement_with_memory_ops_base membase;
571 /* [ WORD 9 ]
572 __asm__ statement. */
573 const char *string;
575 /* [ WORD 10 ]
576 Number of inputs, outputs, clobbers, labels. */
577 unsigned char ni;
578 unsigned char no;
579 unsigned char nc;
580 unsigned char nl;
582 /* [ WORD 11 ]
583 Operand vector. NOTE! This must always be the last field
584 of this structure. In particular, this means that this
585 structure cannot be embedded inside another one. */
586 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
589 /* GIMPLE_OMP_CRITICAL */
591 struct GTY(()) gimple_statement_omp_critical {
592 /* [ WORD 1-5 ] */
593 struct gimple_statement_omp omp;
595 /* [ WORD 6 ]
596 Critical section name. */
597 tree name;
601 struct GTY(()) gimple_omp_for_iter {
602 /* Condition code. */
603 enum tree_code cond;
605 /* Index variable. */
606 tree index;
608 /* Initial value. */
609 tree initial;
611 /* Final value. */
612 tree final;
614 /* Increment. */
615 tree incr;
618 /* GIMPLE_OMP_FOR */
620 struct GTY(()) gimple_statement_omp_for {
621 /* [ WORD 1-5 ] */
622 struct gimple_statement_omp omp;
624 /* [ WORD 6 ] */
625 tree clauses;
627 /* [ WORD 7 ]
628 Number of elements in iter array. */
629 size_t collapse;
631 /* [ WORD 8 ] */
632 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
634 /* [ WORD 9 ]
635 Pre-body evaluated before the loop body begins. */
636 gimple_seq pre_body;
640 /* GIMPLE_OMP_PARALLEL */
642 struct GTY(()) gimple_statement_omp_parallel {
643 /* [ WORD 1-5 ] */
644 struct gimple_statement_omp omp;
646 /* [ WORD 6 ]
647 Clauses. */
648 tree clauses;
650 /* [ WORD 7 ]
651 Child function holding the body of the parallel region. */
652 tree child_fn;
654 /* [ WORD 8 ]
655 Shared data argument. */
656 tree data_arg;
660 /* GIMPLE_OMP_TASK */
662 struct GTY(()) gimple_statement_omp_task {
663 /* [ WORD 1-8 ] */
664 struct gimple_statement_omp_parallel par;
666 /* [ WORD 9 ]
667 Child function holding firstprivate initialization if needed. */
668 tree copy_fn;
670 /* [ WORD 10-11 ]
671 Size and alignment in bytes of the argument data block. */
672 tree arg_size;
673 tree arg_align;
677 /* GIMPLE_OMP_SECTION */
678 /* Uses struct gimple_statement_omp. */
681 /* GIMPLE_OMP_SECTIONS */
683 struct GTY(()) gimple_statement_omp_sections {
684 /* [ WORD 1-5 ] */
685 struct gimple_statement_omp omp;
687 /* [ WORD 6 ] */
688 tree clauses;
690 /* [ WORD 7 ]
691 The control variable used for deciding which of the sections to
692 execute. */
693 tree control;
696 /* GIMPLE_OMP_CONTINUE.
698 Note: This does not inherit from gimple_statement_omp, because we
699 do not need the body field. */
701 struct GTY(()) gimple_statement_omp_continue {
702 /* [ WORD 1-4 ] */
703 struct gimple_statement_base gsbase;
705 /* [ WORD 5 ] */
706 tree control_def;
708 /* [ WORD 6 ] */
709 tree control_use;
712 /* GIMPLE_OMP_SINGLE */
714 struct GTY(()) gimple_statement_omp_single {
715 /* [ WORD 1-5 ] */
716 struct gimple_statement_omp omp;
718 /* [ WORD 6 ] */
719 tree clauses;
723 /* GIMPLE_OMP_ATOMIC_LOAD.
724 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
725 contains a sequence, which we don't need here. */
727 struct GTY(()) gimple_statement_omp_atomic_load {
728 /* [ WORD 1-4 ] */
729 struct gimple_statement_base gsbase;
731 /* [ WORD 5-6 ] */
732 tree rhs, lhs;
735 /* GIMPLE_OMP_ATOMIC_STORE.
736 See note on GIMPLE_OMP_ATOMIC_LOAD. */
738 struct GTY(()) gimple_statement_omp_atomic_store {
739 /* [ WORD 1-4 ] */
740 struct gimple_statement_base gsbase;
742 /* [ WORD 5 ] */
743 tree val;
746 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
747 enum gimple_statement_structure_enum {
748 #include "gsstruct.def"
749 LAST_GSS_ENUM
751 #undef DEFGSSTRUCT
754 /* Define the overall contents of a gimple tuple. It may be any of the
755 structures declared above for various types of tuples. */
757 union GTY ((desc ("gimple_statement_structure (&%h)"))) gimple_statement_d {
758 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
759 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
760 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
761 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
762 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
763 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
764 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
765 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
766 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
767 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
768 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
769 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
770 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
771 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
772 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
773 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
774 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
775 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
776 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
777 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
778 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
779 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
780 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
781 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
784 /* In gimple.c. */
786 /* Offset in bytes to the location of the operand vector.
787 Zero if there is no operand vector for this tuple structure. */
788 extern size_t const gimple_ops_offset_[];
790 /* Map GIMPLE codes to GSS codes. */
791 extern enum gimple_statement_structure_enum const gss_for_code_[];
793 /* This variable holds the currently expanded gimple statement for purposes
794 of comminucating the profile info to the builtin expanders. */
795 extern gimple currently_expanding_gimple_stmt;
797 gimple gimple_build_return (tree);
799 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
800 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
802 void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *);
804 gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
805 tree MEM_STAT_DECL);
806 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
807 gimple_build_assign_with_ops_stat (c, o1, o2, o3 MEM_STAT_INFO)
809 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
810 #define gimple_build_debug_bind(var,val,stmt) \
811 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
813 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
814 gimple gimple_build_call (tree, unsigned, ...);
815 gimple gimple_build_call_from_tree (tree);
816 gimple gimplify_assign (tree, tree, gimple_seq *);
817 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
818 gimple gimple_build_label (tree label);
819 gimple gimple_build_goto (tree dest);
820 gimple gimple_build_nop (void);
821 gimple gimple_build_bind (tree, gimple_seq, tree);
822 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
823 VEC(tree,gc) *, VEC(tree,gc) *);
824 gimple gimple_build_catch (tree, gimple_seq);
825 gimple gimple_build_eh_filter (tree, gimple_seq);
826 gimple gimple_build_eh_must_not_throw (tree);
827 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
828 gimple gimple_build_wce (gimple_seq);
829 gimple gimple_build_resx (int);
830 gimple gimple_build_eh_dispatch (int);
831 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
832 gimple gimple_build_switch (unsigned, tree, tree, ...);
833 gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
834 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
835 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
836 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
837 gimple gimple_build_omp_critical (gimple_seq, tree);
838 gimple gimple_build_omp_section (gimple_seq);
839 gimple gimple_build_omp_continue (tree, tree);
840 gimple gimple_build_omp_master (gimple_seq);
841 gimple gimple_build_omp_return (bool);
842 gimple gimple_build_omp_ordered (gimple_seq);
843 gimple gimple_build_omp_sections (gimple_seq, tree);
844 gimple gimple_build_omp_sections_switch (void);
845 gimple gimple_build_omp_single (gimple_seq, tree);
846 gimple gimple_build_cdt (tree, tree);
847 gimple gimple_build_omp_atomic_load (tree, tree);
848 gimple gimple_build_omp_atomic_store (tree);
849 gimple gimple_build_predict (enum br_predictor, enum prediction);
850 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
851 void sort_case_labels (VEC(tree,heap) *);
852 void gimple_set_body (tree, gimple_seq);
853 gimple_seq gimple_body (tree);
854 bool gimple_has_body_p (tree);
855 gimple_seq gimple_seq_alloc (void);
856 void gimple_seq_free (gimple_seq);
857 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
858 gimple_seq gimple_seq_copy (gimple_seq);
859 int gimple_call_flags (const_gimple);
860 void gimple_call_reset_alias_info (gimple);
861 bool gimple_assign_copy_p (gimple);
862 bool gimple_assign_ssa_name_copy_p (gimple);
863 bool gimple_assign_single_p (gimple);
864 bool gimple_assign_unary_nop_p (gimple);
865 void gimple_set_bb (gimple, struct basic_block_def *);
866 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
867 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
868 tree, tree);
869 tree gimple_get_lhs (const_gimple);
870 void gimple_set_lhs (gimple, tree);
871 void gimple_replace_lhs (gimple, tree);
872 gimple gimple_copy (gimple);
873 bool is_gimple_operand (const_tree);
874 void gimple_set_modified (gimple, bool);
875 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
876 gimple gimple_build_cond_from_tree (tree, tree, tree);
877 void gimple_cond_set_condition_from_tree (gimple, tree);
878 bool gimple_has_side_effects (const_gimple);
879 bool gimple_rhs_has_side_effects (const_gimple);
880 bool gimple_could_trap_p (gimple);
881 bool gimple_assign_rhs_could_trap_p (gimple);
882 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
883 bool empty_body_p (gimple_seq);
884 unsigned get_gimple_rhs_num_ops (enum tree_code);
885 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
886 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
887 const char *gimple_decl_printable_name (tree, int);
888 tree gimple_fold_obj_type_ref (tree, tree);
890 /* Returns true iff T is a valid GIMPLE statement. */
891 extern bool is_gimple_stmt (tree);
893 /* Returns true iff TYPE is a valid type for a scalar register variable. */
894 extern bool is_gimple_reg_type (tree);
895 /* Returns true iff T is a scalar register variable. */
896 extern bool is_gimple_reg (tree);
897 /* Returns true iff T is any sort of variable. */
898 extern bool is_gimple_variable (tree);
899 /* Returns true iff T is any sort of symbol. */
900 extern bool is_gimple_id (tree);
901 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
902 extern bool is_gimple_min_lval (tree);
903 /* Returns true iff T is something whose address can be taken. */
904 extern bool is_gimple_addressable (tree);
905 /* Returns true iff T is any valid GIMPLE lvalue. */
906 extern bool is_gimple_lvalue (tree);
908 /* Returns true iff T is a GIMPLE address. */
909 bool is_gimple_address (const_tree);
910 /* Returns true iff T is a GIMPLE invariant address. */
911 bool is_gimple_invariant_address (const_tree);
912 /* Returns true iff T is a GIMPLE invariant address at interprocedural
913 level. */
914 bool is_gimple_ip_invariant_address (const_tree);
915 /* Returns true iff T is a valid GIMPLE constant. */
916 bool is_gimple_constant (const_tree);
917 /* Returns true iff T is a GIMPLE restricted function invariant. */
918 extern bool is_gimple_min_invariant (const_tree);
919 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
920 extern bool is_gimple_ip_invariant (const_tree);
921 /* Returns true iff T is a GIMPLE rvalue. */
922 extern bool is_gimple_val (tree);
923 /* Returns true iff T is a GIMPLE asm statement input. */
924 extern bool is_gimple_asm_val (tree);
925 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
926 GIMPLE temporary, a renamed user variable, or something else,
927 respectively. */
928 extern bool is_gimple_reg_rhs (tree);
929 extern bool is_gimple_mem_rhs (tree);
931 /* Returns true iff T is a valid if-statement condition. */
932 extern bool is_gimple_condexpr (tree);
934 /* Returns true iff T is a type conversion. */
935 extern bool is_gimple_cast (tree);
936 /* Returns true iff T is a variable that does not need to live in memory. */
937 extern bool is_gimple_non_addressable (tree t);
939 /* Returns true iff T is a valid call address expression. */
940 extern bool is_gimple_call_addr (tree);
941 /* If T makes a function call, returns the CALL_EXPR operand. */
942 extern tree get_call_expr_in (tree t);
944 extern void recalculate_side_effects (tree);
945 extern bool compare_field_offset (tree, tree);
946 extern tree gimple_register_type (tree);
947 extern void print_gimple_types_stats (void);
948 extern void free_gimple_type_tables (void);
949 extern tree gimple_unsigned_type (tree);
950 extern tree gimple_signed_type (tree);
951 extern alias_set_type gimple_get_alias_set (tree);
952 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
953 unsigned *);
954 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
955 bool (*)(gimple, tree, void *),
956 bool (*)(gimple, tree, void *),
957 bool (*)(gimple, tree, void *));
958 extern bool walk_stmt_load_store_ops (gimple, void *,
959 bool (*)(gimple, tree, void *),
960 bool (*)(gimple, tree, void *));
961 extern bool gimple_ior_addresses_taken (bitmap, gimple);
963 /* In gimplify.c */
964 extern tree create_tmp_var_raw (tree, const char *);
965 extern tree create_tmp_var_name (const char *);
966 extern tree create_tmp_var (tree, const char *);
967 extern tree create_tmp_reg (tree, const char *);
968 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
969 extern tree get_formal_tmp_var (tree, gimple_seq *);
970 extern void declare_vars (tree, gimple, bool);
971 extern void annotate_all_with_location (gimple_seq, location_t);
973 /* Validation of GIMPLE expressions. Note that these predicates only check
974 the basic form of the expression, they don't recurse to make sure that
975 underlying nodes are also of the right form. */
976 typedef bool (*gimple_predicate)(tree);
979 /* FIXME we should deduce this from the predicate. */
980 enum fallback {
981 fb_none = 0, /* Do not generate a temporary. */
983 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
984 gimplified expression. */
986 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
987 gimplified expression. */
989 fb_mayfail = 4, /* Gimplification may fail. Error issued
990 afterwards. */
991 fb_either= fb_rvalue | fb_lvalue
994 typedef int fallback_t;
996 enum gimplify_status {
997 GS_ERROR = -2, /* Something Bad Seen. */
998 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
999 GS_OK = 0, /* We did something, maybe more to do. */
1000 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1003 struct gimplify_ctx
1005 struct gimplify_ctx *prev_context;
1007 VEC(gimple,heap) *bind_expr_stack;
1008 tree temps;
1009 gimple_seq conditional_cleanups;
1010 tree exit_label;
1011 tree return_temp;
1013 VEC(tree,heap) *case_labels;
1014 /* The formal temporary table. Should this be persistent? */
1015 htab_t temp_htab;
1017 int conditions;
1018 bool save_stack;
1019 bool into_ssa;
1020 bool allow_rhs_cond_expr;
1023 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1024 bool (*) (tree), fallback_t);
1025 extern void gimplify_type_sizes (tree, gimple_seq *);
1026 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1027 extern bool gimplify_stmt (tree *, gimple_seq *);
1028 extern gimple gimplify_body (tree *, tree, bool);
1029 extern void push_gimplify_context (struct gimplify_ctx *);
1030 extern void pop_gimplify_context (gimple);
1031 extern void gimplify_and_add (tree, gimple_seq *);
1033 /* Miscellaneous helpers. */
1034 extern void gimple_add_tmp_var (tree);
1035 extern gimple gimple_current_bind_expr (void);
1036 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1037 extern tree voidify_wrapper_expr (tree, tree);
1038 extern tree build_and_jump (tree *);
1039 extern tree alloc_stmt_list (void);
1040 extern void free_stmt_list (tree);
1041 extern tree force_labels_r (tree *, int *, void *);
1042 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1043 gimple_seq *);
1044 struct gimplify_omp_ctx;
1045 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1046 extern tree gimple_boolify (tree);
1047 extern gimple_predicate rhs_predicate_for (tree);
1048 extern tree canonicalize_cond_expr_cond (tree);
1050 /* In omp-low.c. */
1051 extern tree omp_reduction_init (tree, tree);
1053 /* In tree-nested.c. */
1054 extern void lower_nested_functions (tree);
1055 extern void insert_field_into_struct (tree, tree);
1057 /* In gimplify.c. */
1058 extern void gimplify_function_tree (tree);
1060 /* In cfgexpand.c. */
1061 extern tree gimple_assign_rhs_to_tree (gimple);
1063 /* In builtins.c */
1064 extern bool validate_gimple_arglist (const_gimple, ...);
1066 /* In tree-ssa.c */
1067 extern bool tree_ssa_useless_type_conversion (tree);
1068 extern tree tree_ssa_strip_useless_type_conversions (tree);
1069 extern bool useless_type_conversion_p (tree, tree);
1070 extern bool types_compatible_p (tree, tree);
1072 /* Return the code for GIMPLE statement G. */
1074 static inline enum gimple_code
1075 gimple_code (const_gimple g)
1077 return g->gsbase.code;
1081 /* Return the GSS code used by a GIMPLE code. */
1083 static inline enum gimple_statement_structure_enum
1084 gss_for_code (enum gimple_code code)
1086 #ifdef ENABLE_CHECKING
1087 gcc_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1088 #endif
1089 return gss_for_code_[code];
1093 /* Return which GSS code is used by GS. */
1095 static inline enum gimple_statement_structure_enum
1096 gimple_statement_structure (gimple gs)
1098 return gss_for_code (gimple_code (gs));
1102 /* Return true if statement G has sub-statements. This is only true for
1103 High GIMPLE statements. */
1105 static inline bool
1106 gimple_has_substatements (gimple g)
1108 switch (gimple_code (g))
1110 case GIMPLE_BIND:
1111 case GIMPLE_CATCH:
1112 case GIMPLE_EH_FILTER:
1113 case GIMPLE_TRY:
1114 case GIMPLE_OMP_FOR:
1115 case GIMPLE_OMP_MASTER:
1116 case GIMPLE_OMP_ORDERED:
1117 case GIMPLE_OMP_SECTION:
1118 case GIMPLE_OMP_PARALLEL:
1119 case GIMPLE_OMP_TASK:
1120 case GIMPLE_OMP_SECTIONS:
1121 case GIMPLE_OMP_SINGLE:
1122 case GIMPLE_OMP_CRITICAL:
1123 case GIMPLE_WITH_CLEANUP_EXPR:
1124 return true;
1126 default:
1127 return false;
1132 /* Return the basic block holding statement G. */
1134 static inline struct basic_block_def *
1135 gimple_bb (const_gimple g)
1137 return g->gsbase.bb;
1141 /* Return the lexical scope block holding statement G. */
1143 static inline tree
1144 gimple_block (const_gimple g)
1146 return g->gsbase.block;
1150 /* Set BLOCK to be the lexical scope block holding statement G. */
1152 static inline void
1153 gimple_set_block (gimple g, tree block)
1155 g->gsbase.block = block;
1159 /* Return location information for statement G. */
1161 static inline location_t
1162 gimple_location (const_gimple g)
1164 return g->gsbase.location;
1167 /* Return pointer to location information for statement G. */
1169 static inline const location_t *
1170 gimple_location_ptr (const_gimple g)
1172 return &g->gsbase.location;
1176 /* Set location information for statement G. */
1178 static inline void
1179 gimple_set_location (gimple g, location_t location)
1181 g->gsbase.location = location;
1185 /* Return true if G contains location information. */
1187 static inline bool
1188 gimple_has_location (const_gimple g)
1190 return gimple_location (g) != UNKNOWN_LOCATION;
1194 /* Return the file name of the location of STMT. */
1196 static inline const char *
1197 gimple_filename (const_gimple stmt)
1199 return LOCATION_FILE (gimple_location (stmt));
1203 /* Return the line number of the location of STMT. */
1205 static inline int
1206 gimple_lineno (const_gimple stmt)
1208 return LOCATION_LINE (gimple_location (stmt));
1212 /* Determine whether SEQ is a singleton. */
1214 static inline bool
1215 gimple_seq_singleton_p (gimple_seq seq)
1217 return ((gimple_seq_first (seq) != NULL)
1218 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1221 /* Return true if no warnings should be emitted for statement STMT. */
1223 static inline bool
1224 gimple_no_warning_p (const_gimple stmt)
1226 return stmt->gsbase.no_warning;
1229 /* Set the no_warning flag of STMT to NO_WARNING. */
1231 static inline void
1232 gimple_set_no_warning (gimple stmt, bool no_warning)
1234 stmt->gsbase.no_warning = (unsigned) no_warning;
1237 /* Set the visited status on statement STMT to VISITED_P. */
1239 static inline void
1240 gimple_set_visited (gimple stmt, bool visited_p)
1242 stmt->gsbase.visited = (unsigned) visited_p;
1246 /* Return the visited status for statement STMT. */
1248 static inline bool
1249 gimple_visited_p (gimple stmt)
1251 return stmt->gsbase.visited;
1255 /* Set pass local flag PLF on statement STMT to VAL_P. */
1257 static inline void
1258 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1260 if (val_p)
1261 stmt->gsbase.plf |= (unsigned int) plf;
1262 else
1263 stmt->gsbase.plf &= ~((unsigned int) plf);
1267 /* Return the value of pass local flag PLF on statement STMT. */
1269 static inline unsigned int
1270 gimple_plf (gimple stmt, enum plf_mask plf)
1272 return stmt->gsbase.plf & ((unsigned int) plf);
1276 /* Set the UID of statement. */
1278 static inline void
1279 gimple_set_uid (gimple g, unsigned uid)
1281 g->gsbase.uid = uid;
1285 /* Return the UID of statement. */
1287 static inline unsigned
1288 gimple_uid (const_gimple g)
1290 return g->gsbase.uid;
1294 /* Return true if GIMPLE statement G has register or memory operands. */
1296 static inline bool
1297 gimple_has_ops (const_gimple g)
1299 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1303 /* Return true if GIMPLE statement G has memory operands. */
1305 static inline bool
1306 gimple_has_mem_ops (const_gimple g)
1308 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1312 /* Return the set of DEF operands for statement G. */
1314 static inline struct def_optype_d *
1315 gimple_def_ops (const_gimple g)
1317 if (!gimple_has_ops (g))
1318 return NULL;
1319 return g->gsops.opbase.def_ops;
1323 /* Set DEF to be the set of DEF operands for statement G. */
1325 static inline void
1326 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1328 gcc_assert (gimple_has_ops (g));
1329 g->gsops.opbase.def_ops = def;
1333 /* Return the set of USE operands for statement G. */
1335 static inline struct use_optype_d *
1336 gimple_use_ops (const_gimple g)
1338 if (!gimple_has_ops (g))
1339 return NULL;
1340 return g->gsops.opbase.use_ops;
1344 /* Set USE to be the set of USE operands for statement G. */
1346 static inline void
1347 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1349 gcc_assert (gimple_has_ops (g));
1350 g->gsops.opbase.use_ops = use;
1354 /* Return the set of VUSE operand for statement G. */
1356 static inline use_operand_p
1357 gimple_vuse_op (const_gimple g)
1359 struct use_optype_d *ops;
1360 if (!gimple_has_mem_ops (g))
1361 return NULL_USE_OPERAND_P;
1362 ops = g->gsops.opbase.use_ops;
1363 if (ops
1364 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1365 return USE_OP_PTR (ops);
1366 return NULL_USE_OPERAND_P;
1369 /* Return the set of VDEF operand for statement G. */
1371 static inline def_operand_p
1372 gimple_vdef_op (const_gimple g)
1374 struct def_optype_d *ops;
1375 if (!gimple_has_mem_ops (g))
1376 return NULL_DEF_OPERAND_P;
1377 ops = g->gsops.opbase.def_ops;
1378 if (ops
1379 && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1380 return DEF_OP_PTR (ops);
1381 return NULL_DEF_OPERAND_P;
1385 /* Return the single VUSE operand of the statement G. */
1387 static inline tree
1388 gimple_vuse (const_gimple g)
1390 if (!gimple_has_mem_ops (g))
1391 return NULL_TREE;
1392 return g->gsmembase.vuse;
1395 /* Return the single VDEF operand of the statement G. */
1397 static inline tree
1398 gimple_vdef (const_gimple g)
1400 if (!gimple_has_mem_ops (g))
1401 return NULL_TREE;
1402 return g->gsmembase.vdef;
1405 /* Return the single VUSE operand of the statement G. */
1407 static inline tree *
1408 gimple_vuse_ptr (gimple g)
1410 if (!gimple_has_mem_ops (g))
1411 return NULL;
1412 return &g->gsmembase.vuse;
1415 /* Return the single VDEF operand of the statement G. */
1417 static inline tree *
1418 gimple_vdef_ptr (gimple g)
1420 if (!gimple_has_mem_ops (g))
1421 return NULL;
1422 return &g->gsmembase.vdef;
1425 /* Set the single VUSE operand of the statement G. */
1427 static inline void
1428 gimple_set_vuse (gimple g, tree vuse)
1430 gcc_assert (gimple_has_mem_ops (g));
1431 g->gsmembase.vuse = vuse;
1434 /* Set the single VDEF operand of the statement G. */
1436 static inline void
1437 gimple_set_vdef (gimple g, tree vdef)
1439 gcc_assert (gimple_has_mem_ops (g));
1440 g->gsmembase.vdef = vdef;
1444 /* Return true if statement G has operands and the modified field has
1445 been set. */
1447 static inline bool
1448 gimple_modified_p (const_gimple g)
1450 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1454 /* Return the tree code for the expression computed by STMT. This is
1455 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1456 GIMPLE_CALL, return CALL_EXPR as the expression code for
1457 consistency. This is useful when the caller needs to deal with the
1458 three kinds of computation that GIMPLE supports. */
1460 static inline enum tree_code
1461 gimple_expr_code (const_gimple stmt)
1463 enum gimple_code code = gimple_code (stmt);
1464 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1465 return (enum tree_code) stmt->gsbase.subcode;
1466 else if (code == GIMPLE_CALL)
1467 return CALL_EXPR;
1468 else
1469 gcc_unreachable ();
1473 /* Mark statement S as modified, and update it. */
1475 static inline void
1476 update_stmt (gimple s)
1478 if (gimple_has_ops (s))
1480 gimple_set_modified (s, true);
1481 update_stmt_operands (s);
1485 /* Update statement S if it has been optimized. */
1487 static inline void
1488 update_stmt_if_modified (gimple s)
1490 if (gimple_modified_p (s))
1491 update_stmt_operands (s);
1494 /* Return true if statement STMT contains volatile operands. */
1496 static inline bool
1497 gimple_has_volatile_ops (const_gimple stmt)
1499 if (gimple_has_mem_ops (stmt))
1500 return stmt->gsbase.has_volatile_ops;
1501 else
1502 return false;
1506 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1508 static inline void
1509 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1511 if (gimple_has_mem_ops (stmt))
1512 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1516 /* Return true if statement STMT may access memory. */
1518 static inline bool
1519 gimple_references_memory_p (gimple stmt)
1521 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1525 /* Return the subcode for OMP statement S. */
1527 static inline unsigned
1528 gimple_omp_subcode (const_gimple s)
1530 gcc_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1531 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1532 return s->gsbase.subcode;
1535 /* Set the subcode for OMP statement S to SUBCODE. */
1537 static inline void
1538 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1540 /* We only have 16 bits for the subcode. Assert that we are not
1541 overflowing it. */
1542 gcc_assert (subcode < (1 << 16));
1543 s->gsbase.subcode = subcode;
1546 /* Set the nowait flag on OMP_RETURN statement S. */
1548 static inline void
1549 gimple_omp_return_set_nowait (gimple s)
1551 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1552 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1556 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1557 flag set. */
1559 static inline bool
1560 gimple_omp_return_nowait_p (const_gimple g)
1562 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1563 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1567 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1568 flag set. */
1570 static inline bool
1571 gimple_omp_section_last_p (const_gimple g)
1573 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1574 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1578 /* Set the GF_OMP_SECTION_LAST flag on G. */
1580 static inline void
1581 gimple_omp_section_set_last (gimple g)
1583 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1584 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1588 /* Return true if OMP parallel statement G has the
1589 GF_OMP_PARALLEL_COMBINED flag set. */
1591 static inline bool
1592 gimple_omp_parallel_combined_p (const_gimple g)
1594 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1595 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1599 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1600 value of COMBINED_P. */
1602 static inline void
1603 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1605 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1606 if (combined_p)
1607 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1608 else
1609 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1613 /* Return the number of operands for statement GS. */
1615 static inline unsigned
1616 gimple_num_ops (const_gimple gs)
1618 return gs->gsbase.num_ops;
1622 /* Set the number of operands for statement GS. */
1624 static inline void
1625 gimple_set_num_ops (gimple gs, unsigned num_ops)
1627 gs->gsbase.num_ops = num_ops;
1631 /* Return the array of operands for statement GS. */
1633 static inline tree *
1634 gimple_ops (gimple gs)
1636 size_t off;
1638 /* All the tuples have their operand vector at the very bottom
1639 of the structure. Note that those structures that do not
1640 have an operand vector have a zero offset. */
1641 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1642 gcc_assert (off != 0);
1644 return (tree *) ((char *) gs + off);
1648 /* Return operand I for statement GS. */
1650 static inline tree
1651 gimple_op (const_gimple gs, unsigned i)
1653 if (gimple_has_ops (gs))
1655 #ifdef ENABLE_CHECKING
1656 gcc_assert (i < gimple_num_ops (gs));
1657 #endif
1658 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1660 else
1661 return NULL_TREE;
1664 /* Return a pointer to operand I for statement GS. */
1666 static inline tree *
1667 gimple_op_ptr (const_gimple gs, unsigned i)
1669 if (gimple_has_ops (gs))
1671 #ifdef ENABLE_CHECKING
1672 gcc_assert (i < gimple_num_ops (gs));
1673 #endif
1674 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1676 else
1677 return NULL;
1680 /* Set operand I of statement GS to OP. */
1682 static inline void
1683 gimple_set_op (gimple gs, unsigned i, tree op)
1685 gcc_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1687 /* Note. It may be tempting to assert that OP matches
1688 is_gimple_operand, but that would be wrong. Different tuples
1689 accept slightly different sets of tree operands. Each caller
1690 should perform its own validation. */
1691 gimple_ops (gs)[i] = op;
1694 /* Return true if GS is a GIMPLE_ASSIGN. */
1696 static inline bool
1697 is_gimple_assign (const_gimple gs)
1699 return gimple_code (gs) == GIMPLE_ASSIGN;
1702 /* Determine if expression CODE is one of the valid expressions that can
1703 be used on the RHS of GIMPLE assignments. */
1705 static inline enum gimple_rhs_class
1706 get_gimple_rhs_class (enum tree_code code)
1708 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1711 /* Return the LHS of assignment statement GS. */
1713 static inline tree
1714 gimple_assign_lhs (const_gimple gs)
1716 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1717 return gimple_op (gs, 0);
1721 /* Return a pointer to the LHS of assignment statement GS. */
1723 static inline tree *
1724 gimple_assign_lhs_ptr (const_gimple gs)
1726 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1727 return gimple_op_ptr (gs, 0);
1731 /* Set LHS to be the LHS operand of assignment statement GS. */
1733 static inline void
1734 gimple_assign_set_lhs (gimple gs, tree lhs)
1736 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1737 gimple_set_op (gs, 0, lhs);
1739 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1740 SSA_NAME_DEF_STMT (lhs) = gs;
1744 /* Return the first operand on the RHS of assignment statement GS. */
1746 static inline tree
1747 gimple_assign_rhs1 (const_gimple gs)
1749 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1750 return gimple_op (gs, 1);
1754 /* Return a pointer to the first operand on the RHS of assignment
1755 statement GS. */
1757 static inline tree *
1758 gimple_assign_rhs1_ptr (const_gimple gs)
1760 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1761 return gimple_op_ptr (gs, 1);
1764 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1766 static inline void
1767 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1769 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1771 gimple_set_op (gs, 1, rhs);
1775 /* Return the second operand on the RHS of assignment statement GS.
1776 If GS does not have two operands, NULL is returned instead. */
1778 static inline tree
1779 gimple_assign_rhs2 (const_gimple gs)
1781 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1783 if (gimple_num_ops (gs) >= 3)
1784 return gimple_op (gs, 2);
1785 else
1786 return NULL_TREE;
1790 /* Return a pointer to the second operand on the RHS of assignment
1791 statement GS. */
1793 static inline tree *
1794 gimple_assign_rhs2_ptr (const_gimple gs)
1796 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1797 return gimple_op_ptr (gs, 2);
1801 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1803 static inline void
1804 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1806 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1808 gimple_set_op (gs, 2, rhs);
1811 /* Returns true if GS is a nontemporal move. */
1813 static inline bool
1814 gimple_assign_nontemporal_move_p (const_gimple gs)
1816 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1817 return gs->gsbase.nontemporal_move;
1820 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1822 static inline void
1823 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1825 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1826 gs->gsbase.nontemporal_move = nontemporal;
1830 /* Return the code of the expression computed on the rhs of assignment
1831 statement GS. In case that the RHS is a single object, returns the
1832 tree code of the object. */
1834 static inline enum tree_code
1835 gimple_assign_rhs_code (const_gimple gs)
1837 enum tree_code code;
1838 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1840 code = gimple_expr_code (gs);
1841 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1842 code = TREE_CODE (gimple_assign_rhs1 (gs));
1844 return code;
1848 /* Set CODE to be the code for the expression computed on the RHS of
1849 assignment S. */
1851 static inline void
1852 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
1854 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
1855 s->gsbase.subcode = code;
1859 /* Return the gimple rhs class of the code of the expression computed on
1860 the rhs of assignment statement GS.
1861 This will never return GIMPLE_INVALID_RHS. */
1863 static inline enum gimple_rhs_class
1864 gimple_assign_rhs_class (const_gimple gs)
1866 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
1870 /* Return true if S is a type-cast assignment. */
1872 static inline bool
1873 gimple_assign_cast_p (gimple s)
1875 if (is_gimple_assign (s))
1877 enum tree_code sc = gimple_assign_rhs_code (s);
1878 return CONVERT_EXPR_CODE_P (sc)
1879 || sc == VIEW_CONVERT_EXPR
1880 || sc == FIX_TRUNC_EXPR;
1883 return false;
1887 /* Return true if GS is a GIMPLE_CALL. */
1889 static inline bool
1890 is_gimple_call (const_gimple gs)
1892 return gimple_code (gs) == GIMPLE_CALL;
1895 /* Return the LHS of call statement GS. */
1897 static inline tree
1898 gimple_call_lhs (const_gimple gs)
1900 GIMPLE_CHECK (gs, GIMPLE_CALL);
1901 return gimple_op (gs, 0);
1905 /* Return a pointer to the LHS of call statement GS. */
1907 static inline tree *
1908 gimple_call_lhs_ptr (const_gimple gs)
1910 GIMPLE_CHECK (gs, GIMPLE_CALL);
1911 return gimple_op_ptr (gs, 0);
1915 /* Set LHS to be the LHS operand of call statement GS. */
1917 static inline void
1918 gimple_call_set_lhs (gimple gs, tree lhs)
1920 GIMPLE_CHECK (gs, GIMPLE_CALL);
1921 gimple_set_op (gs, 0, lhs);
1922 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1923 SSA_NAME_DEF_STMT (lhs) = gs;
1927 /* Return the tree node representing the function called by call
1928 statement GS. */
1930 static inline tree
1931 gimple_call_fn (const_gimple gs)
1933 GIMPLE_CHECK (gs, GIMPLE_CALL);
1934 return gimple_op (gs, 1);
1938 /* Return a pointer to the tree node representing the function called by call
1939 statement GS. */
1941 static inline tree *
1942 gimple_call_fn_ptr (const_gimple gs)
1944 GIMPLE_CHECK (gs, GIMPLE_CALL);
1945 return gimple_op_ptr (gs, 1);
1949 /* Set FN to be the function called by call statement GS. */
1951 static inline void
1952 gimple_call_set_fn (gimple gs, tree fn)
1954 GIMPLE_CHECK (gs, GIMPLE_CALL);
1955 gimple_set_op (gs, 1, fn);
1959 /* Set FNDECL to be the function called by call statement GS. */
1961 static inline void
1962 gimple_call_set_fndecl (gimple gs, tree decl)
1964 GIMPLE_CHECK (gs, GIMPLE_CALL);
1965 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
1969 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
1970 Otherwise return NULL. This function is analogous to
1971 get_callee_fndecl in tree land. */
1973 static inline tree
1974 gimple_call_fndecl (const_gimple gs)
1976 tree addr = gimple_call_fn (gs);
1977 if (TREE_CODE (addr) == ADDR_EXPR)
1978 return TREE_OPERAND (addr, 0);
1979 return NULL_TREE;
1983 /* Return the type returned by call statement GS. */
1985 static inline tree
1986 gimple_call_return_type (const_gimple gs)
1988 tree fn = gimple_call_fn (gs);
1989 tree type = TREE_TYPE (fn);
1991 /* See through the pointer. */
1992 type = TREE_TYPE (type);
1994 /* The type returned by a FUNCTION_DECL is the type of its
1995 function type. */
1996 return TREE_TYPE (type);
2000 /* Return the static chain for call statement GS. */
2002 static inline tree
2003 gimple_call_chain (const_gimple gs)
2005 GIMPLE_CHECK (gs, GIMPLE_CALL);
2006 return gimple_op (gs, 2);
2010 /* Return a pointer to the static chain for call statement GS. */
2012 static inline tree *
2013 gimple_call_chain_ptr (const_gimple gs)
2015 GIMPLE_CHECK (gs, GIMPLE_CALL);
2016 return gimple_op_ptr (gs, 2);
2019 /* Set CHAIN to be the static chain for call statement GS. */
2021 static inline void
2022 gimple_call_set_chain (gimple gs, tree chain)
2024 GIMPLE_CHECK (gs, GIMPLE_CALL);
2026 gimple_set_op (gs, 2, chain);
2030 /* Return the number of arguments used by call statement GS. */
2032 static inline unsigned
2033 gimple_call_num_args (const_gimple gs)
2035 unsigned num_ops;
2036 GIMPLE_CHECK (gs, GIMPLE_CALL);
2037 num_ops = gimple_num_ops (gs);
2038 return num_ops - 3;
2042 /* Return the argument at position INDEX for call statement GS. */
2044 static inline tree
2045 gimple_call_arg (const_gimple gs, unsigned index)
2047 GIMPLE_CHECK (gs, GIMPLE_CALL);
2048 return gimple_op (gs, index + 3);
2052 /* Return a pointer to the argument at position INDEX for call
2053 statement GS. */
2055 static inline tree *
2056 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2058 GIMPLE_CHECK (gs, GIMPLE_CALL);
2059 return gimple_op_ptr (gs, index + 3);
2063 /* Set ARG to be the argument at position INDEX for call statement GS. */
2065 static inline void
2066 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2068 GIMPLE_CHECK (gs, GIMPLE_CALL);
2069 gimple_set_op (gs, index + 3, arg);
2073 /* If TAIL_P is true, mark call statement S as being a tail call
2074 (i.e., a call just before the exit of a function). These calls are
2075 candidate for tail call optimization. */
2077 static inline void
2078 gimple_call_set_tail (gimple s, bool tail_p)
2080 GIMPLE_CHECK (s, GIMPLE_CALL);
2081 if (tail_p)
2082 s->gsbase.subcode |= GF_CALL_TAILCALL;
2083 else
2084 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2088 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2090 static inline bool
2091 gimple_call_tail_p (gimple s)
2093 GIMPLE_CHECK (s, GIMPLE_CALL);
2094 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2098 /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
2100 static inline void
2101 gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
2103 GIMPLE_CHECK (s, GIMPLE_CALL);
2104 if (inlinable_p)
2105 s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
2106 else
2107 s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
2111 /* Return true if GIMPLE_CALL S cannot be inlined. */
2113 static inline bool
2114 gimple_call_cannot_inline_p (gimple s)
2116 GIMPLE_CHECK (s, GIMPLE_CALL);
2117 return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0;
2121 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2122 slot optimization. This transformation uses the target of the call
2123 expansion as the return slot for calls that return in memory. */
2125 static inline void
2126 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2128 GIMPLE_CHECK (s, GIMPLE_CALL);
2129 if (return_slot_opt_p)
2130 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2131 else
2132 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2136 /* Return true if S is marked for return slot optimization. */
2138 static inline bool
2139 gimple_call_return_slot_opt_p (gimple s)
2141 GIMPLE_CHECK (s, GIMPLE_CALL);
2142 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2146 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2147 thunk to the thunked-to function. */
2149 static inline void
2150 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2152 GIMPLE_CHECK (s, GIMPLE_CALL);
2153 if (from_thunk_p)
2154 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2155 else
2156 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2160 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2162 static inline bool
2163 gimple_call_from_thunk_p (gimple s)
2165 GIMPLE_CHECK (s, GIMPLE_CALL);
2166 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2170 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2171 argument pack in its argument list. */
2173 static inline void
2174 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2176 GIMPLE_CHECK (s, GIMPLE_CALL);
2177 if (pass_arg_pack_p)
2178 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2179 else
2180 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2184 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2185 argument pack in its argument list. */
2187 static inline bool
2188 gimple_call_va_arg_pack_p (gimple s)
2190 GIMPLE_CHECK (s, GIMPLE_CALL);
2191 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2195 /* Return true if S is a noreturn call. */
2197 static inline bool
2198 gimple_call_noreturn_p (gimple s)
2200 GIMPLE_CHECK (s, GIMPLE_CALL);
2201 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2205 /* Return true if S is a nothrow call. */
2207 static inline bool
2208 gimple_call_nothrow_p (gimple s)
2210 GIMPLE_CHECK (s, GIMPLE_CALL);
2211 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2215 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2217 static inline void
2218 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2220 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2221 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2222 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2226 /* Return a pointer to the points-to solution for the set of call-used
2227 variables of the call CALL. */
2229 static inline struct pt_solution *
2230 gimple_call_use_set (gimple call)
2232 GIMPLE_CHECK (call, GIMPLE_CALL);
2233 return &call->gimple_call.call_used;
2237 /* Return a pointer to the points-to solution for the set of call-used
2238 variables of the call CALL. */
2240 static inline struct pt_solution *
2241 gimple_call_clobber_set (gimple call)
2243 GIMPLE_CHECK (call, GIMPLE_CALL);
2244 return &call->gimple_call.call_clobbered;
2248 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2249 non-NULL lhs. */
2251 static inline bool
2252 gimple_has_lhs (gimple stmt)
2254 return (is_gimple_assign (stmt)
2255 || (is_gimple_call (stmt)
2256 && gimple_call_lhs (stmt) != NULL_TREE));
2260 /* Return the code of the predicate computed by conditional statement GS. */
2262 static inline enum tree_code
2263 gimple_cond_code (const_gimple gs)
2265 GIMPLE_CHECK (gs, GIMPLE_COND);
2266 return (enum tree_code) gs->gsbase.subcode;
2270 /* Set CODE to be the predicate code for the conditional statement GS. */
2272 static inline void
2273 gimple_cond_set_code (gimple gs, enum tree_code code)
2275 GIMPLE_CHECK (gs, GIMPLE_COND);
2276 gs->gsbase.subcode = code;
2280 /* Return the LHS of the predicate computed by conditional statement GS. */
2282 static inline tree
2283 gimple_cond_lhs (const_gimple gs)
2285 GIMPLE_CHECK (gs, GIMPLE_COND);
2286 return gimple_op (gs, 0);
2289 /* Return the pointer to the LHS of the predicate computed by conditional
2290 statement GS. */
2292 static inline tree *
2293 gimple_cond_lhs_ptr (const_gimple gs)
2295 GIMPLE_CHECK (gs, GIMPLE_COND);
2296 return gimple_op_ptr (gs, 0);
2299 /* Set LHS to be the LHS operand of the predicate computed by
2300 conditional statement GS. */
2302 static inline void
2303 gimple_cond_set_lhs (gimple gs, tree lhs)
2305 GIMPLE_CHECK (gs, GIMPLE_COND);
2306 gimple_set_op (gs, 0, lhs);
2310 /* Return the RHS operand of the predicate computed by conditional GS. */
2312 static inline tree
2313 gimple_cond_rhs (const_gimple gs)
2315 GIMPLE_CHECK (gs, GIMPLE_COND);
2316 return gimple_op (gs, 1);
2319 /* Return the pointer to the RHS operand of the predicate computed by
2320 conditional GS. */
2322 static inline tree *
2323 gimple_cond_rhs_ptr (const_gimple gs)
2325 GIMPLE_CHECK (gs, GIMPLE_COND);
2326 return gimple_op_ptr (gs, 1);
2330 /* Set RHS to be the RHS operand of the predicate computed by
2331 conditional statement GS. */
2333 static inline void
2334 gimple_cond_set_rhs (gimple gs, tree rhs)
2336 GIMPLE_CHECK (gs, GIMPLE_COND);
2337 gimple_set_op (gs, 1, rhs);
2341 /* Return the label used by conditional statement GS when its
2342 predicate evaluates to true. */
2344 static inline tree
2345 gimple_cond_true_label (const_gimple gs)
2347 GIMPLE_CHECK (gs, GIMPLE_COND);
2348 return gimple_op (gs, 2);
2352 /* Set LABEL to be the label used by conditional statement GS when its
2353 predicate evaluates to true. */
2355 static inline void
2356 gimple_cond_set_true_label (gimple gs, tree label)
2358 GIMPLE_CHECK (gs, GIMPLE_COND);
2359 gimple_set_op (gs, 2, label);
2363 /* Set LABEL to be the label used by conditional statement GS when its
2364 predicate evaluates to false. */
2366 static inline void
2367 gimple_cond_set_false_label (gimple gs, tree label)
2369 GIMPLE_CHECK (gs, GIMPLE_COND);
2370 gimple_set_op (gs, 3, label);
2374 /* Return the label used by conditional statement GS when its
2375 predicate evaluates to false. */
2377 static inline tree
2378 gimple_cond_false_label (const_gimple gs)
2380 GIMPLE_CHECK (gs, GIMPLE_COND);
2381 return gimple_op (gs, 3);
2385 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2387 static inline void
2388 gimple_cond_make_false (gimple gs)
2390 gimple_cond_set_lhs (gs, boolean_true_node);
2391 gimple_cond_set_rhs (gs, boolean_false_node);
2392 gs->gsbase.subcode = EQ_EXPR;
2396 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2398 static inline void
2399 gimple_cond_make_true (gimple gs)
2401 gimple_cond_set_lhs (gs, boolean_true_node);
2402 gimple_cond_set_rhs (gs, boolean_true_node);
2403 gs->gsbase.subcode = EQ_EXPR;
2406 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2407 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2409 static inline bool
2410 gimple_cond_true_p (const_gimple gs)
2412 tree lhs = gimple_cond_lhs (gs);
2413 tree rhs = gimple_cond_rhs (gs);
2414 enum tree_code code = gimple_cond_code (gs);
2416 if (lhs != boolean_true_node && lhs != boolean_false_node)
2417 return false;
2419 if (rhs != boolean_true_node && rhs != boolean_false_node)
2420 return false;
2422 if (code == NE_EXPR && lhs != rhs)
2423 return true;
2425 if (code == EQ_EXPR && lhs == rhs)
2426 return true;
2428 return false;
2431 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2432 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2434 static inline bool
2435 gimple_cond_false_p (const_gimple gs)
2437 tree lhs = gimple_cond_lhs (gs);
2438 tree rhs = gimple_cond_rhs (gs);
2439 enum tree_code code = gimple_cond_code (gs);
2441 if (lhs != boolean_true_node && lhs != boolean_false_node)
2442 return false;
2444 if (rhs != boolean_true_node && rhs != boolean_false_node)
2445 return false;
2447 if (code == NE_EXPR && lhs == rhs)
2448 return true;
2450 if (code == EQ_EXPR && lhs != rhs)
2451 return true;
2453 return false;
2456 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2457 'if (var == 1)' */
2459 static inline bool
2460 gimple_cond_single_var_p (gimple gs)
2462 if (gimple_cond_code (gs) == NE_EXPR
2463 && gimple_cond_rhs (gs) == boolean_false_node)
2464 return true;
2466 if (gimple_cond_code (gs) == EQ_EXPR
2467 && gimple_cond_rhs (gs) == boolean_true_node)
2468 return true;
2470 return false;
2473 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2475 static inline void
2476 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2478 gimple_cond_set_code (stmt, code);
2479 gimple_cond_set_lhs (stmt, lhs);
2480 gimple_cond_set_rhs (stmt, rhs);
2483 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2485 static inline tree
2486 gimple_label_label (const_gimple gs)
2488 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2489 return gimple_op (gs, 0);
2493 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2494 GS. */
2496 static inline void
2497 gimple_label_set_label (gimple gs, tree label)
2499 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2500 gimple_set_op (gs, 0, label);
2504 /* Return the destination of the unconditional jump GS. */
2506 static inline tree
2507 gimple_goto_dest (const_gimple gs)
2509 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2510 return gimple_op (gs, 0);
2514 /* Set DEST to be the destination of the unconditonal jump GS. */
2516 static inline void
2517 gimple_goto_set_dest (gimple gs, tree dest)
2519 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2520 gimple_set_op (gs, 0, dest);
2524 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2526 static inline tree
2527 gimple_bind_vars (const_gimple gs)
2529 GIMPLE_CHECK (gs, GIMPLE_BIND);
2530 return gs->gimple_bind.vars;
2534 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2535 statement GS. */
2537 static inline void
2538 gimple_bind_set_vars (gimple gs, tree vars)
2540 GIMPLE_CHECK (gs, GIMPLE_BIND);
2541 gs->gimple_bind.vars = vars;
2545 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2546 statement GS. */
2548 static inline void
2549 gimple_bind_append_vars (gimple gs, tree vars)
2551 GIMPLE_CHECK (gs, GIMPLE_BIND);
2552 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2556 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2558 static inline gimple_seq
2559 gimple_bind_body (gimple gs)
2561 GIMPLE_CHECK (gs, GIMPLE_BIND);
2562 return gs->gimple_bind.body;
2566 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2567 statement GS. */
2569 static inline void
2570 gimple_bind_set_body (gimple gs, gimple_seq seq)
2572 GIMPLE_CHECK (gs, GIMPLE_BIND);
2573 gs->gimple_bind.body = seq;
2577 /* Append a statement to the end of a GIMPLE_BIND's body. */
2579 static inline void
2580 gimple_bind_add_stmt (gimple gs, gimple stmt)
2582 GIMPLE_CHECK (gs, GIMPLE_BIND);
2583 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2587 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2589 static inline void
2590 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2592 GIMPLE_CHECK (gs, GIMPLE_BIND);
2593 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2597 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2598 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2600 static inline tree
2601 gimple_bind_block (const_gimple gs)
2603 GIMPLE_CHECK (gs, GIMPLE_BIND);
2604 return gs->gimple_bind.block;
2608 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2609 statement GS. */
2611 static inline void
2612 gimple_bind_set_block (gimple gs, tree block)
2614 GIMPLE_CHECK (gs, GIMPLE_BIND);
2615 gcc_assert (block == NULL_TREE || TREE_CODE (block) == BLOCK);
2616 gs->gimple_bind.block = block;
2620 /* Return the number of input operands for GIMPLE_ASM GS. */
2622 static inline unsigned
2623 gimple_asm_ninputs (const_gimple gs)
2625 GIMPLE_CHECK (gs, GIMPLE_ASM);
2626 return gs->gimple_asm.ni;
2630 /* Return the number of output operands for GIMPLE_ASM GS. */
2632 static inline unsigned
2633 gimple_asm_noutputs (const_gimple gs)
2635 GIMPLE_CHECK (gs, GIMPLE_ASM);
2636 return gs->gimple_asm.no;
2640 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2642 static inline unsigned
2643 gimple_asm_nclobbers (const_gimple gs)
2645 GIMPLE_CHECK (gs, GIMPLE_ASM);
2646 return gs->gimple_asm.nc;
2649 /* Return the number of label operands for GIMPLE_ASM GS. */
2651 static inline unsigned
2652 gimple_asm_nlabels (const_gimple gs)
2654 GIMPLE_CHECK (gs, GIMPLE_ASM);
2655 return gs->gimple_asm.nl;
2658 /* Return input operand INDEX of GIMPLE_ASM GS. */
2660 static inline tree
2661 gimple_asm_input_op (const_gimple gs, unsigned index)
2663 GIMPLE_CHECK (gs, GIMPLE_ASM);
2664 gcc_assert (index <= gs->gimple_asm.ni);
2665 return gimple_op (gs, index);
2668 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2670 static inline tree *
2671 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2673 GIMPLE_CHECK (gs, GIMPLE_ASM);
2674 gcc_assert (index <= gs->gimple_asm.ni);
2675 return gimple_op_ptr (gs, index);
2679 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2681 static inline void
2682 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2684 GIMPLE_CHECK (gs, GIMPLE_ASM);
2685 gcc_assert (index <= gs->gimple_asm.ni);
2686 gcc_assert (TREE_CODE (in_op) == TREE_LIST);
2687 gimple_set_op (gs, index, in_op);
2691 /* Return output operand INDEX of GIMPLE_ASM GS. */
2693 static inline tree
2694 gimple_asm_output_op (const_gimple gs, unsigned index)
2696 GIMPLE_CHECK (gs, GIMPLE_ASM);
2697 gcc_assert (index <= gs->gimple_asm.no);
2698 return gimple_op (gs, index + gs->gimple_asm.ni);
2701 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2703 static inline tree *
2704 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2706 GIMPLE_CHECK (gs, GIMPLE_ASM);
2707 gcc_assert (index <= gs->gimple_asm.no);
2708 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2712 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2714 static inline void
2715 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2717 GIMPLE_CHECK (gs, GIMPLE_ASM);
2718 gcc_assert (index <= gs->gimple_asm.no);
2719 gcc_assert (TREE_CODE (out_op) == TREE_LIST);
2720 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2724 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2726 static inline tree
2727 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2729 GIMPLE_CHECK (gs, GIMPLE_ASM);
2730 gcc_assert (index <= gs->gimple_asm.nc);
2731 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2735 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2737 static inline void
2738 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2740 GIMPLE_CHECK (gs, GIMPLE_ASM);
2741 gcc_assert (index <= gs->gimple_asm.nc);
2742 gcc_assert (TREE_CODE (clobber_op) == TREE_LIST);
2743 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2746 /* Return label operand INDEX of GIMPLE_ASM GS. */
2748 static inline tree
2749 gimple_asm_label_op (const_gimple gs, unsigned index)
2751 GIMPLE_CHECK (gs, GIMPLE_ASM);
2752 gcc_assert (index <= gs->gimple_asm.nl);
2753 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
2756 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
2758 static inline void
2759 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
2761 GIMPLE_CHECK (gs, GIMPLE_ASM);
2762 gcc_assert (index <= gs->gimple_asm.nl);
2763 gcc_assert (TREE_CODE (label_op) == TREE_LIST);
2764 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
2767 /* Return the string representing the assembly instruction in
2768 GIMPLE_ASM GS. */
2770 static inline const char *
2771 gimple_asm_string (const_gimple gs)
2773 GIMPLE_CHECK (gs, GIMPLE_ASM);
2774 return gs->gimple_asm.string;
2778 /* Return true if GS is an asm statement marked volatile. */
2780 static inline bool
2781 gimple_asm_volatile_p (const_gimple gs)
2783 GIMPLE_CHECK (gs, GIMPLE_ASM);
2784 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
2788 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
2790 static inline void
2791 gimple_asm_set_volatile (gimple gs, bool volatile_p)
2793 GIMPLE_CHECK (gs, GIMPLE_ASM);
2794 if (volatile_p)
2795 gs->gsbase.subcode |= GF_ASM_VOLATILE;
2796 else
2797 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
2801 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
2803 static inline void
2804 gimple_asm_set_input (gimple gs, bool input_p)
2806 GIMPLE_CHECK (gs, GIMPLE_ASM);
2807 if (input_p)
2808 gs->gsbase.subcode |= GF_ASM_INPUT;
2809 else
2810 gs->gsbase.subcode &= ~GF_ASM_INPUT;
2814 /* Return true if asm GS is an ASM_INPUT. */
2816 static inline bool
2817 gimple_asm_input_p (const_gimple gs)
2819 GIMPLE_CHECK (gs, GIMPLE_ASM);
2820 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
2824 /* Return the types handled by GIMPLE_CATCH statement GS. */
2826 static inline tree
2827 gimple_catch_types (const_gimple gs)
2829 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2830 return gs->gimple_catch.types;
2834 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
2836 static inline tree *
2837 gimple_catch_types_ptr (gimple gs)
2839 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2840 return &gs->gimple_catch.types;
2844 /* Return the GIMPLE sequence representing the body of the handler of
2845 GIMPLE_CATCH statement GS. */
2847 static inline gimple_seq
2848 gimple_catch_handler (gimple gs)
2850 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2851 return gs->gimple_catch.handler;
2855 /* Return a pointer to the GIMPLE sequence representing the body of
2856 the handler of GIMPLE_CATCH statement GS. */
2858 static inline gimple_seq *
2859 gimple_catch_handler_ptr (gimple gs)
2861 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2862 return &gs->gimple_catch.handler;
2866 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
2868 static inline void
2869 gimple_catch_set_types (gimple gs, tree t)
2871 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2872 gs->gimple_catch.types = t;
2876 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
2878 static inline void
2879 gimple_catch_set_handler (gimple gs, gimple_seq handler)
2881 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2882 gs->gimple_catch.handler = handler;
2886 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
2888 static inline tree
2889 gimple_eh_filter_types (const_gimple gs)
2891 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2892 return gs->gimple_eh_filter.types;
2896 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
2897 GS. */
2899 static inline tree *
2900 gimple_eh_filter_types_ptr (gimple gs)
2902 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2903 return &gs->gimple_eh_filter.types;
2907 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
2908 statement fails. */
2910 static inline gimple_seq
2911 gimple_eh_filter_failure (gimple gs)
2913 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2914 return gs->gimple_eh_filter.failure;
2918 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
2920 static inline void
2921 gimple_eh_filter_set_types (gimple gs, tree types)
2923 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2924 gs->gimple_eh_filter.types = types;
2928 /* Set FAILURE to be the sequence of statements to execute on failure
2929 for GIMPLE_EH_FILTER GS. */
2931 static inline void
2932 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
2934 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2935 gs->gimple_eh_filter.failure = failure;
2938 /* Get the function decl to be called by the MUST_NOT_THROW region. */
2940 static inline tree
2941 gimple_eh_must_not_throw_fndecl (gimple gs)
2943 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
2944 return gs->gimple_eh_mnt.fndecl;
2947 /* Set the function decl to be called by GS to DECL. */
2949 static inline void
2950 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
2952 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
2953 gs->gimple_eh_mnt.fndecl = decl;
2957 /* GIMPLE_TRY accessors. */
2959 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
2960 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
2962 static inline enum gimple_try_flags
2963 gimple_try_kind (const_gimple gs)
2965 GIMPLE_CHECK (gs, GIMPLE_TRY);
2966 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
2970 /* Set the kind of try block represented by GIMPLE_TRY GS. */
2972 static inline void
2973 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
2975 GIMPLE_CHECK (gs, GIMPLE_TRY);
2976 gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY);
2977 if (gimple_try_kind (gs) != kind)
2978 gs->gsbase.subcode = (unsigned int) kind;
2982 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
2984 static inline bool
2985 gimple_try_catch_is_cleanup (const_gimple gs)
2987 gcc_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
2988 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
2992 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
2994 static inline gimple_seq
2995 gimple_try_eval (gimple gs)
2997 GIMPLE_CHECK (gs, GIMPLE_TRY);
2998 return gs->gimple_try.eval;
3002 /* Return the sequence of statements used as the cleanup body for
3003 GIMPLE_TRY GS. */
3005 static inline gimple_seq
3006 gimple_try_cleanup (gimple gs)
3008 GIMPLE_CHECK (gs, GIMPLE_TRY);
3009 return gs->gimple_try.cleanup;
3013 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3015 static inline void
3016 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3018 gcc_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3019 if (catch_is_cleanup)
3020 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3021 else
3022 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3026 /* Set EVAL to be the sequence of statements to use as the body for
3027 GIMPLE_TRY GS. */
3029 static inline void
3030 gimple_try_set_eval (gimple gs, gimple_seq eval)
3032 GIMPLE_CHECK (gs, GIMPLE_TRY);
3033 gs->gimple_try.eval = eval;
3037 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3038 body for GIMPLE_TRY GS. */
3040 static inline void
3041 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3043 GIMPLE_CHECK (gs, GIMPLE_TRY);
3044 gs->gimple_try.cleanup = cleanup;
3048 /* Return the cleanup sequence for cleanup statement GS. */
3050 static inline gimple_seq
3051 gimple_wce_cleanup (gimple gs)
3053 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3054 return gs->gimple_wce.cleanup;
3058 /* Set CLEANUP to be the cleanup sequence for GS. */
3060 static inline void
3061 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3063 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3064 gs->gimple_wce.cleanup = cleanup;
3068 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3070 static inline bool
3071 gimple_wce_cleanup_eh_only (const_gimple gs)
3073 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3074 return gs->gsbase.subcode != 0;
3078 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3080 static inline void
3081 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3083 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3084 gs->gsbase.subcode = (unsigned int) eh_only_p;
3088 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3090 static inline unsigned
3091 gimple_phi_capacity (const_gimple gs)
3093 GIMPLE_CHECK (gs, GIMPLE_PHI);
3094 return gs->gimple_phi.capacity;
3098 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3099 be exactly the number of incoming edges for the basic block holding
3100 GS. */
3102 static inline unsigned
3103 gimple_phi_num_args (const_gimple gs)
3105 GIMPLE_CHECK (gs, GIMPLE_PHI);
3106 return gs->gimple_phi.nargs;
3110 /* Return the SSA name created by GIMPLE_PHI GS. */
3112 static inline tree
3113 gimple_phi_result (const_gimple gs)
3115 GIMPLE_CHECK (gs, GIMPLE_PHI);
3116 return gs->gimple_phi.result;
3119 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3121 static inline tree *
3122 gimple_phi_result_ptr (gimple gs)
3124 GIMPLE_CHECK (gs, GIMPLE_PHI);
3125 return &gs->gimple_phi.result;
3128 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3130 static inline void
3131 gimple_phi_set_result (gimple gs, tree result)
3133 GIMPLE_CHECK (gs, GIMPLE_PHI);
3134 gs->gimple_phi.result = result;
3138 /* Return the PHI argument corresponding to incoming edge INDEX for
3139 GIMPLE_PHI GS. */
3141 static inline struct phi_arg_d *
3142 gimple_phi_arg (gimple gs, unsigned index)
3144 GIMPLE_CHECK (gs, GIMPLE_PHI);
3145 gcc_assert (index <= gs->gimple_phi.capacity);
3146 return &(gs->gimple_phi.args[index]);
3149 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3150 for GIMPLE_PHI GS. */
3152 static inline void
3153 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3155 GIMPLE_CHECK (gs, GIMPLE_PHI);
3156 gcc_assert (index <= gs->gimple_phi.nargs);
3157 memcpy (gs->gimple_phi.args + index, phiarg, sizeof (struct phi_arg_d));
3160 /* Return the region number for GIMPLE_RESX GS. */
3162 static inline int
3163 gimple_resx_region (const_gimple gs)
3165 GIMPLE_CHECK (gs, GIMPLE_RESX);
3166 return gs->gimple_eh_ctrl.region;
3169 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3171 static inline void
3172 gimple_resx_set_region (gimple gs, int region)
3174 GIMPLE_CHECK (gs, GIMPLE_RESX);
3175 gs->gimple_eh_ctrl.region = region;
3178 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3180 static inline int
3181 gimple_eh_dispatch_region (const_gimple gs)
3183 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3184 return gs->gimple_eh_ctrl.region;
3187 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3189 static inline void
3190 gimple_eh_dispatch_set_region (gimple gs, int region)
3192 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3193 gs->gimple_eh_ctrl.region = region;
3196 /* Return the number of labels associated with the switch statement GS. */
3198 static inline unsigned
3199 gimple_switch_num_labels (const_gimple gs)
3201 unsigned num_ops;
3202 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3203 num_ops = gimple_num_ops (gs);
3204 gcc_assert (num_ops > 1);
3205 return num_ops - 1;
3209 /* Set NLABELS to be the number of labels for the switch statement GS. */
3211 static inline void
3212 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3214 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3215 gimple_set_num_ops (g, nlabels + 1);
3219 /* Return the index variable used by the switch statement GS. */
3221 static inline tree
3222 gimple_switch_index (const_gimple gs)
3224 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3225 return gimple_op (gs, 0);
3229 /* Return a pointer to the index variable for the switch statement GS. */
3231 static inline tree *
3232 gimple_switch_index_ptr (const_gimple gs)
3234 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3235 return gimple_op_ptr (gs, 0);
3239 /* Set INDEX to be the index variable for switch statement GS. */
3241 static inline void
3242 gimple_switch_set_index (gimple gs, tree index)
3244 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3245 gcc_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3246 gimple_set_op (gs, 0, index);
3250 /* Return the label numbered INDEX. The default label is 0, followed by any
3251 labels in a switch statement. */
3253 static inline tree
3254 gimple_switch_label (const_gimple gs, unsigned index)
3256 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3257 gcc_assert (gimple_num_ops (gs) > index + 1);
3258 return gimple_op (gs, index + 1);
3261 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3263 static inline void
3264 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3266 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3267 gcc_assert (gimple_num_ops (gs) > index + 1);
3268 gcc_assert (label == NULL_TREE || TREE_CODE (label) == CASE_LABEL_EXPR);
3269 gimple_set_op (gs, index + 1, label);
3272 /* Return the default label for a switch statement. */
3274 static inline tree
3275 gimple_switch_default_label (const_gimple gs)
3277 return gimple_switch_label (gs, 0);
3280 /* Set the default label for a switch statement. */
3282 static inline void
3283 gimple_switch_set_default_label (gimple gs, tree label)
3285 gimple_switch_set_label (gs, 0, label);
3288 /* Return true if GS is a GIMPLE_DEBUG statement. */
3290 static inline bool
3291 is_gimple_debug (const_gimple gs)
3293 return gimple_code (gs) == GIMPLE_DEBUG;
3296 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3298 static inline bool
3299 gimple_debug_bind_p (const_gimple s)
3301 if (is_gimple_debug (s))
3302 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3304 return false;
3307 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3309 static inline tree
3310 gimple_debug_bind_get_var (gimple dbg)
3312 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3313 #ifdef ENABLE_CHECKING
3314 gcc_assert (gimple_debug_bind_p (dbg));
3315 #endif
3316 return gimple_op (dbg, 0);
3319 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3320 statement. */
3322 static inline tree
3323 gimple_debug_bind_get_value (gimple dbg)
3325 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3326 #ifdef ENABLE_CHECKING
3327 gcc_assert (gimple_debug_bind_p (dbg));
3328 #endif
3329 return gimple_op (dbg, 1);
3332 /* Return a pointer to the value bound to the variable in a
3333 GIMPLE_DEBUG bind statement. */
3335 static inline tree *
3336 gimple_debug_bind_get_value_ptr (gimple dbg)
3338 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3339 #ifdef ENABLE_CHECKING
3340 gcc_assert (gimple_debug_bind_p (dbg));
3341 #endif
3342 return gimple_op_ptr (dbg, 1);
3345 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3347 static inline void
3348 gimple_debug_bind_set_var (gimple dbg, tree var)
3350 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3351 #ifdef ENABLE_CHECKING
3352 gcc_assert (gimple_debug_bind_p (dbg));
3353 #endif
3354 gimple_set_op (dbg, 0, var);
3357 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3358 statement. */
3360 static inline void
3361 gimple_debug_bind_set_value (gimple dbg, tree value)
3363 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3364 #ifdef ENABLE_CHECKING
3365 gcc_assert (gimple_debug_bind_p (dbg));
3366 #endif
3367 gimple_set_op (dbg, 1, value);
3370 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3371 optimized away. */
3372 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3374 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3375 statement. */
3377 static inline void
3378 gimple_debug_bind_reset_value (gimple dbg)
3380 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3381 #ifdef ENABLE_CHECKING
3382 gcc_assert (gimple_debug_bind_p (dbg));
3383 #endif
3384 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3387 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3388 value. */
3390 static inline bool
3391 gimple_debug_bind_has_value_p (gimple dbg)
3393 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3394 #ifdef ENABLE_CHECKING
3395 gcc_assert (gimple_debug_bind_p (dbg));
3396 #endif
3397 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3400 #undef GIMPLE_DEBUG_BIND_NOVALUE
3402 /* Return the body for the OMP statement GS. */
3404 static inline gimple_seq
3405 gimple_omp_body (gimple gs)
3407 return gs->omp.body;
3410 /* Set BODY to be the body for the OMP statement GS. */
3412 static inline void
3413 gimple_omp_set_body (gimple gs, gimple_seq body)
3415 gs->omp.body = body;
3419 /* Return the name associated with OMP_CRITICAL statement GS. */
3421 static inline tree
3422 gimple_omp_critical_name (const_gimple gs)
3424 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3425 return gs->gimple_omp_critical.name;
3429 /* Return a pointer to the name associated with OMP critical statement GS. */
3431 static inline tree *
3432 gimple_omp_critical_name_ptr (gimple gs)
3434 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3435 return &gs->gimple_omp_critical.name;
3439 /* Set NAME to be the name associated with OMP critical statement GS. */
3441 static inline void
3442 gimple_omp_critical_set_name (gimple gs, tree name)
3444 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3445 gs->gimple_omp_critical.name = name;
3449 /* Return the clauses associated with OMP_FOR GS. */
3451 static inline tree
3452 gimple_omp_for_clauses (const_gimple gs)
3454 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3455 return gs->gimple_omp_for.clauses;
3459 /* Return a pointer to the OMP_FOR GS. */
3461 static inline tree *
3462 gimple_omp_for_clauses_ptr (gimple gs)
3464 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3465 return &gs->gimple_omp_for.clauses;
3469 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3471 static inline void
3472 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3474 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3475 gs->gimple_omp_for.clauses = clauses;
3479 /* Get the collapse count of OMP_FOR GS. */
3481 static inline size_t
3482 gimple_omp_for_collapse (gimple gs)
3484 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3485 return gs->gimple_omp_for.collapse;
3489 /* Return the index variable for OMP_FOR GS. */
3491 static inline tree
3492 gimple_omp_for_index (const_gimple gs, size_t i)
3494 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3495 gcc_assert (i < gs->gimple_omp_for.collapse);
3496 return gs->gimple_omp_for.iter[i].index;
3500 /* Return a pointer to the index variable for OMP_FOR GS. */
3502 static inline tree *
3503 gimple_omp_for_index_ptr (gimple gs, size_t i)
3505 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3506 gcc_assert (i < gs->gimple_omp_for.collapse);
3507 return &gs->gimple_omp_for.iter[i].index;
3511 /* Set INDEX to be the index variable for OMP_FOR GS. */
3513 static inline void
3514 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3516 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3517 gcc_assert (i < gs->gimple_omp_for.collapse);
3518 gs->gimple_omp_for.iter[i].index = index;
3522 /* Return the initial value for OMP_FOR GS. */
3524 static inline tree
3525 gimple_omp_for_initial (const_gimple gs, size_t i)
3527 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3528 gcc_assert (i < gs->gimple_omp_for.collapse);
3529 return gs->gimple_omp_for.iter[i].initial;
3533 /* Return a pointer to the initial value for OMP_FOR GS. */
3535 static inline tree *
3536 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3538 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3539 gcc_assert (i < gs->gimple_omp_for.collapse);
3540 return &gs->gimple_omp_for.iter[i].initial;
3544 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3546 static inline void
3547 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3549 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3550 gcc_assert (i < gs->gimple_omp_for.collapse);
3551 gs->gimple_omp_for.iter[i].initial = initial;
3555 /* Return the final value for OMP_FOR GS. */
3557 static inline tree
3558 gimple_omp_for_final (const_gimple gs, size_t i)
3560 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3561 gcc_assert (i < gs->gimple_omp_for.collapse);
3562 return gs->gimple_omp_for.iter[i].final;
3566 /* Return a pointer to the final value for OMP_FOR GS. */
3568 static inline tree *
3569 gimple_omp_for_final_ptr (gimple gs, size_t i)
3571 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3572 gcc_assert (i < gs->gimple_omp_for.collapse);
3573 return &gs->gimple_omp_for.iter[i].final;
3577 /* Set FINAL to be the final value for OMP_FOR GS. */
3579 static inline void
3580 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3582 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3583 gcc_assert (i < gs->gimple_omp_for.collapse);
3584 gs->gimple_omp_for.iter[i].final = final;
3588 /* Return the increment value for OMP_FOR GS. */
3590 static inline tree
3591 gimple_omp_for_incr (const_gimple gs, size_t i)
3593 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3594 gcc_assert (i < gs->gimple_omp_for.collapse);
3595 return gs->gimple_omp_for.iter[i].incr;
3599 /* Return a pointer to the increment value for OMP_FOR GS. */
3601 static inline tree *
3602 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3604 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3605 gcc_assert (i < gs->gimple_omp_for.collapse);
3606 return &gs->gimple_omp_for.iter[i].incr;
3610 /* Set INCR to be the increment value for OMP_FOR GS. */
3612 static inline void
3613 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3615 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3616 gcc_assert (i < gs->gimple_omp_for.collapse);
3617 gs->gimple_omp_for.iter[i].incr = incr;
3621 /* Return the sequence of statements to execute before the OMP_FOR
3622 statement GS starts. */
3624 static inline gimple_seq
3625 gimple_omp_for_pre_body (gimple gs)
3627 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3628 return gs->gimple_omp_for.pre_body;
3632 /* Set PRE_BODY to be the sequence of statements to execute before the
3633 OMP_FOR statement GS starts. */
3635 static inline void
3636 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3638 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3639 gs->gimple_omp_for.pre_body = pre_body;
3643 /* Return the clauses associated with OMP_PARALLEL GS. */
3645 static inline tree
3646 gimple_omp_parallel_clauses (const_gimple gs)
3648 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3649 return gs->gimple_omp_parallel.clauses;
3653 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3655 static inline tree *
3656 gimple_omp_parallel_clauses_ptr (gimple gs)
3658 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3659 return &gs->gimple_omp_parallel.clauses;
3663 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
3664 GS. */
3666 static inline void
3667 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
3669 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3670 gs->gimple_omp_parallel.clauses = clauses;
3674 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
3676 static inline tree
3677 gimple_omp_parallel_child_fn (const_gimple gs)
3679 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3680 return gs->gimple_omp_parallel.child_fn;
3683 /* Return a pointer to the child function used to hold the body of
3684 OMP_PARALLEL GS. */
3686 static inline tree *
3687 gimple_omp_parallel_child_fn_ptr (gimple gs)
3689 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3690 return &gs->gimple_omp_parallel.child_fn;
3694 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
3696 static inline void
3697 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
3699 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3700 gs->gimple_omp_parallel.child_fn = child_fn;
3704 /* Return the artificial argument used to send variables and values
3705 from the parent to the children threads in OMP_PARALLEL GS. */
3707 static inline tree
3708 gimple_omp_parallel_data_arg (const_gimple gs)
3710 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3711 return gs->gimple_omp_parallel.data_arg;
3715 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
3717 static inline tree *
3718 gimple_omp_parallel_data_arg_ptr (gimple gs)
3720 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3721 return &gs->gimple_omp_parallel.data_arg;
3725 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
3727 static inline void
3728 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
3730 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3731 gs->gimple_omp_parallel.data_arg = data_arg;
3735 /* Return the clauses associated with OMP_TASK GS. */
3737 static inline tree
3738 gimple_omp_task_clauses (const_gimple gs)
3740 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3741 return gs->gimple_omp_parallel.clauses;
3745 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3747 static inline tree *
3748 gimple_omp_task_clauses_ptr (gimple gs)
3750 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3751 return &gs->gimple_omp_parallel.clauses;
3755 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3756 GS. */
3758 static inline void
3759 gimple_omp_task_set_clauses (gimple gs, tree clauses)
3761 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3762 gs->gimple_omp_parallel.clauses = clauses;
3766 /* Return the child function used to hold the body of OMP_TASK GS. */
3768 static inline tree
3769 gimple_omp_task_child_fn (const_gimple gs)
3771 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3772 return gs->gimple_omp_parallel.child_fn;
3775 /* Return a pointer to the child function used to hold the body of
3776 OMP_TASK GS. */
3778 static inline tree *
3779 gimple_omp_task_child_fn_ptr (gimple gs)
3781 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3782 return &gs->gimple_omp_parallel.child_fn;
3786 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3788 static inline void
3789 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
3791 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3792 gs->gimple_omp_parallel.child_fn = child_fn;
3796 /* Return the artificial argument used to send variables and values
3797 from the parent to the children threads in OMP_TASK GS. */
3799 static inline tree
3800 gimple_omp_task_data_arg (const_gimple gs)
3802 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3803 return gs->gimple_omp_parallel.data_arg;
3807 /* Return a pointer to the data argument for OMP_TASK GS. */
3809 static inline tree *
3810 gimple_omp_task_data_arg_ptr (gimple gs)
3812 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3813 return &gs->gimple_omp_parallel.data_arg;
3817 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3819 static inline void
3820 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
3822 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3823 gs->gimple_omp_parallel.data_arg = data_arg;
3827 /* Return the clauses associated with OMP_TASK GS. */
3829 static inline tree
3830 gimple_omp_taskreg_clauses (const_gimple gs)
3832 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3833 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3834 return gs->gimple_omp_parallel.clauses;
3838 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3840 static inline tree *
3841 gimple_omp_taskreg_clauses_ptr (gimple gs)
3843 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3844 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3845 return &gs->gimple_omp_parallel.clauses;
3849 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3850 GS. */
3852 static inline void
3853 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
3855 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3856 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3857 gs->gimple_omp_parallel.clauses = clauses;
3861 /* Return the child function used to hold the body of OMP_TASK GS. */
3863 static inline tree
3864 gimple_omp_taskreg_child_fn (const_gimple gs)
3866 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3867 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3868 return gs->gimple_omp_parallel.child_fn;
3871 /* Return a pointer to the child function used to hold the body of
3872 OMP_TASK GS. */
3874 static inline tree *
3875 gimple_omp_taskreg_child_fn_ptr (gimple gs)
3877 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3878 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3879 return &gs->gimple_omp_parallel.child_fn;
3883 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3885 static inline void
3886 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
3888 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3889 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3890 gs->gimple_omp_parallel.child_fn = child_fn;
3894 /* Return the artificial argument used to send variables and values
3895 from the parent to the children threads in OMP_TASK GS. */
3897 static inline tree
3898 gimple_omp_taskreg_data_arg (const_gimple gs)
3900 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3901 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3902 return gs->gimple_omp_parallel.data_arg;
3906 /* Return a pointer to the data argument for OMP_TASK GS. */
3908 static inline tree *
3909 gimple_omp_taskreg_data_arg_ptr (gimple gs)
3911 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3912 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3913 return &gs->gimple_omp_parallel.data_arg;
3917 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3919 static inline void
3920 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
3922 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3923 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3924 gs->gimple_omp_parallel.data_arg = data_arg;
3928 /* Return the copy function used to hold the body of OMP_TASK GS. */
3930 static inline tree
3931 gimple_omp_task_copy_fn (const_gimple gs)
3933 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3934 return gs->gimple_omp_task.copy_fn;
3937 /* Return a pointer to the copy function used to hold the body of
3938 OMP_TASK GS. */
3940 static inline tree *
3941 gimple_omp_task_copy_fn_ptr (gimple gs)
3943 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3944 return &gs->gimple_omp_task.copy_fn;
3948 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
3950 static inline void
3951 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
3953 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3954 gs->gimple_omp_task.copy_fn = copy_fn;
3958 /* Return size of the data block in bytes in OMP_TASK GS. */
3960 static inline tree
3961 gimple_omp_task_arg_size (const_gimple gs)
3963 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3964 return gs->gimple_omp_task.arg_size;
3968 /* Return a pointer to the data block size for OMP_TASK GS. */
3970 static inline tree *
3971 gimple_omp_task_arg_size_ptr (gimple gs)
3973 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3974 return &gs->gimple_omp_task.arg_size;
3978 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
3980 static inline void
3981 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
3983 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3984 gs->gimple_omp_task.arg_size = arg_size;
3988 /* Return align of the data block in bytes in OMP_TASK GS. */
3990 static inline tree
3991 gimple_omp_task_arg_align (const_gimple gs)
3993 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3994 return gs->gimple_omp_task.arg_align;
3998 /* Return a pointer to the data block align for OMP_TASK GS. */
4000 static inline tree *
4001 gimple_omp_task_arg_align_ptr (gimple gs)
4003 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4004 return &gs->gimple_omp_task.arg_align;
4008 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4010 static inline void
4011 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4013 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4014 gs->gimple_omp_task.arg_align = arg_align;
4018 /* Return the clauses associated with OMP_SINGLE GS. */
4020 static inline tree
4021 gimple_omp_single_clauses (const_gimple gs)
4023 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4024 return gs->gimple_omp_single.clauses;
4028 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4030 static inline tree *
4031 gimple_omp_single_clauses_ptr (gimple gs)
4033 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4034 return &gs->gimple_omp_single.clauses;
4038 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4040 static inline void
4041 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4043 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4044 gs->gimple_omp_single.clauses = clauses;
4048 /* Return the clauses associated with OMP_SECTIONS GS. */
4050 static inline tree
4051 gimple_omp_sections_clauses (const_gimple gs)
4053 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4054 return gs->gimple_omp_sections.clauses;
4058 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4060 static inline tree *
4061 gimple_omp_sections_clauses_ptr (gimple gs)
4063 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4064 return &gs->gimple_omp_sections.clauses;
4068 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4069 GS. */
4071 static inline void
4072 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4074 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4075 gs->gimple_omp_sections.clauses = clauses;
4079 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4080 in GS. */
4082 static inline tree
4083 gimple_omp_sections_control (const_gimple gs)
4085 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4086 return gs->gimple_omp_sections.control;
4090 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4091 GS. */
4093 static inline tree *
4094 gimple_omp_sections_control_ptr (gimple gs)
4096 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4097 return &gs->gimple_omp_sections.control;
4101 /* Set CONTROL to be the set of clauses associated with the
4102 GIMPLE_OMP_SECTIONS in GS. */
4104 static inline void
4105 gimple_omp_sections_set_control (gimple gs, tree control)
4107 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4108 gs->gimple_omp_sections.control = control;
4112 /* Set COND to be the condition code for OMP_FOR GS. */
4114 static inline void
4115 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4117 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4118 gcc_assert (TREE_CODE_CLASS (cond) == tcc_comparison);
4119 gcc_assert (i < gs->gimple_omp_for.collapse);
4120 gs->gimple_omp_for.iter[i].cond = cond;
4124 /* Return the condition code associated with OMP_FOR GS. */
4126 static inline enum tree_code
4127 gimple_omp_for_cond (const_gimple gs, size_t i)
4129 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4130 gcc_assert (i < gs->gimple_omp_for.collapse);
4131 return gs->gimple_omp_for.iter[i].cond;
4135 /* Set the value being stored in an atomic store. */
4137 static inline void
4138 gimple_omp_atomic_store_set_val (gimple g, tree val)
4140 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4141 g->gimple_omp_atomic_store.val = val;
4145 /* Return the value being stored in an atomic store. */
4147 static inline tree
4148 gimple_omp_atomic_store_val (const_gimple g)
4150 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4151 return g->gimple_omp_atomic_store.val;
4155 /* Return a pointer to the value being stored in an atomic store. */
4157 static inline tree *
4158 gimple_omp_atomic_store_val_ptr (gimple g)
4160 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4161 return &g->gimple_omp_atomic_store.val;
4165 /* Set the LHS of an atomic load. */
4167 static inline void
4168 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4170 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4171 g->gimple_omp_atomic_load.lhs = lhs;
4175 /* Get the LHS of an atomic load. */
4177 static inline tree
4178 gimple_omp_atomic_load_lhs (const_gimple g)
4180 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4181 return g->gimple_omp_atomic_load.lhs;
4185 /* Return a pointer to the LHS of an atomic load. */
4187 static inline tree *
4188 gimple_omp_atomic_load_lhs_ptr (gimple g)
4190 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4191 return &g->gimple_omp_atomic_load.lhs;
4195 /* Set the RHS of an atomic load. */
4197 static inline void
4198 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4200 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4201 g->gimple_omp_atomic_load.rhs = rhs;
4205 /* Get the RHS of an atomic load. */
4207 static inline tree
4208 gimple_omp_atomic_load_rhs (const_gimple g)
4210 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4211 return g->gimple_omp_atomic_load.rhs;
4215 /* Return a pointer to the RHS of an atomic load. */
4217 static inline tree *
4218 gimple_omp_atomic_load_rhs_ptr (gimple g)
4220 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4221 return &g->gimple_omp_atomic_load.rhs;
4225 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4227 static inline tree
4228 gimple_omp_continue_control_def (const_gimple g)
4230 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4231 return g->gimple_omp_continue.control_def;
4234 /* The same as above, but return the address. */
4236 static inline tree *
4237 gimple_omp_continue_control_def_ptr (gimple g)
4239 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4240 return &g->gimple_omp_continue.control_def;
4243 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4245 static inline void
4246 gimple_omp_continue_set_control_def (gimple g, tree def)
4248 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4249 g->gimple_omp_continue.control_def = def;
4253 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4255 static inline tree
4256 gimple_omp_continue_control_use (const_gimple g)
4258 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4259 return g->gimple_omp_continue.control_use;
4263 /* The same as above, but return the address. */
4265 static inline tree *
4266 gimple_omp_continue_control_use_ptr (gimple g)
4268 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4269 return &g->gimple_omp_continue.control_use;
4273 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4275 static inline void
4276 gimple_omp_continue_set_control_use (gimple g, tree use)
4278 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4279 g->gimple_omp_continue.control_use = use;
4283 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4285 static inline tree *
4286 gimple_return_retval_ptr (const_gimple gs)
4288 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4289 return gimple_op_ptr (gs, 0);
4292 /* Return the return value for GIMPLE_RETURN GS. */
4294 static inline tree
4295 gimple_return_retval (const_gimple gs)
4297 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4298 return gimple_op (gs, 0);
4302 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4304 static inline void
4305 gimple_return_set_retval (gimple gs, tree retval)
4307 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4308 gimple_set_op (gs, 0, retval);
4312 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4314 #define CASE_GIMPLE_OMP \
4315 case GIMPLE_OMP_PARALLEL: \
4316 case GIMPLE_OMP_TASK: \
4317 case GIMPLE_OMP_FOR: \
4318 case GIMPLE_OMP_SECTIONS: \
4319 case GIMPLE_OMP_SECTIONS_SWITCH: \
4320 case GIMPLE_OMP_SINGLE: \
4321 case GIMPLE_OMP_SECTION: \
4322 case GIMPLE_OMP_MASTER: \
4323 case GIMPLE_OMP_ORDERED: \
4324 case GIMPLE_OMP_CRITICAL: \
4325 case GIMPLE_OMP_RETURN: \
4326 case GIMPLE_OMP_ATOMIC_LOAD: \
4327 case GIMPLE_OMP_ATOMIC_STORE: \
4328 case GIMPLE_OMP_CONTINUE
4330 static inline bool
4331 is_gimple_omp (const_gimple stmt)
4333 switch (gimple_code (stmt))
4335 CASE_GIMPLE_OMP:
4336 return true;
4337 default:
4338 return false;
4343 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4345 static inline bool
4346 gimple_nop_p (const_gimple g)
4348 return gimple_code (g) == GIMPLE_NOP;
4352 /* Return true if GS is a GIMPLE_RESX. */
4354 static inline bool
4355 is_gimple_resx (const_gimple gs)
4357 return gimple_code (gs) == GIMPLE_RESX;
4360 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4362 static inline enum br_predictor
4363 gimple_predict_predictor (gimple gs)
4365 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4366 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4370 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4372 static inline void
4373 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4375 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4376 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4377 | (unsigned) predictor;
4381 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4383 static inline enum prediction
4384 gimple_predict_outcome (gimple gs)
4386 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4387 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4391 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4393 static inline void
4394 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4396 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4397 if (outcome == TAKEN)
4398 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4399 else
4400 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4404 /* Return the type of the main expression computed by STMT. Return
4405 void_type_node if the statement computes nothing. */
4407 static inline tree
4408 gimple_expr_type (const_gimple stmt)
4410 enum gimple_code code = gimple_code (stmt);
4412 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4414 tree type;
4415 /* In general we want to pass out a type that can be substituted
4416 for both the RHS and the LHS types if there is a possibly
4417 useless conversion involved. That means returning the
4418 original RHS type as far as we can reconstruct it. */
4419 if (code == GIMPLE_CALL)
4420 type = gimple_call_return_type (stmt);
4421 else
4422 switch (gimple_assign_rhs_code (stmt))
4424 case POINTER_PLUS_EXPR:
4425 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4426 break;
4428 default:
4429 /* As fallback use the type of the LHS. */
4430 type = TREE_TYPE (gimple_get_lhs (stmt));
4431 break;
4433 return type;
4435 else if (code == GIMPLE_COND)
4436 return boolean_type_node;
4437 else
4438 return void_type_node;
4442 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4444 static inline gimple_stmt_iterator
4445 gsi_start (gimple_seq seq)
4447 gimple_stmt_iterator i;
4449 i.ptr = gimple_seq_first (seq);
4450 i.seq = seq;
4451 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4453 return i;
4457 /* Return a new iterator pointing to the first statement in basic block BB. */
4459 static inline gimple_stmt_iterator
4460 gsi_start_bb (basic_block bb)
4462 gimple_stmt_iterator i;
4463 gimple_seq seq;
4465 seq = bb_seq (bb);
4466 i.ptr = gimple_seq_first (seq);
4467 i.seq = seq;
4468 i.bb = bb;
4470 return i;
4474 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4476 static inline gimple_stmt_iterator
4477 gsi_last (gimple_seq seq)
4479 gimple_stmt_iterator i;
4481 i.ptr = gimple_seq_last (seq);
4482 i.seq = seq;
4483 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4485 return i;
4489 /* Return a new iterator pointing to the last statement in basic block BB. */
4491 static inline gimple_stmt_iterator
4492 gsi_last_bb (basic_block bb)
4494 gimple_stmt_iterator i;
4495 gimple_seq seq;
4497 seq = bb_seq (bb);
4498 i.ptr = gimple_seq_last (seq);
4499 i.seq = seq;
4500 i.bb = bb;
4502 return i;
4506 /* Return true if I is at the end of its sequence. */
4508 static inline bool
4509 gsi_end_p (gimple_stmt_iterator i)
4511 return i.ptr == NULL;
4515 /* Return true if I is one statement before the end of its sequence. */
4517 static inline bool
4518 gsi_one_before_end_p (gimple_stmt_iterator i)
4520 return i.ptr != NULL && i.ptr->next == NULL;
4524 /* Advance the iterator to the next gimple statement. */
4526 static inline void
4527 gsi_next (gimple_stmt_iterator *i)
4529 i->ptr = i->ptr->next;
4532 /* Advance the iterator to the previous gimple statement. */
4534 static inline void
4535 gsi_prev (gimple_stmt_iterator *i)
4537 i->ptr = i->ptr->prev;
4540 /* Return the current stmt. */
4542 static inline gimple
4543 gsi_stmt (gimple_stmt_iterator i)
4545 return i.ptr->stmt;
4548 /* Return a block statement iterator that points to the first non-label
4549 statement in block BB. */
4551 static inline gimple_stmt_iterator
4552 gsi_after_labels (basic_block bb)
4554 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4556 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4557 gsi_next (&gsi);
4559 return gsi;
4562 /* Advance the iterator to the next non-debug gimple statement. */
4564 static inline void
4565 gsi_next_nondebug (gimple_stmt_iterator *i)
4569 gsi_next (i);
4571 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4574 /* Advance the iterator to the next non-debug gimple statement. */
4576 static inline void
4577 gsi_prev_nondebug (gimple_stmt_iterator *i)
4581 gsi_prev (i);
4583 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4586 /* Return a new iterator pointing to the first non-debug statement in
4587 basic block BB. */
4589 static inline gimple_stmt_iterator
4590 gsi_start_nondebug_bb (basic_block bb)
4592 gimple_stmt_iterator i = gsi_start_bb (bb);
4594 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4595 gsi_next_nondebug (&i);
4597 return i;
4600 /* Return a new iterator pointing to the last non-debug statement in
4601 basic block BB. */
4603 static inline gimple_stmt_iterator
4604 gsi_last_nondebug_bb (basic_block bb)
4606 gimple_stmt_iterator i = gsi_last_bb (bb);
4608 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4609 gsi_prev_nondebug (&i);
4611 return i;
4614 /* Return a pointer to the current stmt.
4616 NOTE: You may want to use gsi_replace on the iterator itself,
4617 as this performs additional bookkeeping that will not be done
4618 if you simply assign through a pointer returned by gsi_stmt_ptr. */
4620 static inline gimple *
4621 gsi_stmt_ptr (gimple_stmt_iterator *i)
4623 return &i->ptr->stmt;
4627 /* Return the basic block associated with this iterator. */
4629 static inline basic_block
4630 gsi_bb (gimple_stmt_iterator i)
4632 return i.bb;
4636 /* Return the sequence associated with this iterator. */
4638 static inline gimple_seq
4639 gsi_seq (gimple_stmt_iterator i)
4641 return i.seq;
4645 enum gsi_iterator_update
4647 GSI_NEW_STMT, /* Only valid when single statement is added, move
4648 iterator to it. */
4649 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
4650 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
4651 for linking other statements in the same
4652 direction. */
4655 /* In gimple-iterator.c */
4656 gimple_stmt_iterator gsi_start_phis (basic_block);
4657 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
4658 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
4659 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
4660 void gsi_insert_before (gimple_stmt_iterator *, gimple,
4661 enum gsi_iterator_update);
4662 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
4663 enum gsi_iterator_update);
4664 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
4665 enum gsi_iterator_update);
4666 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
4667 enum gsi_iterator_update);
4668 void gsi_insert_after (gimple_stmt_iterator *, gimple,
4669 enum gsi_iterator_update);
4670 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
4671 enum gsi_iterator_update);
4672 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
4673 enum gsi_iterator_update);
4674 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
4675 enum gsi_iterator_update);
4676 void gsi_remove (gimple_stmt_iterator *, bool);
4677 gimple_stmt_iterator gsi_for_stmt (gimple);
4678 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
4679 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
4680 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
4681 void gsi_insert_on_edge (edge, gimple);
4682 void gsi_insert_seq_on_edge (edge, gimple_seq);
4683 basic_block gsi_insert_on_edge_immediate (edge, gimple);
4684 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
4685 void gsi_commit_one_edge_insert (edge, basic_block *);
4686 void gsi_commit_edge_inserts (void);
4687 gimple gimple_call_copy_skip_args (gimple, bitmap);
4690 /* Convenience routines to walk all statements of a gimple function.
4691 Note that this is useful exclusively before the code is converted
4692 into SSA form. Once the program is in SSA form, the standard
4693 operand interface should be used to analyze/modify statements. */
4694 struct walk_stmt_info
4696 /* Points to the current statement being walked. */
4697 gimple_stmt_iterator gsi;
4699 /* Additional data that the callback functions may want to carry
4700 through the recursion. */
4701 void *info;
4703 /* Pointer map used to mark visited tree nodes when calling
4704 walk_tree on each operand. If set to NULL, duplicate tree nodes
4705 will be visited more than once. */
4706 struct pointer_set_t *pset;
4708 /* Indicates whether the operand being examined may be replaced
4709 with something that matches is_gimple_val (if true) or something
4710 slightly more complicated (if false). "Something" technically
4711 means the common subset of is_gimple_lvalue and is_gimple_rhs,
4712 but we never try to form anything more complicated than that, so
4713 we don't bother checking.
4715 Also note that CALLBACK should update this flag while walking the
4716 sub-expressions of a statement. For instance, when walking the
4717 statement 'foo (&var)', the flag VAL_ONLY will initially be set
4718 to true, however, when walking &var, the operand of that
4719 ADDR_EXPR does not need to be a GIMPLE value. */
4720 bool val_only;
4722 /* True if we are currently walking the LHS of an assignment. */
4723 bool is_lhs;
4725 /* Optional. Set to true by the callback functions if they made any
4726 changes. */
4727 bool changed;
4729 /* True if we're interested in location information. */
4730 bool want_locations;
4732 /* Operand returned by the callbacks. This is set when calling
4733 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
4734 returns non-NULL, this field will contain the tree returned by
4735 the last callback. */
4736 tree callback_result;
4739 /* Callback for walk_gimple_stmt. Called for every statement found
4740 during traversal. The first argument points to the statement to
4741 walk. The second argument is a flag that the callback sets to
4742 'true' if it the callback handled all the operands and
4743 sub-statements of the statement (the default value of this flag is
4744 'false'). The third argument is an anonymous pointer to data
4745 to be used by the callback. */
4746 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
4747 struct walk_stmt_info *);
4749 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
4750 struct walk_stmt_info *);
4751 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
4752 struct walk_stmt_info *);
4753 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
4755 #ifdef GATHER_STATISTICS
4756 /* Enum and arrays used for allocation stats. Keep in sync with
4757 gimple.c:gimple_alloc_kind_names. */
4758 enum gimple_alloc_kind
4760 gimple_alloc_kind_assign, /* Assignments. */
4761 gimple_alloc_kind_phi, /* PHI nodes. */
4762 gimple_alloc_kind_cond, /* Conditionals. */
4763 gimple_alloc_kind_seq, /* Sequences. */
4764 gimple_alloc_kind_rest, /* Everything else. */
4765 gimple_alloc_kind_all
4768 extern int gimple_alloc_counts[];
4769 extern int gimple_alloc_sizes[];
4771 /* Return the allocation kind for a given stmt CODE. */
4772 static inline enum gimple_alloc_kind
4773 gimple_alloc_kind (enum gimple_code code)
4775 switch (code)
4777 case GIMPLE_ASSIGN:
4778 return gimple_alloc_kind_assign;
4779 case GIMPLE_PHI:
4780 return gimple_alloc_kind_phi;
4781 case GIMPLE_COND:
4782 return gimple_alloc_kind_cond;
4783 default:
4784 return gimple_alloc_kind_rest;
4787 #endif /* GATHER_STATISTICS */
4789 extern void dump_gimple_statistics (void);
4791 /* In gimple-fold.c. */
4792 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
4793 tree gimple_fold_builtin (gimple);
4794 bool fold_stmt (gimple_stmt_iterator *);
4795 bool fold_stmt_inplace (gimple);
4796 tree maybe_fold_offset_to_reference (location_t, tree, tree, tree);
4797 tree maybe_fold_offset_to_address (location_t, tree, tree, tree);
4798 tree maybe_fold_stmt_addition (location_t, tree, tree, tree);
4799 tree get_symbol_constant_value (tree);
4800 bool may_propagate_address_into_dereference (tree, tree);
4803 #endif /* GCC_GIMPLE_H */