2009-10-11 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / gimple.h
blob3998bdfe03e8c8d1e5502b933b127e1a2059c273
1 /* Gimple IR definitions.
3 Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "pointer-set.h"
26 #include "vec.h"
27 #include "ggc.h"
28 #include "tm.h"
29 #include "hard-reg-set.h"
30 #include "basic-block.h"
31 #include "tree-ssa-operands.h"
33 DEF_VEC_P(gimple);
34 DEF_VEC_ALLOC_P(gimple,heap);
35 DEF_VEC_ALLOC_P(gimple,gc);
37 typedef gimple *gimple_p;
38 DEF_VEC_P(gimple_p);
39 DEF_VEC_ALLOC_P(gimple_p,heap);
41 DEF_VEC_P(gimple_seq);
42 DEF_VEC_ALLOC_P(gimple_seq,gc);
43 DEF_VEC_ALLOC_P(gimple_seq,heap);
45 /* For each block, the PHI nodes that need to be rewritten are stored into
46 these vectors. */
47 typedef VEC(gimple, heap) *gimple_vec;
48 DEF_VEC_P (gimple_vec);
49 DEF_VEC_ALLOC_P (gimple_vec, heap);
51 enum gimple_code {
52 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
53 #include "gimple.def"
54 #undef DEFGSCODE
55 LAST_AND_UNUSED_GIMPLE_CODE
58 extern const char *const gimple_code_name[];
59 extern const unsigned char gimple_rhs_class_table[];
61 /* Error out if a gimple tuple is addressed incorrectly. */
62 #if defined ENABLE_GIMPLE_CHECKING
63 extern void gimple_check_failed (const_gimple, const char *, int, \
64 const char *, enum gimple_code, \
65 enum tree_code) ATTRIBUTE_NORETURN;
67 #define GIMPLE_CHECK(GS, CODE) \
68 do { \
69 const_gimple __gs = (GS); \
70 if (gimple_code (__gs) != (CODE)) \
71 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
72 (CODE), ERROR_MARK); \
73 } while (0)
74 #else /* not ENABLE_GIMPLE_CHECKING */
75 #define GIMPLE_CHECK(GS, CODE) (void)0
76 #endif
78 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
79 get_gimple_rhs_class. */
80 enum gimple_rhs_class
82 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
83 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
84 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
85 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
86 name, a _DECL, a _REF, etc. */
89 /* Specific flags for individual GIMPLE statements. These flags are
90 always stored in gimple_statement_base.subcode and they may only be
91 defined for statement codes that do not use sub-codes.
93 Values for the masks can overlap as long as the overlapping values
94 are never used in the same statement class.
96 The maximum mask value that can be defined is 1 << 15 (i.e., each
97 statement code can hold up to 16 bitflags).
99 Keep this list sorted. */
100 enum gf_mask {
101 GF_ASM_INPUT = 1 << 0,
102 GF_ASM_VOLATILE = 1 << 1,
103 GF_CALL_CANNOT_INLINE = 1 << 0,
104 GF_CALL_FROM_THUNK = 1 << 1,
105 GF_CALL_RETURN_SLOT_OPT = 1 << 2,
106 GF_CALL_TAILCALL = 1 << 3,
107 GF_CALL_VA_ARG_PACK = 1 << 4,
108 GF_OMP_PARALLEL_COMBINED = 1 << 0,
110 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
111 a thread synchronization via some sort of barrier. The exact barrier
112 that would otherwise be emitted is dependent on the OMP statement with
113 which this return is associated. */
114 GF_OMP_RETURN_NOWAIT = 1 << 0,
116 GF_OMP_SECTION_LAST = 1 << 0,
117 GF_PREDICT_TAKEN = 1 << 15
120 /* Currently, there's only one type of gimple debug stmt. Others are
121 envisioned, for example, to enable the generation of is_stmt notes
122 in line number information, to mark sequence points, etc. This
123 subcode is to be used to tell them apart. */
124 enum gimple_debug_subcode {
125 GIMPLE_DEBUG_BIND = 0
128 /* Masks for selecting a pass local flag (PLF) to work on. These
129 masks are used by gimple_set_plf and gimple_plf. */
130 enum plf_mask {
131 GF_PLF_1 = 1 << 0,
132 GF_PLF_2 = 1 << 1
135 /* A node in a gimple_seq_d. */
136 struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) gimple_seq_node_d {
137 gimple stmt;
138 struct gimple_seq_node_d *prev;
139 struct gimple_seq_node_d *next;
142 /* A double-linked sequence of gimple statements. */
143 struct GTY ((chain_next ("%h.next_free"))) gimple_seq_d {
144 /* First and last statements in the sequence. */
145 gimple_seq_node first;
146 gimple_seq_node last;
148 /* Sequences are created/destroyed frequently. To minimize
149 allocation activity, deallocated sequences are kept in a pool of
150 available sequences. This is the pointer to the next free
151 sequence in the pool. */
152 gimple_seq next_free;
156 /* Return the first node in GIMPLE sequence S. */
158 static inline gimple_seq_node
159 gimple_seq_first (const_gimple_seq s)
161 return s ? s->first : NULL;
165 /* Return the first statement in GIMPLE sequence S. */
167 static inline gimple
168 gimple_seq_first_stmt (const_gimple_seq s)
170 gimple_seq_node n = gimple_seq_first (s);
171 return (n) ? n->stmt : NULL;
175 /* Return the last node in GIMPLE sequence S. */
177 static inline gimple_seq_node
178 gimple_seq_last (const_gimple_seq s)
180 return s ? s->last : NULL;
184 /* Return the last statement in GIMPLE sequence S. */
186 static inline gimple
187 gimple_seq_last_stmt (const_gimple_seq s)
189 gimple_seq_node n = gimple_seq_last (s);
190 return (n) ? n->stmt : NULL;
194 /* Set the last node in GIMPLE sequence S to LAST. */
196 static inline void
197 gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
199 s->last = last;
203 /* Set the first node in GIMPLE sequence S to FIRST. */
205 static inline void
206 gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
208 s->first = first;
212 /* Return true if GIMPLE sequence S is empty. */
214 static inline bool
215 gimple_seq_empty_p (const_gimple_seq s)
217 return s == NULL || s->first == NULL;
221 void gimple_seq_add_stmt (gimple_seq *, gimple);
223 /* Allocate a new sequence and initialize its first element with STMT. */
225 static inline gimple_seq
226 gimple_seq_alloc_with_stmt (gimple stmt)
228 gimple_seq seq = NULL;
229 gimple_seq_add_stmt (&seq, stmt);
230 return seq;
234 /* Returns the sequence of statements in BB. */
236 static inline gimple_seq
237 bb_seq (const_basic_block bb)
239 return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
243 /* Sets the sequence of statements in BB to SEQ. */
245 static inline void
246 set_bb_seq (basic_block bb, gimple_seq seq)
248 gcc_assert (!(bb->flags & BB_RTL));
249 bb->il.gimple->seq = seq;
252 /* Iterator object for GIMPLE statement sequences. */
254 typedef struct
256 /* Sequence node holding the current statement. */
257 gimple_seq_node ptr;
259 /* Sequence and basic block holding the statement. These fields
260 are necessary to handle edge cases such as when statement is
261 added to an empty basic block or when the last statement of a
262 block/sequence is removed. */
263 gimple_seq seq;
264 basic_block bb;
265 } gimple_stmt_iterator;
268 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
269 are for 64 bit hosts. */
271 struct GTY(()) gimple_statement_base {
272 /* [ WORD 1 ]
273 Main identifying code for a tuple. */
274 ENUM_BITFIELD(gimple_code) code : 8;
276 /* Nonzero if a warning should not be emitted on this tuple. */
277 unsigned int no_warning : 1;
279 /* Nonzero if this tuple has been visited. Passes are responsible
280 for clearing this bit before using it. */
281 unsigned int visited : 1;
283 /* Nonzero if this tuple represents a non-temporal move. */
284 unsigned int nontemporal_move : 1;
286 /* Pass local flags. These flags are free for any pass to use as
287 they see fit. Passes should not assume that these flags contain
288 any useful value when the pass starts. Any initial state that
289 the pass requires should be set on entry to the pass. See
290 gimple_set_plf and gimple_plf for usage. */
291 unsigned int plf : 2;
293 /* Nonzero if this statement has been modified and needs to have its
294 operands rescanned. */
295 unsigned modified : 1;
297 /* Nonzero if this statement contains volatile operands. */
298 unsigned has_volatile_ops : 1;
300 /* Padding to get subcode to 16 bit alignment. */
301 unsigned pad : 1;
303 /* The SUBCODE field can be used for tuple-specific flags for tuples
304 that do not require subcodes. Note that SUBCODE should be at
305 least as wide as tree codes, as several tuples store tree codes
306 in there. */
307 unsigned int subcode : 16;
309 /* UID of this statement. This is used by passes that want to
310 assign IDs to statements. It must be assigned and used by each
311 pass. By default it should be assumed to contain garbage. */
312 unsigned uid;
314 /* [ WORD 2 ]
315 Locus information for debug info. */
316 location_t location;
318 /* Number of operands in this tuple. */
319 unsigned num_ops;
321 /* [ WORD 3 ]
322 Basic block holding this statement. */
323 struct basic_block_def *bb;
325 /* [ WORD 4 ]
326 Lexical block holding this statement. */
327 tree block;
331 /* Base structure for tuples with operands. */
333 struct GTY(()) gimple_statement_with_ops_base
335 /* [ WORD 1-4 ] */
336 struct gimple_statement_base gsbase;
338 /* [ WORD 5-6 ]
339 SSA operand vectors. NOTE: It should be possible to
340 amalgamate these vectors with the operand vector OP. However,
341 the SSA operand vectors are organized differently and contain
342 more information (like immediate use chaining). */
343 struct def_optype_d GTY((skip (""))) *def_ops;
344 struct use_optype_d GTY((skip (""))) *use_ops;
348 /* Statements that take register operands. */
350 struct GTY(()) gimple_statement_with_ops
352 /* [ WORD 1-6 ] */
353 struct gimple_statement_with_ops_base opbase;
355 /* [ WORD 7 ]
356 Operand vector. NOTE! This must always be the last field
357 of this structure. In particular, this means that this
358 structure cannot be embedded inside another one. */
359 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
363 /* Base for statements that take both memory and register operands. */
365 struct GTY(()) gimple_statement_with_memory_ops_base
367 /* [ WORD 1-6 ] */
368 struct gimple_statement_with_ops_base opbase;
370 /* [ WORD 7-8 ]
371 Virtual operands for this statement. The GC will pick them
372 up via the ssa_names array. */
373 tree GTY((skip (""))) vdef;
374 tree GTY((skip (""))) vuse;
378 /* Statements that take both memory and register operands. */
380 struct GTY(()) gimple_statement_with_memory_ops
382 /* [ WORD 1-8 ] */
383 struct gimple_statement_with_memory_ops_base membase;
385 /* [ WORD 9 ]
386 Operand vector. NOTE! This must always be the last field
387 of this structure. In particular, this means that this
388 structure cannot be embedded inside another one. */
389 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
393 /* OpenMP statements (#pragma omp). */
395 struct GTY(()) gimple_statement_omp {
396 /* [ WORD 1-4 ] */
397 struct gimple_statement_base gsbase;
399 /* [ WORD 5 ] */
400 gimple_seq body;
404 /* GIMPLE_BIND */
406 struct GTY(()) gimple_statement_bind {
407 /* [ WORD 1-4 ] */
408 struct gimple_statement_base gsbase;
410 /* [ WORD 5 ]
411 Variables declared in this scope. */
412 tree vars;
414 /* [ WORD 6 ]
415 This is different than the BLOCK field in gimple_statement_base,
416 which is analogous to TREE_BLOCK (i.e., the lexical block holding
417 this statement). This field is the equivalent of BIND_EXPR_BLOCK
418 in tree land (i.e., the lexical scope defined by this bind). See
419 gimple-low.c. */
420 tree block;
422 /* [ WORD 7 ] */
423 gimple_seq body;
427 /* GIMPLE_CATCH */
429 struct GTY(()) gimple_statement_catch {
430 /* [ WORD 1-4 ] */
431 struct gimple_statement_base gsbase;
433 /* [ WORD 5 ] */
434 tree types;
436 /* [ WORD 6 ] */
437 gimple_seq handler;
441 /* GIMPLE_EH_FILTER */
443 struct GTY(()) gimple_statement_eh_filter {
444 /* [ WORD 1-4 ] */
445 struct gimple_statement_base gsbase;
447 /* [ WORD 5 ]
448 Filter types. */
449 tree types;
451 /* [ WORD 6 ]
452 Failure actions. */
453 gimple_seq failure;
457 /* GIMPLE_EH_MUST_NOT_THROW */
459 struct GTY(()) gimple_statement_eh_mnt {
460 /* [ WORD 1-4 ] */
461 struct gimple_statement_base gsbase;
463 /* [ WORD 5 ] Abort function decl. */
464 tree fndecl;
467 /* GIMPLE_PHI */
469 struct GTY(()) gimple_statement_phi {
470 /* [ WORD 1-4 ] */
471 struct gimple_statement_base gsbase;
473 /* [ WORD 5 ] */
474 unsigned capacity;
475 unsigned nargs;
477 /* [ WORD 6 ] */
478 tree result;
480 /* [ WORD 7 ] */
481 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
485 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
487 struct GTY(()) gimple_statement_eh_ctrl
489 /* [ WORD 1-4 ] */
490 struct gimple_statement_base gsbase;
492 /* [ WORD 5 ]
493 Exception region number. */
494 int region;
498 /* GIMPLE_TRY */
500 struct GTY(()) gimple_statement_try {
501 /* [ WORD 1-4 ] */
502 struct gimple_statement_base gsbase;
504 /* [ WORD 5 ]
505 Expression to evaluate. */
506 gimple_seq eval;
508 /* [ WORD 6 ]
509 Cleanup expression. */
510 gimple_seq cleanup;
513 /* Kind of GIMPLE_TRY statements. */
514 enum gimple_try_flags
516 /* A try/catch. */
517 GIMPLE_TRY_CATCH = 1 << 0,
519 /* A try/finally. */
520 GIMPLE_TRY_FINALLY = 1 << 1,
521 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
523 /* Analogous to TRY_CATCH_IS_CLEANUP. */
524 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
527 /* GIMPLE_WITH_CLEANUP_EXPR */
529 struct GTY(()) gimple_statement_wce {
530 /* [ WORD 1-4 ] */
531 struct gimple_statement_base gsbase;
533 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
534 executed if an exception is thrown, not on normal exit of its
535 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
536 in TARGET_EXPRs. */
538 /* [ WORD 5 ]
539 Cleanup expression. */
540 gimple_seq cleanup;
544 /* GIMPLE_ASM */
546 struct GTY(()) gimple_statement_asm
548 /* [ WORD 1-8 ] */
549 struct gimple_statement_with_memory_ops_base membase;
551 /* [ WORD 9 ]
552 __asm__ statement. */
553 const char *string;
555 /* [ WORD 10 ]
556 Number of inputs, outputs, clobbers, labels. */
557 unsigned char ni;
558 unsigned char no;
559 unsigned char nc;
560 unsigned char nl;
562 /* [ WORD 11 ]
563 Operand vector. NOTE! This must always be the last field
564 of this structure. In particular, this means that this
565 structure cannot be embedded inside another one. */
566 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
569 /* GIMPLE_OMP_CRITICAL */
571 struct GTY(()) gimple_statement_omp_critical {
572 /* [ WORD 1-5 ] */
573 struct gimple_statement_omp omp;
575 /* [ WORD 6 ]
576 Critical section name. */
577 tree name;
581 struct GTY(()) gimple_omp_for_iter {
582 /* Condition code. */
583 enum tree_code cond;
585 /* Index variable. */
586 tree index;
588 /* Initial value. */
589 tree initial;
591 /* Final value. */
592 tree final;
594 /* Increment. */
595 tree incr;
598 /* GIMPLE_OMP_FOR */
600 struct GTY(()) gimple_statement_omp_for {
601 /* [ WORD 1-5 ] */
602 struct gimple_statement_omp omp;
604 /* [ WORD 6 ] */
605 tree clauses;
607 /* [ WORD 7 ]
608 Number of elements in iter array. */
609 size_t collapse;
611 /* [ WORD 8 ] */
612 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
614 /* [ WORD 9 ]
615 Pre-body evaluated before the loop body begins. */
616 gimple_seq pre_body;
620 /* GIMPLE_OMP_PARALLEL */
622 struct GTY(()) gimple_statement_omp_parallel {
623 /* [ WORD 1-5 ] */
624 struct gimple_statement_omp omp;
626 /* [ WORD 6 ]
627 Clauses. */
628 tree clauses;
630 /* [ WORD 7 ]
631 Child function holding the body of the parallel region. */
632 tree child_fn;
634 /* [ WORD 8 ]
635 Shared data argument. */
636 tree data_arg;
640 /* GIMPLE_OMP_TASK */
642 struct GTY(()) gimple_statement_omp_task {
643 /* [ WORD 1-8 ] */
644 struct gimple_statement_omp_parallel par;
646 /* [ WORD 9 ]
647 Child function holding firstprivate initialization if needed. */
648 tree copy_fn;
650 /* [ WORD 10-11 ]
651 Size and alignment in bytes of the argument data block. */
652 tree arg_size;
653 tree arg_align;
657 /* GIMPLE_OMP_SECTION */
658 /* Uses struct gimple_statement_omp. */
661 /* GIMPLE_OMP_SECTIONS */
663 struct GTY(()) gimple_statement_omp_sections {
664 /* [ WORD 1-5 ] */
665 struct gimple_statement_omp omp;
667 /* [ WORD 6 ] */
668 tree clauses;
670 /* [ WORD 7 ]
671 The control variable used for deciding which of the sections to
672 execute. */
673 tree control;
676 /* GIMPLE_OMP_CONTINUE.
678 Note: This does not inherit from gimple_statement_omp, because we
679 do not need the body field. */
681 struct GTY(()) gimple_statement_omp_continue {
682 /* [ WORD 1-4 ] */
683 struct gimple_statement_base gsbase;
685 /* [ WORD 5 ] */
686 tree control_def;
688 /* [ WORD 6 ] */
689 tree control_use;
692 /* GIMPLE_OMP_SINGLE */
694 struct GTY(()) gimple_statement_omp_single {
695 /* [ WORD 1-5 ] */
696 struct gimple_statement_omp omp;
698 /* [ WORD 6 ] */
699 tree clauses;
703 /* GIMPLE_OMP_ATOMIC_LOAD.
704 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
705 contains a sequence, which we don't need here. */
707 struct GTY(()) gimple_statement_omp_atomic_load {
708 /* [ WORD 1-4 ] */
709 struct gimple_statement_base gsbase;
711 /* [ WORD 5-6 ] */
712 tree rhs, lhs;
715 /* GIMPLE_OMP_ATOMIC_STORE.
716 See note on GIMPLE_OMP_ATOMIC_LOAD. */
718 struct GTY(()) gimple_statement_omp_atomic_store {
719 /* [ WORD 1-4 ] */
720 struct gimple_statement_base gsbase;
722 /* [ WORD 5 ] */
723 tree val;
726 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
727 enum gimple_statement_structure_enum {
728 #include "gsstruct.def"
729 LAST_GSS_ENUM
731 #undef DEFGSSTRUCT
734 /* Define the overall contents of a gimple tuple. It may be any of the
735 structures declared above for various types of tuples. */
737 union GTY ((desc ("gimple_statement_structure (&%h)"))) gimple_statement_d {
738 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
739 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
740 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
741 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
742 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
743 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
744 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
745 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
746 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
747 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
748 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
749 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
750 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
751 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
752 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
753 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
754 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
755 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
756 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
757 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
758 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
759 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
762 /* In gimple.c. */
764 /* Offset in bytes to the location of the operand vector.
765 Zero if there is no operand vector for this tuple structure. */
766 extern size_t const gimple_ops_offset_[];
768 /* Map GIMPLE codes to GSS codes. */
769 extern enum gimple_statement_structure_enum const gss_for_code_[];
771 gimple gimple_build_return (tree);
773 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
774 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
776 void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *);
778 gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
779 tree MEM_STAT_DECL);
780 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
781 gimple_build_assign_with_ops_stat (c, o1, o2, o3 MEM_STAT_INFO)
783 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
784 #define gimple_build_debug_bind(var,val,stmt) \
785 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
787 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
788 gimple gimple_build_call (tree, unsigned, ...);
789 gimple gimple_build_call_from_tree (tree);
790 gimple gimplify_assign (tree, tree, gimple_seq *);
791 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
792 gimple gimple_build_label (tree label);
793 gimple gimple_build_goto (tree dest);
794 gimple gimple_build_nop (void);
795 gimple gimple_build_bind (tree, gimple_seq, tree);
796 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
797 VEC(tree,gc) *, VEC(tree,gc) *);
798 gimple gimple_build_catch (tree, gimple_seq);
799 gimple gimple_build_eh_filter (tree, gimple_seq);
800 gimple gimple_build_eh_must_not_throw (tree);
801 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
802 gimple gimple_build_wce (gimple_seq);
803 gimple gimple_build_resx (int);
804 gimple gimple_build_eh_dispatch (int);
805 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
806 gimple gimple_build_switch (unsigned, tree, tree, ...);
807 gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
808 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
809 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
810 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
811 gimple gimple_build_omp_critical (gimple_seq, tree);
812 gimple gimple_build_omp_section (gimple_seq);
813 gimple gimple_build_omp_continue (tree, tree);
814 gimple gimple_build_omp_master (gimple_seq);
815 gimple gimple_build_omp_return (bool);
816 gimple gimple_build_omp_ordered (gimple_seq);
817 gimple gimple_build_omp_sections (gimple_seq, tree);
818 gimple gimple_build_omp_sections_switch (void);
819 gimple gimple_build_omp_single (gimple_seq, tree);
820 gimple gimple_build_cdt (tree, tree);
821 gimple gimple_build_omp_atomic_load (tree, tree);
822 gimple gimple_build_omp_atomic_store (tree);
823 gimple gimple_build_predict (enum br_predictor, enum prediction);
824 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
825 void sort_case_labels (VEC(tree,heap) *);
826 void gimple_set_body (tree, gimple_seq);
827 gimple_seq gimple_body (tree);
828 bool gimple_has_body_p (tree);
829 gimple_seq gimple_seq_alloc (void);
830 void gimple_seq_free (gimple_seq);
831 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
832 gimple_seq gimple_seq_copy (gimple_seq);
833 int gimple_call_flags (const_gimple);
834 bool gimple_assign_copy_p (gimple);
835 bool gimple_assign_ssa_name_copy_p (gimple);
836 bool gimple_assign_single_p (gimple);
837 bool gimple_assign_unary_nop_p (gimple);
838 void gimple_set_bb (gimple, struct basic_block_def *);
839 tree gimple_fold (const_gimple);
840 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
841 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
842 tree, tree);
843 tree gimple_get_lhs (const_gimple);
844 void gimple_set_lhs (gimple, tree);
845 gimple gimple_copy (gimple);
846 bool is_gimple_operand (const_tree);
847 void gimple_set_modified (gimple, bool);
848 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
849 gimple gimple_build_cond_from_tree (tree, tree, tree);
850 void gimple_cond_set_condition_from_tree (gimple, tree);
851 bool gimple_has_side_effects (const_gimple);
852 bool gimple_rhs_has_side_effects (const_gimple);
853 bool gimple_could_trap_p (gimple);
854 bool gimple_assign_rhs_could_trap_p (gimple);
855 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
856 bool empty_body_p (gimple_seq);
857 unsigned get_gimple_rhs_num_ops (enum tree_code);
858 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
859 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
860 const char *gimple_decl_printable_name (tree, int);
861 tree gimple_fold_obj_type_ref (tree, tree);
863 /* Returns true iff T is a valid GIMPLE statement. */
864 extern bool is_gimple_stmt (tree);
866 /* Returns true iff TYPE is a valid type for a scalar register variable. */
867 extern bool is_gimple_reg_type (tree);
868 /* Returns true iff T is a scalar register variable. */
869 extern bool is_gimple_reg (tree);
870 /* Returns true iff T is any sort of variable. */
871 extern bool is_gimple_variable (tree);
872 /* Returns true iff T is any sort of symbol. */
873 extern bool is_gimple_id (tree);
874 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
875 extern bool is_gimple_min_lval (tree);
876 /* Returns true iff T is something whose address can be taken. */
877 extern bool is_gimple_addressable (tree);
878 /* Returns true iff T is any valid GIMPLE lvalue. */
879 extern bool is_gimple_lvalue (tree);
881 /* Returns true iff T is a GIMPLE address. */
882 bool is_gimple_address (const_tree);
883 /* Returns true iff T is a GIMPLE invariant address. */
884 bool is_gimple_invariant_address (const_tree);
885 /* Returns true iff T is a GIMPLE invariant address at interprocedural
886 level. */
887 bool is_gimple_ip_invariant_address (const_tree);
888 /* Returns true iff T is a valid GIMPLE constant. */
889 bool is_gimple_constant (const_tree);
890 /* Returns true iff T is a GIMPLE restricted function invariant. */
891 extern bool is_gimple_min_invariant (const_tree);
892 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
893 extern bool is_gimple_ip_invariant (const_tree);
894 /* Returns true iff T is a GIMPLE rvalue. */
895 extern bool is_gimple_val (tree);
896 /* Returns true iff T is a GIMPLE asm statement input. */
897 extern bool is_gimple_asm_val (tree);
898 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
899 GIMPLE temporary, a renamed user variable, or something else,
900 respectively. */
901 extern bool is_gimple_reg_rhs (tree);
902 extern bool is_gimple_mem_rhs (tree);
904 /* Returns true iff T is a valid if-statement condition. */
905 extern bool is_gimple_condexpr (tree);
907 /* Returns true iff T is a type conversion. */
908 extern bool is_gimple_cast (tree);
909 /* Returns true iff T is a variable that does not need to live in memory. */
910 extern bool is_gimple_non_addressable (tree t);
912 /* Returns true iff T is a valid call address expression. */
913 extern bool is_gimple_call_addr (tree);
914 /* If T makes a function call, returns the CALL_EXPR operand. */
915 extern tree get_call_expr_in (tree t);
917 extern void recalculate_side_effects (tree);
918 extern void gimple_force_type_merge (tree, tree);
919 extern int gimple_types_compatible_p (tree, tree);
920 extern tree gimple_register_type (tree);
921 extern void print_gimple_types_stats (void);
922 extern void free_gimple_type_tables (void);
923 extern tree gimple_unsigned_type (tree);
924 extern tree gimple_signed_type (tree);
925 extern alias_set_type gimple_get_alias_set (tree);
926 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
927 unsigned *);
928 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
929 bool (*)(gimple, tree, void *),
930 bool (*)(gimple, tree, void *),
931 bool (*)(gimple, tree, void *));
932 extern bool walk_stmt_load_store_ops (gimple, void *,
933 bool (*)(gimple, tree, void *),
934 bool (*)(gimple, tree, void *));
935 extern bool gimple_ior_addresses_taken (bitmap, gimple);
937 /* In gimplify.c */
938 extern tree create_tmp_var_raw (tree, const char *);
939 extern tree create_tmp_var_name (const char *);
940 extern tree create_tmp_var (tree, const char *);
941 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
942 extern tree get_formal_tmp_var (tree, gimple_seq *);
943 extern void declare_vars (tree, gimple, bool);
944 extern void tree_annotate_all_with_location (tree *, location_t);
945 extern void annotate_all_with_location (gimple_seq, location_t);
947 /* Validation of GIMPLE expressions. Note that these predicates only check
948 the basic form of the expression, they don't recurse to make sure that
949 underlying nodes are also of the right form. */
950 typedef bool (*gimple_predicate)(tree);
953 /* FIXME we should deduce this from the predicate. */
954 enum fallback {
955 fb_none = 0, /* Do not generate a temporary. */
957 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
958 gimplified expression. */
960 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
961 gimplified expression. */
963 fb_mayfail = 4, /* Gimplification may fail. Error issued
964 afterwards. */
965 fb_either= fb_rvalue | fb_lvalue
968 typedef int fallback_t;
970 enum gimplify_status {
971 GS_ERROR = -2, /* Something Bad Seen. */
972 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
973 GS_OK = 0, /* We did something, maybe more to do. */
974 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
977 struct gimplify_ctx
979 struct gimplify_ctx *prev_context;
981 VEC(gimple,heap) *bind_expr_stack;
982 tree temps;
983 gimple_seq conditional_cleanups;
984 tree exit_label;
985 tree return_temp;
987 VEC(tree,heap) *case_labels;
988 /* The formal temporary table. Should this be persistent? */
989 htab_t temp_htab;
991 int conditions;
992 bool save_stack;
993 bool into_ssa;
994 bool allow_rhs_cond_expr;
997 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
998 bool (*) (tree), fallback_t);
999 extern void gimplify_type_sizes (tree, gimple_seq *);
1000 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1001 extern bool gimplify_stmt (tree *, gimple_seq *);
1002 extern gimple gimplify_body (tree *, tree, bool);
1003 extern void push_gimplify_context (struct gimplify_ctx *);
1004 extern void pop_gimplify_context (gimple);
1005 extern void gimplify_and_add (tree, gimple_seq *);
1007 /* Miscellaneous helpers. */
1008 extern void gimple_add_tmp_var (tree);
1009 extern gimple gimple_current_bind_expr (void);
1010 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1011 extern tree voidify_wrapper_expr (tree, tree);
1012 extern tree build_and_jump (tree *);
1013 extern tree alloc_stmt_list (void);
1014 extern void free_stmt_list (tree);
1015 extern tree force_labels_r (tree *, int *, void *);
1016 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1017 gimple_seq *);
1018 struct gimplify_omp_ctx;
1019 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1020 extern tree gimple_boolify (tree);
1021 extern gimple_predicate rhs_predicate_for (tree);
1022 extern tree canonicalize_cond_expr_cond (tree);
1024 /* In omp-low.c. */
1025 extern tree omp_reduction_init (tree, tree);
1027 /* In tree-nested.c. */
1028 extern void lower_nested_functions (tree);
1029 extern void insert_field_into_struct (tree, tree);
1031 /* In gimplify.c. */
1032 extern void gimplify_function_tree (tree);
1034 /* In cfgexpand.c. */
1035 extern tree gimple_assign_rhs_to_tree (gimple);
1037 /* In builtins.c */
1038 extern bool validate_gimple_arglist (const_gimple, ...);
1040 /* In tree-ssa.c */
1041 extern bool tree_ssa_useless_type_conversion (tree);
1042 extern tree tree_ssa_strip_useless_type_conversions (tree);
1043 extern bool useless_type_conversion_p (tree, tree);
1044 extern bool types_compatible_p (tree, tree);
1046 /* Return the code for GIMPLE statement G. */
1048 static inline enum gimple_code
1049 gimple_code (const_gimple g)
1051 return g->gsbase.code;
1055 /* Return the GSS code used by a GIMPLE code. */
1057 static inline enum gimple_statement_structure_enum
1058 gss_for_code (enum gimple_code code)
1060 gcc_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1061 return gss_for_code_[code];
1065 /* Return which GSS code is used by GS. */
1067 static inline enum gimple_statement_structure_enum
1068 gimple_statement_structure (gimple gs)
1070 return gss_for_code (gimple_code (gs));
1074 /* Return true if statement G has sub-statements. This is only true for
1075 High GIMPLE statements. */
1077 static inline bool
1078 gimple_has_substatements (gimple g)
1080 switch (gimple_code (g))
1082 case GIMPLE_BIND:
1083 case GIMPLE_CATCH:
1084 case GIMPLE_EH_FILTER:
1085 case GIMPLE_TRY:
1086 case GIMPLE_OMP_FOR:
1087 case GIMPLE_OMP_MASTER:
1088 case GIMPLE_OMP_ORDERED:
1089 case GIMPLE_OMP_SECTION:
1090 case GIMPLE_OMP_PARALLEL:
1091 case GIMPLE_OMP_TASK:
1092 case GIMPLE_OMP_SECTIONS:
1093 case GIMPLE_OMP_SINGLE:
1094 case GIMPLE_OMP_CRITICAL:
1095 case GIMPLE_WITH_CLEANUP_EXPR:
1096 return true;
1098 default:
1099 return false;
1104 /* Return the basic block holding statement G. */
1106 static inline struct basic_block_def *
1107 gimple_bb (const_gimple g)
1109 return g->gsbase.bb;
1113 /* Return the lexical scope block holding statement G. */
1115 static inline tree
1116 gimple_block (const_gimple g)
1118 return g->gsbase.block;
1122 /* Set BLOCK to be the lexical scope block holding statement G. */
1124 static inline void
1125 gimple_set_block (gimple g, tree block)
1127 g->gsbase.block = block;
1131 /* Return location information for statement G. */
1133 static inline location_t
1134 gimple_location (const_gimple g)
1136 return g->gsbase.location;
1139 /* Return pointer to location information for statement G. */
1141 static inline const location_t *
1142 gimple_location_ptr (const_gimple g)
1144 return &g->gsbase.location;
1148 /* Set location information for statement G. */
1150 static inline void
1151 gimple_set_location (gimple g, location_t location)
1153 g->gsbase.location = location;
1157 /* Return true if G contains location information. */
1159 static inline bool
1160 gimple_has_location (const_gimple g)
1162 return gimple_location (g) != UNKNOWN_LOCATION;
1166 /* Return the file name of the location of STMT. */
1168 static inline const char *
1169 gimple_filename (const_gimple stmt)
1171 return LOCATION_FILE (gimple_location (stmt));
1175 /* Return the line number of the location of STMT. */
1177 static inline int
1178 gimple_lineno (const_gimple stmt)
1180 return LOCATION_LINE (gimple_location (stmt));
1184 /* Determine whether SEQ is a singleton. */
1186 static inline bool
1187 gimple_seq_singleton_p (gimple_seq seq)
1189 return ((gimple_seq_first (seq) != NULL)
1190 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1193 /* Return true if no warnings should be emitted for statement STMT. */
1195 static inline bool
1196 gimple_no_warning_p (const_gimple stmt)
1198 return stmt->gsbase.no_warning;
1201 /* Set the no_warning flag of STMT to NO_WARNING. */
1203 static inline void
1204 gimple_set_no_warning (gimple stmt, bool no_warning)
1206 stmt->gsbase.no_warning = (unsigned) no_warning;
1209 /* Set the visited status on statement STMT to VISITED_P. */
1211 static inline void
1212 gimple_set_visited (gimple stmt, bool visited_p)
1214 stmt->gsbase.visited = (unsigned) visited_p;
1218 /* Return the visited status for statement STMT. */
1220 static inline bool
1221 gimple_visited_p (gimple stmt)
1223 return stmt->gsbase.visited;
1227 /* Set pass local flag PLF on statement STMT to VAL_P. */
1229 static inline void
1230 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1232 if (val_p)
1233 stmt->gsbase.plf |= (unsigned int) plf;
1234 else
1235 stmt->gsbase.plf &= ~((unsigned int) plf);
1239 /* Return the value of pass local flag PLF on statement STMT. */
1241 static inline unsigned int
1242 gimple_plf (gimple stmt, enum plf_mask plf)
1244 return stmt->gsbase.plf & ((unsigned int) plf);
1248 /* Set the UID of statement. */
1250 static inline void
1251 gimple_set_uid (gimple g, unsigned uid)
1253 g->gsbase.uid = uid;
1257 /* Return the UID of statement. */
1259 static inline unsigned
1260 gimple_uid (const_gimple g)
1262 return g->gsbase.uid;
1266 /* Return true if GIMPLE statement G has register or memory operands. */
1268 static inline bool
1269 gimple_has_ops (const_gimple g)
1271 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1275 /* Return true if GIMPLE statement G has memory operands. */
1277 static inline bool
1278 gimple_has_mem_ops (const_gimple g)
1280 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1284 /* Return the set of DEF operands for statement G. */
1286 static inline struct def_optype_d *
1287 gimple_def_ops (const_gimple g)
1289 if (!gimple_has_ops (g))
1290 return NULL;
1291 return g->gsops.opbase.def_ops;
1295 /* Set DEF to be the set of DEF operands for statement G. */
1297 static inline void
1298 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1300 gcc_assert (gimple_has_ops (g));
1301 g->gsops.opbase.def_ops = def;
1305 /* Return the set of USE operands for statement G. */
1307 static inline struct use_optype_d *
1308 gimple_use_ops (const_gimple g)
1310 if (!gimple_has_ops (g))
1311 return NULL;
1312 return g->gsops.opbase.use_ops;
1316 /* Set USE to be the set of USE operands for statement G. */
1318 static inline void
1319 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1321 gcc_assert (gimple_has_ops (g));
1322 g->gsops.opbase.use_ops = use;
1326 /* Return the set of VUSE operand for statement G. */
1328 static inline use_operand_p
1329 gimple_vuse_op (const_gimple g)
1331 struct use_optype_d *ops;
1332 if (!gimple_has_mem_ops (g))
1333 return NULL_USE_OPERAND_P;
1334 ops = g->gsops.opbase.use_ops;
1335 if (ops
1336 && USE_OP_PTR (ops)->use == &g->gsmem.membase.vuse)
1337 return USE_OP_PTR (ops);
1338 return NULL_USE_OPERAND_P;
1341 /* Return the set of VDEF operand for statement G. */
1343 static inline def_operand_p
1344 gimple_vdef_op (const_gimple g)
1346 struct def_optype_d *ops;
1347 if (!gimple_has_mem_ops (g))
1348 return NULL_DEF_OPERAND_P;
1349 ops = g->gsops.opbase.def_ops;
1350 if (ops
1351 && DEF_OP_PTR (ops) == &g->gsmem.membase.vdef)
1352 return DEF_OP_PTR (ops);
1353 return NULL_DEF_OPERAND_P;
1357 /* Return the single VUSE operand of the statement G. */
1359 static inline tree
1360 gimple_vuse (const_gimple g)
1362 if (!gimple_has_mem_ops (g))
1363 return NULL_TREE;
1364 return g->gsmem.membase.vuse;
1367 /* Return the single VDEF operand of the statement G. */
1369 static inline tree
1370 gimple_vdef (const_gimple g)
1372 if (!gimple_has_mem_ops (g))
1373 return NULL_TREE;
1374 return g->gsmem.membase.vdef;
1377 /* Return the single VUSE operand of the statement G. */
1379 static inline tree *
1380 gimple_vuse_ptr (gimple g)
1382 if (!gimple_has_mem_ops (g))
1383 return NULL;
1384 return &g->gsmem.membase.vuse;
1387 /* Return the single VDEF operand of the statement G. */
1389 static inline tree *
1390 gimple_vdef_ptr (gimple g)
1392 if (!gimple_has_mem_ops (g))
1393 return NULL;
1394 return &g->gsmem.membase.vdef;
1397 /* Set the single VUSE operand of the statement G. */
1399 static inline void
1400 gimple_set_vuse (gimple g, tree vuse)
1402 gcc_assert (gimple_has_mem_ops (g));
1403 g->gsmem.membase.vuse = vuse;
1406 /* Set the single VDEF operand of the statement G. */
1408 static inline void
1409 gimple_set_vdef (gimple g, tree vdef)
1411 gcc_assert (gimple_has_mem_ops (g));
1412 g->gsmem.membase.vdef = vdef;
1416 /* Return true if statement G has operands and the modified field has
1417 been set. */
1419 static inline bool
1420 gimple_modified_p (const_gimple g)
1422 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1426 /* Return the tree code for the expression computed by STMT. This is
1427 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1428 GIMPLE_CALL, return CALL_EXPR as the expression code for
1429 consistency. This is useful when the caller needs to deal with the
1430 three kinds of computation that GIMPLE supports. */
1432 static inline enum tree_code
1433 gimple_expr_code (const_gimple stmt)
1435 enum gimple_code code = gimple_code (stmt);
1436 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1437 return (enum tree_code) stmt->gsbase.subcode;
1438 else if (code == GIMPLE_CALL)
1439 return CALL_EXPR;
1440 else
1441 gcc_unreachable ();
1445 /* Mark statement S as modified, and update it. */
1447 static inline void
1448 update_stmt (gimple s)
1450 if (gimple_has_ops (s))
1452 gimple_set_modified (s, true);
1453 update_stmt_operands (s);
1457 /* Update statement S if it has been optimized. */
1459 static inline void
1460 update_stmt_if_modified (gimple s)
1462 if (gimple_modified_p (s))
1463 update_stmt_operands (s);
1466 /* Return true if statement STMT contains volatile operands. */
1468 static inline bool
1469 gimple_has_volatile_ops (const_gimple stmt)
1471 if (gimple_has_mem_ops (stmt))
1472 return stmt->gsbase.has_volatile_ops;
1473 else
1474 return false;
1478 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1480 static inline void
1481 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1483 if (gimple_has_mem_ops (stmt))
1484 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1488 /* Return true if statement STMT may access memory. */
1490 static inline bool
1491 gimple_references_memory_p (gimple stmt)
1493 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1497 /* Return the subcode for OMP statement S. */
1499 static inline unsigned
1500 gimple_omp_subcode (const_gimple s)
1502 gcc_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1503 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1504 return s->gsbase.subcode;
1507 /* Set the subcode for OMP statement S to SUBCODE. */
1509 static inline void
1510 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1512 /* We only have 16 bits for the subcode. Assert that we are not
1513 overflowing it. */
1514 gcc_assert (subcode < (1 << 16));
1515 s->gsbase.subcode = subcode;
1518 /* Set the nowait flag on OMP_RETURN statement S. */
1520 static inline void
1521 gimple_omp_return_set_nowait (gimple s)
1523 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1524 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1528 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1529 flag set. */
1531 static inline bool
1532 gimple_omp_return_nowait_p (const_gimple g)
1534 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1535 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1539 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1540 flag set. */
1542 static inline bool
1543 gimple_omp_section_last_p (const_gimple g)
1545 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1546 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1550 /* Set the GF_OMP_SECTION_LAST flag on G. */
1552 static inline void
1553 gimple_omp_section_set_last (gimple g)
1555 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1556 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1560 /* Return true if OMP parallel statement G has the
1561 GF_OMP_PARALLEL_COMBINED flag set. */
1563 static inline bool
1564 gimple_omp_parallel_combined_p (const_gimple g)
1566 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1567 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1571 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1572 value of COMBINED_P. */
1574 static inline void
1575 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1577 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1578 if (combined_p)
1579 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1580 else
1581 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1585 /* Return the number of operands for statement GS. */
1587 static inline unsigned
1588 gimple_num_ops (const_gimple gs)
1590 return gs->gsbase.num_ops;
1594 /* Set the number of operands for statement GS. */
1596 static inline void
1597 gimple_set_num_ops (gimple gs, unsigned num_ops)
1599 gs->gsbase.num_ops = num_ops;
1603 /* Return the array of operands for statement GS. */
1605 static inline tree *
1606 gimple_ops (gimple gs)
1608 size_t off;
1610 /* All the tuples have their operand vector at the very bottom
1611 of the structure. Note that those structures that do not
1612 have an operand vector have a zero offset. */
1613 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1614 gcc_assert (off != 0);
1616 return (tree *) ((char *) gs + off);
1620 /* Return operand I for statement GS. */
1622 static inline tree
1623 gimple_op (const_gimple gs, unsigned i)
1625 if (gimple_has_ops (gs))
1627 gcc_assert (i < gimple_num_ops (gs));
1628 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1630 else
1631 return NULL_TREE;
1634 /* Return a pointer to operand I for statement GS. */
1636 static inline tree *
1637 gimple_op_ptr (const_gimple gs, unsigned i)
1639 if (gimple_has_ops (gs))
1641 gcc_assert (i < gimple_num_ops (gs));
1642 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1644 else
1645 return NULL;
1648 /* Set operand I of statement GS to OP. */
1650 static inline void
1651 gimple_set_op (gimple gs, unsigned i, tree op)
1653 gcc_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1655 /* Note. It may be tempting to assert that OP matches
1656 is_gimple_operand, but that would be wrong. Different tuples
1657 accept slightly different sets of tree operands. Each caller
1658 should perform its own validation. */
1659 gimple_ops (gs)[i] = op;
1662 /* Return true if GS is a GIMPLE_ASSIGN. */
1664 static inline bool
1665 is_gimple_assign (const_gimple gs)
1667 return gimple_code (gs) == GIMPLE_ASSIGN;
1670 /* Determine if expression CODE is one of the valid expressions that can
1671 be used on the RHS of GIMPLE assignments. */
1673 static inline enum gimple_rhs_class
1674 get_gimple_rhs_class (enum tree_code code)
1676 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1679 /* Return the LHS of assignment statement GS. */
1681 static inline tree
1682 gimple_assign_lhs (const_gimple gs)
1684 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1685 return gimple_op (gs, 0);
1689 /* Return a pointer to the LHS of assignment statement GS. */
1691 static inline tree *
1692 gimple_assign_lhs_ptr (const_gimple gs)
1694 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1695 return gimple_op_ptr (gs, 0);
1699 /* Set LHS to be the LHS operand of assignment statement GS. */
1701 static inline void
1702 gimple_assign_set_lhs (gimple gs, tree lhs)
1704 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1705 gcc_assert (is_gimple_operand (lhs));
1706 gimple_set_op (gs, 0, lhs);
1708 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1709 SSA_NAME_DEF_STMT (lhs) = gs;
1713 /* Return the first operand on the RHS of assignment statement GS. */
1715 static inline tree
1716 gimple_assign_rhs1 (const_gimple gs)
1718 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1719 return gimple_op (gs, 1);
1723 /* Return a pointer to the first operand on the RHS of assignment
1724 statement GS. */
1726 static inline tree *
1727 gimple_assign_rhs1_ptr (const_gimple gs)
1729 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1730 return gimple_op_ptr (gs, 1);
1733 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1735 static inline void
1736 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1738 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1740 /* If there are 3 or more operands, the 2 operands on the RHS must be
1741 GIMPLE values. */
1742 if (gimple_num_ops (gs) >= 3)
1743 gcc_assert (is_gimple_val (rhs));
1744 else
1745 gcc_assert (is_gimple_operand (rhs));
1747 gimple_set_op (gs, 1, rhs);
1751 /* Return the second operand on the RHS of assignment statement GS.
1752 If GS does not have two operands, NULL is returned instead. */
1754 static inline tree
1755 gimple_assign_rhs2 (const_gimple gs)
1757 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1759 if (gimple_num_ops (gs) >= 3)
1760 return gimple_op (gs, 2);
1761 else
1762 return NULL_TREE;
1766 /* Return a pointer to the second operand on the RHS of assignment
1767 statement GS. */
1769 static inline tree *
1770 gimple_assign_rhs2_ptr (const_gimple gs)
1772 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1773 return gimple_op_ptr (gs, 2);
1777 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1779 static inline void
1780 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1782 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1784 /* The 2 operands on the RHS must be GIMPLE values. */
1785 gcc_assert (is_gimple_val (rhs));
1787 gimple_set_op (gs, 2, rhs);
1790 /* Returns true if GS is a nontemporal move. */
1792 static inline bool
1793 gimple_assign_nontemporal_move_p (const_gimple gs)
1795 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1796 return gs->gsbase.nontemporal_move;
1799 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1801 static inline void
1802 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1804 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1805 gs->gsbase.nontemporal_move = nontemporal;
1809 /* Return the code of the expression computed on the rhs of assignment
1810 statement GS. In case that the RHS is a single object, returns the
1811 tree code of the object. */
1813 static inline enum tree_code
1814 gimple_assign_rhs_code (const_gimple gs)
1816 enum tree_code code;
1817 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1819 code = gimple_expr_code (gs);
1820 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1821 code = TREE_CODE (gimple_assign_rhs1 (gs));
1823 return code;
1827 /* Set CODE to be the code for the expression computed on the RHS of
1828 assignment S. */
1830 static inline void
1831 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
1833 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
1834 s->gsbase.subcode = code;
1838 /* Return the gimple rhs class of the code of the expression computed on
1839 the rhs of assignment statement GS.
1840 This will never return GIMPLE_INVALID_RHS. */
1842 static inline enum gimple_rhs_class
1843 gimple_assign_rhs_class (const_gimple gs)
1845 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
1849 /* Return true if S is a type-cast assignment. */
1851 static inline bool
1852 gimple_assign_cast_p (gimple s)
1854 if (is_gimple_assign (s))
1856 enum tree_code sc = gimple_assign_rhs_code (s);
1857 return CONVERT_EXPR_CODE_P (sc)
1858 || sc == VIEW_CONVERT_EXPR
1859 || sc == FIX_TRUNC_EXPR;
1862 return false;
1866 /* Return true if GS is a GIMPLE_CALL. */
1868 static inline bool
1869 is_gimple_call (const_gimple gs)
1871 return gimple_code (gs) == GIMPLE_CALL;
1874 /* Return the LHS of call statement GS. */
1876 static inline tree
1877 gimple_call_lhs (const_gimple gs)
1879 GIMPLE_CHECK (gs, GIMPLE_CALL);
1880 return gimple_op (gs, 0);
1884 /* Return a pointer to the LHS of call statement GS. */
1886 static inline tree *
1887 gimple_call_lhs_ptr (const_gimple gs)
1889 GIMPLE_CHECK (gs, GIMPLE_CALL);
1890 return gimple_op_ptr (gs, 0);
1894 /* Set LHS to be the LHS operand of call statement GS. */
1896 static inline void
1897 gimple_call_set_lhs (gimple gs, tree lhs)
1899 GIMPLE_CHECK (gs, GIMPLE_CALL);
1900 gcc_assert (!lhs || is_gimple_operand (lhs));
1901 gimple_set_op (gs, 0, lhs);
1902 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1903 SSA_NAME_DEF_STMT (lhs) = gs;
1907 /* Return the tree node representing the function called by call
1908 statement GS. */
1910 static inline tree
1911 gimple_call_fn (const_gimple gs)
1913 GIMPLE_CHECK (gs, GIMPLE_CALL);
1914 return gimple_op (gs, 1);
1918 /* Return a pointer to the tree node representing the function called by call
1919 statement GS. */
1921 static inline tree *
1922 gimple_call_fn_ptr (const_gimple gs)
1924 GIMPLE_CHECK (gs, GIMPLE_CALL);
1925 return gimple_op_ptr (gs, 1);
1929 /* Set FN to be the function called by call statement GS. */
1931 static inline void
1932 gimple_call_set_fn (gimple gs, tree fn)
1934 GIMPLE_CHECK (gs, GIMPLE_CALL);
1935 gcc_assert (is_gimple_operand (fn));
1936 gimple_set_op (gs, 1, fn);
1940 /* Set FNDECL to be the function called by call statement GS. */
1942 static inline void
1943 gimple_call_set_fndecl (gimple gs, tree decl)
1945 GIMPLE_CHECK (gs, GIMPLE_CALL);
1946 gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
1947 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
1951 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
1952 Otherwise return NULL. This function is analogous to
1953 get_callee_fndecl in tree land. */
1955 static inline tree
1956 gimple_call_fndecl (const_gimple gs)
1958 tree addr = gimple_call_fn (gs);
1959 if (TREE_CODE (addr) == ADDR_EXPR)
1961 gcc_assert (TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL);
1962 return TREE_OPERAND (addr, 0);
1964 return NULL_TREE;
1968 /* Return the type returned by call statement GS. */
1970 static inline tree
1971 gimple_call_return_type (const_gimple gs)
1973 tree fn = gimple_call_fn (gs);
1974 tree type = TREE_TYPE (fn);
1976 /* See through the pointer. */
1977 gcc_assert (POINTER_TYPE_P (type));
1978 type = TREE_TYPE (type);
1980 gcc_assert (TREE_CODE (type) == FUNCTION_TYPE
1981 || TREE_CODE (type) == METHOD_TYPE);
1983 /* The type returned by a FUNCTION_DECL is the type of its
1984 function type. */
1985 return TREE_TYPE (type);
1989 /* Return the static chain for call statement GS. */
1991 static inline tree
1992 gimple_call_chain (const_gimple gs)
1994 GIMPLE_CHECK (gs, GIMPLE_CALL);
1995 return gimple_op (gs, 2);
1999 /* Return a pointer to the static chain for call statement GS. */
2001 static inline tree *
2002 gimple_call_chain_ptr (const_gimple gs)
2004 GIMPLE_CHECK (gs, GIMPLE_CALL);
2005 return gimple_op_ptr (gs, 2);
2008 /* Set CHAIN to be the static chain for call statement GS. */
2010 static inline void
2011 gimple_call_set_chain (gimple gs, tree chain)
2013 GIMPLE_CHECK (gs, GIMPLE_CALL);
2014 gcc_assert (chain == NULL
2015 || TREE_CODE (chain) == ADDR_EXPR
2016 || SSA_VAR_P (chain));
2017 gimple_set_op (gs, 2, chain);
2021 /* Return the number of arguments used by call statement GS. */
2023 static inline unsigned
2024 gimple_call_num_args (const_gimple gs)
2026 unsigned num_ops;
2027 GIMPLE_CHECK (gs, GIMPLE_CALL);
2028 num_ops = gimple_num_ops (gs);
2029 gcc_assert (num_ops >= 3);
2030 return num_ops - 3;
2034 /* Return the argument at position INDEX for call statement GS. */
2036 static inline tree
2037 gimple_call_arg (const_gimple gs, unsigned index)
2039 GIMPLE_CHECK (gs, GIMPLE_CALL);
2040 return gimple_op (gs, index + 3);
2044 /* Return a pointer to the argument at position INDEX for call
2045 statement GS. */
2047 static inline tree *
2048 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2050 GIMPLE_CHECK (gs, GIMPLE_CALL);
2051 return gimple_op_ptr (gs, index + 3);
2055 /* Set ARG to be the argument at position INDEX for call statement GS. */
2057 static inline void
2058 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2060 GIMPLE_CHECK (gs, GIMPLE_CALL);
2061 gcc_assert (is_gimple_operand (arg));
2062 gimple_set_op (gs, index + 3, arg);
2066 /* If TAIL_P is true, mark call statement S as being a tail call
2067 (i.e., a call just before the exit of a function). These calls are
2068 candidate for tail call optimization. */
2070 static inline void
2071 gimple_call_set_tail (gimple s, bool tail_p)
2073 GIMPLE_CHECK (s, GIMPLE_CALL);
2074 if (tail_p)
2075 s->gsbase.subcode |= GF_CALL_TAILCALL;
2076 else
2077 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2081 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2083 static inline bool
2084 gimple_call_tail_p (gimple s)
2086 GIMPLE_CHECK (s, GIMPLE_CALL);
2087 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2091 /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
2093 static inline void
2094 gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
2096 GIMPLE_CHECK (s, GIMPLE_CALL);
2097 if (inlinable_p)
2098 s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
2099 else
2100 s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
2104 /* Return true if GIMPLE_CALL S cannot be inlined. */
2106 static inline bool
2107 gimple_call_cannot_inline_p (gimple s)
2109 GIMPLE_CHECK (s, GIMPLE_CALL);
2110 return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0;
2114 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2115 slot optimization. This transformation uses the target of the call
2116 expansion as the return slot for calls that return in memory. */
2118 static inline void
2119 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2121 GIMPLE_CHECK (s, GIMPLE_CALL);
2122 if (return_slot_opt_p)
2123 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2124 else
2125 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2129 /* Return true if S is marked for return slot optimization. */
2131 static inline bool
2132 gimple_call_return_slot_opt_p (gimple s)
2134 GIMPLE_CHECK (s, GIMPLE_CALL);
2135 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2139 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2140 thunk to the thunked-to function. */
2142 static inline void
2143 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2145 GIMPLE_CHECK (s, GIMPLE_CALL);
2146 if (from_thunk_p)
2147 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2148 else
2149 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2153 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2155 static inline bool
2156 gimple_call_from_thunk_p (gimple s)
2158 GIMPLE_CHECK (s, GIMPLE_CALL);
2159 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2163 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2164 argument pack in its argument list. */
2166 static inline void
2167 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2169 GIMPLE_CHECK (s, GIMPLE_CALL);
2170 if (pass_arg_pack_p)
2171 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2172 else
2173 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2177 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2178 argument pack in its argument list. */
2180 static inline bool
2181 gimple_call_va_arg_pack_p (gimple s)
2183 GIMPLE_CHECK (s, GIMPLE_CALL);
2184 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2188 /* Return true if S is a noreturn call. */
2190 static inline bool
2191 gimple_call_noreturn_p (gimple s)
2193 GIMPLE_CHECK (s, GIMPLE_CALL);
2194 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2198 /* Return true if S is a nothrow call. */
2200 static inline bool
2201 gimple_call_nothrow_p (gimple s)
2203 GIMPLE_CHECK (s, GIMPLE_CALL);
2204 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2208 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2210 static inline void
2211 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2213 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2214 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2215 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2219 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2220 non-NULL lhs. */
2222 static inline bool
2223 gimple_has_lhs (gimple stmt)
2225 return (is_gimple_assign (stmt)
2226 || (is_gimple_call (stmt)
2227 && gimple_call_lhs (stmt) != NULL_TREE));
2231 /* Return the code of the predicate computed by conditional statement GS. */
2233 static inline enum tree_code
2234 gimple_cond_code (const_gimple gs)
2236 GIMPLE_CHECK (gs, GIMPLE_COND);
2237 return (enum tree_code) gs->gsbase.subcode;
2241 /* Set CODE to be the predicate code for the conditional statement GS. */
2243 static inline void
2244 gimple_cond_set_code (gimple gs, enum tree_code code)
2246 GIMPLE_CHECK (gs, GIMPLE_COND);
2247 gcc_assert (TREE_CODE_CLASS (code) == tcc_comparison);
2248 gs->gsbase.subcode = code;
2252 /* Return the LHS of the predicate computed by conditional statement GS. */
2254 static inline tree
2255 gimple_cond_lhs (const_gimple gs)
2257 GIMPLE_CHECK (gs, GIMPLE_COND);
2258 return gimple_op (gs, 0);
2261 /* Return the pointer to the LHS of the predicate computed by conditional
2262 statement GS. */
2264 static inline tree *
2265 gimple_cond_lhs_ptr (const_gimple gs)
2267 GIMPLE_CHECK (gs, GIMPLE_COND);
2268 return gimple_op_ptr (gs, 0);
2271 /* Set LHS to be the LHS operand of the predicate computed by
2272 conditional statement GS. */
2274 static inline void
2275 gimple_cond_set_lhs (gimple gs, tree lhs)
2277 GIMPLE_CHECK (gs, GIMPLE_COND);
2278 gcc_assert (is_gimple_operand (lhs));
2279 gimple_set_op (gs, 0, lhs);
2283 /* Return the RHS operand of the predicate computed by conditional GS. */
2285 static inline tree
2286 gimple_cond_rhs (const_gimple gs)
2288 GIMPLE_CHECK (gs, GIMPLE_COND);
2289 return gimple_op (gs, 1);
2292 /* Return the pointer to the RHS operand of the predicate computed by
2293 conditional GS. */
2295 static inline tree *
2296 gimple_cond_rhs_ptr (const_gimple gs)
2298 GIMPLE_CHECK (gs, GIMPLE_COND);
2299 return gimple_op_ptr (gs, 1);
2303 /* Set RHS to be the RHS operand of the predicate computed by
2304 conditional statement GS. */
2306 static inline void
2307 gimple_cond_set_rhs (gimple gs, tree rhs)
2309 GIMPLE_CHECK (gs, GIMPLE_COND);
2310 gcc_assert (is_gimple_operand (rhs));
2311 gimple_set_op (gs, 1, rhs);
2315 /* Return the label used by conditional statement GS when its
2316 predicate evaluates to true. */
2318 static inline tree
2319 gimple_cond_true_label (const_gimple gs)
2321 GIMPLE_CHECK (gs, GIMPLE_COND);
2322 return gimple_op (gs, 2);
2326 /* Set LABEL to be the label used by conditional statement GS when its
2327 predicate evaluates to true. */
2329 static inline void
2330 gimple_cond_set_true_label (gimple gs, tree label)
2332 GIMPLE_CHECK (gs, GIMPLE_COND);
2333 gcc_assert (!label || TREE_CODE (label) == LABEL_DECL);
2334 gimple_set_op (gs, 2, label);
2338 /* Set LABEL to be the label used by conditional statement GS when its
2339 predicate evaluates to false. */
2341 static inline void
2342 gimple_cond_set_false_label (gimple gs, tree label)
2344 GIMPLE_CHECK (gs, GIMPLE_COND);
2345 gcc_assert (!label || TREE_CODE (label) == LABEL_DECL);
2346 gimple_set_op (gs, 3, label);
2350 /* Return the label used by conditional statement GS when its
2351 predicate evaluates to false. */
2353 static inline tree
2354 gimple_cond_false_label (const_gimple gs)
2356 GIMPLE_CHECK (gs, GIMPLE_COND);
2357 return gimple_op (gs, 3);
2361 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2363 static inline void
2364 gimple_cond_make_false (gimple gs)
2366 gimple_cond_set_lhs (gs, boolean_true_node);
2367 gimple_cond_set_rhs (gs, boolean_false_node);
2368 gs->gsbase.subcode = EQ_EXPR;
2372 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2374 static inline void
2375 gimple_cond_make_true (gimple gs)
2377 gimple_cond_set_lhs (gs, boolean_true_node);
2378 gimple_cond_set_rhs (gs, boolean_true_node);
2379 gs->gsbase.subcode = EQ_EXPR;
2382 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2383 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2385 static inline bool
2386 gimple_cond_true_p (const_gimple gs)
2388 tree lhs = gimple_cond_lhs (gs);
2389 tree rhs = gimple_cond_rhs (gs);
2390 enum tree_code code = gimple_cond_code (gs);
2392 if (lhs != boolean_true_node && lhs != boolean_false_node)
2393 return false;
2395 if (rhs != boolean_true_node && rhs != boolean_false_node)
2396 return false;
2398 if (code == NE_EXPR && lhs != rhs)
2399 return true;
2401 if (code == EQ_EXPR && lhs == rhs)
2402 return true;
2404 return false;
2407 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2408 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2410 static inline bool
2411 gimple_cond_false_p (const_gimple gs)
2413 tree lhs = gimple_cond_lhs (gs);
2414 tree rhs = gimple_cond_rhs (gs);
2415 enum tree_code code = gimple_cond_code (gs);
2417 if (lhs != boolean_true_node && lhs != boolean_false_node)
2418 return false;
2420 if (rhs != boolean_true_node && rhs != boolean_false_node)
2421 return false;
2423 if (code == NE_EXPR && lhs == rhs)
2424 return true;
2426 if (code == EQ_EXPR && lhs != rhs)
2427 return true;
2429 return false;
2432 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2433 'if (var == 1)' */
2435 static inline bool
2436 gimple_cond_single_var_p (gimple gs)
2438 if (gimple_cond_code (gs) == NE_EXPR
2439 && gimple_cond_rhs (gs) == boolean_false_node)
2440 return true;
2442 if (gimple_cond_code (gs) == EQ_EXPR
2443 && gimple_cond_rhs (gs) == boolean_true_node)
2444 return true;
2446 return false;
2449 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2451 static inline void
2452 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2454 gimple_cond_set_code (stmt, code);
2455 gimple_cond_set_lhs (stmt, lhs);
2456 gimple_cond_set_rhs (stmt, rhs);
2459 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2461 static inline tree
2462 gimple_label_label (const_gimple gs)
2464 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2465 return gimple_op (gs, 0);
2469 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2470 GS. */
2472 static inline void
2473 gimple_label_set_label (gimple gs, tree label)
2475 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2476 gcc_assert (TREE_CODE (label) == LABEL_DECL);
2477 gimple_set_op (gs, 0, label);
2481 /* Return the destination of the unconditional jump GS. */
2483 static inline tree
2484 gimple_goto_dest (const_gimple gs)
2486 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2487 return gimple_op (gs, 0);
2491 /* Set DEST to be the destination of the unconditonal jump GS. */
2493 static inline void
2494 gimple_goto_set_dest (gimple gs, tree dest)
2496 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2497 gcc_assert (is_gimple_operand (dest));
2498 gimple_set_op (gs, 0, dest);
2502 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2504 static inline tree
2505 gimple_bind_vars (const_gimple gs)
2507 GIMPLE_CHECK (gs, GIMPLE_BIND);
2508 return gs->gimple_bind.vars;
2512 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2513 statement GS. */
2515 static inline void
2516 gimple_bind_set_vars (gimple gs, tree vars)
2518 GIMPLE_CHECK (gs, GIMPLE_BIND);
2519 gs->gimple_bind.vars = vars;
2523 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2524 statement GS. */
2526 static inline void
2527 gimple_bind_append_vars (gimple gs, tree vars)
2529 GIMPLE_CHECK (gs, GIMPLE_BIND);
2530 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2534 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2536 static inline gimple_seq
2537 gimple_bind_body (gimple gs)
2539 GIMPLE_CHECK (gs, GIMPLE_BIND);
2540 return gs->gimple_bind.body;
2544 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2545 statement GS. */
2547 static inline void
2548 gimple_bind_set_body (gimple gs, gimple_seq seq)
2550 GIMPLE_CHECK (gs, GIMPLE_BIND);
2551 gs->gimple_bind.body = seq;
2555 /* Append a statement to the end of a GIMPLE_BIND's body. */
2557 static inline void
2558 gimple_bind_add_stmt (gimple gs, gimple stmt)
2560 GIMPLE_CHECK (gs, GIMPLE_BIND);
2561 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2565 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2567 static inline void
2568 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2570 GIMPLE_CHECK (gs, GIMPLE_BIND);
2571 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2575 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2576 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2578 static inline tree
2579 gimple_bind_block (const_gimple gs)
2581 GIMPLE_CHECK (gs, GIMPLE_BIND);
2582 return gs->gimple_bind.block;
2586 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2587 statement GS. */
2589 static inline void
2590 gimple_bind_set_block (gimple gs, tree block)
2592 GIMPLE_CHECK (gs, GIMPLE_BIND);
2593 gcc_assert (block == NULL_TREE || TREE_CODE (block) == BLOCK);
2594 gs->gimple_bind.block = block;
2598 /* Return the number of input operands for GIMPLE_ASM GS. */
2600 static inline unsigned
2601 gimple_asm_ninputs (const_gimple gs)
2603 GIMPLE_CHECK (gs, GIMPLE_ASM);
2604 return gs->gimple_asm.ni;
2608 /* Return the number of output operands for GIMPLE_ASM GS. */
2610 static inline unsigned
2611 gimple_asm_noutputs (const_gimple gs)
2613 GIMPLE_CHECK (gs, GIMPLE_ASM);
2614 return gs->gimple_asm.no;
2618 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2620 static inline unsigned
2621 gimple_asm_nclobbers (const_gimple gs)
2623 GIMPLE_CHECK (gs, GIMPLE_ASM);
2624 return gs->gimple_asm.nc;
2627 /* Return the number of label operands for GIMPLE_ASM GS. */
2629 static inline unsigned
2630 gimple_asm_nlabels (const_gimple gs)
2632 GIMPLE_CHECK (gs, GIMPLE_ASM);
2633 return gs->gimple_asm.nl;
2636 /* Return input operand INDEX of GIMPLE_ASM GS. */
2638 static inline tree
2639 gimple_asm_input_op (const_gimple gs, unsigned index)
2641 GIMPLE_CHECK (gs, GIMPLE_ASM);
2642 gcc_assert (index <= gs->gimple_asm.ni);
2643 return gimple_op (gs, index);
2646 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2648 static inline tree *
2649 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2651 GIMPLE_CHECK (gs, GIMPLE_ASM);
2652 gcc_assert (index <= gs->gimple_asm.ni);
2653 return gimple_op_ptr (gs, index);
2657 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2659 static inline void
2660 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2662 GIMPLE_CHECK (gs, GIMPLE_ASM);
2663 gcc_assert (index <= gs->gimple_asm.ni);
2664 gcc_assert (TREE_CODE (in_op) == TREE_LIST);
2665 gimple_set_op (gs, index, in_op);
2669 /* Return output operand INDEX of GIMPLE_ASM GS. */
2671 static inline tree
2672 gimple_asm_output_op (const_gimple gs, unsigned index)
2674 GIMPLE_CHECK (gs, GIMPLE_ASM);
2675 gcc_assert (index <= gs->gimple_asm.no);
2676 return gimple_op (gs, index + gs->gimple_asm.ni);
2679 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2681 static inline tree *
2682 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2684 GIMPLE_CHECK (gs, GIMPLE_ASM);
2685 gcc_assert (index <= gs->gimple_asm.no);
2686 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2690 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2692 static inline void
2693 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2695 GIMPLE_CHECK (gs, GIMPLE_ASM);
2696 gcc_assert (index <= gs->gimple_asm.no);
2697 gcc_assert (TREE_CODE (out_op) == TREE_LIST);
2698 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2702 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2704 static inline tree
2705 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2707 GIMPLE_CHECK (gs, GIMPLE_ASM);
2708 gcc_assert (index <= gs->gimple_asm.nc);
2709 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2713 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2715 static inline void
2716 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2718 GIMPLE_CHECK (gs, GIMPLE_ASM);
2719 gcc_assert (index <= gs->gimple_asm.nc);
2720 gcc_assert (TREE_CODE (clobber_op) == TREE_LIST);
2721 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2724 /* Return label operand INDEX of GIMPLE_ASM GS. */
2726 static inline tree
2727 gimple_asm_label_op (const_gimple gs, unsigned index)
2729 GIMPLE_CHECK (gs, GIMPLE_ASM);
2730 gcc_assert (index <= gs->gimple_asm.nl);
2731 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
2734 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
2736 static inline void
2737 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
2739 GIMPLE_CHECK (gs, GIMPLE_ASM);
2740 gcc_assert (index <= gs->gimple_asm.nl);
2741 gcc_assert (TREE_CODE (label_op) == TREE_LIST);
2742 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
2745 /* Return the string representing the assembly instruction in
2746 GIMPLE_ASM GS. */
2748 static inline const char *
2749 gimple_asm_string (const_gimple gs)
2751 GIMPLE_CHECK (gs, GIMPLE_ASM);
2752 return gs->gimple_asm.string;
2756 /* Return true if GS is an asm statement marked volatile. */
2758 static inline bool
2759 gimple_asm_volatile_p (const_gimple gs)
2761 GIMPLE_CHECK (gs, GIMPLE_ASM);
2762 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
2766 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
2768 static inline void
2769 gimple_asm_set_volatile (gimple gs, bool volatile_p)
2771 GIMPLE_CHECK (gs, GIMPLE_ASM);
2772 if (volatile_p)
2773 gs->gsbase.subcode |= GF_ASM_VOLATILE;
2774 else
2775 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
2779 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
2781 static inline void
2782 gimple_asm_set_input (gimple gs, bool input_p)
2784 GIMPLE_CHECK (gs, GIMPLE_ASM);
2785 if (input_p)
2786 gs->gsbase.subcode |= GF_ASM_INPUT;
2787 else
2788 gs->gsbase.subcode &= ~GF_ASM_INPUT;
2792 /* Return true if asm GS is an ASM_INPUT. */
2794 static inline bool
2795 gimple_asm_input_p (const_gimple gs)
2797 GIMPLE_CHECK (gs, GIMPLE_ASM);
2798 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
2802 /* Return the types handled by GIMPLE_CATCH statement GS. */
2804 static inline tree
2805 gimple_catch_types (const_gimple gs)
2807 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2808 return gs->gimple_catch.types;
2812 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
2814 static inline tree *
2815 gimple_catch_types_ptr (gimple gs)
2817 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2818 return &gs->gimple_catch.types;
2822 /* Return the GIMPLE sequence representing the body of the handler of
2823 GIMPLE_CATCH statement GS. */
2825 static inline gimple_seq
2826 gimple_catch_handler (gimple gs)
2828 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2829 return gs->gimple_catch.handler;
2833 /* Return a pointer to the GIMPLE sequence representing the body of
2834 the handler of GIMPLE_CATCH statement GS. */
2836 static inline gimple_seq *
2837 gimple_catch_handler_ptr (gimple gs)
2839 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2840 return &gs->gimple_catch.handler;
2844 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
2846 static inline void
2847 gimple_catch_set_types (gimple gs, tree t)
2849 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2850 gs->gimple_catch.types = t;
2854 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
2856 static inline void
2857 gimple_catch_set_handler (gimple gs, gimple_seq handler)
2859 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2860 gs->gimple_catch.handler = handler;
2864 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
2866 static inline tree
2867 gimple_eh_filter_types (const_gimple gs)
2869 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2870 return gs->gimple_eh_filter.types;
2874 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
2875 GS. */
2877 static inline tree *
2878 gimple_eh_filter_types_ptr (gimple gs)
2880 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2881 return &gs->gimple_eh_filter.types;
2885 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
2886 statement fails. */
2888 static inline gimple_seq
2889 gimple_eh_filter_failure (gimple gs)
2891 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2892 return gs->gimple_eh_filter.failure;
2896 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
2898 static inline void
2899 gimple_eh_filter_set_types (gimple gs, tree types)
2901 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2902 gs->gimple_eh_filter.types = types;
2906 /* Set FAILURE to be the sequence of statements to execute on failure
2907 for GIMPLE_EH_FILTER GS. */
2909 static inline void
2910 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
2912 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2913 gs->gimple_eh_filter.failure = failure;
2916 /* Get the function decl to be called by the MUST_NOT_THROW region. */
2918 static inline tree
2919 gimple_eh_must_not_throw_fndecl (gimple gs)
2921 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
2922 return gs->gimple_eh_mnt.fndecl;
2925 /* Set the function decl to be called by GS to DECL. */
2927 static inline void
2928 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
2930 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
2931 gs->gimple_eh_mnt.fndecl = decl;
2935 /* GIMPLE_TRY accessors. */
2937 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
2938 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
2940 static inline enum gimple_try_flags
2941 gimple_try_kind (const_gimple gs)
2943 GIMPLE_CHECK (gs, GIMPLE_TRY);
2944 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
2948 /* Set the kind of try block represented by GIMPLE_TRY GS. */
2950 static inline void
2951 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
2953 GIMPLE_CHECK (gs, GIMPLE_TRY);
2954 gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY);
2955 if (gimple_try_kind (gs) != kind)
2956 gs->gsbase.subcode = (unsigned int) kind;
2960 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
2962 static inline bool
2963 gimple_try_catch_is_cleanup (const_gimple gs)
2965 gcc_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
2966 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
2970 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
2972 static inline gimple_seq
2973 gimple_try_eval (gimple gs)
2975 GIMPLE_CHECK (gs, GIMPLE_TRY);
2976 return gs->gimple_try.eval;
2980 /* Return the sequence of statements used as the cleanup body for
2981 GIMPLE_TRY GS. */
2983 static inline gimple_seq
2984 gimple_try_cleanup (gimple gs)
2986 GIMPLE_CHECK (gs, GIMPLE_TRY);
2987 return gs->gimple_try.cleanup;
2991 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
2993 static inline void
2994 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
2996 gcc_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
2997 if (catch_is_cleanup)
2998 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
2999 else
3000 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3004 /* Set EVAL to be the sequence of statements to use as the body for
3005 GIMPLE_TRY GS. */
3007 static inline void
3008 gimple_try_set_eval (gimple gs, gimple_seq eval)
3010 GIMPLE_CHECK (gs, GIMPLE_TRY);
3011 gs->gimple_try.eval = eval;
3015 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3016 body for GIMPLE_TRY GS. */
3018 static inline void
3019 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3021 GIMPLE_CHECK (gs, GIMPLE_TRY);
3022 gs->gimple_try.cleanup = cleanup;
3026 /* Return the cleanup sequence for cleanup statement GS. */
3028 static inline gimple_seq
3029 gimple_wce_cleanup (gimple gs)
3031 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3032 return gs->gimple_wce.cleanup;
3036 /* Set CLEANUP to be the cleanup sequence for GS. */
3038 static inline void
3039 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3041 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3042 gs->gimple_wce.cleanup = cleanup;
3046 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3048 static inline bool
3049 gimple_wce_cleanup_eh_only (const_gimple gs)
3051 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3052 return gs->gsbase.subcode != 0;
3056 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3058 static inline void
3059 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3061 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3062 gs->gsbase.subcode = (unsigned int) eh_only_p;
3066 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3068 static inline unsigned
3069 gimple_phi_capacity (const_gimple gs)
3071 GIMPLE_CHECK (gs, GIMPLE_PHI);
3072 return gs->gimple_phi.capacity;
3076 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3077 be exactly the number of incoming edges for the basic block holding
3078 GS. */
3080 static inline unsigned
3081 gimple_phi_num_args (const_gimple gs)
3083 GIMPLE_CHECK (gs, GIMPLE_PHI);
3084 return gs->gimple_phi.nargs;
3088 /* Return the SSA name created by GIMPLE_PHI GS. */
3090 static inline tree
3091 gimple_phi_result (const_gimple gs)
3093 GIMPLE_CHECK (gs, GIMPLE_PHI);
3094 return gs->gimple_phi.result;
3097 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3099 static inline tree *
3100 gimple_phi_result_ptr (gimple gs)
3102 GIMPLE_CHECK (gs, GIMPLE_PHI);
3103 return &gs->gimple_phi.result;
3106 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3108 static inline void
3109 gimple_phi_set_result (gimple gs, tree result)
3111 GIMPLE_CHECK (gs, GIMPLE_PHI);
3112 gs->gimple_phi.result = result;
3116 /* Return the PHI argument corresponding to incoming edge INDEX for
3117 GIMPLE_PHI GS. */
3119 static inline struct phi_arg_d *
3120 gimple_phi_arg (gimple gs, unsigned index)
3122 GIMPLE_CHECK (gs, GIMPLE_PHI);
3123 gcc_assert (index <= gs->gimple_phi.capacity);
3124 return &(gs->gimple_phi.args[index]);
3127 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3128 for GIMPLE_PHI GS. */
3130 static inline void
3131 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3133 GIMPLE_CHECK (gs, GIMPLE_PHI);
3134 gcc_assert (index <= gs->gimple_phi.nargs);
3135 memcpy (gs->gimple_phi.args + index, phiarg, sizeof (struct phi_arg_d));
3138 /* Return the region number for GIMPLE_RESX GS. */
3140 static inline int
3141 gimple_resx_region (const_gimple gs)
3143 GIMPLE_CHECK (gs, GIMPLE_RESX);
3144 return gs->gimple_eh_ctrl.region;
3147 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3149 static inline void
3150 gimple_resx_set_region (gimple gs, int region)
3152 GIMPLE_CHECK (gs, GIMPLE_RESX);
3153 gs->gimple_eh_ctrl.region = region;
3156 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3158 static inline int
3159 gimple_eh_dispatch_region (const_gimple gs)
3161 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3162 return gs->gimple_eh_ctrl.region;
3165 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3167 static inline void
3168 gimple_eh_dispatch_set_region (gimple gs, int region)
3170 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3171 gs->gimple_eh_ctrl.region = region;
3174 /* Return the number of labels associated with the switch statement GS. */
3176 static inline unsigned
3177 gimple_switch_num_labels (const_gimple gs)
3179 unsigned num_ops;
3180 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3181 num_ops = gimple_num_ops (gs);
3182 gcc_assert (num_ops > 1);
3183 return num_ops - 1;
3187 /* Set NLABELS to be the number of labels for the switch statement GS. */
3189 static inline void
3190 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3192 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3193 gimple_set_num_ops (g, nlabels + 1);
3197 /* Return the index variable used by the switch statement GS. */
3199 static inline tree
3200 gimple_switch_index (const_gimple gs)
3202 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3203 return gimple_op (gs, 0);
3207 /* Return a pointer to the index variable for the switch statement GS. */
3209 static inline tree *
3210 gimple_switch_index_ptr (const_gimple gs)
3212 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3213 return gimple_op_ptr (gs, 0);
3217 /* Set INDEX to be the index variable for switch statement GS. */
3219 static inline void
3220 gimple_switch_set_index (gimple gs, tree index)
3222 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3223 gcc_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3224 gimple_set_op (gs, 0, index);
3228 /* Return the label numbered INDEX. The default label is 0, followed by any
3229 labels in a switch statement. */
3231 static inline tree
3232 gimple_switch_label (const_gimple gs, unsigned index)
3234 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3235 gcc_assert (gimple_num_ops (gs) > index + 1);
3236 return gimple_op (gs, index + 1);
3239 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3241 static inline void
3242 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3244 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3245 gcc_assert (gimple_num_ops (gs) > index + 1);
3246 gcc_assert (label == NULL_TREE || TREE_CODE (label) == CASE_LABEL_EXPR);
3247 gimple_set_op (gs, index + 1, label);
3250 /* Return the default label for a switch statement. */
3252 static inline tree
3253 gimple_switch_default_label (const_gimple gs)
3255 return gimple_switch_label (gs, 0);
3258 /* Set the default label for a switch statement. */
3260 static inline void
3261 gimple_switch_set_default_label (gimple gs, tree label)
3263 gimple_switch_set_label (gs, 0, label);
3266 /* Return true if GS is a GIMPLE_DEBUG statement. */
3268 static inline bool
3269 is_gimple_debug (const_gimple gs)
3271 return gimple_code (gs) == GIMPLE_DEBUG;
3274 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3276 static inline bool
3277 gimple_debug_bind_p (const_gimple s)
3279 if (is_gimple_debug (s))
3280 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3282 return false;
3285 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3287 static inline tree
3288 gimple_debug_bind_get_var (gimple dbg)
3290 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3291 gcc_assert (gimple_debug_bind_p (dbg));
3292 return gimple_op (dbg, 0);
3295 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3296 statement. */
3298 static inline tree
3299 gimple_debug_bind_get_value (gimple dbg)
3301 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3302 gcc_assert (gimple_debug_bind_p (dbg));
3303 return gimple_op (dbg, 1);
3306 /* Return a pointer to the value bound to the variable in a
3307 GIMPLE_DEBUG bind statement. */
3309 static inline tree *
3310 gimple_debug_bind_get_value_ptr (gimple dbg)
3312 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3313 gcc_assert (gimple_debug_bind_p (dbg));
3314 return gimple_op_ptr (dbg, 1);
3317 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3319 static inline void
3320 gimple_debug_bind_set_var (gimple dbg, tree var)
3322 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3323 gcc_assert (gimple_debug_bind_p (dbg));
3324 gimple_set_op (dbg, 0, var);
3327 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3328 statement. */
3330 static inline void
3331 gimple_debug_bind_set_value (gimple dbg, tree value)
3333 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3334 gcc_assert (gimple_debug_bind_p (dbg));
3335 gimple_set_op (dbg, 1, value);
3338 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3339 optimized away. */
3340 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3342 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3343 statement. */
3345 static inline void
3346 gimple_debug_bind_reset_value (gimple dbg)
3348 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3349 gcc_assert (gimple_debug_bind_p (dbg));
3350 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3353 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3354 value. */
3356 static inline bool
3357 gimple_debug_bind_has_value_p (gimple dbg)
3359 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3360 gcc_assert (gimple_debug_bind_p (dbg));
3361 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3364 #undef GIMPLE_DEBUG_BIND_NOVALUE
3366 /* Return the body for the OMP statement GS. */
3368 static inline gimple_seq
3369 gimple_omp_body (gimple gs)
3371 return gs->omp.body;
3374 /* Set BODY to be the body for the OMP statement GS. */
3376 static inline void
3377 gimple_omp_set_body (gimple gs, gimple_seq body)
3379 gs->omp.body = body;
3383 /* Return the name associated with OMP_CRITICAL statement GS. */
3385 static inline tree
3386 gimple_omp_critical_name (const_gimple gs)
3388 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3389 return gs->gimple_omp_critical.name;
3393 /* Return a pointer to the name associated with OMP critical statement GS. */
3395 static inline tree *
3396 gimple_omp_critical_name_ptr (gimple gs)
3398 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3399 return &gs->gimple_omp_critical.name;
3403 /* Set NAME to be the name associated with OMP critical statement GS. */
3405 static inline void
3406 gimple_omp_critical_set_name (gimple gs, tree name)
3408 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3409 gs->gimple_omp_critical.name = name;
3413 /* Return the clauses associated with OMP_FOR GS. */
3415 static inline tree
3416 gimple_omp_for_clauses (const_gimple gs)
3418 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3419 return gs->gimple_omp_for.clauses;
3423 /* Return a pointer to the OMP_FOR GS. */
3425 static inline tree *
3426 gimple_omp_for_clauses_ptr (gimple gs)
3428 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3429 return &gs->gimple_omp_for.clauses;
3433 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3435 static inline void
3436 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3438 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3439 gs->gimple_omp_for.clauses = clauses;
3443 /* Get the collapse count of OMP_FOR GS. */
3445 static inline size_t
3446 gimple_omp_for_collapse (gimple gs)
3448 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3449 return gs->gimple_omp_for.collapse;
3453 /* Return the index variable for OMP_FOR GS. */
3455 static inline tree
3456 gimple_omp_for_index (const_gimple gs, size_t i)
3458 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3459 gcc_assert (i < gs->gimple_omp_for.collapse);
3460 return gs->gimple_omp_for.iter[i].index;
3464 /* Return a pointer to the index variable for OMP_FOR GS. */
3466 static inline tree *
3467 gimple_omp_for_index_ptr (gimple gs, size_t i)
3469 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3470 gcc_assert (i < gs->gimple_omp_for.collapse);
3471 return &gs->gimple_omp_for.iter[i].index;
3475 /* Set INDEX to be the index variable for OMP_FOR GS. */
3477 static inline void
3478 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3480 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3481 gcc_assert (i < gs->gimple_omp_for.collapse);
3482 gs->gimple_omp_for.iter[i].index = index;
3486 /* Return the initial value for OMP_FOR GS. */
3488 static inline tree
3489 gimple_omp_for_initial (const_gimple gs, size_t i)
3491 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3492 gcc_assert (i < gs->gimple_omp_for.collapse);
3493 return gs->gimple_omp_for.iter[i].initial;
3497 /* Return a pointer to the initial value for OMP_FOR GS. */
3499 static inline tree *
3500 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3502 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3503 gcc_assert (i < gs->gimple_omp_for.collapse);
3504 return &gs->gimple_omp_for.iter[i].initial;
3508 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3510 static inline void
3511 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3513 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3514 gcc_assert (i < gs->gimple_omp_for.collapse);
3515 gs->gimple_omp_for.iter[i].initial = initial;
3519 /* Return the final value for OMP_FOR GS. */
3521 static inline tree
3522 gimple_omp_for_final (const_gimple gs, size_t i)
3524 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3525 gcc_assert (i < gs->gimple_omp_for.collapse);
3526 return gs->gimple_omp_for.iter[i].final;
3530 /* Return a pointer to the final value for OMP_FOR GS. */
3532 static inline tree *
3533 gimple_omp_for_final_ptr (gimple gs, size_t i)
3535 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3536 gcc_assert (i < gs->gimple_omp_for.collapse);
3537 return &gs->gimple_omp_for.iter[i].final;
3541 /* Set FINAL to be the final value for OMP_FOR GS. */
3543 static inline void
3544 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3546 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3547 gcc_assert (i < gs->gimple_omp_for.collapse);
3548 gs->gimple_omp_for.iter[i].final = final;
3552 /* Return the increment value for OMP_FOR GS. */
3554 static inline tree
3555 gimple_omp_for_incr (const_gimple gs, size_t i)
3557 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3558 gcc_assert (i < gs->gimple_omp_for.collapse);
3559 return gs->gimple_omp_for.iter[i].incr;
3563 /* Return a pointer to the increment value for OMP_FOR GS. */
3565 static inline tree *
3566 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3568 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3569 gcc_assert (i < gs->gimple_omp_for.collapse);
3570 return &gs->gimple_omp_for.iter[i].incr;
3574 /* Set INCR to be the increment value for OMP_FOR GS. */
3576 static inline void
3577 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3579 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3580 gcc_assert (i < gs->gimple_omp_for.collapse);
3581 gs->gimple_omp_for.iter[i].incr = incr;
3585 /* Return the sequence of statements to execute before the OMP_FOR
3586 statement GS starts. */
3588 static inline gimple_seq
3589 gimple_omp_for_pre_body (gimple gs)
3591 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3592 return gs->gimple_omp_for.pre_body;
3596 /* Set PRE_BODY to be the sequence of statements to execute before the
3597 OMP_FOR statement GS starts. */
3599 static inline void
3600 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3602 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3603 gs->gimple_omp_for.pre_body = pre_body;
3607 /* Return the clauses associated with OMP_PARALLEL GS. */
3609 static inline tree
3610 gimple_omp_parallel_clauses (const_gimple gs)
3612 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3613 return gs->gimple_omp_parallel.clauses;
3617 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3619 static inline tree *
3620 gimple_omp_parallel_clauses_ptr (gimple gs)
3622 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3623 return &gs->gimple_omp_parallel.clauses;
3627 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
3628 GS. */
3630 static inline void
3631 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
3633 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3634 gs->gimple_omp_parallel.clauses = clauses;
3638 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
3640 static inline tree
3641 gimple_omp_parallel_child_fn (const_gimple gs)
3643 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3644 return gs->gimple_omp_parallel.child_fn;
3647 /* Return a pointer to the child function used to hold the body of
3648 OMP_PARALLEL GS. */
3650 static inline tree *
3651 gimple_omp_parallel_child_fn_ptr (gimple gs)
3653 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3654 return &gs->gimple_omp_parallel.child_fn;
3658 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
3660 static inline void
3661 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
3663 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3664 gs->gimple_omp_parallel.child_fn = child_fn;
3668 /* Return the artificial argument used to send variables and values
3669 from the parent to the children threads in OMP_PARALLEL GS. */
3671 static inline tree
3672 gimple_omp_parallel_data_arg (const_gimple gs)
3674 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3675 return gs->gimple_omp_parallel.data_arg;
3679 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
3681 static inline tree *
3682 gimple_omp_parallel_data_arg_ptr (gimple gs)
3684 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3685 return &gs->gimple_omp_parallel.data_arg;
3689 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
3691 static inline void
3692 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
3694 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3695 gs->gimple_omp_parallel.data_arg = data_arg;
3699 /* Return the clauses associated with OMP_TASK GS. */
3701 static inline tree
3702 gimple_omp_task_clauses (const_gimple gs)
3704 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3705 return gs->gimple_omp_parallel.clauses;
3709 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3711 static inline tree *
3712 gimple_omp_task_clauses_ptr (gimple gs)
3714 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3715 return &gs->gimple_omp_parallel.clauses;
3719 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3720 GS. */
3722 static inline void
3723 gimple_omp_task_set_clauses (gimple gs, tree clauses)
3725 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3726 gs->gimple_omp_parallel.clauses = clauses;
3730 /* Return the child function used to hold the body of OMP_TASK GS. */
3732 static inline tree
3733 gimple_omp_task_child_fn (const_gimple gs)
3735 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3736 return gs->gimple_omp_parallel.child_fn;
3739 /* Return a pointer to the child function used to hold the body of
3740 OMP_TASK GS. */
3742 static inline tree *
3743 gimple_omp_task_child_fn_ptr (gimple gs)
3745 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3746 return &gs->gimple_omp_parallel.child_fn;
3750 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3752 static inline void
3753 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
3755 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3756 gs->gimple_omp_parallel.child_fn = child_fn;
3760 /* Return the artificial argument used to send variables and values
3761 from the parent to the children threads in OMP_TASK GS. */
3763 static inline tree
3764 gimple_omp_task_data_arg (const_gimple gs)
3766 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3767 return gs->gimple_omp_parallel.data_arg;
3771 /* Return a pointer to the data argument for OMP_TASK GS. */
3773 static inline tree *
3774 gimple_omp_task_data_arg_ptr (gimple gs)
3776 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3777 return &gs->gimple_omp_parallel.data_arg;
3781 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3783 static inline void
3784 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
3786 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3787 gs->gimple_omp_parallel.data_arg = data_arg;
3791 /* Return the clauses associated with OMP_TASK GS. */
3793 static inline tree
3794 gimple_omp_taskreg_clauses (const_gimple gs)
3796 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3797 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3798 return gs->gimple_omp_parallel.clauses;
3802 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3804 static inline tree *
3805 gimple_omp_taskreg_clauses_ptr (gimple gs)
3807 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3808 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3809 return &gs->gimple_omp_parallel.clauses;
3813 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3814 GS. */
3816 static inline void
3817 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
3819 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3820 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3821 gs->gimple_omp_parallel.clauses = clauses;
3825 /* Return the child function used to hold the body of OMP_TASK GS. */
3827 static inline tree
3828 gimple_omp_taskreg_child_fn (const_gimple gs)
3830 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3831 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3832 return gs->gimple_omp_parallel.child_fn;
3835 /* Return a pointer to the child function used to hold the body of
3836 OMP_TASK GS. */
3838 static inline tree *
3839 gimple_omp_taskreg_child_fn_ptr (gimple gs)
3841 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3842 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3843 return &gs->gimple_omp_parallel.child_fn;
3847 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3849 static inline void
3850 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
3852 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3853 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3854 gs->gimple_omp_parallel.child_fn = child_fn;
3858 /* Return the artificial argument used to send variables and values
3859 from the parent to the children threads in OMP_TASK GS. */
3861 static inline tree
3862 gimple_omp_taskreg_data_arg (const_gimple gs)
3864 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3865 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3866 return gs->gimple_omp_parallel.data_arg;
3870 /* Return a pointer to the data argument for OMP_TASK GS. */
3872 static inline tree *
3873 gimple_omp_taskreg_data_arg_ptr (gimple gs)
3875 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3876 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3877 return &gs->gimple_omp_parallel.data_arg;
3881 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3883 static inline void
3884 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
3886 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3887 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3888 gs->gimple_omp_parallel.data_arg = data_arg;
3892 /* Return the copy function used to hold the body of OMP_TASK GS. */
3894 static inline tree
3895 gimple_omp_task_copy_fn (const_gimple gs)
3897 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3898 return gs->gimple_omp_task.copy_fn;
3901 /* Return a pointer to the copy function used to hold the body of
3902 OMP_TASK GS. */
3904 static inline tree *
3905 gimple_omp_task_copy_fn_ptr (gimple gs)
3907 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3908 return &gs->gimple_omp_task.copy_fn;
3912 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
3914 static inline void
3915 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
3917 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3918 gs->gimple_omp_task.copy_fn = copy_fn;
3922 /* Return size of the data block in bytes in OMP_TASK GS. */
3924 static inline tree
3925 gimple_omp_task_arg_size (const_gimple gs)
3927 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3928 return gs->gimple_omp_task.arg_size;
3932 /* Return a pointer to the data block size for OMP_TASK GS. */
3934 static inline tree *
3935 gimple_omp_task_arg_size_ptr (gimple gs)
3937 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3938 return &gs->gimple_omp_task.arg_size;
3942 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
3944 static inline void
3945 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
3947 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3948 gs->gimple_omp_task.arg_size = arg_size;
3952 /* Return align of the data block in bytes in OMP_TASK GS. */
3954 static inline tree
3955 gimple_omp_task_arg_align (const_gimple gs)
3957 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3958 return gs->gimple_omp_task.arg_align;
3962 /* Return a pointer to the data block align for OMP_TASK GS. */
3964 static inline tree *
3965 gimple_omp_task_arg_align_ptr (gimple gs)
3967 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3968 return &gs->gimple_omp_task.arg_align;
3972 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
3974 static inline void
3975 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
3977 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3978 gs->gimple_omp_task.arg_align = arg_align;
3982 /* Return the clauses associated with OMP_SINGLE GS. */
3984 static inline tree
3985 gimple_omp_single_clauses (const_gimple gs)
3987 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
3988 return gs->gimple_omp_single.clauses;
3992 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
3994 static inline tree *
3995 gimple_omp_single_clauses_ptr (gimple gs)
3997 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
3998 return &gs->gimple_omp_single.clauses;
4002 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4004 static inline void
4005 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4007 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4008 gs->gimple_omp_single.clauses = clauses;
4012 /* Return the clauses associated with OMP_SECTIONS GS. */
4014 static inline tree
4015 gimple_omp_sections_clauses (const_gimple gs)
4017 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4018 return gs->gimple_omp_sections.clauses;
4022 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4024 static inline tree *
4025 gimple_omp_sections_clauses_ptr (gimple gs)
4027 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4028 return &gs->gimple_omp_sections.clauses;
4032 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4033 GS. */
4035 static inline void
4036 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4038 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4039 gs->gimple_omp_sections.clauses = clauses;
4043 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4044 in GS. */
4046 static inline tree
4047 gimple_omp_sections_control (const_gimple gs)
4049 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4050 return gs->gimple_omp_sections.control;
4054 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4055 GS. */
4057 static inline tree *
4058 gimple_omp_sections_control_ptr (gimple gs)
4060 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4061 return &gs->gimple_omp_sections.control;
4065 /* Set CONTROL to be the set of clauses associated with the
4066 GIMPLE_OMP_SECTIONS in GS. */
4068 static inline void
4069 gimple_omp_sections_set_control (gimple gs, tree control)
4071 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4072 gs->gimple_omp_sections.control = control;
4076 /* Set COND to be the condition code for OMP_FOR GS. */
4078 static inline void
4079 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4081 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4082 gcc_assert (TREE_CODE_CLASS (cond) == tcc_comparison);
4083 gcc_assert (i < gs->gimple_omp_for.collapse);
4084 gs->gimple_omp_for.iter[i].cond = cond;
4088 /* Return the condition code associated with OMP_FOR GS. */
4090 static inline enum tree_code
4091 gimple_omp_for_cond (const_gimple gs, size_t i)
4093 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4094 gcc_assert (i < gs->gimple_omp_for.collapse);
4095 return gs->gimple_omp_for.iter[i].cond;
4099 /* Set the value being stored in an atomic store. */
4101 static inline void
4102 gimple_omp_atomic_store_set_val (gimple g, tree val)
4104 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4105 g->gimple_omp_atomic_store.val = val;
4109 /* Return the value being stored in an atomic store. */
4111 static inline tree
4112 gimple_omp_atomic_store_val (const_gimple g)
4114 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4115 return g->gimple_omp_atomic_store.val;
4119 /* Return a pointer to the value being stored in an atomic store. */
4121 static inline tree *
4122 gimple_omp_atomic_store_val_ptr (gimple g)
4124 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4125 return &g->gimple_omp_atomic_store.val;
4129 /* Set the LHS of an atomic load. */
4131 static inline void
4132 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4134 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4135 g->gimple_omp_atomic_load.lhs = lhs;
4139 /* Get the LHS of an atomic load. */
4141 static inline tree
4142 gimple_omp_atomic_load_lhs (const_gimple g)
4144 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4145 return g->gimple_omp_atomic_load.lhs;
4149 /* Return a pointer to the LHS of an atomic load. */
4151 static inline tree *
4152 gimple_omp_atomic_load_lhs_ptr (gimple g)
4154 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4155 return &g->gimple_omp_atomic_load.lhs;
4159 /* Set the RHS of an atomic load. */
4161 static inline void
4162 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4164 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4165 g->gimple_omp_atomic_load.rhs = rhs;
4169 /* Get the RHS of an atomic load. */
4171 static inline tree
4172 gimple_omp_atomic_load_rhs (const_gimple g)
4174 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4175 return g->gimple_omp_atomic_load.rhs;
4179 /* Return a pointer to the RHS of an atomic load. */
4181 static inline tree *
4182 gimple_omp_atomic_load_rhs_ptr (gimple g)
4184 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4185 return &g->gimple_omp_atomic_load.rhs;
4189 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4191 static inline tree
4192 gimple_omp_continue_control_def (const_gimple g)
4194 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4195 return g->gimple_omp_continue.control_def;
4198 /* The same as above, but return the address. */
4200 static inline tree *
4201 gimple_omp_continue_control_def_ptr (gimple g)
4203 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4204 return &g->gimple_omp_continue.control_def;
4207 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4209 static inline void
4210 gimple_omp_continue_set_control_def (gimple g, tree def)
4212 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4213 g->gimple_omp_continue.control_def = def;
4217 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4219 static inline tree
4220 gimple_omp_continue_control_use (const_gimple g)
4222 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4223 return g->gimple_omp_continue.control_use;
4227 /* The same as above, but return the address. */
4229 static inline tree *
4230 gimple_omp_continue_control_use_ptr (gimple g)
4232 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4233 return &g->gimple_omp_continue.control_use;
4237 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4239 static inline void
4240 gimple_omp_continue_set_control_use (gimple g, tree use)
4242 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4243 g->gimple_omp_continue.control_use = use;
4247 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4249 static inline tree *
4250 gimple_return_retval_ptr (const_gimple gs)
4252 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4253 gcc_assert (gimple_num_ops (gs) == 1);
4254 return gimple_op_ptr (gs, 0);
4257 /* Return the return value for GIMPLE_RETURN GS. */
4259 static inline tree
4260 gimple_return_retval (const_gimple gs)
4262 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4263 gcc_assert (gimple_num_ops (gs) == 1);
4264 return gimple_op (gs, 0);
4268 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4270 static inline void
4271 gimple_return_set_retval (gimple gs, tree retval)
4273 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4274 gcc_assert (gimple_num_ops (gs) == 1);
4275 gcc_assert (retval == NULL_TREE
4276 || TREE_CODE (retval) == RESULT_DECL
4277 || is_gimple_val (retval));
4278 gimple_set_op (gs, 0, retval);
4282 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4284 #define CASE_GIMPLE_OMP \
4285 case GIMPLE_OMP_PARALLEL: \
4286 case GIMPLE_OMP_TASK: \
4287 case GIMPLE_OMP_FOR: \
4288 case GIMPLE_OMP_SECTIONS: \
4289 case GIMPLE_OMP_SECTIONS_SWITCH: \
4290 case GIMPLE_OMP_SINGLE: \
4291 case GIMPLE_OMP_SECTION: \
4292 case GIMPLE_OMP_MASTER: \
4293 case GIMPLE_OMP_ORDERED: \
4294 case GIMPLE_OMP_CRITICAL: \
4295 case GIMPLE_OMP_RETURN: \
4296 case GIMPLE_OMP_ATOMIC_LOAD: \
4297 case GIMPLE_OMP_ATOMIC_STORE: \
4298 case GIMPLE_OMP_CONTINUE
4300 static inline bool
4301 is_gimple_omp (const_gimple stmt)
4303 switch (gimple_code (stmt))
4305 CASE_GIMPLE_OMP:
4306 return true;
4307 default:
4308 return false;
4313 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4315 static inline bool
4316 gimple_nop_p (const_gimple g)
4318 return gimple_code (g) == GIMPLE_NOP;
4322 /* Return true if GS is a GIMPLE_RESX. */
4324 static inline bool
4325 is_gimple_resx (const_gimple gs)
4327 return gimple_code (gs) == GIMPLE_RESX;
4330 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4332 static inline enum br_predictor
4333 gimple_predict_predictor (gimple gs)
4335 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4336 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4340 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4342 static inline void
4343 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4345 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4346 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4347 | (unsigned) predictor;
4351 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4353 static inline enum prediction
4354 gimple_predict_outcome (gimple gs)
4356 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4357 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4361 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4363 static inline void
4364 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4366 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4367 if (outcome == TAKEN)
4368 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4369 else
4370 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4374 /* Return the type of the main expression computed by STMT. Return
4375 void_type_node if the statement computes nothing. */
4377 static inline tree
4378 gimple_expr_type (const_gimple stmt)
4380 enum gimple_code code = gimple_code (stmt);
4382 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4384 tree type;
4385 /* In general we want to pass out a type that can be substituted
4386 for both the RHS and the LHS types if there is a possibly
4387 useless conversion involved. That means returning the
4388 original RHS type as far as we can reconstruct it. */
4389 if (code == GIMPLE_CALL)
4390 type = gimple_call_return_type (stmt);
4391 else
4392 switch (gimple_assign_rhs_code (stmt))
4394 case POINTER_PLUS_EXPR:
4395 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4396 break;
4398 default:
4399 /* As fallback use the type of the LHS. */
4400 type = TREE_TYPE (gimple_get_lhs (stmt));
4401 break;
4403 return type;
4405 else if (code == GIMPLE_COND)
4406 return boolean_type_node;
4407 else
4408 return void_type_node;
4412 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4414 static inline gimple_stmt_iterator
4415 gsi_start (gimple_seq seq)
4417 gimple_stmt_iterator i;
4419 i.ptr = gimple_seq_first (seq);
4420 i.seq = seq;
4421 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4423 return i;
4427 /* Return a new iterator pointing to the first statement in basic block BB. */
4429 static inline gimple_stmt_iterator
4430 gsi_start_bb (basic_block bb)
4432 gimple_stmt_iterator i;
4433 gimple_seq seq;
4435 seq = bb_seq (bb);
4436 i.ptr = gimple_seq_first (seq);
4437 i.seq = seq;
4438 i.bb = bb;
4440 return i;
4444 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4446 static inline gimple_stmt_iterator
4447 gsi_last (gimple_seq seq)
4449 gimple_stmt_iterator i;
4451 i.ptr = gimple_seq_last (seq);
4452 i.seq = seq;
4453 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4455 return i;
4459 /* Return a new iterator pointing to the last statement in basic block BB. */
4461 static inline gimple_stmt_iterator
4462 gsi_last_bb (basic_block bb)
4464 gimple_stmt_iterator i;
4465 gimple_seq seq;
4467 seq = bb_seq (bb);
4468 i.ptr = gimple_seq_last (seq);
4469 i.seq = seq;
4470 i.bb = bb;
4472 return i;
4476 /* Return true if I is at the end of its sequence. */
4478 static inline bool
4479 gsi_end_p (gimple_stmt_iterator i)
4481 return i.ptr == NULL;
4485 /* Return true if I is one statement before the end of its sequence. */
4487 static inline bool
4488 gsi_one_before_end_p (gimple_stmt_iterator i)
4490 return i.ptr != NULL && i.ptr->next == NULL;
4494 /* Advance the iterator to the next gimple statement. */
4496 static inline void
4497 gsi_next (gimple_stmt_iterator *i)
4499 i->ptr = i->ptr->next;
4502 /* Advance the iterator to the previous gimple statement. */
4504 static inline void
4505 gsi_prev (gimple_stmt_iterator *i)
4507 i->ptr = i->ptr->prev;
4510 /* Return the current stmt. */
4512 static inline gimple
4513 gsi_stmt (gimple_stmt_iterator i)
4515 return i.ptr->stmt;
4518 /* Return a block statement iterator that points to the first non-label
4519 statement in block BB. */
4521 static inline gimple_stmt_iterator
4522 gsi_after_labels (basic_block bb)
4524 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4526 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4527 gsi_next (&gsi);
4529 return gsi;
4532 /* Advance the iterator to the next non-debug gimple statement. */
4534 static inline void
4535 gsi_next_nondebug (gimple_stmt_iterator *i)
4539 gsi_next (i);
4541 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4544 /* Advance the iterator to the next non-debug gimple statement. */
4546 static inline void
4547 gsi_prev_nondebug (gimple_stmt_iterator *i)
4551 gsi_prev (i);
4553 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4556 /* Return a new iterator pointing to the first non-debug statement in
4557 basic block BB. */
4559 static inline gimple_stmt_iterator
4560 gsi_start_nondebug_bb (basic_block bb)
4562 gimple_stmt_iterator i = gsi_start_bb (bb);
4564 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4565 gsi_next_nondebug (&i);
4567 return i;
4570 /* Return a new iterator pointing to the last non-debug statement in
4571 basic block BB. */
4573 static inline gimple_stmt_iterator
4574 gsi_last_nondebug_bb (basic_block bb)
4576 gimple_stmt_iterator i = gsi_last_bb (bb);
4578 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4579 gsi_prev_nondebug (&i);
4581 return i;
4584 /* Return a pointer to the current stmt.
4586 NOTE: You may want to use gsi_replace on the iterator itself,
4587 as this performs additional bookkeeping that will not be done
4588 if you simply assign through a pointer returned by gsi_stmt_ptr. */
4590 static inline gimple *
4591 gsi_stmt_ptr (gimple_stmt_iterator *i)
4593 return &i->ptr->stmt;
4597 /* Return the basic block associated with this iterator. */
4599 static inline basic_block
4600 gsi_bb (gimple_stmt_iterator i)
4602 return i.bb;
4606 /* Return the sequence associated with this iterator. */
4608 static inline gimple_seq
4609 gsi_seq (gimple_stmt_iterator i)
4611 return i.seq;
4615 enum gsi_iterator_update
4617 GSI_NEW_STMT, /* Only valid when single statement is added, move
4618 iterator to it. */
4619 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
4620 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
4621 for linking other statements in the same
4622 direction. */
4625 /* In gimple-iterator.c */
4626 gimple_stmt_iterator gsi_start_phis (basic_block);
4627 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
4628 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
4629 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
4630 void gsi_insert_before (gimple_stmt_iterator *, gimple,
4631 enum gsi_iterator_update);
4632 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
4633 enum gsi_iterator_update);
4634 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
4635 enum gsi_iterator_update);
4636 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
4637 enum gsi_iterator_update);
4638 void gsi_insert_after (gimple_stmt_iterator *, gimple,
4639 enum gsi_iterator_update);
4640 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
4641 enum gsi_iterator_update);
4642 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
4643 enum gsi_iterator_update);
4644 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
4645 enum gsi_iterator_update);
4646 void gsi_remove (gimple_stmt_iterator *, bool);
4647 gimple_stmt_iterator gsi_for_stmt (gimple);
4648 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
4649 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
4650 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
4651 void gsi_insert_on_edge (edge, gimple);
4652 void gsi_insert_seq_on_edge (edge, gimple_seq);
4653 basic_block gsi_insert_on_edge_immediate (edge, gimple);
4654 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
4655 void gsi_commit_one_edge_insert (edge, basic_block *);
4656 void gsi_commit_edge_inserts (void);
4657 gimple gimple_call_copy_skip_args (gimple, bitmap);
4660 /* Convenience routines to walk all statements of a gimple function.
4661 Note that this is useful exclusively before the code is converted
4662 into SSA form. Once the program is in SSA form, the standard
4663 operand interface should be used to analyze/modify statements. */
4664 struct walk_stmt_info
4666 /* Points to the current statement being walked. */
4667 gimple_stmt_iterator gsi;
4669 /* Additional data that the callback functions may want to carry
4670 through the recursion. */
4671 void *info;
4673 /* Pointer map used to mark visited tree nodes when calling
4674 walk_tree on each operand. If set to NULL, duplicate tree nodes
4675 will be visited more than once. */
4676 struct pointer_set_t *pset;
4678 /* Indicates whether the operand being examined may be replaced
4679 with something that matches is_gimple_val (if true) or something
4680 slightly more complicated (if false). "Something" technically
4681 means the common subset of is_gimple_lvalue and is_gimple_rhs,
4682 but we never try to form anything more complicated than that, so
4683 we don't bother checking.
4685 Also note that CALLBACK should update this flag while walking the
4686 sub-expressions of a statement. For instance, when walking the
4687 statement 'foo (&var)', the flag VAL_ONLY will initially be set
4688 to true, however, when walking &var, the operand of that
4689 ADDR_EXPR does not need to be a GIMPLE value. */
4690 bool val_only;
4692 /* True if we are currently walking the LHS of an assignment. */
4693 bool is_lhs;
4695 /* Optional. Set to true by the callback functions if they made any
4696 changes. */
4697 bool changed;
4699 /* True if we're interested in location information. */
4700 bool want_locations;
4702 /* Operand returned by the callbacks. This is set when calling
4703 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
4704 returns non-NULL, this field will contain the tree returned by
4705 the last callback. */
4706 tree callback_result;
4709 /* Callback for walk_gimple_stmt. Called for every statement found
4710 during traversal. The first argument points to the statement to
4711 walk. The second argument is a flag that the callback sets to
4712 'true' if it the callback handled all the operands and
4713 sub-statements of the statement (the default value of this flag is
4714 'false'). The third argument is an anonymous pointer to data
4715 to be used by the callback. */
4716 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
4717 struct walk_stmt_info *);
4719 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
4720 struct walk_stmt_info *);
4721 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
4722 struct walk_stmt_info *);
4723 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
4725 #ifdef GATHER_STATISTICS
4726 /* Enum and arrays used for allocation stats. Keep in sync with
4727 gimple.c:gimple_alloc_kind_names. */
4728 enum gimple_alloc_kind
4730 gimple_alloc_kind_assign, /* Assignments. */
4731 gimple_alloc_kind_phi, /* PHI nodes. */
4732 gimple_alloc_kind_cond, /* Conditionals. */
4733 gimple_alloc_kind_seq, /* Sequences. */
4734 gimple_alloc_kind_rest, /* Everything else. */
4735 gimple_alloc_kind_all
4738 extern int gimple_alloc_counts[];
4739 extern int gimple_alloc_sizes[];
4741 /* Return the allocation kind for a given stmt CODE. */
4742 static inline enum gimple_alloc_kind
4743 gimple_alloc_kind (enum gimple_code code)
4745 switch (code)
4747 case GIMPLE_ASSIGN:
4748 return gimple_alloc_kind_assign;
4749 case GIMPLE_PHI:
4750 return gimple_alloc_kind_phi;
4751 case GIMPLE_COND:
4752 return gimple_alloc_kind_cond;
4753 default:
4754 return gimple_alloc_kind_rest;
4757 #endif /* GATHER_STATISTICS */
4759 extern void dump_gimple_statistics (void);
4761 #endif /* GCC_GIMPLE_H */