2010-05-28 Segher Boessenkool <segher@kernel.crashing.org>
[official-gcc.git] / gcc / gimple.h
blobbaa839fab6f64b279ac004b9d7b1a62b0f3aae58
1 /* Gimple IR definitions.
3 Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "pointer-set.h"
26 #include "vec.h"
27 #include "vecprim.h"
28 #include "vecir.h"
29 #include "ggc.h"
30 #include "tm.h"
31 #include "hard-reg-set.h"
32 #include "basic-block.h"
33 #include "tree-ssa-operands.h"
34 #include "tree-ssa-alias.h"
36 /* For each block, the PHI nodes that need to be rewritten are stored into
37 these vectors. */
38 typedef VEC(gimple, heap) *gimple_vec;
39 DEF_VEC_P (gimple_vec);
40 DEF_VEC_ALLOC_P (gimple_vec, heap);
42 enum gimple_code {
43 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
44 #include "gimple.def"
45 #undef DEFGSCODE
46 LAST_AND_UNUSED_GIMPLE_CODE
49 extern const char *const gimple_code_name[];
50 extern const unsigned char gimple_rhs_class_table[];
52 /* Error out if a gimple tuple is addressed incorrectly. */
53 #if defined ENABLE_GIMPLE_CHECKING
54 extern void gimple_check_failed (const_gimple, const char *, int, \
55 const char *, enum gimple_code, \
56 enum tree_code) ATTRIBUTE_NORETURN;
58 #define GIMPLE_CHECK(GS, CODE) \
59 do { \
60 const_gimple __gs = (GS); \
61 if (gimple_code (__gs) != (CODE)) \
62 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
63 (CODE), ERROR_MARK); \
64 } while (0)
65 #else /* not ENABLE_GIMPLE_CHECKING */
66 #define GIMPLE_CHECK(GS, CODE) (void)0
67 #endif
69 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
70 get_gimple_rhs_class. */
71 enum gimple_rhs_class
73 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
74 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
75 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
76 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
77 name, a _DECL, a _REF, etc. */
80 /* Specific flags for individual GIMPLE statements. These flags are
81 always stored in gimple_statement_base.subcode and they may only be
82 defined for statement codes that do not use sub-codes.
84 Values for the masks can overlap as long as the overlapping values
85 are never used in the same statement class.
87 The maximum mask value that can be defined is 1 << 15 (i.e., each
88 statement code can hold up to 16 bitflags).
90 Keep this list sorted. */
91 enum gf_mask {
92 GF_ASM_INPUT = 1 << 0,
93 GF_ASM_VOLATILE = 1 << 1,
94 GF_CALL_CANNOT_INLINE = 1 << 0,
95 GF_CALL_FROM_THUNK = 1 << 1,
96 GF_CALL_RETURN_SLOT_OPT = 1 << 2,
97 GF_CALL_TAILCALL = 1 << 3,
98 GF_CALL_VA_ARG_PACK = 1 << 4,
99 GF_CALL_NOTHROW = 1 << 5,
100 GF_OMP_PARALLEL_COMBINED = 1 << 0,
102 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
103 a thread synchronization via some sort of barrier. The exact barrier
104 that would otherwise be emitted is dependent on the OMP statement with
105 which this return is associated. */
106 GF_OMP_RETURN_NOWAIT = 1 << 0,
108 GF_OMP_SECTION_LAST = 1 << 0,
109 GF_PREDICT_TAKEN = 1 << 15
112 /* Currently, there's only one type of gimple debug stmt. Others are
113 envisioned, for example, to enable the generation of is_stmt notes
114 in line number information, to mark sequence points, etc. This
115 subcode is to be used to tell them apart. */
116 enum gimple_debug_subcode {
117 GIMPLE_DEBUG_BIND = 0
120 /* Masks for selecting a pass local flag (PLF) to work on. These
121 masks are used by gimple_set_plf and gimple_plf. */
122 enum plf_mask {
123 GF_PLF_1 = 1 << 0,
124 GF_PLF_2 = 1 << 1
127 /* A node in a gimple_seq_d. */
128 struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) gimple_seq_node_d {
129 gimple stmt;
130 struct gimple_seq_node_d *prev;
131 struct gimple_seq_node_d *next;
134 /* A double-linked sequence of gimple statements. */
135 struct GTY ((chain_next ("%h.next_free"))) gimple_seq_d {
136 /* First and last statements in the sequence. */
137 gimple_seq_node first;
138 gimple_seq_node last;
140 /* Sequences are created/destroyed frequently. To minimize
141 allocation activity, deallocated sequences are kept in a pool of
142 available sequences. This is the pointer to the next free
143 sequence in the pool. */
144 gimple_seq next_free;
148 /* Return the first node in GIMPLE sequence S. */
150 static inline gimple_seq_node
151 gimple_seq_first (const_gimple_seq s)
153 return s ? s->first : NULL;
157 /* Return the first statement in GIMPLE sequence S. */
159 static inline gimple
160 gimple_seq_first_stmt (const_gimple_seq s)
162 gimple_seq_node n = gimple_seq_first (s);
163 return (n) ? n->stmt : NULL;
167 /* Return the last node in GIMPLE sequence S. */
169 static inline gimple_seq_node
170 gimple_seq_last (const_gimple_seq s)
172 return s ? s->last : NULL;
176 /* Return the last statement in GIMPLE sequence S. */
178 static inline gimple
179 gimple_seq_last_stmt (const_gimple_seq s)
181 gimple_seq_node n = gimple_seq_last (s);
182 return (n) ? n->stmt : NULL;
186 /* Set the last node in GIMPLE sequence S to LAST. */
188 static inline void
189 gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
191 s->last = last;
195 /* Set the first node in GIMPLE sequence S to FIRST. */
197 static inline void
198 gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
200 s->first = first;
204 /* Return true if GIMPLE sequence S is empty. */
206 static inline bool
207 gimple_seq_empty_p (const_gimple_seq s)
209 return s == NULL || s->first == NULL;
213 void gimple_seq_add_stmt (gimple_seq *, gimple);
215 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
216 *SEQ_P is NULL, a new sequence is allocated. This function is
217 similar to gimple_seq_add_stmt, but does not scan the operands.
218 During gimplification, we need to manipulate statement sequences
219 before the def/use vectors have been constructed. */
220 void gimplify_seq_add_stmt (gimple_seq *, gimple);
222 /* Allocate a new sequence and initialize its first element with STMT. */
224 static inline gimple_seq
225 gimple_seq_alloc_with_stmt (gimple stmt)
227 gimple_seq seq = NULL;
228 gimple_seq_add_stmt (&seq, stmt);
229 return seq;
233 /* Returns the sequence of statements in BB. */
235 static inline gimple_seq
236 bb_seq (const_basic_block bb)
238 return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
242 /* Sets the sequence of statements in BB to SEQ. */
244 static inline void
245 set_bb_seq (basic_block bb, gimple_seq seq)
247 gcc_assert (!(bb->flags & BB_RTL));
248 bb->il.gimple->seq = seq;
251 /* Iterator object for GIMPLE statement sequences. */
253 typedef struct
255 /* Sequence node holding the current statement. */
256 gimple_seq_node ptr;
258 /* Sequence and basic block holding the statement. These fields
259 are necessary to handle edge cases such as when statement is
260 added to an empty basic block or when the last statement of a
261 block/sequence is removed. */
262 gimple_seq seq;
263 basic_block bb;
264 } gimple_stmt_iterator;
267 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
268 are for 64 bit hosts. */
270 struct GTY(()) gimple_statement_base {
271 /* [ WORD 1 ]
272 Main identifying code for a tuple. */
273 ENUM_BITFIELD(gimple_code) code : 8;
275 /* Nonzero if a warning should not be emitted on this tuple. */
276 unsigned int no_warning : 1;
278 /* Nonzero if this tuple has been visited. Passes are responsible
279 for clearing this bit before using it. */
280 unsigned int visited : 1;
282 /* Nonzero if this tuple represents a non-temporal move. */
283 unsigned int nontemporal_move : 1;
285 /* Pass local flags. These flags are free for any pass to use as
286 they see fit. Passes should not assume that these flags contain
287 any useful value when the pass starts. Any initial state that
288 the pass requires should be set on entry to the pass. See
289 gimple_set_plf and gimple_plf for usage. */
290 unsigned int plf : 2;
292 /* Nonzero if this statement has been modified and needs to have its
293 operands rescanned. */
294 unsigned modified : 1;
296 /* Nonzero if this statement contains volatile operands. */
297 unsigned has_volatile_ops : 1;
299 /* Padding to get subcode to 16 bit alignment. */
300 unsigned pad : 1;
302 /* The SUBCODE field can be used for tuple-specific flags for tuples
303 that do not require subcodes. Note that SUBCODE should be at
304 least as wide as tree codes, as several tuples store tree codes
305 in there. */
306 unsigned int subcode : 16;
308 /* UID of this statement. This is used by passes that want to
309 assign IDs to statements. It must be assigned and used by each
310 pass. By default it should be assumed to contain garbage. */
311 unsigned uid;
313 /* [ WORD 2 ]
314 Locus information for debug info. */
315 location_t location;
317 /* Number of operands in this tuple. */
318 unsigned num_ops;
320 /* [ WORD 3 ]
321 Basic block holding this statement. */
322 struct basic_block_def *bb;
324 /* [ WORD 4 ]
325 Lexical block holding this statement. */
326 tree block;
330 /* Base structure for tuples with operands. */
332 struct GTY(()) gimple_statement_with_ops_base
334 /* [ WORD 1-4 ] */
335 struct gimple_statement_base gsbase;
337 /* [ WORD 5-6 ]
338 SSA operand vectors. NOTE: It should be possible to
339 amalgamate these vectors with the operand vector OP. However,
340 the SSA operand vectors are organized differently and contain
341 more information (like immediate use chaining). */
342 struct def_optype_d GTY((skip (""))) *def_ops;
343 struct use_optype_d GTY((skip (""))) *use_ops;
347 /* Statements that take register operands. */
349 struct GTY(()) gimple_statement_with_ops
351 /* [ WORD 1-6 ] */
352 struct gimple_statement_with_ops_base opbase;
354 /* [ WORD 7 ]
355 Operand vector. NOTE! This must always be the last field
356 of this structure. In particular, this means that this
357 structure cannot be embedded inside another one. */
358 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
362 /* Base for statements that take both memory and register operands. */
364 struct GTY(()) gimple_statement_with_memory_ops_base
366 /* [ WORD 1-6 ] */
367 struct gimple_statement_with_ops_base opbase;
369 /* [ WORD 7-8 ]
370 Virtual operands for this statement. The GC will pick them
371 up via the ssa_names array. */
372 tree GTY((skip (""))) vdef;
373 tree GTY((skip (""))) vuse;
377 /* Statements that take both memory and register operands. */
379 struct GTY(()) gimple_statement_with_memory_ops
381 /* [ WORD 1-8 ] */
382 struct gimple_statement_with_memory_ops_base membase;
384 /* [ WORD 9 ]
385 Operand vector. NOTE! This must always be the last field
386 of this structure. In particular, this means that this
387 structure cannot be embedded inside another one. */
388 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
392 /* Call statements that take both memory and register operands. */
394 struct GTY(()) gimple_statement_call
396 /* [ WORD 1-8 ] */
397 struct gimple_statement_with_memory_ops_base membase;
399 /* [ WORD 9-12 ] */
400 struct pt_solution call_used;
401 struct pt_solution call_clobbered;
403 /* [ WORD 13 ]
404 Operand vector. NOTE! This must always be the last field
405 of this structure. In particular, this means that this
406 structure cannot be embedded inside another one. */
407 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
411 /* OpenMP statements (#pragma omp). */
413 struct GTY(()) gimple_statement_omp {
414 /* [ WORD 1-4 ] */
415 struct gimple_statement_base gsbase;
417 /* [ WORD 5 ] */
418 gimple_seq body;
422 /* GIMPLE_BIND */
424 struct GTY(()) gimple_statement_bind {
425 /* [ WORD 1-4 ] */
426 struct gimple_statement_base gsbase;
428 /* [ WORD 5 ]
429 Variables declared in this scope. */
430 tree vars;
432 /* [ WORD 6 ]
433 This is different than the BLOCK field in gimple_statement_base,
434 which is analogous to TREE_BLOCK (i.e., the lexical block holding
435 this statement). This field is the equivalent of BIND_EXPR_BLOCK
436 in tree land (i.e., the lexical scope defined by this bind). See
437 gimple-low.c. */
438 tree block;
440 /* [ WORD 7 ] */
441 gimple_seq body;
445 /* GIMPLE_CATCH */
447 struct GTY(()) gimple_statement_catch {
448 /* [ WORD 1-4 ] */
449 struct gimple_statement_base gsbase;
451 /* [ WORD 5 ] */
452 tree types;
454 /* [ WORD 6 ] */
455 gimple_seq handler;
459 /* GIMPLE_EH_FILTER */
461 struct GTY(()) gimple_statement_eh_filter {
462 /* [ WORD 1-4 ] */
463 struct gimple_statement_base gsbase;
465 /* [ WORD 5 ]
466 Filter types. */
467 tree types;
469 /* [ WORD 6 ]
470 Failure actions. */
471 gimple_seq failure;
475 /* GIMPLE_EH_MUST_NOT_THROW */
477 struct GTY(()) gimple_statement_eh_mnt {
478 /* [ WORD 1-4 ] */
479 struct gimple_statement_base gsbase;
481 /* [ WORD 5 ] Abort function decl. */
482 tree fndecl;
485 /* GIMPLE_PHI */
487 struct GTY(()) gimple_statement_phi {
488 /* [ WORD 1-4 ] */
489 struct gimple_statement_base gsbase;
491 /* [ WORD 5 ] */
492 unsigned capacity;
493 unsigned nargs;
495 /* [ WORD 6 ] */
496 tree result;
498 /* [ WORD 7 ] */
499 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
503 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
505 struct GTY(()) gimple_statement_eh_ctrl
507 /* [ WORD 1-4 ] */
508 struct gimple_statement_base gsbase;
510 /* [ WORD 5 ]
511 Exception region number. */
512 int region;
516 /* GIMPLE_TRY */
518 struct GTY(()) gimple_statement_try {
519 /* [ WORD 1-4 ] */
520 struct gimple_statement_base gsbase;
522 /* [ WORD 5 ]
523 Expression to evaluate. */
524 gimple_seq eval;
526 /* [ WORD 6 ]
527 Cleanup expression. */
528 gimple_seq cleanup;
531 /* Kind of GIMPLE_TRY statements. */
532 enum gimple_try_flags
534 /* A try/catch. */
535 GIMPLE_TRY_CATCH = 1 << 0,
537 /* A try/finally. */
538 GIMPLE_TRY_FINALLY = 1 << 1,
539 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
541 /* Analogous to TRY_CATCH_IS_CLEANUP. */
542 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
545 /* GIMPLE_WITH_CLEANUP_EXPR */
547 struct GTY(()) gimple_statement_wce {
548 /* [ WORD 1-4 ] */
549 struct gimple_statement_base gsbase;
551 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
552 executed if an exception is thrown, not on normal exit of its
553 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
554 in TARGET_EXPRs. */
556 /* [ WORD 5 ]
557 Cleanup expression. */
558 gimple_seq cleanup;
562 /* GIMPLE_ASM */
564 struct GTY(()) gimple_statement_asm
566 /* [ WORD 1-8 ] */
567 struct gimple_statement_with_memory_ops_base membase;
569 /* [ WORD 9 ]
570 __asm__ statement. */
571 const char *string;
573 /* [ WORD 10 ]
574 Number of inputs, outputs, clobbers, labels. */
575 unsigned char ni;
576 unsigned char no;
577 unsigned char nc;
578 unsigned char nl;
580 /* [ WORD 11 ]
581 Operand vector. NOTE! This must always be the last field
582 of this structure. In particular, this means that this
583 structure cannot be embedded inside another one. */
584 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
587 /* GIMPLE_OMP_CRITICAL */
589 struct GTY(()) gimple_statement_omp_critical {
590 /* [ WORD 1-5 ] */
591 struct gimple_statement_omp omp;
593 /* [ WORD 6 ]
594 Critical section name. */
595 tree name;
599 struct GTY(()) gimple_omp_for_iter {
600 /* Condition code. */
601 enum tree_code cond;
603 /* Index variable. */
604 tree index;
606 /* Initial value. */
607 tree initial;
609 /* Final value. */
610 tree final;
612 /* Increment. */
613 tree incr;
616 /* GIMPLE_OMP_FOR */
618 struct GTY(()) gimple_statement_omp_for {
619 /* [ WORD 1-5 ] */
620 struct gimple_statement_omp omp;
622 /* [ WORD 6 ] */
623 tree clauses;
625 /* [ WORD 7 ]
626 Number of elements in iter array. */
627 size_t collapse;
629 /* [ WORD 8 ] */
630 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
632 /* [ WORD 9 ]
633 Pre-body evaluated before the loop body begins. */
634 gimple_seq pre_body;
638 /* GIMPLE_OMP_PARALLEL */
640 struct GTY(()) gimple_statement_omp_parallel {
641 /* [ WORD 1-5 ] */
642 struct gimple_statement_omp omp;
644 /* [ WORD 6 ]
645 Clauses. */
646 tree clauses;
648 /* [ WORD 7 ]
649 Child function holding the body of the parallel region. */
650 tree child_fn;
652 /* [ WORD 8 ]
653 Shared data argument. */
654 tree data_arg;
658 /* GIMPLE_OMP_TASK */
660 struct GTY(()) gimple_statement_omp_task {
661 /* [ WORD 1-8 ] */
662 struct gimple_statement_omp_parallel par;
664 /* [ WORD 9 ]
665 Child function holding firstprivate initialization if needed. */
666 tree copy_fn;
668 /* [ WORD 10-11 ]
669 Size and alignment in bytes of the argument data block. */
670 tree arg_size;
671 tree arg_align;
675 /* GIMPLE_OMP_SECTION */
676 /* Uses struct gimple_statement_omp. */
679 /* GIMPLE_OMP_SECTIONS */
681 struct GTY(()) gimple_statement_omp_sections {
682 /* [ WORD 1-5 ] */
683 struct gimple_statement_omp omp;
685 /* [ WORD 6 ] */
686 tree clauses;
688 /* [ WORD 7 ]
689 The control variable used for deciding which of the sections to
690 execute. */
691 tree control;
694 /* GIMPLE_OMP_CONTINUE.
696 Note: This does not inherit from gimple_statement_omp, because we
697 do not need the body field. */
699 struct GTY(()) gimple_statement_omp_continue {
700 /* [ WORD 1-4 ] */
701 struct gimple_statement_base gsbase;
703 /* [ WORD 5 ] */
704 tree control_def;
706 /* [ WORD 6 ] */
707 tree control_use;
710 /* GIMPLE_OMP_SINGLE */
712 struct GTY(()) gimple_statement_omp_single {
713 /* [ WORD 1-5 ] */
714 struct gimple_statement_omp omp;
716 /* [ WORD 6 ] */
717 tree clauses;
721 /* GIMPLE_OMP_ATOMIC_LOAD.
722 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
723 contains a sequence, which we don't need here. */
725 struct GTY(()) gimple_statement_omp_atomic_load {
726 /* [ WORD 1-4 ] */
727 struct gimple_statement_base gsbase;
729 /* [ WORD 5-6 ] */
730 tree rhs, lhs;
733 /* GIMPLE_OMP_ATOMIC_STORE.
734 See note on GIMPLE_OMP_ATOMIC_LOAD. */
736 struct GTY(()) gimple_statement_omp_atomic_store {
737 /* [ WORD 1-4 ] */
738 struct gimple_statement_base gsbase;
740 /* [ WORD 5 ] */
741 tree val;
744 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
745 enum gimple_statement_structure_enum {
746 #include "gsstruct.def"
747 LAST_GSS_ENUM
749 #undef DEFGSSTRUCT
752 /* Define the overall contents of a gimple tuple. It may be any of the
753 structures declared above for various types of tuples. */
755 union GTY ((desc ("gimple_statement_structure (&%h)"))) gimple_statement_d {
756 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
757 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
758 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
759 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
760 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
761 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
762 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
763 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
764 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
765 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
766 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
767 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
768 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
769 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
770 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
771 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
772 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
773 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
774 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
775 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
776 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
777 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
778 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
779 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
782 /* In gimple.c. */
784 /* Offset in bytes to the location of the operand vector.
785 Zero if there is no operand vector for this tuple structure. */
786 extern size_t const gimple_ops_offset_[];
788 /* Map GIMPLE codes to GSS codes. */
789 extern enum gimple_statement_structure_enum const gss_for_code_[];
791 /* This variable holds the currently expanded gimple statement for purposes
792 of comminucating the profile info to the builtin expanders. */
793 extern gimple currently_expanding_gimple_stmt;
795 gimple gimple_build_return (tree);
797 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
798 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
800 void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *);
802 gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
803 tree MEM_STAT_DECL);
804 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
805 gimple_build_assign_with_ops_stat (c, o1, o2, o3 MEM_STAT_INFO)
807 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
808 #define gimple_build_debug_bind(var,val,stmt) \
809 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
811 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
812 gimple gimple_build_call (tree, unsigned, ...);
813 gimple gimple_build_call_from_tree (tree);
814 gimple gimplify_assign (tree, tree, gimple_seq *);
815 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
816 gimple gimple_build_label (tree label);
817 gimple gimple_build_goto (tree dest);
818 gimple gimple_build_nop (void);
819 gimple gimple_build_bind (tree, gimple_seq, tree);
820 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
821 VEC(tree,gc) *, VEC(tree,gc) *);
822 gimple gimple_build_catch (tree, gimple_seq);
823 gimple gimple_build_eh_filter (tree, gimple_seq);
824 gimple gimple_build_eh_must_not_throw (tree);
825 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
826 gimple gimple_build_wce (gimple_seq);
827 gimple gimple_build_resx (int);
828 gimple gimple_build_eh_dispatch (int);
829 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
830 gimple gimple_build_switch (unsigned, tree, tree, ...);
831 gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
832 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
833 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
834 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
835 gimple gimple_build_omp_critical (gimple_seq, tree);
836 gimple gimple_build_omp_section (gimple_seq);
837 gimple gimple_build_omp_continue (tree, tree);
838 gimple gimple_build_omp_master (gimple_seq);
839 gimple gimple_build_omp_return (bool);
840 gimple gimple_build_omp_ordered (gimple_seq);
841 gimple gimple_build_omp_sections (gimple_seq, tree);
842 gimple gimple_build_omp_sections_switch (void);
843 gimple gimple_build_omp_single (gimple_seq, tree);
844 gimple gimple_build_cdt (tree, tree);
845 gimple gimple_build_omp_atomic_load (tree, tree);
846 gimple gimple_build_omp_atomic_store (tree);
847 gimple gimple_build_predict (enum br_predictor, enum prediction);
848 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
849 void sort_case_labels (VEC(tree,heap) *);
850 void gimple_set_body (tree, gimple_seq);
851 gimple_seq gimple_body (tree);
852 bool gimple_has_body_p (tree);
853 gimple_seq gimple_seq_alloc (void);
854 void gimple_seq_free (gimple_seq);
855 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
856 gimple_seq gimple_seq_copy (gimple_seq);
857 int gimple_call_flags (const_gimple);
858 int gimple_call_return_flags (const_gimple);
859 int gimple_call_arg_flags (const_gimple, unsigned);
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);
889 tree gimple_get_relevant_ref_binfo (tree ref, tree known_binfo);
890 tree gimple_fold_obj_type_ref_known_binfo (HOST_WIDE_INT, tree);
892 /* Returns true iff T is a valid GIMPLE statement. */
893 extern bool is_gimple_stmt (tree);
895 /* Returns true iff TYPE is a valid type for a scalar register variable. */
896 extern bool is_gimple_reg_type (tree);
897 /* Returns true iff T is a scalar register variable. */
898 extern bool is_gimple_reg (tree);
899 /* Returns true iff T is any sort of variable. */
900 extern bool is_gimple_variable (tree);
901 /* Returns true iff T is any sort of symbol. */
902 extern bool is_gimple_id (tree);
903 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
904 extern bool is_gimple_min_lval (tree);
905 /* Returns true iff T is something whose address can be taken. */
906 extern bool is_gimple_addressable (tree);
907 /* Returns true iff T is any valid GIMPLE lvalue. */
908 extern bool is_gimple_lvalue (tree);
910 /* Returns true iff T is a GIMPLE address. */
911 bool is_gimple_address (const_tree);
912 /* Returns true iff T is a GIMPLE invariant address. */
913 bool is_gimple_invariant_address (const_tree);
914 /* Returns true iff T is a GIMPLE invariant address at interprocedural
915 level. */
916 bool is_gimple_ip_invariant_address (const_tree);
917 /* Returns true iff T is a valid GIMPLE constant. */
918 bool is_gimple_constant (const_tree);
919 /* Returns true iff T is a GIMPLE restricted function invariant. */
920 extern bool is_gimple_min_invariant (const_tree);
921 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
922 extern bool is_gimple_ip_invariant (const_tree);
923 /* Returns true iff T is a GIMPLE rvalue. */
924 extern bool is_gimple_val (tree);
925 /* Returns true iff T is a GIMPLE asm statement input. */
926 extern bool is_gimple_asm_val (tree);
927 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
928 GIMPLE temporary, a renamed user variable, or something else,
929 respectively. */
930 extern bool is_gimple_reg_rhs (tree);
931 extern bool is_gimple_mem_rhs (tree);
933 /* Returns true iff T is a valid if-statement condition. */
934 extern bool is_gimple_condexpr (tree);
936 /* Returns true iff T is a type conversion. */
937 extern bool is_gimple_cast (tree);
938 /* Returns true iff T is a variable that does not need to live in memory. */
939 extern bool is_gimple_non_addressable (tree t);
941 /* Returns true iff T is a valid call address expression. */
942 extern bool is_gimple_call_addr (tree);
943 /* If T makes a function call, returns the CALL_EXPR operand. */
944 extern tree get_call_expr_in (tree t);
946 extern void recalculate_side_effects (tree);
947 extern bool gimple_compare_field_offset (tree, tree);
948 extern tree gimple_register_type (tree);
949 extern void print_gimple_types_stats (void);
950 extern void free_gimple_type_tables (void);
951 extern tree gimple_unsigned_type (tree);
952 extern tree gimple_signed_type (tree);
953 extern alias_set_type gimple_get_alias_set (tree);
954 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
955 unsigned *);
956 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
957 bool (*)(gimple, tree, void *),
958 bool (*)(gimple, tree, void *),
959 bool (*)(gimple, tree, void *));
960 extern bool walk_stmt_load_store_ops (gimple, void *,
961 bool (*)(gimple, tree, void *),
962 bool (*)(gimple, tree, void *));
963 extern bool gimple_ior_addresses_taken (bitmap, gimple);
965 /* In gimplify.c */
966 extern tree create_tmp_var_raw (tree, const char *);
967 extern tree create_tmp_var_name (const char *);
968 extern tree create_tmp_var (tree, const char *);
969 extern tree create_tmp_reg (tree, const char *);
970 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
971 extern tree get_formal_tmp_var (tree, gimple_seq *);
972 extern void declare_vars (tree, gimple, bool);
973 extern void annotate_all_with_location (gimple_seq, location_t);
975 /* Validation of GIMPLE expressions. Note that these predicates only check
976 the basic form of the expression, they don't recurse to make sure that
977 underlying nodes are also of the right form. */
978 typedef bool (*gimple_predicate)(tree);
981 /* FIXME we should deduce this from the predicate. */
982 enum fallback {
983 fb_none = 0, /* Do not generate a temporary. */
985 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
986 gimplified expression. */
988 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
989 gimplified expression. */
991 fb_mayfail = 4, /* Gimplification may fail. Error issued
992 afterwards. */
993 fb_either= fb_rvalue | fb_lvalue
996 typedef int fallback_t;
998 enum gimplify_status {
999 GS_ERROR = -2, /* Something Bad Seen. */
1000 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
1001 GS_OK = 0, /* We did something, maybe more to do. */
1002 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1005 struct gimplify_ctx
1007 struct gimplify_ctx *prev_context;
1009 VEC(gimple,heap) *bind_expr_stack;
1010 tree temps;
1011 gimple_seq conditional_cleanups;
1012 tree exit_label;
1013 tree return_temp;
1015 VEC(tree,heap) *case_labels;
1016 /* The formal temporary table. Should this be persistent? */
1017 htab_t temp_htab;
1019 int conditions;
1020 bool save_stack;
1021 bool into_ssa;
1022 bool allow_rhs_cond_expr;
1025 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1026 bool (*) (tree), fallback_t);
1027 extern void gimplify_type_sizes (tree, gimple_seq *);
1028 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1029 extern bool gimplify_stmt (tree *, gimple_seq *);
1030 extern gimple gimplify_body (tree *, tree, bool);
1031 extern void push_gimplify_context (struct gimplify_ctx *);
1032 extern void pop_gimplify_context (gimple);
1033 extern void gimplify_and_add (tree, gimple_seq *);
1035 /* Miscellaneous helpers. */
1036 extern void gimple_add_tmp_var (tree);
1037 extern gimple gimple_current_bind_expr (void);
1038 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1039 extern tree voidify_wrapper_expr (tree, tree);
1040 extern tree build_and_jump (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 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2206 even if the called function can throw in other cases. */
2208 static inline void
2209 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2211 GIMPLE_CHECK (s, GIMPLE_CALL);
2212 if (nothrow_p)
2213 s->gsbase.subcode |= GF_CALL_NOTHROW;
2214 else
2215 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2218 /* Return true if S is a nothrow call. */
2220 static inline bool
2221 gimple_call_nothrow_p (gimple s)
2223 GIMPLE_CHECK (s, GIMPLE_CALL);
2224 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2228 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2230 static inline void
2231 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2233 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2234 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2235 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2239 /* Return a pointer to the points-to solution for the set of call-used
2240 variables of the call CALL. */
2242 static inline struct pt_solution *
2243 gimple_call_use_set (gimple call)
2245 GIMPLE_CHECK (call, GIMPLE_CALL);
2246 return &call->gimple_call.call_used;
2250 /* Return a pointer to the points-to solution for the set of call-used
2251 variables of the call CALL. */
2253 static inline struct pt_solution *
2254 gimple_call_clobber_set (gimple call)
2256 GIMPLE_CHECK (call, GIMPLE_CALL);
2257 return &call->gimple_call.call_clobbered;
2261 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2262 non-NULL lhs. */
2264 static inline bool
2265 gimple_has_lhs (gimple stmt)
2267 return (is_gimple_assign (stmt)
2268 || (is_gimple_call (stmt)
2269 && gimple_call_lhs (stmt) != NULL_TREE));
2273 /* Return the code of the predicate computed by conditional statement GS. */
2275 static inline enum tree_code
2276 gimple_cond_code (const_gimple gs)
2278 GIMPLE_CHECK (gs, GIMPLE_COND);
2279 return (enum tree_code) gs->gsbase.subcode;
2283 /* Set CODE to be the predicate code for the conditional statement GS. */
2285 static inline void
2286 gimple_cond_set_code (gimple gs, enum tree_code code)
2288 GIMPLE_CHECK (gs, GIMPLE_COND);
2289 gs->gsbase.subcode = code;
2293 /* Return the LHS of the predicate computed by conditional statement GS. */
2295 static inline tree
2296 gimple_cond_lhs (const_gimple gs)
2298 GIMPLE_CHECK (gs, GIMPLE_COND);
2299 return gimple_op (gs, 0);
2302 /* Return the pointer to the LHS of the predicate computed by conditional
2303 statement GS. */
2305 static inline tree *
2306 gimple_cond_lhs_ptr (const_gimple gs)
2308 GIMPLE_CHECK (gs, GIMPLE_COND);
2309 return gimple_op_ptr (gs, 0);
2312 /* Set LHS to be the LHS operand of the predicate computed by
2313 conditional statement GS. */
2315 static inline void
2316 gimple_cond_set_lhs (gimple gs, tree lhs)
2318 GIMPLE_CHECK (gs, GIMPLE_COND);
2319 gimple_set_op (gs, 0, lhs);
2323 /* Return the RHS operand of the predicate computed by conditional GS. */
2325 static inline tree
2326 gimple_cond_rhs (const_gimple gs)
2328 GIMPLE_CHECK (gs, GIMPLE_COND);
2329 return gimple_op (gs, 1);
2332 /* Return the pointer to the RHS operand of the predicate computed by
2333 conditional GS. */
2335 static inline tree *
2336 gimple_cond_rhs_ptr (const_gimple gs)
2338 GIMPLE_CHECK (gs, GIMPLE_COND);
2339 return gimple_op_ptr (gs, 1);
2343 /* Set RHS to be the RHS operand of the predicate computed by
2344 conditional statement GS. */
2346 static inline void
2347 gimple_cond_set_rhs (gimple gs, tree rhs)
2349 GIMPLE_CHECK (gs, GIMPLE_COND);
2350 gimple_set_op (gs, 1, rhs);
2354 /* Return the label used by conditional statement GS when its
2355 predicate evaluates to true. */
2357 static inline tree
2358 gimple_cond_true_label (const_gimple gs)
2360 GIMPLE_CHECK (gs, GIMPLE_COND);
2361 return gimple_op (gs, 2);
2365 /* Set LABEL to be the label used by conditional statement GS when its
2366 predicate evaluates to true. */
2368 static inline void
2369 gimple_cond_set_true_label (gimple gs, tree label)
2371 GIMPLE_CHECK (gs, GIMPLE_COND);
2372 gimple_set_op (gs, 2, label);
2376 /* Set LABEL to be the label used by conditional statement GS when its
2377 predicate evaluates to false. */
2379 static inline void
2380 gimple_cond_set_false_label (gimple gs, tree label)
2382 GIMPLE_CHECK (gs, GIMPLE_COND);
2383 gimple_set_op (gs, 3, label);
2387 /* Return the label used by conditional statement GS when its
2388 predicate evaluates to false. */
2390 static inline tree
2391 gimple_cond_false_label (const_gimple gs)
2393 GIMPLE_CHECK (gs, GIMPLE_COND);
2394 return gimple_op (gs, 3);
2398 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2400 static inline void
2401 gimple_cond_make_false (gimple gs)
2403 gimple_cond_set_lhs (gs, boolean_true_node);
2404 gimple_cond_set_rhs (gs, boolean_false_node);
2405 gs->gsbase.subcode = EQ_EXPR;
2409 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2411 static inline void
2412 gimple_cond_make_true (gimple gs)
2414 gimple_cond_set_lhs (gs, boolean_true_node);
2415 gimple_cond_set_rhs (gs, boolean_true_node);
2416 gs->gsbase.subcode = EQ_EXPR;
2419 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2420 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2422 static inline bool
2423 gimple_cond_true_p (const_gimple gs)
2425 tree lhs = gimple_cond_lhs (gs);
2426 tree rhs = gimple_cond_rhs (gs);
2427 enum tree_code code = gimple_cond_code (gs);
2429 if (lhs != boolean_true_node && lhs != boolean_false_node)
2430 return false;
2432 if (rhs != boolean_true_node && rhs != boolean_false_node)
2433 return false;
2435 if (code == NE_EXPR && lhs != rhs)
2436 return true;
2438 if (code == EQ_EXPR && lhs == rhs)
2439 return true;
2441 return false;
2444 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2445 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2447 static inline bool
2448 gimple_cond_false_p (const_gimple gs)
2450 tree lhs = gimple_cond_lhs (gs);
2451 tree rhs = gimple_cond_rhs (gs);
2452 enum tree_code code = gimple_cond_code (gs);
2454 if (lhs != boolean_true_node && lhs != boolean_false_node)
2455 return false;
2457 if (rhs != boolean_true_node && rhs != boolean_false_node)
2458 return false;
2460 if (code == NE_EXPR && lhs == rhs)
2461 return true;
2463 if (code == EQ_EXPR && lhs != rhs)
2464 return true;
2466 return false;
2469 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2470 'if (var == 1)' */
2472 static inline bool
2473 gimple_cond_single_var_p (gimple gs)
2475 if (gimple_cond_code (gs) == NE_EXPR
2476 && gimple_cond_rhs (gs) == boolean_false_node)
2477 return true;
2479 if (gimple_cond_code (gs) == EQ_EXPR
2480 && gimple_cond_rhs (gs) == boolean_true_node)
2481 return true;
2483 return false;
2486 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2488 static inline void
2489 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2491 gimple_cond_set_code (stmt, code);
2492 gimple_cond_set_lhs (stmt, lhs);
2493 gimple_cond_set_rhs (stmt, rhs);
2496 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2498 static inline tree
2499 gimple_label_label (const_gimple gs)
2501 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2502 return gimple_op (gs, 0);
2506 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2507 GS. */
2509 static inline void
2510 gimple_label_set_label (gimple gs, tree label)
2512 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2513 gimple_set_op (gs, 0, label);
2517 /* Return the destination of the unconditional jump GS. */
2519 static inline tree
2520 gimple_goto_dest (const_gimple gs)
2522 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2523 return gimple_op (gs, 0);
2527 /* Set DEST to be the destination of the unconditonal jump GS. */
2529 static inline void
2530 gimple_goto_set_dest (gimple gs, tree dest)
2532 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2533 gimple_set_op (gs, 0, dest);
2537 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2539 static inline tree
2540 gimple_bind_vars (const_gimple gs)
2542 GIMPLE_CHECK (gs, GIMPLE_BIND);
2543 return gs->gimple_bind.vars;
2547 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2548 statement GS. */
2550 static inline void
2551 gimple_bind_set_vars (gimple gs, tree vars)
2553 GIMPLE_CHECK (gs, GIMPLE_BIND);
2554 gs->gimple_bind.vars = vars;
2558 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2559 statement GS. */
2561 static inline void
2562 gimple_bind_append_vars (gimple gs, tree vars)
2564 GIMPLE_CHECK (gs, GIMPLE_BIND);
2565 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2569 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2571 static inline gimple_seq
2572 gimple_bind_body (gimple gs)
2574 GIMPLE_CHECK (gs, GIMPLE_BIND);
2575 return gs->gimple_bind.body;
2579 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2580 statement GS. */
2582 static inline void
2583 gimple_bind_set_body (gimple gs, gimple_seq seq)
2585 GIMPLE_CHECK (gs, GIMPLE_BIND);
2586 gs->gimple_bind.body = seq;
2590 /* Append a statement to the end of a GIMPLE_BIND's body. */
2592 static inline void
2593 gimple_bind_add_stmt (gimple gs, gimple stmt)
2595 GIMPLE_CHECK (gs, GIMPLE_BIND);
2596 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2600 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2602 static inline void
2603 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2605 GIMPLE_CHECK (gs, GIMPLE_BIND);
2606 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2610 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2611 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2613 static inline tree
2614 gimple_bind_block (const_gimple gs)
2616 GIMPLE_CHECK (gs, GIMPLE_BIND);
2617 return gs->gimple_bind.block;
2621 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2622 statement GS. */
2624 static inline void
2625 gimple_bind_set_block (gimple gs, tree block)
2627 GIMPLE_CHECK (gs, GIMPLE_BIND);
2628 gcc_assert (block == NULL_TREE || TREE_CODE (block) == BLOCK);
2629 gs->gimple_bind.block = block;
2633 /* Return the number of input operands for GIMPLE_ASM GS. */
2635 static inline unsigned
2636 gimple_asm_ninputs (const_gimple gs)
2638 GIMPLE_CHECK (gs, GIMPLE_ASM);
2639 return gs->gimple_asm.ni;
2643 /* Return the number of output operands for GIMPLE_ASM GS. */
2645 static inline unsigned
2646 gimple_asm_noutputs (const_gimple gs)
2648 GIMPLE_CHECK (gs, GIMPLE_ASM);
2649 return gs->gimple_asm.no;
2653 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2655 static inline unsigned
2656 gimple_asm_nclobbers (const_gimple gs)
2658 GIMPLE_CHECK (gs, GIMPLE_ASM);
2659 return gs->gimple_asm.nc;
2662 /* Return the number of label operands for GIMPLE_ASM GS. */
2664 static inline unsigned
2665 gimple_asm_nlabels (const_gimple gs)
2667 GIMPLE_CHECK (gs, GIMPLE_ASM);
2668 return gs->gimple_asm.nl;
2671 /* Return input operand INDEX of GIMPLE_ASM GS. */
2673 static inline tree
2674 gimple_asm_input_op (const_gimple gs, unsigned index)
2676 GIMPLE_CHECK (gs, GIMPLE_ASM);
2677 gcc_assert (index <= gs->gimple_asm.ni);
2678 return gimple_op (gs, index);
2681 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2683 static inline tree *
2684 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2686 GIMPLE_CHECK (gs, GIMPLE_ASM);
2687 gcc_assert (index <= gs->gimple_asm.ni);
2688 return gimple_op_ptr (gs, index);
2692 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2694 static inline void
2695 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2697 GIMPLE_CHECK (gs, GIMPLE_ASM);
2698 gcc_assert (index <= gs->gimple_asm.ni);
2699 gcc_assert (TREE_CODE (in_op) == TREE_LIST);
2700 gimple_set_op (gs, index, in_op);
2704 /* Return output operand INDEX of GIMPLE_ASM GS. */
2706 static inline tree
2707 gimple_asm_output_op (const_gimple gs, unsigned index)
2709 GIMPLE_CHECK (gs, GIMPLE_ASM);
2710 gcc_assert (index <= gs->gimple_asm.no);
2711 return gimple_op (gs, index + gs->gimple_asm.ni);
2714 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2716 static inline tree *
2717 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2719 GIMPLE_CHECK (gs, GIMPLE_ASM);
2720 gcc_assert (index <= gs->gimple_asm.no);
2721 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2725 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2727 static inline void
2728 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2730 GIMPLE_CHECK (gs, GIMPLE_ASM);
2731 gcc_assert (index <= gs->gimple_asm.no);
2732 gcc_assert (TREE_CODE (out_op) == TREE_LIST);
2733 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2737 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2739 static inline tree
2740 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2742 GIMPLE_CHECK (gs, GIMPLE_ASM);
2743 gcc_assert (index <= gs->gimple_asm.nc);
2744 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2748 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2750 static inline void
2751 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2753 GIMPLE_CHECK (gs, GIMPLE_ASM);
2754 gcc_assert (index <= gs->gimple_asm.nc);
2755 gcc_assert (TREE_CODE (clobber_op) == TREE_LIST);
2756 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2759 /* Return label operand INDEX of GIMPLE_ASM GS. */
2761 static inline tree
2762 gimple_asm_label_op (const_gimple gs, unsigned index)
2764 GIMPLE_CHECK (gs, GIMPLE_ASM);
2765 gcc_assert (index <= gs->gimple_asm.nl);
2766 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
2769 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
2771 static inline void
2772 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
2774 GIMPLE_CHECK (gs, GIMPLE_ASM);
2775 gcc_assert (index <= gs->gimple_asm.nl);
2776 gcc_assert (TREE_CODE (label_op) == TREE_LIST);
2777 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
2780 /* Return the string representing the assembly instruction in
2781 GIMPLE_ASM GS. */
2783 static inline const char *
2784 gimple_asm_string (const_gimple gs)
2786 GIMPLE_CHECK (gs, GIMPLE_ASM);
2787 return gs->gimple_asm.string;
2791 /* Return true if GS is an asm statement marked volatile. */
2793 static inline bool
2794 gimple_asm_volatile_p (const_gimple gs)
2796 GIMPLE_CHECK (gs, GIMPLE_ASM);
2797 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
2801 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
2803 static inline void
2804 gimple_asm_set_volatile (gimple gs, bool volatile_p)
2806 GIMPLE_CHECK (gs, GIMPLE_ASM);
2807 if (volatile_p)
2808 gs->gsbase.subcode |= GF_ASM_VOLATILE;
2809 else
2810 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
2814 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
2816 static inline void
2817 gimple_asm_set_input (gimple gs, bool input_p)
2819 GIMPLE_CHECK (gs, GIMPLE_ASM);
2820 if (input_p)
2821 gs->gsbase.subcode |= GF_ASM_INPUT;
2822 else
2823 gs->gsbase.subcode &= ~GF_ASM_INPUT;
2827 /* Return true if asm GS is an ASM_INPUT. */
2829 static inline bool
2830 gimple_asm_input_p (const_gimple gs)
2832 GIMPLE_CHECK (gs, GIMPLE_ASM);
2833 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
2837 /* Return the types handled by GIMPLE_CATCH statement GS. */
2839 static inline tree
2840 gimple_catch_types (const_gimple gs)
2842 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2843 return gs->gimple_catch.types;
2847 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
2849 static inline tree *
2850 gimple_catch_types_ptr (gimple gs)
2852 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2853 return &gs->gimple_catch.types;
2857 /* Return the GIMPLE sequence representing the body of the handler of
2858 GIMPLE_CATCH statement GS. */
2860 static inline gimple_seq
2861 gimple_catch_handler (gimple gs)
2863 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2864 return gs->gimple_catch.handler;
2868 /* Return a pointer to the GIMPLE sequence representing the body of
2869 the handler of GIMPLE_CATCH statement GS. */
2871 static inline gimple_seq *
2872 gimple_catch_handler_ptr (gimple gs)
2874 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2875 return &gs->gimple_catch.handler;
2879 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
2881 static inline void
2882 gimple_catch_set_types (gimple gs, tree t)
2884 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2885 gs->gimple_catch.types = t;
2889 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
2891 static inline void
2892 gimple_catch_set_handler (gimple gs, gimple_seq handler)
2894 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2895 gs->gimple_catch.handler = handler;
2899 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
2901 static inline tree
2902 gimple_eh_filter_types (const_gimple gs)
2904 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2905 return gs->gimple_eh_filter.types;
2909 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
2910 GS. */
2912 static inline tree *
2913 gimple_eh_filter_types_ptr (gimple gs)
2915 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2916 return &gs->gimple_eh_filter.types;
2920 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
2921 statement fails. */
2923 static inline gimple_seq
2924 gimple_eh_filter_failure (gimple gs)
2926 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2927 return gs->gimple_eh_filter.failure;
2931 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
2933 static inline void
2934 gimple_eh_filter_set_types (gimple gs, tree types)
2936 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2937 gs->gimple_eh_filter.types = types;
2941 /* Set FAILURE to be the sequence of statements to execute on failure
2942 for GIMPLE_EH_FILTER GS. */
2944 static inline void
2945 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
2947 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2948 gs->gimple_eh_filter.failure = failure;
2951 /* Get the function decl to be called by the MUST_NOT_THROW region. */
2953 static inline tree
2954 gimple_eh_must_not_throw_fndecl (gimple gs)
2956 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
2957 return gs->gimple_eh_mnt.fndecl;
2960 /* Set the function decl to be called by GS to DECL. */
2962 static inline void
2963 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
2965 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
2966 gs->gimple_eh_mnt.fndecl = decl;
2970 /* GIMPLE_TRY accessors. */
2972 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
2973 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
2975 static inline enum gimple_try_flags
2976 gimple_try_kind (const_gimple gs)
2978 GIMPLE_CHECK (gs, GIMPLE_TRY);
2979 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
2983 /* Set the kind of try block represented by GIMPLE_TRY GS. */
2985 static inline void
2986 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
2988 GIMPLE_CHECK (gs, GIMPLE_TRY);
2989 gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY);
2990 if (gimple_try_kind (gs) != kind)
2991 gs->gsbase.subcode = (unsigned int) kind;
2995 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
2997 static inline bool
2998 gimple_try_catch_is_cleanup (const_gimple gs)
3000 gcc_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3001 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3005 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3007 static inline gimple_seq
3008 gimple_try_eval (gimple gs)
3010 GIMPLE_CHECK (gs, GIMPLE_TRY);
3011 return gs->gimple_try.eval;
3015 /* Return the sequence of statements used as the cleanup body for
3016 GIMPLE_TRY GS. */
3018 static inline gimple_seq
3019 gimple_try_cleanup (gimple gs)
3021 GIMPLE_CHECK (gs, GIMPLE_TRY);
3022 return gs->gimple_try.cleanup;
3026 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3028 static inline void
3029 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3031 gcc_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3032 if (catch_is_cleanup)
3033 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3034 else
3035 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3039 /* Set EVAL to be the sequence of statements to use as the body for
3040 GIMPLE_TRY GS. */
3042 static inline void
3043 gimple_try_set_eval (gimple gs, gimple_seq eval)
3045 GIMPLE_CHECK (gs, GIMPLE_TRY);
3046 gs->gimple_try.eval = eval;
3050 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3051 body for GIMPLE_TRY GS. */
3053 static inline void
3054 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3056 GIMPLE_CHECK (gs, GIMPLE_TRY);
3057 gs->gimple_try.cleanup = cleanup;
3061 /* Return the cleanup sequence for cleanup statement GS. */
3063 static inline gimple_seq
3064 gimple_wce_cleanup (gimple gs)
3066 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3067 return gs->gimple_wce.cleanup;
3071 /* Set CLEANUP to be the cleanup sequence for GS. */
3073 static inline void
3074 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3076 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3077 gs->gimple_wce.cleanup = cleanup;
3081 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3083 static inline bool
3084 gimple_wce_cleanup_eh_only (const_gimple gs)
3086 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3087 return gs->gsbase.subcode != 0;
3091 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3093 static inline void
3094 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3096 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3097 gs->gsbase.subcode = (unsigned int) eh_only_p;
3101 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3103 static inline unsigned
3104 gimple_phi_capacity (const_gimple gs)
3106 GIMPLE_CHECK (gs, GIMPLE_PHI);
3107 return gs->gimple_phi.capacity;
3111 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3112 be exactly the number of incoming edges for the basic block holding
3113 GS. */
3115 static inline unsigned
3116 gimple_phi_num_args (const_gimple gs)
3118 GIMPLE_CHECK (gs, GIMPLE_PHI);
3119 return gs->gimple_phi.nargs;
3123 /* Return the SSA name created by GIMPLE_PHI GS. */
3125 static inline tree
3126 gimple_phi_result (const_gimple gs)
3128 GIMPLE_CHECK (gs, GIMPLE_PHI);
3129 return gs->gimple_phi.result;
3132 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3134 static inline tree *
3135 gimple_phi_result_ptr (gimple gs)
3137 GIMPLE_CHECK (gs, GIMPLE_PHI);
3138 return &gs->gimple_phi.result;
3141 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3143 static inline void
3144 gimple_phi_set_result (gimple gs, tree result)
3146 GIMPLE_CHECK (gs, GIMPLE_PHI);
3147 gs->gimple_phi.result = result;
3151 /* Return the PHI argument corresponding to incoming edge INDEX for
3152 GIMPLE_PHI GS. */
3154 static inline struct phi_arg_d *
3155 gimple_phi_arg (gimple gs, unsigned index)
3157 GIMPLE_CHECK (gs, GIMPLE_PHI);
3158 gcc_assert (index <= gs->gimple_phi.capacity);
3159 return &(gs->gimple_phi.args[index]);
3162 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3163 for GIMPLE_PHI GS. */
3165 static inline void
3166 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3168 GIMPLE_CHECK (gs, GIMPLE_PHI);
3169 gcc_assert (index <= gs->gimple_phi.nargs);
3170 memcpy (gs->gimple_phi.args + index, phiarg, sizeof (struct phi_arg_d));
3173 /* Return the region number for GIMPLE_RESX GS. */
3175 static inline int
3176 gimple_resx_region (const_gimple gs)
3178 GIMPLE_CHECK (gs, GIMPLE_RESX);
3179 return gs->gimple_eh_ctrl.region;
3182 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3184 static inline void
3185 gimple_resx_set_region (gimple gs, int region)
3187 GIMPLE_CHECK (gs, GIMPLE_RESX);
3188 gs->gimple_eh_ctrl.region = region;
3191 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3193 static inline int
3194 gimple_eh_dispatch_region (const_gimple gs)
3196 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3197 return gs->gimple_eh_ctrl.region;
3200 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3202 static inline void
3203 gimple_eh_dispatch_set_region (gimple gs, int region)
3205 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3206 gs->gimple_eh_ctrl.region = region;
3209 /* Return the number of labels associated with the switch statement GS. */
3211 static inline unsigned
3212 gimple_switch_num_labels (const_gimple gs)
3214 unsigned num_ops;
3215 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3216 num_ops = gimple_num_ops (gs);
3217 gcc_assert (num_ops > 1);
3218 return num_ops - 1;
3222 /* Set NLABELS to be the number of labels for the switch statement GS. */
3224 static inline void
3225 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3227 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3228 gimple_set_num_ops (g, nlabels + 1);
3232 /* Return the index variable used by the switch statement GS. */
3234 static inline tree
3235 gimple_switch_index (const_gimple gs)
3237 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3238 return gimple_op (gs, 0);
3242 /* Return a pointer to the index variable for the switch statement GS. */
3244 static inline tree *
3245 gimple_switch_index_ptr (const_gimple gs)
3247 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3248 return gimple_op_ptr (gs, 0);
3252 /* Set INDEX to be the index variable for switch statement GS. */
3254 static inline void
3255 gimple_switch_set_index (gimple gs, tree index)
3257 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3258 gcc_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3259 gimple_set_op (gs, 0, index);
3263 /* Return the label numbered INDEX. The default label is 0, followed by any
3264 labels in a switch statement. */
3266 static inline tree
3267 gimple_switch_label (const_gimple gs, unsigned index)
3269 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3270 gcc_assert (gimple_num_ops (gs) > index + 1);
3271 return gimple_op (gs, index + 1);
3274 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3276 static inline void
3277 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3279 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3280 gcc_assert (gimple_num_ops (gs) > index + 1);
3281 gcc_assert (label == NULL_TREE || TREE_CODE (label) == CASE_LABEL_EXPR);
3282 gimple_set_op (gs, index + 1, label);
3285 /* Return the default label for a switch statement. */
3287 static inline tree
3288 gimple_switch_default_label (const_gimple gs)
3290 return gimple_switch_label (gs, 0);
3293 /* Set the default label for a switch statement. */
3295 static inline void
3296 gimple_switch_set_default_label (gimple gs, tree label)
3298 gimple_switch_set_label (gs, 0, label);
3301 /* Return true if GS is a GIMPLE_DEBUG statement. */
3303 static inline bool
3304 is_gimple_debug (const_gimple gs)
3306 return gimple_code (gs) == GIMPLE_DEBUG;
3309 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3311 static inline bool
3312 gimple_debug_bind_p (const_gimple s)
3314 if (is_gimple_debug (s))
3315 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3317 return false;
3320 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3322 static inline tree
3323 gimple_debug_bind_get_var (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, 0);
3332 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3333 statement. */
3335 static inline tree
3336 gimple_debug_bind_get_value (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 (dbg, 1);
3345 /* Return a pointer to the value bound to the variable in a
3346 GIMPLE_DEBUG bind statement. */
3348 static inline tree *
3349 gimple_debug_bind_get_value_ptr (gimple dbg)
3351 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3352 #ifdef ENABLE_CHECKING
3353 gcc_assert (gimple_debug_bind_p (dbg));
3354 #endif
3355 return gimple_op_ptr (dbg, 1);
3358 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3360 static inline void
3361 gimple_debug_bind_set_var (gimple dbg, tree var)
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, 0, var);
3370 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3371 statement. */
3373 static inline void
3374 gimple_debug_bind_set_value (gimple dbg, tree value)
3376 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3377 #ifdef ENABLE_CHECKING
3378 gcc_assert (gimple_debug_bind_p (dbg));
3379 #endif
3380 gimple_set_op (dbg, 1, value);
3383 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3384 optimized away. */
3385 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3387 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3388 statement. */
3390 static inline void
3391 gimple_debug_bind_reset_value (gimple dbg)
3393 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3394 #ifdef ENABLE_CHECKING
3395 gcc_assert (gimple_debug_bind_p (dbg));
3396 #endif
3397 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3400 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3401 value. */
3403 static inline bool
3404 gimple_debug_bind_has_value_p (gimple dbg)
3406 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3407 #ifdef ENABLE_CHECKING
3408 gcc_assert (gimple_debug_bind_p (dbg));
3409 #endif
3410 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3413 #undef GIMPLE_DEBUG_BIND_NOVALUE
3415 /* Return the body for the OMP statement GS. */
3417 static inline gimple_seq
3418 gimple_omp_body (gimple gs)
3420 return gs->omp.body;
3423 /* Set BODY to be the body for the OMP statement GS. */
3425 static inline void
3426 gimple_omp_set_body (gimple gs, gimple_seq body)
3428 gs->omp.body = body;
3432 /* Return the name associated with OMP_CRITICAL statement GS. */
3434 static inline tree
3435 gimple_omp_critical_name (const_gimple gs)
3437 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3438 return gs->gimple_omp_critical.name;
3442 /* Return a pointer to the name associated with OMP critical statement GS. */
3444 static inline tree *
3445 gimple_omp_critical_name_ptr (gimple gs)
3447 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3448 return &gs->gimple_omp_critical.name;
3452 /* Set NAME to be the name associated with OMP critical statement GS. */
3454 static inline void
3455 gimple_omp_critical_set_name (gimple gs, tree name)
3457 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3458 gs->gimple_omp_critical.name = name;
3462 /* Return the clauses associated with OMP_FOR GS. */
3464 static inline tree
3465 gimple_omp_for_clauses (const_gimple gs)
3467 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3468 return gs->gimple_omp_for.clauses;
3472 /* Return a pointer to the OMP_FOR GS. */
3474 static inline tree *
3475 gimple_omp_for_clauses_ptr (gimple gs)
3477 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3478 return &gs->gimple_omp_for.clauses;
3482 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3484 static inline void
3485 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3487 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3488 gs->gimple_omp_for.clauses = clauses;
3492 /* Get the collapse count of OMP_FOR GS. */
3494 static inline size_t
3495 gimple_omp_for_collapse (gimple gs)
3497 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3498 return gs->gimple_omp_for.collapse;
3502 /* Return the index variable for OMP_FOR GS. */
3504 static inline tree
3505 gimple_omp_for_index (const_gimple gs, size_t i)
3507 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3508 gcc_assert (i < gs->gimple_omp_for.collapse);
3509 return gs->gimple_omp_for.iter[i].index;
3513 /* Return a pointer to the index variable for OMP_FOR GS. */
3515 static inline tree *
3516 gimple_omp_for_index_ptr (gimple gs, size_t i)
3518 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3519 gcc_assert (i < gs->gimple_omp_for.collapse);
3520 return &gs->gimple_omp_for.iter[i].index;
3524 /* Set INDEX to be the index variable for OMP_FOR GS. */
3526 static inline void
3527 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3529 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3530 gcc_assert (i < gs->gimple_omp_for.collapse);
3531 gs->gimple_omp_for.iter[i].index = index;
3535 /* Return the initial value for OMP_FOR GS. */
3537 static inline tree
3538 gimple_omp_for_initial (const_gimple gs, size_t i)
3540 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3541 gcc_assert (i < gs->gimple_omp_for.collapse);
3542 return gs->gimple_omp_for.iter[i].initial;
3546 /* Return a pointer to the initial value for OMP_FOR GS. */
3548 static inline tree *
3549 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3551 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3552 gcc_assert (i < gs->gimple_omp_for.collapse);
3553 return &gs->gimple_omp_for.iter[i].initial;
3557 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3559 static inline void
3560 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3562 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3563 gcc_assert (i < gs->gimple_omp_for.collapse);
3564 gs->gimple_omp_for.iter[i].initial = initial;
3568 /* Return the final value for OMP_FOR GS. */
3570 static inline tree
3571 gimple_omp_for_final (const_gimple gs, size_t i)
3573 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3574 gcc_assert (i < gs->gimple_omp_for.collapse);
3575 return gs->gimple_omp_for.iter[i].final;
3579 /* Return a pointer to the final value for OMP_FOR GS. */
3581 static inline tree *
3582 gimple_omp_for_final_ptr (gimple gs, size_t i)
3584 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3585 gcc_assert (i < gs->gimple_omp_for.collapse);
3586 return &gs->gimple_omp_for.iter[i].final;
3590 /* Set FINAL to be the final value for OMP_FOR GS. */
3592 static inline void
3593 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3595 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3596 gcc_assert (i < gs->gimple_omp_for.collapse);
3597 gs->gimple_omp_for.iter[i].final = final;
3601 /* Return the increment value for OMP_FOR GS. */
3603 static inline tree
3604 gimple_omp_for_incr (const_gimple gs, size_t i)
3606 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3607 gcc_assert (i < gs->gimple_omp_for.collapse);
3608 return gs->gimple_omp_for.iter[i].incr;
3612 /* Return a pointer to the increment value for OMP_FOR GS. */
3614 static inline tree *
3615 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3617 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3618 gcc_assert (i < gs->gimple_omp_for.collapse);
3619 return &gs->gimple_omp_for.iter[i].incr;
3623 /* Set INCR to be the increment value for OMP_FOR GS. */
3625 static inline void
3626 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3628 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3629 gcc_assert (i < gs->gimple_omp_for.collapse);
3630 gs->gimple_omp_for.iter[i].incr = incr;
3634 /* Return the sequence of statements to execute before the OMP_FOR
3635 statement GS starts. */
3637 static inline gimple_seq
3638 gimple_omp_for_pre_body (gimple gs)
3640 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3641 return gs->gimple_omp_for.pre_body;
3645 /* Set PRE_BODY to be the sequence of statements to execute before the
3646 OMP_FOR statement GS starts. */
3648 static inline void
3649 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3651 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3652 gs->gimple_omp_for.pre_body = pre_body;
3656 /* Return the clauses associated with OMP_PARALLEL GS. */
3658 static inline tree
3659 gimple_omp_parallel_clauses (const_gimple gs)
3661 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3662 return gs->gimple_omp_parallel.clauses;
3666 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3668 static inline tree *
3669 gimple_omp_parallel_clauses_ptr (gimple gs)
3671 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3672 return &gs->gimple_omp_parallel.clauses;
3676 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
3677 GS. */
3679 static inline void
3680 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
3682 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3683 gs->gimple_omp_parallel.clauses = clauses;
3687 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
3689 static inline tree
3690 gimple_omp_parallel_child_fn (const_gimple gs)
3692 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3693 return gs->gimple_omp_parallel.child_fn;
3696 /* Return a pointer to the child function used to hold the body of
3697 OMP_PARALLEL GS. */
3699 static inline tree *
3700 gimple_omp_parallel_child_fn_ptr (gimple gs)
3702 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3703 return &gs->gimple_omp_parallel.child_fn;
3707 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
3709 static inline void
3710 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
3712 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3713 gs->gimple_omp_parallel.child_fn = child_fn;
3717 /* Return the artificial argument used to send variables and values
3718 from the parent to the children threads in OMP_PARALLEL GS. */
3720 static inline tree
3721 gimple_omp_parallel_data_arg (const_gimple gs)
3723 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3724 return gs->gimple_omp_parallel.data_arg;
3728 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
3730 static inline tree *
3731 gimple_omp_parallel_data_arg_ptr (gimple gs)
3733 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3734 return &gs->gimple_omp_parallel.data_arg;
3738 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
3740 static inline void
3741 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
3743 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3744 gs->gimple_omp_parallel.data_arg = data_arg;
3748 /* Return the clauses associated with OMP_TASK GS. */
3750 static inline tree
3751 gimple_omp_task_clauses (const_gimple gs)
3753 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3754 return gs->gimple_omp_parallel.clauses;
3758 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3760 static inline tree *
3761 gimple_omp_task_clauses_ptr (gimple gs)
3763 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3764 return &gs->gimple_omp_parallel.clauses;
3768 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3769 GS. */
3771 static inline void
3772 gimple_omp_task_set_clauses (gimple gs, tree clauses)
3774 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3775 gs->gimple_omp_parallel.clauses = clauses;
3779 /* Return the child function used to hold the body of OMP_TASK GS. */
3781 static inline tree
3782 gimple_omp_task_child_fn (const_gimple gs)
3784 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3785 return gs->gimple_omp_parallel.child_fn;
3788 /* Return a pointer to the child function used to hold the body of
3789 OMP_TASK GS. */
3791 static inline tree *
3792 gimple_omp_task_child_fn_ptr (gimple gs)
3794 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3795 return &gs->gimple_omp_parallel.child_fn;
3799 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3801 static inline void
3802 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
3804 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3805 gs->gimple_omp_parallel.child_fn = child_fn;
3809 /* Return the artificial argument used to send variables and values
3810 from the parent to the children threads in OMP_TASK GS. */
3812 static inline tree
3813 gimple_omp_task_data_arg (const_gimple gs)
3815 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3816 return gs->gimple_omp_parallel.data_arg;
3820 /* Return a pointer to the data argument for OMP_TASK GS. */
3822 static inline tree *
3823 gimple_omp_task_data_arg_ptr (gimple gs)
3825 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3826 return &gs->gimple_omp_parallel.data_arg;
3830 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3832 static inline void
3833 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
3835 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3836 gs->gimple_omp_parallel.data_arg = data_arg;
3840 /* Return the clauses associated with OMP_TASK GS. */
3842 static inline tree
3843 gimple_omp_taskreg_clauses (const_gimple gs)
3845 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3846 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3847 return gs->gimple_omp_parallel.clauses;
3851 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3853 static inline tree *
3854 gimple_omp_taskreg_clauses_ptr (gimple gs)
3856 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3857 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3858 return &gs->gimple_omp_parallel.clauses;
3862 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3863 GS. */
3865 static inline void
3866 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
3868 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3869 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3870 gs->gimple_omp_parallel.clauses = clauses;
3874 /* Return the child function used to hold the body of OMP_TASK GS. */
3876 static inline tree
3877 gimple_omp_taskreg_child_fn (const_gimple gs)
3879 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3880 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3881 return gs->gimple_omp_parallel.child_fn;
3884 /* Return a pointer to the child function used to hold the body of
3885 OMP_TASK GS. */
3887 static inline tree *
3888 gimple_omp_taskreg_child_fn_ptr (gimple gs)
3890 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3891 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3892 return &gs->gimple_omp_parallel.child_fn;
3896 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3898 static inline void
3899 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
3901 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3902 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3903 gs->gimple_omp_parallel.child_fn = child_fn;
3907 /* Return the artificial argument used to send variables and values
3908 from the parent to the children threads in OMP_TASK GS. */
3910 static inline tree
3911 gimple_omp_taskreg_data_arg (const_gimple gs)
3913 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3914 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3915 return gs->gimple_omp_parallel.data_arg;
3919 /* Return a pointer to the data argument for OMP_TASK GS. */
3921 static inline tree *
3922 gimple_omp_taskreg_data_arg_ptr (gimple gs)
3924 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3925 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3926 return &gs->gimple_omp_parallel.data_arg;
3930 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3932 static inline void
3933 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
3935 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3936 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3937 gs->gimple_omp_parallel.data_arg = data_arg;
3941 /* Return the copy function used to hold the body of OMP_TASK GS. */
3943 static inline tree
3944 gimple_omp_task_copy_fn (const_gimple gs)
3946 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3947 return gs->gimple_omp_task.copy_fn;
3950 /* Return a pointer to the copy function used to hold the body of
3951 OMP_TASK GS. */
3953 static inline tree *
3954 gimple_omp_task_copy_fn_ptr (gimple gs)
3956 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3957 return &gs->gimple_omp_task.copy_fn;
3961 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
3963 static inline void
3964 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
3966 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3967 gs->gimple_omp_task.copy_fn = copy_fn;
3971 /* Return size of the data block in bytes in OMP_TASK GS. */
3973 static inline tree
3974 gimple_omp_task_arg_size (const_gimple gs)
3976 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3977 return gs->gimple_omp_task.arg_size;
3981 /* Return a pointer to the data block size for OMP_TASK GS. */
3983 static inline tree *
3984 gimple_omp_task_arg_size_ptr (gimple gs)
3986 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3987 return &gs->gimple_omp_task.arg_size;
3991 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
3993 static inline void
3994 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
3996 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3997 gs->gimple_omp_task.arg_size = arg_size;
4001 /* Return align of the data block in bytes in OMP_TASK GS. */
4003 static inline tree
4004 gimple_omp_task_arg_align (const_gimple gs)
4006 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4007 return gs->gimple_omp_task.arg_align;
4011 /* Return a pointer to the data block align for OMP_TASK GS. */
4013 static inline tree *
4014 gimple_omp_task_arg_align_ptr (gimple gs)
4016 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4017 return &gs->gimple_omp_task.arg_align;
4021 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4023 static inline void
4024 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4026 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4027 gs->gimple_omp_task.arg_align = arg_align;
4031 /* Return the clauses associated with OMP_SINGLE GS. */
4033 static inline tree
4034 gimple_omp_single_clauses (const_gimple gs)
4036 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4037 return gs->gimple_omp_single.clauses;
4041 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4043 static inline tree *
4044 gimple_omp_single_clauses_ptr (gimple gs)
4046 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4047 return &gs->gimple_omp_single.clauses;
4051 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4053 static inline void
4054 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4056 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4057 gs->gimple_omp_single.clauses = clauses;
4061 /* Return the clauses associated with OMP_SECTIONS GS. */
4063 static inline tree
4064 gimple_omp_sections_clauses (const_gimple gs)
4066 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4067 return gs->gimple_omp_sections.clauses;
4071 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4073 static inline tree *
4074 gimple_omp_sections_clauses_ptr (gimple gs)
4076 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4077 return &gs->gimple_omp_sections.clauses;
4081 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4082 GS. */
4084 static inline void
4085 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4087 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4088 gs->gimple_omp_sections.clauses = clauses;
4092 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4093 in GS. */
4095 static inline tree
4096 gimple_omp_sections_control (const_gimple gs)
4098 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4099 return gs->gimple_omp_sections.control;
4103 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4104 GS. */
4106 static inline tree *
4107 gimple_omp_sections_control_ptr (gimple gs)
4109 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4110 return &gs->gimple_omp_sections.control;
4114 /* Set CONTROL to be the set of clauses associated with the
4115 GIMPLE_OMP_SECTIONS in GS. */
4117 static inline void
4118 gimple_omp_sections_set_control (gimple gs, tree control)
4120 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4121 gs->gimple_omp_sections.control = control;
4125 /* Set COND to be the condition code for OMP_FOR GS. */
4127 static inline void
4128 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4130 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4131 gcc_assert (TREE_CODE_CLASS (cond) == tcc_comparison);
4132 gcc_assert (i < gs->gimple_omp_for.collapse);
4133 gs->gimple_omp_for.iter[i].cond = cond;
4137 /* Return the condition code associated with OMP_FOR GS. */
4139 static inline enum tree_code
4140 gimple_omp_for_cond (const_gimple gs, size_t i)
4142 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4143 gcc_assert (i < gs->gimple_omp_for.collapse);
4144 return gs->gimple_omp_for.iter[i].cond;
4148 /* Set the value being stored in an atomic store. */
4150 static inline void
4151 gimple_omp_atomic_store_set_val (gimple g, tree val)
4153 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4154 g->gimple_omp_atomic_store.val = val;
4158 /* Return the value being stored in an atomic store. */
4160 static inline tree
4161 gimple_omp_atomic_store_val (const_gimple g)
4163 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4164 return g->gimple_omp_atomic_store.val;
4168 /* Return a pointer to the value being stored in an atomic store. */
4170 static inline tree *
4171 gimple_omp_atomic_store_val_ptr (gimple g)
4173 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4174 return &g->gimple_omp_atomic_store.val;
4178 /* Set the LHS of an atomic load. */
4180 static inline void
4181 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4183 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4184 g->gimple_omp_atomic_load.lhs = lhs;
4188 /* Get the LHS of an atomic load. */
4190 static inline tree
4191 gimple_omp_atomic_load_lhs (const_gimple g)
4193 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4194 return g->gimple_omp_atomic_load.lhs;
4198 /* Return a pointer to the LHS of an atomic load. */
4200 static inline tree *
4201 gimple_omp_atomic_load_lhs_ptr (gimple g)
4203 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4204 return &g->gimple_omp_atomic_load.lhs;
4208 /* Set the RHS of an atomic load. */
4210 static inline void
4211 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4213 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4214 g->gimple_omp_atomic_load.rhs = rhs;
4218 /* Get the RHS of an atomic load. */
4220 static inline tree
4221 gimple_omp_atomic_load_rhs (const_gimple g)
4223 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4224 return g->gimple_omp_atomic_load.rhs;
4228 /* Return a pointer to the RHS of an atomic load. */
4230 static inline tree *
4231 gimple_omp_atomic_load_rhs_ptr (gimple g)
4233 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4234 return &g->gimple_omp_atomic_load.rhs;
4238 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4240 static inline tree
4241 gimple_omp_continue_control_def (const_gimple g)
4243 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4244 return g->gimple_omp_continue.control_def;
4247 /* The same as above, but return the address. */
4249 static inline tree *
4250 gimple_omp_continue_control_def_ptr (gimple g)
4252 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4253 return &g->gimple_omp_continue.control_def;
4256 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4258 static inline void
4259 gimple_omp_continue_set_control_def (gimple g, tree def)
4261 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4262 g->gimple_omp_continue.control_def = def;
4266 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4268 static inline tree
4269 gimple_omp_continue_control_use (const_gimple g)
4271 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4272 return g->gimple_omp_continue.control_use;
4276 /* The same as above, but return the address. */
4278 static inline tree *
4279 gimple_omp_continue_control_use_ptr (gimple g)
4281 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4282 return &g->gimple_omp_continue.control_use;
4286 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4288 static inline void
4289 gimple_omp_continue_set_control_use (gimple g, tree use)
4291 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4292 g->gimple_omp_continue.control_use = use;
4296 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4298 static inline tree *
4299 gimple_return_retval_ptr (const_gimple gs)
4301 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4302 return gimple_op_ptr (gs, 0);
4305 /* Return the return value for GIMPLE_RETURN GS. */
4307 static inline tree
4308 gimple_return_retval (const_gimple gs)
4310 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4311 return gimple_op (gs, 0);
4315 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4317 static inline void
4318 gimple_return_set_retval (gimple gs, tree retval)
4320 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4321 gimple_set_op (gs, 0, retval);
4325 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4327 #define CASE_GIMPLE_OMP \
4328 case GIMPLE_OMP_PARALLEL: \
4329 case GIMPLE_OMP_TASK: \
4330 case GIMPLE_OMP_FOR: \
4331 case GIMPLE_OMP_SECTIONS: \
4332 case GIMPLE_OMP_SECTIONS_SWITCH: \
4333 case GIMPLE_OMP_SINGLE: \
4334 case GIMPLE_OMP_SECTION: \
4335 case GIMPLE_OMP_MASTER: \
4336 case GIMPLE_OMP_ORDERED: \
4337 case GIMPLE_OMP_CRITICAL: \
4338 case GIMPLE_OMP_RETURN: \
4339 case GIMPLE_OMP_ATOMIC_LOAD: \
4340 case GIMPLE_OMP_ATOMIC_STORE: \
4341 case GIMPLE_OMP_CONTINUE
4343 static inline bool
4344 is_gimple_omp (const_gimple stmt)
4346 switch (gimple_code (stmt))
4348 CASE_GIMPLE_OMP:
4349 return true;
4350 default:
4351 return false;
4356 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4358 static inline bool
4359 gimple_nop_p (const_gimple g)
4361 return gimple_code (g) == GIMPLE_NOP;
4365 /* Return true if GS is a GIMPLE_RESX. */
4367 static inline bool
4368 is_gimple_resx (const_gimple gs)
4370 return gimple_code (gs) == GIMPLE_RESX;
4373 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4375 static inline enum br_predictor
4376 gimple_predict_predictor (gimple gs)
4378 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4379 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4383 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4385 static inline void
4386 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4388 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4389 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4390 | (unsigned) predictor;
4394 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4396 static inline enum prediction
4397 gimple_predict_outcome (gimple gs)
4399 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4400 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4404 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4406 static inline void
4407 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4409 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4410 if (outcome == TAKEN)
4411 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4412 else
4413 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4417 /* Return the type of the main expression computed by STMT. Return
4418 void_type_node if the statement computes nothing. */
4420 static inline tree
4421 gimple_expr_type (const_gimple stmt)
4423 enum gimple_code code = gimple_code (stmt);
4425 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4427 tree type;
4428 /* In general we want to pass out a type that can be substituted
4429 for both the RHS and the LHS types if there is a possibly
4430 useless conversion involved. That means returning the
4431 original RHS type as far as we can reconstruct it. */
4432 if (code == GIMPLE_CALL)
4433 type = gimple_call_return_type (stmt);
4434 else
4435 switch (gimple_assign_rhs_code (stmt))
4437 case POINTER_PLUS_EXPR:
4438 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4439 break;
4441 default:
4442 /* As fallback use the type of the LHS. */
4443 type = TREE_TYPE (gimple_get_lhs (stmt));
4444 break;
4446 return type;
4448 else if (code == GIMPLE_COND)
4449 return boolean_type_node;
4450 else
4451 return void_type_node;
4455 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4457 static inline gimple_stmt_iterator
4458 gsi_start (gimple_seq seq)
4460 gimple_stmt_iterator i;
4462 i.ptr = gimple_seq_first (seq);
4463 i.seq = seq;
4464 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4466 return i;
4470 /* Return a new iterator pointing to the first statement in basic block BB. */
4472 static inline gimple_stmt_iterator
4473 gsi_start_bb (basic_block bb)
4475 gimple_stmt_iterator i;
4476 gimple_seq seq;
4478 seq = bb_seq (bb);
4479 i.ptr = gimple_seq_first (seq);
4480 i.seq = seq;
4481 i.bb = bb;
4483 return i;
4487 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4489 static inline gimple_stmt_iterator
4490 gsi_last (gimple_seq seq)
4492 gimple_stmt_iterator i;
4494 i.ptr = gimple_seq_last (seq);
4495 i.seq = seq;
4496 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4498 return i;
4502 /* Return a new iterator pointing to the last statement in basic block BB. */
4504 static inline gimple_stmt_iterator
4505 gsi_last_bb (basic_block bb)
4507 gimple_stmt_iterator i;
4508 gimple_seq seq;
4510 seq = bb_seq (bb);
4511 i.ptr = gimple_seq_last (seq);
4512 i.seq = seq;
4513 i.bb = bb;
4515 return i;
4519 /* Return true if I is at the end of its sequence. */
4521 static inline bool
4522 gsi_end_p (gimple_stmt_iterator i)
4524 return i.ptr == NULL;
4528 /* Return true if I is one statement before the end of its sequence. */
4530 static inline bool
4531 gsi_one_before_end_p (gimple_stmt_iterator i)
4533 return i.ptr != NULL && i.ptr->next == NULL;
4537 /* Advance the iterator to the next gimple statement. */
4539 static inline void
4540 gsi_next (gimple_stmt_iterator *i)
4542 i->ptr = i->ptr->next;
4545 /* Advance the iterator to the previous gimple statement. */
4547 static inline void
4548 gsi_prev (gimple_stmt_iterator *i)
4550 i->ptr = i->ptr->prev;
4553 /* Return the current stmt. */
4555 static inline gimple
4556 gsi_stmt (gimple_stmt_iterator i)
4558 return i.ptr->stmt;
4561 /* Return a block statement iterator that points to the first non-label
4562 statement in block BB. */
4564 static inline gimple_stmt_iterator
4565 gsi_after_labels (basic_block bb)
4567 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4569 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4570 gsi_next (&gsi);
4572 return gsi;
4575 /* Advance the iterator to the next non-debug gimple statement. */
4577 static inline void
4578 gsi_next_nondebug (gimple_stmt_iterator *i)
4582 gsi_next (i);
4584 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4587 /* Advance the iterator to the next non-debug gimple statement. */
4589 static inline void
4590 gsi_prev_nondebug (gimple_stmt_iterator *i)
4594 gsi_prev (i);
4596 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4599 /* Return a new iterator pointing to the first non-debug statement in
4600 basic block BB. */
4602 static inline gimple_stmt_iterator
4603 gsi_start_nondebug_bb (basic_block bb)
4605 gimple_stmt_iterator i = gsi_start_bb (bb);
4607 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4608 gsi_next_nondebug (&i);
4610 return i;
4613 /* Return a new iterator pointing to the last non-debug statement in
4614 basic block BB. */
4616 static inline gimple_stmt_iterator
4617 gsi_last_nondebug_bb (basic_block bb)
4619 gimple_stmt_iterator i = gsi_last_bb (bb);
4621 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4622 gsi_prev_nondebug (&i);
4624 return i;
4627 /* Return a pointer to the current stmt.
4629 NOTE: You may want to use gsi_replace on the iterator itself,
4630 as this performs additional bookkeeping that will not be done
4631 if you simply assign through a pointer returned by gsi_stmt_ptr. */
4633 static inline gimple *
4634 gsi_stmt_ptr (gimple_stmt_iterator *i)
4636 return &i->ptr->stmt;
4640 /* Return the basic block associated with this iterator. */
4642 static inline basic_block
4643 gsi_bb (gimple_stmt_iterator i)
4645 return i.bb;
4649 /* Return the sequence associated with this iterator. */
4651 static inline gimple_seq
4652 gsi_seq (gimple_stmt_iterator i)
4654 return i.seq;
4658 enum gsi_iterator_update
4660 GSI_NEW_STMT, /* Only valid when single statement is added, move
4661 iterator to it. */
4662 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
4663 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
4664 for linking other statements in the same
4665 direction. */
4668 /* In gimple-iterator.c */
4669 gimple_stmt_iterator gsi_start_phis (basic_block);
4670 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
4671 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
4672 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
4673 void gsi_insert_before (gimple_stmt_iterator *, gimple,
4674 enum gsi_iterator_update);
4675 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
4676 enum gsi_iterator_update);
4677 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
4678 enum gsi_iterator_update);
4679 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
4680 enum gsi_iterator_update);
4681 void gsi_insert_after (gimple_stmt_iterator *, gimple,
4682 enum gsi_iterator_update);
4683 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
4684 enum gsi_iterator_update);
4685 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
4686 enum gsi_iterator_update);
4687 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
4688 enum gsi_iterator_update);
4689 void gsi_remove (gimple_stmt_iterator *, bool);
4690 gimple_stmt_iterator gsi_for_stmt (gimple);
4691 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
4692 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
4693 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
4694 void gsi_insert_on_edge (edge, gimple);
4695 void gsi_insert_seq_on_edge (edge, gimple_seq);
4696 basic_block gsi_insert_on_edge_immediate (edge, gimple);
4697 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
4698 void gsi_commit_one_edge_insert (edge, basic_block *);
4699 void gsi_commit_edge_inserts (void);
4700 gimple gimple_call_copy_skip_args (gimple, bitmap);
4703 /* Convenience routines to walk all statements of a gimple function.
4704 Note that this is useful exclusively before the code is converted
4705 into SSA form. Once the program is in SSA form, the standard
4706 operand interface should be used to analyze/modify statements. */
4707 struct walk_stmt_info
4709 /* Points to the current statement being walked. */
4710 gimple_stmt_iterator gsi;
4712 /* Additional data that the callback functions may want to carry
4713 through the recursion. */
4714 void *info;
4716 /* Pointer map used to mark visited tree nodes when calling
4717 walk_tree on each operand. If set to NULL, duplicate tree nodes
4718 will be visited more than once. */
4719 struct pointer_set_t *pset;
4721 /* Indicates whether the operand being examined may be replaced
4722 with something that matches is_gimple_val (if true) or something
4723 slightly more complicated (if false). "Something" technically
4724 means the common subset of is_gimple_lvalue and is_gimple_rhs,
4725 but we never try to form anything more complicated than that, so
4726 we don't bother checking.
4728 Also note that CALLBACK should update this flag while walking the
4729 sub-expressions of a statement. For instance, when walking the
4730 statement 'foo (&var)', the flag VAL_ONLY will initially be set
4731 to true, however, when walking &var, the operand of that
4732 ADDR_EXPR does not need to be a GIMPLE value. */
4733 bool val_only;
4735 /* True if we are currently walking the LHS of an assignment. */
4736 bool is_lhs;
4738 /* Optional. Set to true by the callback functions if they made any
4739 changes. */
4740 bool changed;
4742 /* True if we're interested in location information. */
4743 bool want_locations;
4745 /* Operand returned by the callbacks. This is set when calling
4746 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
4747 returns non-NULL, this field will contain the tree returned by
4748 the last callback. */
4749 tree callback_result;
4752 /* Callback for walk_gimple_stmt. Called for every statement found
4753 during traversal. The first argument points to the statement to
4754 walk. The second argument is a flag that the callback sets to
4755 'true' if it the callback handled all the operands and
4756 sub-statements of the statement (the default value of this flag is
4757 'false'). The third argument is an anonymous pointer to data
4758 to be used by the callback. */
4759 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
4760 struct walk_stmt_info *);
4762 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
4763 struct walk_stmt_info *);
4764 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
4765 struct walk_stmt_info *);
4766 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
4768 #ifdef GATHER_STATISTICS
4769 /* Enum and arrays used for allocation stats. Keep in sync with
4770 gimple.c:gimple_alloc_kind_names. */
4771 enum gimple_alloc_kind
4773 gimple_alloc_kind_assign, /* Assignments. */
4774 gimple_alloc_kind_phi, /* PHI nodes. */
4775 gimple_alloc_kind_cond, /* Conditionals. */
4776 gimple_alloc_kind_seq, /* Sequences. */
4777 gimple_alloc_kind_rest, /* Everything else. */
4778 gimple_alloc_kind_all
4781 extern int gimple_alloc_counts[];
4782 extern int gimple_alloc_sizes[];
4784 /* Return the allocation kind for a given stmt CODE. */
4785 static inline enum gimple_alloc_kind
4786 gimple_alloc_kind (enum gimple_code code)
4788 switch (code)
4790 case GIMPLE_ASSIGN:
4791 return gimple_alloc_kind_assign;
4792 case GIMPLE_PHI:
4793 return gimple_alloc_kind_phi;
4794 case GIMPLE_COND:
4795 return gimple_alloc_kind_cond;
4796 default:
4797 return gimple_alloc_kind_rest;
4800 #endif /* GATHER_STATISTICS */
4802 extern void dump_gimple_statistics (void);
4804 /* In gimple-fold.c. */
4805 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
4806 tree gimple_fold_builtin (gimple);
4807 bool fold_stmt (gimple_stmt_iterator *);
4808 bool fold_stmt_inplace (gimple);
4809 tree maybe_fold_offset_to_reference (location_t, tree, tree, tree);
4810 tree maybe_fold_offset_to_address (location_t, tree, tree, tree);
4811 tree maybe_fold_stmt_addition (location_t, tree, tree, tree);
4812 tree get_symbol_constant_value (tree);
4813 bool may_propagate_address_into_dereference (tree, tree);
4816 #endif /* GCC_GIMPLE_H */