Enable dumping of alias graphs.
[official-gcc/Ramakrishna.git] / gcc / gimple.h
blob97d2c3789ac987fa5f1aaa6f956d1c488c2cc801
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 /* Subcode: EH_FILTER_MUST_NOT_THROW. A boolean flag analogous to
448 the tree counterpart. */
450 /* [ WORD 5 ]
451 Filter types. */
452 tree types;
454 /* [ WORD 6 ]
455 Failure actions. */
456 gimple_seq failure;
460 /* GIMPLE_PHI */
462 struct GTY(()) gimple_statement_phi {
463 /* [ WORD 1-4 ] */
464 struct gimple_statement_base gsbase;
466 /* [ WORD 5 ] */
467 unsigned capacity;
468 unsigned nargs;
470 /* [ WORD 6 ] */
471 tree result;
473 /* [ WORD 7 ] */
474 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
478 /* GIMPLE_RESX */
480 struct GTY(()) gimple_statement_resx {
481 /* [ WORD 1-4 ] */
482 struct gimple_statement_base gsbase;
484 /* [ WORD 5 ]
485 Exception region number. */
486 int region;
490 /* GIMPLE_TRY */
492 struct GTY(()) gimple_statement_try {
493 /* [ WORD 1-4 ] */
494 struct gimple_statement_base gsbase;
496 /* [ WORD 5 ]
497 Expression to evaluate. */
498 gimple_seq eval;
500 /* [ WORD 6 ]
501 Cleanup expression. */
502 gimple_seq cleanup;
505 /* Kind of GIMPLE_TRY statements. */
506 enum gimple_try_flags
508 /* A try/catch. */
509 GIMPLE_TRY_CATCH = 1 << 0,
511 /* A try/finally. */
512 GIMPLE_TRY_FINALLY = 1 << 1,
513 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
515 /* Analogous to TRY_CATCH_IS_CLEANUP. */
516 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
519 /* GIMPLE_WITH_CLEANUP_EXPR */
521 struct GTY(()) gimple_statement_wce {
522 /* [ WORD 1-4 ] */
523 struct gimple_statement_base gsbase;
525 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
526 executed if an exception is thrown, not on normal exit of its
527 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
528 in TARGET_EXPRs. */
530 /* [ WORD 5 ]
531 Cleanup expression. */
532 gimple_seq cleanup;
536 /* GIMPLE_ASM */
538 struct GTY(()) gimple_statement_asm
540 /* [ WORD 1-8 ] */
541 struct gimple_statement_with_memory_ops_base membase;
543 /* [ WORD 9 ]
544 __asm__ statement. */
545 const char *string;
547 /* [ WORD 10 ]
548 Number of inputs, outputs and clobbers. */
549 unsigned char ni;
550 unsigned char no;
551 unsigned short nc;
553 /* [ WORD 11 ]
554 Operand vector. NOTE! This must always be the last field
555 of this structure. In particular, this means that this
556 structure cannot be embedded inside another one. */
557 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
560 /* GIMPLE_OMP_CRITICAL */
562 struct GTY(()) gimple_statement_omp_critical {
563 /* [ WORD 1-5 ] */
564 struct gimple_statement_omp omp;
566 /* [ WORD 6 ]
567 Critical section name. */
568 tree name;
572 struct GTY(()) gimple_omp_for_iter {
573 /* Condition code. */
574 enum tree_code cond;
576 /* Index variable. */
577 tree index;
579 /* Initial value. */
580 tree initial;
582 /* Final value. */
583 tree final;
585 /* Increment. */
586 tree incr;
589 /* GIMPLE_OMP_FOR */
591 struct GTY(()) gimple_statement_omp_for {
592 /* [ WORD 1-5 ] */
593 struct gimple_statement_omp omp;
595 /* [ WORD 6 ] */
596 tree clauses;
598 /* [ WORD 7 ]
599 Number of elements in iter array. */
600 size_t collapse;
602 /* [ WORD 8 ] */
603 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
605 /* [ WORD 9 ]
606 Pre-body evaluated before the loop body begins. */
607 gimple_seq pre_body;
611 /* GIMPLE_OMP_PARALLEL */
613 struct GTY(()) gimple_statement_omp_parallel {
614 /* [ WORD 1-5 ] */
615 struct gimple_statement_omp omp;
617 /* [ WORD 6 ]
618 Clauses. */
619 tree clauses;
621 /* [ WORD 7 ]
622 Child function holding the body of the parallel region. */
623 tree child_fn;
625 /* [ WORD 8 ]
626 Shared data argument. */
627 tree data_arg;
631 /* GIMPLE_OMP_TASK */
633 struct GTY(()) gimple_statement_omp_task {
634 /* [ WORD 1-8 ] */
635 struct gimple_statement_omp_parallel par;
637 /* [ WORD 9 ]
638 Child function holding firstprivate initialization if needed. */
639 tree copy_fn;
641 /* [ WORD 10-11 ]
642 Size and alignment in bytes of the argument data block. */
643 tree arg_size;
644 tree arg_align;
648 /* GIMPLE_OMP_SECTION */
649 /* Uses struct gimple_statement_omp. */
652 /* GIMPLE_OMP_SECTIONS */
654 struct GTY(()) gimple_statement_omp_sections {
655 /* [ WORD 1-5 ] */
656 struct gimple_statement_omp omp;
658 /* [ WORD 6 ] */
659 tree clauses;
661 /* [ WORD 7 ]
662 The control variable used for deciding which of the sections to
663 execute. */
664 tree control;
667 /* GIMPLE_OMP_CONTINUE.
669 Note: This does not inherit from gimple_statement_omp, because we
670 do not need the body field. */
672 struct GTY(()) gimple_statement_omp_continue {
673 /* [ WORD 1-4 ] */
674 struct gimple_statement_base gsbase;
676 /* [ WORD 5 ] */
677 tree control_def;
679 /* [ WORD 6 ] */
680 tree control_use;
683 /* GIMPLE_OMP_SINGLE */
685 struct GTY(()) gimple_statement_omp_single {
686 /* [ WORD 1-5 ] */
687 struct gimple_statement_omp omp;
689 /* [ WORD 6 ] */
690 tree clauses;
694 /* GIMPLE_OMP_ATOMIC_LOAD.
695 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
696 contains a sequence, which we don't need here. */
698 struct GTY(()) gimple_statement_omp_atomic_load {
699 /* [ WORD 1-4 ] */
700 struct gimple_statement_base gsbase;
702 /* [ WORD 5-6 ] */
703 tree rhs, lhs;
706 /* GIMPLE_OMP_ATOMIC_STORE.
707 See note on GIMPLE_OMP_ATOMIC_LOAD. */
709 struct GTY(()) gimple_statement_omp_atomic_store {
710 /* [ WORD 1-4 ] */
711 struct gimple_statement_base gsbase;
713 /* [ WORD 5 ] */
714 tree val;
717 enum gimple_statement_structure_enum {
718 #define DEFGSSTRUCT(SYM, STRING) SYM,
719 #include "gsstruct.def"
720 #undef DEFGSSTRUCT
721 LAST_GSS_ENUM
725 /* Define the overall contents of a gimple tuple. It may be any of the
726 structures declared above for various types of tuples. */
728 union GTY ((desc ("gimple_statement_structure (&%h)"))) gimple_statement_d {
729 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
730 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
731 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
732 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
733 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
734 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
735 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
736 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
737 struct gimple_statement_resx GTY ((tag ("GSS_RESX"))) gimple_resx;
738 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
739 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
740 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
741 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
742 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
743 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
744 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
745 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
746 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
747 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
748 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
749 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
752 /* In gimple.c. */
753 gimple gimple_build_return (tree);
755 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
756 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
758 void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *);
760 gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
761 tree MEM_STAT_DECL);
762 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
763 gimple_build_assign_with_ops_stat (c, o1, o2, o3 MEM_STAT_INFO)
765 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
766 #define gimple_build_debug_bind(var,val,stmt) \
767 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
769 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
770 gimple gimple_build_call (tree, unsigned, ...);
771 gimple gimple_build_call_from_tree (tree);
772 gimple gimplify_assign (tree, tree, gimple_seq *);
773 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
774 gimple gimple_build_label (tree label);
775 gimple gimple_build_goto (tree dest);
776 gimple gimple_build_nop (void);
777 gimple gimple_build_bind (tree, gimple_seq, tree);
778 gimple gimple_build_asm (const char *, unsigned, unsigned, unsigned, ...);
779 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
780 VEC(tree,gc) *);
781 gimple gimple_build_catch (tree, gimple_seq);
782 gimple gimple_build_eh_filter (tree, gimple_seq);
783 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
784 gimple gimple_build_wce (gimple_seq);
785 gimple gimple_build_resx (int);
786 gimple gimple_build_switch (unsigned, tree, tree, ...);
787 gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
788 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
789 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
790 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
791 gimple gimple_build_omp_critical (gimple_seq, tree);
792 gimple gimple_build_omp_section (gimple_seq);
793 gimple gimple_build_omp_continue (tree, tree);
794 gimple gimple_build_omp_master (gimple_seq);
795 gimple gimple_build_omp_return (bool);
796 gimple gimple_build_omp_ordered (gimple_seq);
797 gimple gimple_build_omp_sections (gimple_seq, tree);
798 gimple gimple_build_omp_sections_switch (void);
799 gimple gimple_build_omp_single (gimple_seq, tree);
800 gimple gimple_build_cdt (tree, tree);
801 gimple gimple_build_omp_atomic_load (tree, tree);
802 gimple gimple_build_omp_atomic_store (tree);
803 gimple gimple_build_predict (enum br_predictor, enum prediction);
804 enum gimple_statement_structure_enum gimple_statement_structure (gimple);
805 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
806 void sort_case_labels (VEC(tree,heap) *);
807 void gimple_set_body (tree, gimple_seq);
808 gimple_seq gimple_body (tree);
809 bool gimple_has_body_p (tree);
810 gimple_seq gimple_seq_alloc (void);
811 void gimple_seq_free (gimple_seq);
812 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
813 gimple_seq gimple_seq_copy (gimple_seq);
814 int gimple_call_flags (const_gimple);
815 bool gimple_assign_copy_p (gimple);
816 bool gimple_assign_ssa_name_copy_p (gimple);
817 bool gimple_assign_single_p (gimple);
818 bool gimple_assign_unary_nop_p (gimple);
819 void gimple_set_bb (gimple, struct basic_block_def *);
820 tree gimple_fold (const_gimple);
821 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
822 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
823 tree, tree);
824 tree gimple_get_lhs (const_gimple);
825 void gimple_set_lhs (gimple, tree);
826 gimple gimple_copy (gimple);
827 bool is_gimple_operand (const_tree);
828 void gimple_set_modified (gimple, bool);
829 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
830 gimple gimple_build_cond_from_tree (tree, tree, tree);
831 void gimple_cond_set_condition_from_tree (gimple, tree);
832 bool gimple_has_side_effects (const_gimple);
833 bool gimple_rhs_has_side_effects (const_gimple);
834 bool gimple_could_trap_p (gimple);
835 bool gimple_assign_rhs_could_trap_p (gimple);
836 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
837 bool empty_body_p (gimple_seq);
838 unsigned get_gimple_rhs_num_ops (enum tree_code);
839 const char *gimple_decl_printable_name (tree, int);
840 tree gimple_fold_obj_type_ref (tree, tree);
842 /* Returns true iff T is a valid GIMPLE statement. */
843 extern bool is_gimple_stmt (tree);
845 /* Returns true iff TYPE is a valid type for a scalar register variable. */
846 extern bool is_gimple_reg_type (tree);
847 /* Returns true iff T is a scalar register variable. */
848 extern bool is_gimple_reg (tree);
849 /* Returns true iff T is any sort of variable. */
850 extern bool is_gimple_variable (tree);
851 /* Returns true iff T is any sort of symbol. */
852 extern bool is_gimple_id (tree);
853 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
854 extern bool is_gimple_min_lval (tree);
855 /* Returns true iff T is something whose address can be taken. */
856 extern bool is_gimple_addressable (tree);
857 /* Returns true iff T is any valid GIMPLE lvalue. */
858 extern bool is_gimple_lvalue (tree);
860 /* Returns true iff T is a GIMPLE address. */
861 bool is_gimple_address (const_tree);
862 /* Returns true iff T is a GIMPLE invariant address. */
863 bool is_gimple_invariant_address (const_tree);
864 /* Returns true iff T is a GIMPLE invariant address at interprocedural
865 level. */
866 bool is_gimple_ip_invariant_address (const_tree);
867 /* Returns true iff T is a valid GIMPLE constant. */
868 bool is_gimple_constant (const_tree);
869 /* Returns true iff T is a GIMPLE restricted function invariant. */
870 extern bool is_gimple_min_invariant (const_tree);
871 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
872 extern bool is_gimple_ip_invariant (const_tree);
873 /* Returns true iff T is a GIMPLE rvalue. */
874 extern bool is_gimple_val (tree);
875 /* Returns true iff T is a GIMPLE asm statement input. */
876 extern bool is_gimple_asm_val (tree);
877 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
878 GIMPLE temporary, a renamed user variable, or something else,
879 respectively. */
880 extern bool is_gimple_reg_rhs (tree);
881 extern bool is_gimple_mem_rhs (tree);
883 /* Returns true iff T is a valid if-statement condition. */
884 extern bool is_gimple_condexpr (tree);
886 /* Returns true iff T is a type conversion. */
887 extern bool is_gimple_cast (tree);
888 /* Returns true iff T is a variable that does not need to live in memory. */
889 extern bool is_gimple_non_addressable (tree t);
891 /* Returns true iff T is a valid call address expression. */
892 extern bool is_gimple_call_addr (tree);
893 /* If T makes a function call, returns the CALL_EXPR operand. */
894 extern tree get_call_expr_in (tree t);
896 extern void recalculate_side_effects (tree);
897 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
898 unsigned *);
899 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
900 bool (*)(gimple, tree, void *),
901 bool (*)(gimple, tree, void *),
902 bool (*)(gimple, tree, void *));
903 extern bool walk_stmt_load_store_ops (gimple, void *,
904 bool (*)(gimple, tree, void *),
905 bool (*)(gimple, tree, void *));
906 extern bool gimple_ior_addresses_taken (bitmap, gimple);
908 /* In gimplify.c */
909 extern tree create_tmp_var_raw (tree, const char *);
910 extern tree create_tmp_var_name (const char *);
911 extern tree create_tmp_var (tree, const char *);
912 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
913 extern tree get_formal_tmp_var (tree, gimple_seq *);
914 extern void declare_vars (tree, gimple, bool);
915 extern void tree_annotate_all_with_location (tree *, location_t);
916 extern void annotate_all_with_location (gimple_seq, location_t);
918 /* Validation of GIMPLE expressions. Note that these predicates only check
919 the basic form of the expression, they don't recurse to make sure that
920 underlying nodes are also of the right form. */
921 typedef bool (*gimple_predicate)(tree);
924 /* FIXME we should deduce this from the predicate. */
925 enum fallback {
926 fb_none = 0, /* Do not generate a temporary. */
928 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
929 gimplified expression. */
931 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
932 gimplified expression. */
934 fb_mayfail = 4, /* Gimplification may fail. Error issued
935 afterwards. */
936 fb_either= fb_rvalue | fb_lvalue
939 typedef int fallback_t;
941 enum gimplify_status {
942 GS_ERROR = -2, /* Something Bad Seen. */
943 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
944 GS_OK = 0, /* We did something, maybe more to do. */
945 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
948 struct gimplify_ctx
950 struct gimplify_ctx *prev_context;
952 VEC(gimple,heap) *bind_expr_stack;
953 tree temps;
954 gimple_seq conditional_cleanups;
955 tree exit_label;
956 tree return_temp;
958 VEC(tree,heap) *case_labels;
959 /* The formal temporary table. Should this be persistent? */
960 htab_t temp_htab;
962 int conditions;
963 bool save_stack;
964 bool into_ssa;
965 bool allow_rhs_cond_expr;
968 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
969 bool (*) (tree), fallback_t);
970 extern void gimplify_type_sizes (tree, gimple_seq *);
971 extern void gimplify_one_sizepos (tree *, gimple_seq *);
972 extern bool gimplify_stmt (tree *, gimple_seq *);
973 extern gimple gimplify_body (tree *, tree, bool);
974 extern void push_gimplify_context (struct gimplify_ctx *);
975 extern void pop_gimplify_context (gimple);
976 extern void gimplify_and_add (tree, gimple_seq *);
978 /* Miscellaneous helpers. */
979 extern void gimple_add_tmp_var (tree);
980 extern gimple gimple_current_bind_expr (void);
981 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
982 extern tree voidify_wrapper_expr (tree, tree);
983 extern tree build_and_jump (tree *);
984 extern tree alloc_stmt_list (void);
985 extern void free_stmt_list (tree);
986 extern tree force_labels_r (tree *, int *, void *);
987 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
988 gimple_seq *);
989 struct gimplify_omp_ctx;
990 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
991 extern tree gimple_boolify (tree);
992 extern gimple_predicate rhs_predicate_for (tree);
993 extern tree canonicalize_cond_expr_cond (tree);
995 /* In omp-low.c. */
996 extern tree omp_reduction_init (tree, tree);
998 /* In tree-nested.c. */
999 extern void lower_nested_functions (tree);
1000 extern void insert_field_into_struct (tree, tree);
1002 /* In gimplify.c. */
1003 extern void gimplify_function_tree (tree);
1005 /* In cfgexpand.c. */
1006 extern tree gimple_assign_rhs_to_tree (gimple);
1008 /* In builtins.c */
1009 extern bool validate_gimple_arglist (const_gimple, ...);
1011 /* In tree-ssa.c */
1012 extern bool tree_ssa_useless_type_conversion (tree);
1013 extern tree tree_ssa_strip_useless_type_conversions (tree);
1014 extern bool useless_type_conversion_p (tree, tree);
1015 extern bool types_compatible_p (tree, tree);
1017 /* Return the code for GIMPLE statement G. */
1019 static inline enum gimple_code
1020 gimple_code (const_gimple g)
1022 return g->gsbase.code;
1026 /* Return true if statement G has sub-statements. This is only true for
1027 High GIMPLE statements. */
1029 static inline bool
1030 gimple_has_substatements (gimple g)
1032 switch (gimple_code (g))
1034 case GIMPLE_BIND:
1035 case GIMPLE_CATCH:
1036 case GIMPLE_EH_FILTER:
1037 case GIMPLE_TRY:
1038 case GIMPLE_OMP_FOR:
1039 case GIMPLE_OMP_MASTER:
1040 case GIMPLE_OMP_ORDERED:
1041 case GIMPLE_OMP_SECTION:
1042 case GIMPLE_OMP_PARALLEL:
1043 case GIMPLE_OMP_TASK:
1044 case GIMPLE_OMP_SECTIONS:
1045 case GIMPLE_OMP_SINGLE:
1046 case GIMPLE_OMP_CRITICAL:
1047 case GIMPLE_WITH_CLEANUP_EXPR:
1048 return true;
1050 default:
1051 return false;
1056 /* Return the basic block holding statement G. */
1058 static inline struct basic_block_def *
1059 gimple_bb (const_gimple g)
1061 return g->gsbase.bb;
1065 /* Return the lexical scope block holding statement G. */
1067 static inline tree
1068 gimple_block (const_gimple g)
1070 return g->gsbase.block;
1074 /* Set BLOCK to be the lexical scope block holding statement G. */
1076 static inline void
1077 gimple_set_block (gimple g, tree block)
1079 g->gsbase.block = block;
1083 /* Return location information for statement G. */
1085 static inline location_t
1086 gimple_location (const_gimple g)
1088 return g->gsbase.location;
1091 /* Return pointer to location information for statement G. */
1093 static inline const location_t *
1094 gimple_location_ptr (const_gimple g)
1096 return &g->gsbase.location;
1100 /* Set location information for statement G. */
1102 static inline void
1103 gimple_set_location (gimple g, location_t location)
1105 g->gsbase.location = location;
1109 /* Return true if G contains location information. */
1111 static inline bool
1112 gimple_has_location (const_gimple g)
1114 return gimple_location (g) != UNKNOWN_LOCATION;
1118 /* Return the file name of the location of STMT. */
1120 static inline const char *
1121 gimple_filename (const_gimple stmt)
1123 return LOCATION_FILE (gimple_location (stmt));
1127 /* Return the line number of the location of STMT. */
1129 static inline int
1130 gimple_lineno (const_gimple stmt)
1132 return LOCATION_LINE (gimple_location (stmt));
1136 /* Determine whether SEQ is a singleton. */
1138 static inline bool
1139 gimple_seq_singleton_p (gimple_seq seq)
1141 return ((gimple_seq_first (seq) != NULL)
1142 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1145 /* Return true if no warnings should be emitted for statement STMT. */
1147 static inline bool
1148 gimple_no_warning_p (const_gimple stmt)
1150 return stmt->gsbase.no_warning;
1153 /* Set the no_warning flag of STMT to NO_WARNING. */
1155 static inline void
1156 gimple_set_no_warning (gimple stmt, bool no_warning)
1158 stmt->gsbase.no_warning = (unsigned) no_warning;
1161 /* Set the visited status on statement STMT to VISITED_P. */
1163 static inline void
1164 gimple_set_visited (gimple stmt, bool visited_p)
1166 stmt->gsbase.visited = (unsigned) visited_p;
1170 /* Return the visited status for statement STMT. */
1172 static inline bool
1173 gimple_visited_p (gimple stmt)
1175 return stmt->gsbase.visited;
1179 /* Set pass local flag PLF on statement STMT to VAL_P. */
1181 static inline void
1182 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1184 if (val_p)
1185 stmt->gsbase.plf |= (unsigned int) plf;
1186 else
1187 stmt->gsbase.plf &= ~((unsigned int) plf);
1191 /* Return the value of pass local flag PLF on statement STMT. */
1193 static inline unsigned int
1194 gimple_plf (gimple stmt, enum plf_mask plf)
1196 return stmt->gsbase.plf & ((unsigned int) plf);
1200 /* Set the UID of statement. */
1202 static inline void
1203 gimple_set_uid (gimple g, unsigned uid)
1205 g->gsbase.uid = uid;
1209 /* Return the UID of statement. */
1211 static inline unsigned
1212 gimple_uid (const_gimple g)
1214 return g->gsbase.uid;
1218 /* Return true if GIMPLE statement G has register or memory operands. */
1220 static inline bool
1221 gimple_has_ops (const_gimple g)
1223 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1227 /* Return true if GIMPLE statement G has memory operands. */
1229 static inline bool
1230 gimple_has_mem_ops (const_gimple g)
1232 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1236 /* Return the set of DEF operands for statement G. */
1238 static inline struct def_optype_d *
1239 gimple_def_ops (const_gimple g)
1241 if (!gimple_has_ops (g))
1242 return NULL;
1243 return g->gsops.opbase.def_ops;
1247 /* Set DEF to be the set of DEF operands for statement G. */
1249 static inline void
1250 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1252 gcc_assert (gimple_has_ops (g));
1253 g->gsops.opbase.def_ops = def;
1257 /* Return the set of USE operands for statement G. */
1259 static inline struct use_optype_d *
1260 gimple_use_ops (const_gimple g)
1262 if (!gimple_has_ops (g))
1263 return NULL;
1264 return g->gsops.opbase.use_ops;
1268 /* Set USE to be the set of USE operands for statement G. */
1270 static inline void
1271 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1273 gcc_assert (gimple_has_ops (g));
1274 g->gsops.opbase.use_ops = use;
1278 /* Return the set of VUSE operand for statement G. */
1280 static inline use_operand_p
1281 gimple_vuse_op (const_gimple g)
1283 struct use_optype_d *ops;
1284 if (!gimple_has_mem_ops (g))
1285 return NULL_USE_OPERAND_P;
1286 ops = g->gsops.opbase.use_ops;
1287 if (ops
1288 && USE_OP_PTR (ops)->use == &g->gsmem.membase.vuse)
1289 return USE_OP_PTR (ops);
1290 return NULL_USE_OPERAND_P;
1293 /* Return the set of VDEF operand for statement G. */
1295 static inline def_operand_p
1296 gimple_vdef_op (const_gimple g)
1298 struct def_optype_d *ops;
1299 if (!gimple_has_mem_ops (g))
1300 return NULL_DEF_OPERAND_P;
1301 ops = g->gsops.opbase.def_ops;
1302 if (ops
1303 && DEF_OP_PTR (ops) == &g->gsmem.membase.vdef)
1304 return DEF_OP_PTR (ops);
1305 return NULL_DEF_OPERAND_P;
1309 /* Return the single VUSE operand of the statement G. */
1311 static inline tree
1312 gimple_vuse (const_gimple g)
1314 if (!gimple_has_mem_ops (g))
1315 return NULL_TREE;
1316 return g->gsmem.membase.vuse;
1319 /* Return the single VDEF operand of the statement G. */
1321 static inline tree
1322 gimple_vdef (const_gimple g)
1324 if (!gimple_has_mem_ops (g))
1325 return NULL_TREE;
1326 return g->gsmem.membase.vdef;
1329 /* Return the single VUSE operand of the statement G. */
1331 static inline tree *
1332 gimple_vuse_ptr (gimple g)
1334 if (!gimple_has_mem_ops (g))
1335 return NULL;
1336 return &g->gsmem.membase.vuse;
1339 /* Return the single VDEF operand of the statement G. */
1341 static inline tree *
1342 gimple_vdef_ptr (gimple g)
1344 if (!gimple_has_mem_ops (g))
1345 return NULL;
1346 return &g->gsmem.membase.vdef;
1349 /* Set the single VUSE operand of the statement G. */
1351 static inline void
1352 gimple_set_vuse (gimple g, tree vuse)
1354 gcc_assert (gimple_has_mem_ops (g));
1355 g->gsmem.membase.vuse = vuse;
1358 /* Set the single VDEF operand of the statement G. */
1360 static inline void
1361 gimple_set_vdef (gimple g, tree vdef)
1363 gcc_assert (gimple_has_mem_ops (g));
1364 g->gsmem.membase.vdef = vdef;
1368 /* Return true if statement G has operands and the modified field has
1369 been set. */
1371 static inline bool
1372 gimple_modified_p (const_gimple g)
1374 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1378 /* Return the tree code for the expression computed by STMT. This is
1379 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1380 GIMPLE_CALL, return CALL_EXPR as the expression code for
1381 consistency. This is useful when the caller needs to deal with the
1382 three kinds of computation that GIMPLE supports. */
1384 static inline enum tree_code
1385 gimple_expr_code (const_gimple stmt)
1387 enum gimple_code code = gimple_code (stmt);
1388 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1389 return (enum tree_code) stmt->gsbase.subcode;
1390 else if (code == GIMPLE_CALL)
1391 return CALL_EXPR;
1392 else
1393 gcc_unreachable ();
1397 /* Mark statement S as modified, and update it. */
1399 static inline void
1400 update_stmt (gimple s)
1402 if (gimple_has_ops (s))
1404 gimple_set_modified (s, true);
1405 update_stmt_operands (s);
1409 /* Update statement S if it has been optimized. */
1411 static inline void
1412 update_stmt_if_modified (gimple s)
1414 if (gimple_modified_p (s))
1415 update_stmt_operands (s);
1418 /* Return true if statement STMT contains volatile operands. */
1420 static inline bool
1421 gimple_has_volatile_ops (const_gimple stmt)
1423 if (gimple_has_mem_ops (stmt))
1424 return stmt->gsbase.has_volatile_ops;
1425 else
1426 return false;
1430 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1432 static inline void
1433 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1435 if (gimple_has_mem_ops (stmt))
1436 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1440 /* Return true if statement STMT may access memory. */
1442 static inline bool
1443 gimple_references_memory_p (gimple stmt)
1445 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1449 /* Return the subcode for OMP statement S. */
1451 static inline unsigned
1452 gimple_omp_subcode (const_gimple s)
1454 gcc_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1455 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1456 return s->gsbase.subcode;
1459 /* Set the subcode for OMP statement S to SUBCODE. */
1461 static inline void
1462 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1464 /* We only have 16 bits for the subcode. Assert that we are not
1465 overflowing it. */
1466 gcc_assert (subcode < (1 << 16));
1467 s->gsbase.subcode = subcode;
1470 /* Set the nowait flag on OMP_RETURN statement S. */
1472 static inline void
1473 gimple_omp_return_set_nowait (gimple s)
1475 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1476 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1480 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1481 flag set. */
1483 static inline bool
1484 gimple_omp_return_nowait_p (const_gimple g)
1486 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1487 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1491 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1492 flag set. */
1494 static inline bool
1495 gimple_omp_section_last_p (const_gimple g)
1497 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1498 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1502 /* Set the GF_OMP_SECTION_LAST flag on G. */
1504 static inline void
1505 gimple_omp_section_set_last (gimple g)
1507 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1508 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1512 /* Return true if OMP parallel statement G has the
1513 GF_OMP_PARALLEL_COMBINED flag set. */
1515 static inline bool
1516 gimple_omp_parallel_combined_p (const_gimple g)
1518 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1519 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1523 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1524 value of COMBINED_P. */
1526 static inline void
1527 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1529 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1530 if (combined_p)
1531 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1532 else
1533 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1537 /* Return the number of operands for statement GS. */
1539 static inline unsigned
1540 gimple_num_ops (const_gimple gs)
1542 return gs->gsbase.num_ops;
1546 /* Set the number of operands for statement GS. */
1548 static inline void
1549 gimple_set_num_ops (gimple gs, unsigned num_ops)
1551 gs->gsbase.num_ops = num_ops;
1555 /* Return the array of operands for statement GS. */
1557 static inline tree *
1558 gimple_ops (gimple gs)
1560 /* Offset in bytes to the location of the operand vector in every
1561 tuple structure. Defined in gimple.c */
1562 extern size_t const gimple_ops_offset_[];
1564 if (!gimple_has_ops (gs))
1565 return NULL;
1567 /* All the tuples have their operand vector at the very bottom
1568 of the structure. */
1569 return ((tree *) ((char *) gs + gimple_ops_offset_[gimple_code (gs)]));
1573 /* Return operand I for statement GS. */
1575 static inline tree
1576 gimple_op (const_gimple gs, unsigned i)
1578 if (gimple_has_ops (gs))
1580 gcc_assert (i < gimple_num_ops (gs));
1581 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1583 else
1584 return NULL_TREE;
1587 /* Return a pointer to operand I for statement GS. */
1589 static inline tree *
1590 gimple_op_ptr (const_gimple gs, unsigned i)
1592 if (gimple_has_ops (gs))
1594 gcc_assert (i < gimple_num_ops (gs));
1595 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1597 else
1598 return NULL;
1601 /* Set operand I of statement GS to OP. */
1603 static inline void
1604 gimple_set_op (gimple gs, unsigned i, tree op)
1606 gcc_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1608 /* Note. It may be tempting to assert that OP matches
1609 is_gimple_operand, but that would be wrong. Different tuples
1610 accept slightly different sets of tree operands. Each caller
1611 should perform its own validation. */
1612 gimple_ops (gs)[i] = op;
1615 /* Return true if GS is a GIMPLE_ASSIGN. */
1617 static inline bool
1618 is_gimple_assign (const_gimple gs)
1620 return gimple_code (gs) == GIMPLE_ASSIGN;
1623 /* Determine if expression CODE is one of the valid expressions that can
1624 be used on the RHS of GIMPLE assignments. */
1626 static inline enum gimple_rhs_class
1627 get_gimple_rhs_class (enum tree_code code)
1629 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1632 /* Return the LHS of assignment statement GS. */
1634 static inline tree
1635 gimple_assign_lhs (const_gimple gs)
1637 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1638 return gimple_op (gs, 0);
1642 /* Return a pointer to the LHS of assignment statement GS. */
1644 static inline tree *
1645 gimple_assign_lhs_ptr (const_gimple gs)
1647 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1648 return gimple_op_ptr (gs, 0);
1652 /* Set LHS to be the LHS operand of assignment statement GS. */
1654 static inline void
1655 gimple_assign_set_lhs (gimple gs, tree lhs)
1657 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1658 gcc_assert (is_gimple_operand (lhs));
1659 gimple_set_op (gs, 0, lhs);
1661 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1662 SSA_NAME_DEF_STMT (lhs) = gs;
1666 /* Return the first operand on the RHS of assignment statement GS. */
1668 static inline tree
1669 gimple_assign_rhs1 (const_gimple gs)
1671 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1672 return gimple_op (gs, 1);
1676 /* Return a pointer to the first operand on the RHS of assignment
1677 statement GS. */
1679 static inline tree *
1680 gimple_assign_rhs1_ptr (const_gimple gs)
1682 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1683 return gimple_op_ptr (gs, 1);
1686 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1688 static inline void
1689 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1691 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1693 /* If there are 3 or more operands, the 2 operands on the RHS must be
1694 GIMPLE values. */
1695 if (gimple_num_ops (gs) >= 3)
1696 gcc_assert (is_gimple_val (rhs));
1697 else
1698 gcc_assert (is_gimple_operand (rhs));
1700 gimple_set_op (gs, 1, rhs);
1704 /* Return the second operand on the RHS of assignment statement GS.
1705 If GS does not have two operands, NULL is returned instead. */
1707 static inline tree
1708 gimple_assign_rhs2 (const_gimple gs)
1710 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1712 if (gimple_num_ops (gs) >= 3)
1713 return gimple_op (gs, 2);
1714 else
1715 return NULL_TREE;
1719 /* Return a pointer to the second operand on the RHS of assignment
1720 statement GS. */
1722 static inline tree *
1723 gimple_assign_rhs2_ptr (const_gimple gs)
1725 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1726 return gimple_op_ptr (gs, 2);
1730 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1732 static inline void
1733 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1735 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1737 /* The 2 operands on the RHS must be GIMPLE values. */
1738 gcc_assert (is_gimple_val (rhs));
1740 gimple_set_op (gs, 2, rhs);
1743 /* Returns true if GS is a nontemporal move. */
1745 static inline bool
1746 gimple_assign_nontemporal_move_p (const_gimple gs)
1748 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1749 return gs->gsbase.nontemporal_move;
1752 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1754 static inline void
1755 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1757 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1758 gs->gsbase.nontemporal_move = nontemporal;
1762 /* Return the code of the expression computed on the rhs of assignment
1763 statement GS. In case that the RHS is a single object, returns the
1764 tree code of the object. */
1766 static inline enum tree_code
1767 gimple_assign_rhs_code (const_gimple gs)
1769 enum tree_code code;
1770 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1772 code = gimple_expr_code (gs);
1773 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1774 code = TREE_CODE (gimple_assign_rhs1 (gs));
1776 return code;
1780 /* Set CODE to be the code for the expression computed on the RHS of
1781 assignment S. */
1783 static inline void
1784 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
1786 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
1787 s->gsbase.subcode = code;
1791 /* Return the gimple rhs class of the code of the expression computed on
1792 the rhs of assignment statement GS.
1793 This will never return GIMPLE_INVALID_RHS. */
1795 static inline enum gimple_rhs_class
1796 gimple_assign_rhs_class (const_gimple gs)
1798 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
1802 /* Return true if S is a type-cast assignment. */
1804 static inline bool
1805 gimple_assign_cast_p (gimple s)
1807 if (is_gimple_assign (s))
1809 enum tree_code sc = gimple_assign_rhs_code (s);
1810 return CONVERT_EXPR_CODE_P (sc)
1811 || sc == VIEW_CONVERT_EXPR
1812 || sc == FIX_TRUNC_EXPR;
1815 return false;
1819 /* Return true if GS is a GIMPLE_CALL. */
1821 static inline bool
1822 is_gimple_call (const_gimple gs)
1824 return gimple_code (gs) == GIMPLE_CALL;
1827 /* Return the LHS of call statement GS. */
1829 static inline tree
1830 gimple_call_lhs (const_gimple gs)
1832 GIMPLE_CHECK (gs, GIMPLE_CALL);
1833 return gimple_op (gs, 0);
1837 /* Return a pointer to the LHS of call statement GS. */
1839 static inline tree *
1840 gimple_call_lhs_ptr (const_gimple gs)
1842 GIMPLE_CHECK (gs, GIMPLE_CALL);
1843 return gimple_op_ptr (gs, 0);
1847 /* Set LHS to be the LHS operand of call statement GS. */
1849 static inline void
1850 gimple_call_set_lhs (gimple gs, tree lhs)
1852 GIMPLE_CHECK (gs, GIMPLE_CALL);
1853 gcc_assert (!lhs || is_gimple_operand (lhs));
1854 gimple_set_op (gs, 0, lhs);
1855 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1856 SSA_NAME_DEF_STMT (lhs) = gs;
1860 /* Return the tree node representing the function called by call
1861 statement GS. */
1863 static inline tree
1864 gimple_call_fn (const_gimple gs)
1866 GIMPLE_CHECK (gs, GIMPLE_CALL);
1867 return gimple_op (gs, 1);
1871 /* Return a pointer to the tree node representing the function called by call
1872 statement GS. */
1874 static inline tree *
1875 gimple_call_fn_ptr (const_gimple gs)
1877 GIMPLE_CHECK (gs, GIMPLE_CALL);
1878 return gimple_op_ptr (gs, 1);
1882 /* Set FN to be the function called by call statement GS. */
1884 static inline void
1885 gimple_call_set_fn (gimple gs, tree fn)
1887 GIMPLE_CHECK (gs, GIMPLE_CALL);
1888 gcc_assert (is_gimple_operand (fn));
1889 gimple_set_op (gs, 1, fn);
1893 /* Set FNDECL to be the function called by call statement GS. */
1895 static inline void
1896 gimple_call_set_fndecl (gimple gs, tree decl)
1898 GIMPLE_CHECK (gs, GIMPLE_CALL);
1899 gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
1900 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
1904 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
1905 Otherwise return NULL. This function is analogous to
1906 get_callee_fndecl in tree land. */
1908 static inline tree
1909 gimple_call_fndecl (const_gimple gs)
1911 tree addr = gimple_call_fn (gs);
1912 if (TREE_CODE (addr) == ADDR_EXPR)
1914 gcc_assert (TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL);
1915 return TREE_OPERAND (addr, 0);
1917 return NULL_TREE;
1921 /* Return the type returned by call statement GS. */
1923 static inline tree
1924 gimple_call_return_type (const_gimple gs)
1926 tree fn = gimple_call_fn (gs);
1927 tree type = TREE_TYPE (fn);
1929 /* See through the pointer. */
1930 gcc_assert (POINTER_TYPE_P (type));
1931 type = TREE_TYPE (type);
1933 gcc_assert (TREE_CODE (type) == FUNCTION_TYPE
1934 || TREE_CODE (type) == METHOD_TYPE);
1936 /* The type returned by a FUNCTION_DECL is the type of its
1937 function type. */
1938 return TREE_TYPE (type);
1942 /* Return the static chain for call statement GS. */
1944 static inline tree
1945 gimple_call_chain (const_gimple gs)
1947 GIMPLE_CHECK (gs, GIMPLE_CALL);
1948 return gimple_op (gs, 2);
1952 /* Return a pointer to the static chain for call statement GS. */
1954 static inline tree *
1955 gimple_call_chain_ptr (const_gimple gs)
1957 GIMPLE_CHECK (gs, GIMPLE_CALL);
1958 return gimple_op_ptr (gs, 2);
1961 /* Set CHAIN to be the static chain for call statement GS. */
1963 static inline void
1964 gimple_call_set_chain (gimple gs, tree chain)
1966 GIMPLE_CHECK (gs, GIMPLE_CALL);
1967 gcc_assert (chain == NULL
1968 || TREE_CODE (chain) == ADDR_EXPR
1969 || SSA_VAR_P (chain));
1970 gimple_set_op (gs, 2, chain);
1974 /* Return the number of arguments used by call statement GS. */
1976 static inline unsigned
1977 gimple_call_num_args (const_gimple gs)
1979 unsigned num_ops;
1980 GIMPLE_CHECK (gs, GIMPLE_CALL);
1981 num_ops = gimple_num_ops (gs);
1982 gcc_assert (num_ops >= 3);
1983 return num_ops - 3;
1987 /* Return the argument at position INDEX for call statement GS. */
1989 static inline tree
1990 gimple_call_arg (const_gimple gs, unsigned index)
1992 GIMPLE_CHECK (gs, GIMPLE_CALL);
1993 return gimple_op (gs, index + 3);
1997 /* Return a pointer to the argument at position INDEX for call
1998 statement GS. */
2000 static inline tree *
2001 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2003 GIMPLE_CHECK (gs, GIMPLE_CALL);
2004 return gimple_op_ptr (gs, index + 3);
2008 /* Set ARG to be the argument at position INDEX for call statement GS. */
2010 static inline void
2011 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2013 GIMPLE_CHECK (gs, GIMPLE_CALL);
2014 gcc_assert (is_gimple_operand (arg));
2015 gimple_set_op (gs, index + 3, arg);
2019 /* If TAIL_P is true, mark call statement S as being a tail call
2020 (i.e., a call just before the exit of a function). These calls are
2021 candidate for tail call optimization. */
2023 static inline void
2024 gimple_call_set_tail (gimple s, bool tail_p)
2026 GIMPLE_CHECK (s, GIMPLE_CALL);
2027 if (tail_p)
2028 s->gsbase.subcode |= GF_CALL_TAILCALL;
2029 else
2030 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2034 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2036 static inline bool
2037 gimple_call_tail_p (gimple s)
2039 GIMPLE_CHECK (s, GIMPLE_CALL);
2040 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2044 /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
2046 static inline void
2047 gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
2049 GIMPLE_CHECK (s, GIMPLE_CALL);
2050 if (inlinable_p)
2051 s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
2052 else
2053 s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
2057 /* Return true if GIMPLE_CALL S cannot be inlined. */
2059 static inline bool
2060 gimple_call_cannot_inline_p (gimple s)
2062 GIMPLE_CHECK (s, GIMPLE_CALL);
2063 return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0;
2067 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2068 slot optimization. This transformation uses the target of the call
2069 expansion as the return slot for calls that return in memory. */
2071 static inline void
2072 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2074 GIMPLE_CHECK (s, GIMPLE_CALL);
2075 if (return_slot_opt_p)
2076 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2077 else
2078 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2082 /* Return true if S is marked for return slot optimization. */
2084 static inline bool
2085 gimple_call_return_slot_opt_p (gimple s)
2087 GIMPLE_CHECK (s, GIMPLE_CALL);
2088 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2092 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2093 thunk to the thunked-to function. */
2095 static inline void
2096 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2098 GIMPLE_CHECK (s, GIMPLE_CALL);
2099 if (from_thunk_p)
2100 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2101 else
2102 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2106 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2108 static inline bool
2109 gimple_call_from_thunk_p (gimple s)
2111 GIMPLE_CHECK (s, GIMPLE_CALL);
2112 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2116 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2117 argument pack in its argument list. */
2119 static inline void
2120 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2122 GIMPLE_CHECK (s, GIMPLE_CALL);
2123 if (pass_arg_pack_p)
2124 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2125 else
2126 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2130 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2131 argument pack in its argument list. */
2133 static inline bool
2134 gimple_call_va_arg_pack_p (gimple s)
2136 GIMPLE_CHECK (s, GIMPLE_CALL);
2137 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2141 /* Return true if S is a noreturn call. */
2143 static inline bool
2144 gimple_call_noreturn_p (gimple s)
2146 GIMPLE_CHECK (s, GIMPLE_CALL);
2147 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2151 /* Return true if S is a nothrow call. */
2153 static inline bool
2154 gimple_call_nothrow_p (gimple s)
2156 GIMPLE_CHECK (s, GIMPLE_CALL);
2157 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2161 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2163 static inline void
2164 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2166 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2167 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2168 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2172 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2173 non-NULL lhs. */
2175 static inline bool
2176 gimple_has_lhs (gimple stmt)
2178 return (is_gimple_assign (stmt)
2179 || (is_gimple_call (stmt)
2180 && gimple_call_lhs (stmt) != NULL_TREE));
2184 /* Return the code of the predicate computed by conditional statement GS. */
2186 static inline enum tree_code
2187 gimple_cond_code (const_gimple gs)
2189 GIMPLE_CHECK (gs, GIMPLE_COND);
2190 return (enum tree_code) gs->gsbase.subcode;
2194 /* Set CODE to be the predicate code for the conditional statement GS. */
2196 static inline void
2197 gimple_cond_set_code (gimple gs, enum tree_code code)
2199 GIMPLE_CHECK (gs, GIMPLE_COND);
2200 gcc_assert (TREE_CODE_CLASS (code) == tcc_comparison);
2201 gs->gsbase.subcode = code;
2205 /* Return the LHS of the predicate computed by conditional statement GS. */
2207 static inline tree
2208 gimple_cond_lhs (const_gimple gs)
2210 GIMPLE_CHECK (gs, GIMPLE_COND);
2211 return gimple_op (gs, 0);
2214 /* Return the pointer to the LHS of the predicate computed by conditional
2215 statement GS. */
2217 static inline tree *
2218 gimple_cond_lhs_ptr (const_gimple gs)
2220 GIMPLE_CHECK (gs, GIMPLE_COND);
2221 return gimple_op_ptr (gs, 0);
2224 /* Set LHS to be the LHS operand of the predicate computed by
2225 conditional statement GS. */
2227 static inline void
2228 gimple_cond_set_lhs (gimple gs, tree lhs)
2230 GIMPLE_CHECK (gs, GIMPLE_COND);
2231 gcc_assert (is_gimple_operand (lhs));
2232 gimple_set_op (gs, 0, lhs);
2236 /* Return the RHS operand of the predicate computed by conditional GS. */
2238 static inline tree
2239 gimple_cond_rhs (const_gimple gs)
2241 GIMPLE_CHECK (gs, GIMPLE_COND);
2242 return gimple_op (gs, 1);
2245 /* Return the pointer to the RHS operand of the predicate computed by
2246 conditional GS. */
2248 static inline tree *
2249 gimple_cond_rhs_ptr (const_gimple gs)
2251 GIMPLE_CHECK (gs, GIMPLE_COND);
2252 return gimple_op_ptr (gs, 1);
2256 /* Set RHS to be the RHS operand of the predicate computed by
2257 conditional statement GS. */
2259 static inline void
2260 gimple_cond_set_rhs (gimple gs, tree rhs)
2262 GIMPLE_CHECK (gs, GIMPLE_COND);
2263 gcc_assert (is_gimple_operand (rhs));
2264 gimple_set_op (gs, 1, rhs);
2268 /* Return the label used by conditional statement GS when its
2269 predicate evaluates to true. */
2271 static inline tree
2272 gimple_cond_true_label (const_gimple gs)
2274 GIMPLE_CHECK (gs, GIMPLE_COND);
2275 return gimple_op (gs, 2);
2279 /* Set LABEL to be the label used by conditional statement GS when its
2280 predicate evaluates to true. */
2282 static inline void
2283 gimple_cond_set_true_label (gimple gs, tree label)
2285 GIMPLE_CHECK (gs, GIMPLE_COND);
2286 gcc_assert (!label || TREE_CODE (label) == LABEL_DECL);
2287 gimple_set_op (gs, 2, label);
2291 /* Set LABEL to be the label used by conditional statement GS when its
2292 predicate evaluates to false. */
2294 static inline void
2295 gimple_cond_set_false_label (gimple gs, tree label)
2297 GIMPLE_CHECK (gs, GIMPLE_COND);
2298 gcc_assert (!label || TREE_CODE (label) == LABEL_DECL);
2299 gimple_set_op (gs, 3, label);
2303 /* Return the label used by conditional statement GS when its
2304 predicate evaluates to false. */
2306 static inline tree
2307 gimple_cond_false_label (const_gimple gs)
2309 GIMPLE_CHECK (gs, GIMPLE_COND);
2310 return gimple_op (gs, 3);
2314 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2316 static inline void
2317 gimple_cond_make_false (gimple gs)
2319 gimple_cond_set_lhs (gs, boolean_true_node);
2320 gimple_cond_set_rhs (gs, boolean_false_node);
2321 gs->gsbase.subcode = EQ_EXPR;
2325 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2327 static inline void
2328 gimple_cond_make_true (gimple gs)
2330 gimple_cond_set_lhs (gs, boolean_true_node);
2331 gimple_cond_set_rhs (gs, boolean_true_node);
2332 gs->gsbase.subcode = EQ_EXPR;
2335 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2336 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2338 static inline bool
2339 gimple_cond_true_p (const_gimple gs)
2341 tree lhs = gimple_cond_lhs (gs);
2342 tree rhs = gimple_cond_rhs (gs);
2343 enum tree_code code = gimple_cond_code (gs);
2345 if (lhs != boolean_true_node && lhs != boolean_false_node)
2346 return false;
2348 if (rhs != boolean_true_node && rhs != boolean_false_node)
2349 return false;
2351 if (code == NE_EXPR && lhs != rhs)
2352 return true;
2354 if (code == EQ_EXPR && lhs == rhs)
2355 return true;
2357 return false;
2360 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2361 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2363 static inline bool
2364 gimple_cond_false_p (const_gimple gs)
2366 tree lhs = gimple_cond_lhs (gs);
2367 tree rhs = gimple_cond_rhs (gs);
2368 enum tree_code code = gimple_cond_code (gs);
2370 if (lhs != boolean_true_node && lhs != boolean_false_node)
2371 return false;
2373 if (rhs != boolean_true_node && rhs != boolean_false_node)
2374 return false;
2376 if (code == NE_EXPR && lhs == rhs)
2377 return true;
2379 if (code == EQ_EXPR && lhs != rhs)
2380 return true;
2382 return false;
2385 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2386 'if (var == 1)' */
2388 static inline bool
2389 gimple_cond_single_var_p (gimple gs)
2391 if (gimple_cond_code (gs) == NE_EXPR
2392 && gimple_cond_rhs (gs) == boolean_false_node)
2393 return true;
2395 if (gimple_cond_code (gs) == EQ_EXPR
2396 && gimple_cond_rhs (gs) == boolean_true_node)
2397 return true;
2399 return false;
2402 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2404 static inline void
2405 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2407 gimple_cond_set_code (stmt, code);
2408 gimple_cond_set_lhs (stmt, lhs);
2409 gimple_cond_set_rhs (stmt, rhs);
2412 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2414 static inline tree
2415 gimple_label_label (const_gimple gs)
2417 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2418 return gimple_op (gs, 0);
2422 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2423 GS. */
2425 static inline void
2426 gimple_label_set_label (gimple gs, tree label)
2428 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2429 gcc_assert (TREE_CODE (label) == LABEL_DECL);
2430 gimple_set_op (gs, 0, label);
2434 /* Return the destination of the unconditional jump GS. */
2436 static inline tree
2437 gimple_goto_dest (const_gimple gs)
2439 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2440 return gimple_op (gs, 0);
2444 /* Set DEST to be the destination of the unconditonal jump GS. */
2446 static inline void
2447 gimple_goto_set_dest (gimple gs, tree dest)
2449 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2450 gcc_assert (is_gimple_operand (dest));
2451 gimple_set_op (gs, 0, dest);
2455 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2457 static inline tree
2458 gimple_bind_vars (const_gimple gs)
2460 GIMPLE_CHECK (gs, GIMPLE_BIND);
2461 return gs->gimple_bind.vars;
2465 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2466 statement GS. */
2468 static inline void
2469 gimple_bind_set_vars (gimple gs, tree vars)
2471 GIMPLE_CHECK (gs, GIMPLE_BIND);
2472 gs->gimple_bind.vars = vars;
2476 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2477 statement GS. */
2479 static inline void
2480 gimple_bind_append_vars (gimple gs, tree vars)
2482 GIMPLE_CHECK (gs, GIMPLE_BIND);
2483 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2487 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2489 static inline gimple_seq
2490 gimple_bind_body (gimple gs)
2492 GIMPLE_CHECK (gs, GIMPLE_BIND);
2493 return gs->gimple_bind.body;
2497 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2498 statement GS. */
2500 static inline void
2501 gimple_bind_set_body (gimple gs, gimple_seq seq)
2503 GIMPLE_CHECK (gs, GIMPLE_BIND);
2504 gs->gimple_bind.body = seq;
2508 /* Append a statement to the end of a GIMPLE_BIND's body. */
2510 static inline void
2511 gimple_bind_add_stmt (gimple gs, gimple stmt)
2513 GIMPLE_CHECK (gs, GIMPLE_BIND);
2514 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2518 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2520 static inline void
2521 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2523 GIMPLE_CHECK (gs, GIMPLE_BIND);
2524 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2528 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2529 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2531 static inline tree
2532 gimple_bind_block (const_gimple gs)
2534 GIMPLE_CHECK (gs, GIMPLE_BIND);
2535 return gs->gimple_bind.block;
2539 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2540 statement GS. */
2542 static inline void
2543 gimple_bind_set_block (gimple gs, tree block)
2545 GIMPLE_CHECK (gs, GIMPLE_BIND);
2546 gcc_assert (block == NULL_TREE || TREE_CODE (block) == BLOCK);
2547 gs->gimple_bind.block = block;
2551 /* Return the number of input operands for GIMPLE_ASM GS. */
2553 static inline unsigned
2554 gimple_asm_ninputs (const_gimple gs)
2556 GIMPLE_CHECK (gs, GIMPLE_ASM);
2557 return gs->gimple_asm.ni;
2561 /* Return the number of output operands for GIMPLE_ASM GS. */
2563 static inline unsigned
2564 gimple_asm_noutputs (const_gimple gs)
2566 GIMPLE_CHECK (gs, GIMPLE_ASM);
2567 return gs->gimple_asm.no;
2571 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2573 static inline unsigned
2574 gimple_asm_nclobbers (const_gimple gs)
2576 GIMPLE_CHECK (gs, GIMPLE_ASM);
2577 return gs->gimple_asm.nc;
2581 /* Return input operand INDEX of GIMPLE_ASM GS. */
2583 static inline tree
2584 gimple_asm_input_op (const_gimple gs, unsigned index)
2586 GIMPLE_CHECK (gs, GIMPLE_ASM);
2587 gcc_assert (index <= gs->gimple_asm.ni);
2588 return gimple_op (gs, index);
2591 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2593 static inline tree *
2594 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2596 GIMPLE_CHECK (gs, GIMPLE_ASM);
2597 gcc_assert (index <= gs->gimple_asm.ni);
2598 return gimple_op_ptr (gs, index);
2602 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2604 static inline void
2605 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2607 GIMPLE_CHECK (gs, GIMPLE_ASM);
2608 gcc_assert (index <= gs->gimple_asm.ni);
2609 gcc_assert (TREE_CODE (in_op) == TREE_LIST);
2610 gimple_set_op (gs, index, in_op);
2614 /* Return output operand INDEX of GIMPLE_ASM GS. */
2616 static inline tree
2617 gimple_asm_output_op (const_gimple gs, unsigned index)
2619 GIMPLE_CHECK (gs, GIMPLE_ASM);
2620 gcc_assert (index <= gs->gimple_asm.no);
2621 return gimple_op (gs, index + gs->gimple_asm.ni);
2624 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2626 static inline tree *
2627 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2629 GIMPLE_CHECK (gs, GIMPLE_ASM);
2630 gcc_assert (index <= gs->gimple_asm.no);
2631 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2635 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2637 static inline void
2638 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2640 GIMPLE_CHECK (gs, GIMPLE_ASM);
2641 gcc_assert (index <= gs->gimple_asm.no);
2642 gcc_assert (TREE_CODE (out_op) == TREE_LIST);
2643 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2647 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2649 static inline tree
2650 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2652 GIMPLE_CHECK (gs, GIMPLE_ASM);
2653 gcc_assert (index <= gs->gimple_asm.nc);
2654 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2658 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2660 static inline void
2661 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2663 GIMPLE_CHECK (gs, GIMPLE_ASM);
2664 gcc_assert (index <= gs->gimple_asm.nc);
2665 gcc_assert (TREE_CODE (clobber_op) == TREE_LIST);
2666 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2670 /* Return the string representing the assembly instruction in
2671 GIMPLE_ASM GS. */
2673 static inline const char *
2674 gimple_asm_string (const_gimple gs)
2676 GIMPLE_CHECK (gs, GIMPLE_ASM);
2677 return gs->gimple_asm.string;
2681 /* Return true if GS is an asm statement marked volatile. */
2683 static inline bool
2684 gimple_asm_volatile_p (const_gimple gs)
2686 GIMPLE_CHECK (gs, GIMPLE_ASM);
2687 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
2691 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
2693 static inline void
2694 gimple_asm_set_volatile (gimple gs, bool volatile_p)
2696 GIMPLE_CHECK (gs, GIMPLE_ASM);
2697 if (volatile_p)
2698 gs->gsbase.subcode |= GF_ASM_VOLATILE;
2699 else
2700 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
2704 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
2706 static inline void
2707 gimple_asm_set_input (gimple gs, bool input_p)
2709 GIMPLE_CHECK (gs, GIMPLE_ASM);
2710 if (input_p)
2711 gs->gsbase.subcode |= GF_ASM_INPUT;
2712 else
2713 gs->gsbase.subcode &= ~GF_ASM_INPUT;
2717 /* Return true if asm GS is an ASM_INPUT. */
2719 static inline bool
2720 gimple_asm_input_p (const_gimple gs)
2722 GIMPLE_CHECK (gs, GIMPLE_ASM);
2723 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
2727 /* Return the types handled by GIMPLE_CATCH statement GS. */
2729 static inline tree
2730 gimple_catch_types (const_gimple gs)
2732 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2733 return gs->gimple_catch.types;
2737 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
2739 static inline tree *
2740 gimple_catch_types_ptr (gimple gs)
2742 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2743 return &gs->gimple_catch.types;
2747 /* Return the GIMPLE sequence representing the body of the handler of
2748 GIMPLE_CATCH statement GS. */
2750 static inline gimple_seq
2751 gimple_catch_handler (gimple gs)
2753 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2754 return gs->gimple_catch.handler;
2758 /* Return a pointer to the GIMPLE sequence representing the body of
2759 the handler of GIMPLE_CATCH statement GS. */
2761 static inline gimple_seq *
2762 gimple_catch_handler_ptr (gimple gs)
2764 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2765 return &gs->gimple_catch.handler;
2769 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
2771 static inline void
2772 gimple_catch_set_types (gimple gs, tree t)
2774 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2775 gs->gimple_catch.types = t;
2779 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
2781 static inline void
2782 gimple_catch_set_handler (gimple gs, gimple_seq handler)
2784 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2785 gs->gimple_catch.handler = handler;
2789 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
2791 static inline tree
2792 gimple_eh_filter_types (const_gimple gs)
2794 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2795 return gs->gimple_eh_filter.types;
2799 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
2800 GS. */
2802 static inline tree *
2803 gimple_eh_filter_types_ptr (gimple gs)
2805 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2806 return &gs->gimple_eh_filter.types;
2810 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
2811 statement fails. */
2813 static inline gimple_seq
2814 gimple_eh_filter_failure (gimple gs)
2816 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2817 return gs->gimple_eh_filter.failure;
2821 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
2823 static inline void
2824 gimple_eh_filter_set_types (gimple gs, tree types)
2826 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2827 gs->gimple_eh_filter.types = types;
2831 /* Set FAILURE to be the sequence of statements to execute on failure
2832 for GIMPLE_EH_FILTER GS. */
2834 static inline void
2835 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
2837 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2838 gs->gimple_eh_filter.failure = failure;
2841 /* Return the EH_FILTER_MUST_NOT_THROW flag. */
2843 static inline bool
2845 gimple_eh_filter_must_not_throw (gimple gs)
2847 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2848 return gs->gsbase.subcode != 0;
2851 /* Set the EH_FILTER_MUST_NOT_THROW flag to the value MNTP. */
2853 static inline void
2854 gimple_eh_filter_set_must_not_throw (gimple gs, bool mntp)
2856 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2857 gs->gsbase.subcode = (unsigned int) mntp;
2861 /* GIMPLE_TRY accessors. */
2863 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
2864 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
2866 static inline enum gimple_try_flags
2867 gimple_try_kind (const_gimple gs)
2869 GIMPLE_CHECK (gs, GIMPLE_TRY);
2870 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
2874 /* Set the kind of try block represented by GIMPLE_TRY GS. */
2876 static inline void
2877 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
2879 GIMPLE_CHECK (gs, GIMPLE_TRY);
2880 gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY);
2881 if (gimple_try_kind (gs) != kind)
2882 gs->gsbase.subcode = (unsigned int) kind;
2886 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
2888 static inline bool
2889 gimple_try_catch_is_cleanup (const_gimple gs)
2891 gcc_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
2892 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
2896 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
2898 static inline gimple_seq
2899 gimple_try_eval (gimple gs)
2901 GIMPLE_CHECK (gs, GIMPLE_TRY);
2902 return gs->gimple_try.eval;
2906 /* Return the sequence of statements used as the cleanup body for
2907 GIMPLE_TRY GS. */
2909 static inline gimple_seq
2910 gimple_try_cleanup (gimple gs)
2912 GIMPLE_CHECK (gs, GIMPLE_TRY);
2913 return gs->gimple_try.cleanup;
2917 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
2919 static inline void
2920 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
2922 gcc_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
2923 if (catch_is_cleanup)
2924 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
2925 else
2926 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
2930 /* Set EVAL to be the sequence of statements to use as the body for
2931 GIMPLE_TRY GS. */
2933 static inline void
2934 gimple_try_set_eval (gimple gs, gimple_seq eval)
2936 GIMPLE_CHECK (gs, GIMPLE_TRY);
2937 gs->gimple_try.eval = eval;
2941 /* Set CLEANUP to be the sequence of statements to use as the cleanup
2942 body for GIMPLE_TRY GS. */
2944 static inline void
2945 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
2947 GIMPLE_CHECK (gs, GIMPLE_TRY);
2948 gs->gimple_try.cleanup = cleanup;
2952 /* Return the cleanup sequence for cleanup statement GS. */
2954 static inline gimple_seq
2955 gimple_wce_cleanup (gimple gs)
2957 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
2958 return gs->gimple_wce.cleanup;
2962 /* Set CLEANUP to be the cleanup sequence for GS. */
2964 static inline void
2965 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
2967 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
2968 gs->gimple_wce.cleanup = cleanup;
2972 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
2974 static inline bool
2975 gimple_wce_cleanup_eh_only (const_gimple gs)
2977 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
2978 return gs->gsbase.subcode != 0;
2982 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
2984 static inline void
2985 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
2987 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
2988 gs->gsbase.subcode = (unsigned int) eh_only_p;
2992 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
2994 static inline unsigned
2995 gimple_phi_capacity (const_gimple gs)
2997 GIMPLE_CHECK (gs, GIMPLE_PHI);
2998 return gs->gimple_phi.capacity;
3002 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3003 be exactly the number of incoming edges for the basic block holding
3004 GS. */
3006 static inline unsigned
3007 gimple_phi_num_args (const_gimple gs)
3009 GIMPLE_CHECK (gs, GIMPLE_PHI);
3010 return gs->gimple_phi.nargs;
3014 /* Return the SSA name created by GIMPLE_PHI GS. */
3016 static inline tree
3017 gimple_phi_result (const_gimple gs)
3019 GIMPLE_CHECK (gs, GIMPLE_PHI);
3020 return gs->gimple_phi.result;
3023 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3025 static inline tree *
3026 gimple_phi_result_ptr (gimple gs)
3028 GIMPLE_CHECK (gs, GIMPLE_PHI);
3029 return &gs->gimple_phi.result;
3032 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3034 static inline void
3035 gimple_phi_set_result (gimple gs, tree result)
3037 GIMPLE_CHECK (gs, GIMPLE_PHI);
3038 gs->gimple_phi.result = result;
3042 /* Return the PHI argument corresponding to incoming edge INDEX for
3043 GIMPLE_PHI GS. */
3045 static inline struct phi_arg_d *
3046 gimple_phi_arg (gimple gs, unsigned index)
3048 GIMPLE_CHECK (gs, GIMPLE_PHI);
3049 gcc_assert (index <= gs->gimple_phi.capacity);
3050 return &(gs->gimple_phi.args[index]);
3053 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3054 for GIMPLE_PHI GS. */
3056 static inline void
3057 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3059 GIMPLE_CHECK (gs, GIMPLE_PHI);
3060 gcc_assert (index <= gs->gimple_phi.nargs);
3061 memcpy (gs->gimple_phi.args + index, phiarg, sizeof (struct phi_arg_d));
3064 /* Return the region number for GIMPLE_RESX GS. */
3066 static inline int
3067 gimple_resx_region (const_gimple gs)
3069 GIMPLE_CHECK (gs, GIMPLE_RESX);
3070 return gs->gimple_resx.region;
3073 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3075 static inline void
3076 gimple_resx_set_region (gimple gs, int region)
3078 GIMPLE_CHECK (gs, GIMPLE_RESX);
3079 gs->gimple_resx.region = region;
3083 /* Return the number of labels associated with the switch statement GS. */
3085 static inline unsigned
3086 gimple_switch_num_labels (const_gimple gs)
3088 unsigned num_ops;
3089 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3090 num_ops = gimple_num_ops (gs);
3091 gcc_assert (num_ops > 1);
3092 return num_ops - 1;
3096 /* Set NLABELS to be the number of labels for the switch statement GS. */
3098 static inline void
3099 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3101 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3102 gimple_set_num_ops (g, nlabels + 1);
3106 /* Return the index variable used by the switch statement GS. */
3108 static inline tree
3109 gimple_switch_index (const_gimple gs)
3111 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3112 return gimple_op (gs, 0);
3116 /* Return a pointer to the index variable for the switch statement GS. */
3118 static inline tree *
3119 gimple_switch_index_ptr (const_gimple gs)
3121 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3122 return gimple_op_ptr (gs, 0);
3126 /* Set INDEX to be the index variable for switch statement GS. */
3128 static inline void
3129 gimple_switch_set_index (gimple gs, tree index)
3131 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3132 gcc_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3133 gimple_set_op (gs, 0, index);
3137 /* Return the label numbered INDEX. The default label is 0, followed by any
3138 labels in a switch statement. */
3140 static inline tree
3141 gimple_switch_label (const_gimple gs, unsigned index)
3143 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3144 gcc_assert (gimple_num_ops (gs) > index + 1);
3145 return gimple_op (gs, index + 1);
3148 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3150 static inline void
3151 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3153 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3154 gcc_assert (gimple_num_ops (gs) > index + 1);
3155 gcc_assert (label == NULL_TREE || TREE_CODE (label) == CASE_LABEL_EXPR);
3156 gimple_set_op (gs, index + 1, label);
3159 /* Return the default label for a switch statement. */
3161 static inline tree
3162 gimple_switch_default_label (const_gimple gs)
3164 return gimple_switch_label (gs, 0);
3167 /* Set the default label for a switch statement. */
3169 static inline void
3170 gimple_switch_set_default_label (gimple gs, tree label)
3172 gimple_switch_set_label (gs, 0, label);
3175 /* Return true if GS is a GIMPLE_DEBUG statement. */
3177 static inline bool
3178 is_gimple_debug (const_gimple gs)
3180 return gimple_code (gs) == GIMPLE_DEBUG;
3183 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3185 static inline bool
3186 gimple_debug_bind_p (const_gimple s)
3188 if (is_gimple_debug (s))
3189 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3191 return false;
3194 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3196 static inline tree
3197 gimple_debug_bind_get_var (gimple dbg)
3199 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3200 gcc_assert (gimple_debug_bind_p (dbg));
3201 return gimple_op (dbg, 0);
3204 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3205 statement. */
3207 static inline tree
3208 gimple_debug_bind_get_value (gimple dbg)
3210 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3211 gcc_assert (gimple_debug_bind_p (dbg));
3212 return gimple_op (dbg, 1);
3215 /* Return a pointer to the value bound to the variable in a
3216 GIMPLE_DEBUG bind statement. */
3218 static inline tree *
3219 gimple_debug_bind_get_value_ptr (gimple dbg)
3221 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3222 gcc_assert (gimple_debug_bind_p (dbg));
3223 return gimple_op_ptr (dbg, 1);
3226 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3228 static inline void
3229 gimple_debug_bind_set_var (gimple dbg, tree var)
3231 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3232 gcc_assert (gimple_debug_bind_p (dbg));
3233 gimple_set_op (dbg, 0, var);
3236 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3237 statement. */
3239 static inline void
3240 gimple_debug_bind_set_value (gimple dbg, tree value)
3242 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3243 gcc_assert (gimple_debug_bind_p (dbg));
3244 gimple_set_op (dbg, 1, value);
3247 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3248 optimized away. */
3249 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3251 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3252 statement. */
3254 static inline void
3255 gimple_debug_bind_reset_value (gimple dbg)
3257 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3258 gcc_assert (gimple_debug_bind_p (dbg));
3259 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3262 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3263 value. */
3265 static inline bool
3266 gimple_debug_bind_has_value_p (gimple dbg)
3268 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3269 gcc_assert (gimple_debug_bind_p (dbg));
3270 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3273 #undef GIMPLE_DEBUG_BIND_NOVALUE
3275 /* Return the body for the OMP statement GS. */
3277 static inline gimple_seq
3278 gimple_omp_body (gimple gs)
3280 return gs->omp.body;
3283 /* Set BODY to be the body for the OMP statement GS. */
3285 static inline void
3286 gimple_omp_set_body (gimple gs, gimple_seq body)
3288 gs->omp.body = body;
3292 /* Return the name associated with OMP_CRITICAL statement GS. */
3294 static inline tree
3295 gimple_omp_critical_name (const_gimple gs)
3297 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3298 return gs->gimple_omp_critical.name;
3302 /* Return a pointer to the name associated with OMP critical statement GS. */
3304 static inline tree *
3305 gimple_omp_critical_name_ptr (gimple gs)
3307 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3308 return &gs->gimple_omp_critical.name;
3312 /* Set NAME to be the name associated with OMP critical statement GS. */
3314 static inline void
3315 gimple_omp_critical_set_name (gimple gs, tree name)
3317 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3318 gs->gimple_omp_critical.name = name;
3322 /* Return the clauses associated with OMP_FOR GS. */
3324 static inline tree
3325 gimple_omp_for_clauses (const_gimple gs)
3327 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3328 return gs->gimple_omp_for.clauses;
3332 /* Return a pointer to the OMP_FOR GS. */
3334 static inline tree *
3335 gimple_omp_for_clauses_ptr (gimple gs)
3337 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3338 return &gs->gimple_omp_for.clauses;
3342 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3344 static inline void
3345 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3347 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3348 gs->gimple_omp_for.clauses = clauses;
3352 /* Get the collapse count of OMP_FOR GS. */
3354 static inline size_t
3355 gimple_omp_for_collapse (gimple gs)
3357 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3358 return gs->gimple_omp_for.collapse;
3362 /* Return the index variable for OMP_FOR GS. */
3364 static inline tree
3365 gimple_omp_for_index (const_gimple gs, size_t i)
3367 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3368 gcc_assert (i < gs->gimple_omp_for.collapse);
3369 return gs->gimple_omp_for.iter[i].index;
3373 /* Return a pointer to the index variable for OMP_FOR GS. */
3375 static inline tree *
3376 gimple_omp_for_index_ptr (gimple gs, size_t i)
3378 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3379 gcc_assert (i < gs->gimple_omp_for.collapse);
3380 return &gs->gimple_omp_for.iter[i].index;
3384 /* Set INDEX to be the index variable for OMP_FOR GS. */
3386 static inline void
3387 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3389 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3390 gcc_assert (i < gs->gimple_omp_for.collapse);
3391 gs->gimple_omp_for.iter[i].index = index;
3395 /* Return the initial value for OMP_FOR GS. */
3397 static inline tree
3398 gimple_omp_for_initial (const_gimple gs, size_t i)
3400 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3401 gcc_assert (i < gs->gimple_omp_for.collapse);
3402 return gs->gimple_omp_for.iter[i].initial;
3406 /* Return a pointer to the initial value for OMP_FOR GS. */
3408 static inline tree *
3409 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3411 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3412 gcc_assert (i < gs->gimple_omp_for.collapse);
3413 return &gs->gimple_omp_for.iter[i].initial;
3417 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3419 static inline void
3420 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3422 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3423 gcc_assert (i < gs->gimple_omp_for.collapse);
3424 gs->gimple_omp_for.iter[i].initial = initial;
3428 /* Return the final value for OMP_FOR GS. */
3430 static inline tree
3431 gimple_omp_for_final (const_gimple gs, size_t i)
3433 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3434 gcc_assert (i < gs->gimple_omp_for.collapse);
3435 return gs->gimple_omp_for.iter[i].final;
3439 /* Return a pointer to the final value for OMP_FOR GS. */
3441 static inline tree *
3442 gimple_omp_for_final_ptr (gimple gs, size_t i)
3444 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3445 gcc_assert (i < gs->gimple_omp_for.collapse);
3446 return &gs->gimple_omp_for.iter[i].final;
3450 /* Set FINAL to be the final value for OMP_FOR GS. */
3452 static inline void
3453 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3455 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3456 gcc_assert (i < gs->gimple_omp_for.collapse);
3457 gs->gimple_omp_for.iter[i].final = final;
3461 /* Return the increment value for OMP_FOR GS. */
3463 static inline tree
3464 gimple_omp_for_incr (const_gimple gs, size_t i)
3466 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3467 gcc_assert (i < gs->gimple_omp_for.collapse);
3468 return gs->gimple_omp_for.iter[i].incr;
3472 /* Return a pointer to the increment value for OMP_FOR GS. */
3474 static inline tree *
3475 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3477 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3478 gcc_assert (i < gs->gimple_omp_for.collapse);
3479 return &gs->gimple_omp_for.iter[i].incr;
3483 /* Set INCR to be the increment value for OMP_FOR GS. */
3485 static inline void
3486 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3488 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3489 gcc_assert (i < gs->gimple_omp_for.collapse);
3490 gs->gimple_omp_for.iter[i].incr = incr;
3494 /* Return the sequence of statements to execute before the OMP_FOR
3495 statement GS starts. */
3497 static inline gimple_seq
3498 gimple_omp_for_pre_body (gimple gs)
3500 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3501 return gs->gimple_omp_for.pre_body;
3505 /* Set PRE_BODY to be the sequence of statements to execute before the
3506 OMP_FOR statement GS starts. */
3508 static inline void
3509 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3511 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3512 gs->gimple_omp_for.pre_body = pre_body;
3516 /* Return the clauses associated with OMP_PARALLEL GS. */
3518 static inline tree
3519 gimple_omp_parallel_clauses (const_gimple gs)
3521 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3522 return gs->gimple_omp_parallel.clauses;
3526 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3528 static inline tree *
3529 gimple_omp_parallel_clauses_ptr (gimple gs)
3531 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3532 return &gs->gimple_omp_parallel.clauses;
3536 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
3537 GS. */
3539 static inline void
3540 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
3542 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3543 gs->gimple_omp_parallel.clauses = clauses;
3547 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
3549 static inline tree
3550 gimple_omp_parallel_child_fn (const_gimple gs)
3552 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3553 return gs->gimple_omp_parallel.child_fn;
3556 /* Return a pointer to the child function used to hold the body of
3557 OMP_PARALLEL GS. */
3559 static inline tree *
3560 gimple_omp_parallel_child_fn_ptr (gimple gs)
3562 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3563 return &gs->gimple_omp_parallel.child_fn;
3567 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
3569 static inline void
3570 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
3572 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3573 gs->gimple_omp_parallel.child_fn = child_fn;
3577 /* Return the artificial argument used to send variables and values
3578 from the parent to the children threads in OMP_PARALLEL GS. */
3580 static inline tree
3581 gimple_omp_parallel_data_arg (const_gimple gs)
3583 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3584 return gs->gimple_omp_parallel.data_arg;
3588 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
3590 static inline tree *
3591 gimple_omp_parallel_data_arg_ptr (gimple gs)
3593 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3594 return &gs->gimple_omp_parallel.data_arg;
3598 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
3600 static inline void
3601 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
3603 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3604 gs->gimple_omp_parallel.data_arg = data_arg;
3608 /* Return the clauses associated with OMP_TASK GS. */
3610 static inline tree
3611 gimple_omp_task_clauses (const_gimple gs)
3613 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3614 return gs->gimple_omp_parallel.clauses;
3618 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3620 static inline tree *
3621 gimple_omp_task_clauses_ptr (gimple gs)
3623 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3624 return &gs->gimple_omp_parallel.clauses;
3628 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3629 GS. */
3631 static inline void
3632 gimple_omp_task_set_clauses (gimple gs, tree clauses)
3634 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3635 gs->gimple_omp_parallel.clauses = clauses;
3639 /* Return the child function used to hold the body of OMP_TASK GS. */
3641 static inline tree
3642 gimple_omp_task_child_fn (const_gimple gs)
3644 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3645 return gs->gimple_omp_parallel.child_fn;
3648 /* Return a pointer to the child function used to hold the body of
3649 OMP_TASK GS. */
3651 static inline tree *
3652 gimple_omp_task_child_fn_ptr (gimple gs)
3654 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3655 return &gs->gimple_omp_parallel.child_fn;
3659 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3661 static inline void
3662 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
3664 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3665 gs->gimple_omp_parallel.child_fn = child_fn;
3669 /* Return the artificial argument used to send variables and values
3670 from the parent to the children threads in OMP_TASK GS. */
3672 static inline tree
3673 gimple_omp_task_data_arg (const_gimple gs)
3675 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3676 return gs->gimple_omp_parallel.data_arg;
3680 /* Return a pointer to the data argument for OMP_TASK GS. */
3682 static inline tree *
3683 gimple_omp_task_data_arg_ptr (gimple gs)
3685 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3686 return &gs->gimple_omp_parallel.data_arg;
3690 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3692 static inline void
3693 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
3695 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3696 gs->gimple_omp_parallel.data_arg = data_arg;
3700 /* Return the clauses associated with OMP_TASK GS. */
3702 static inline tree
3703 gimple_omp_taskreg_clauses (const_gimple gs)
3705 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3706 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3707 return gs->gimple_omp_parallel.clauses;
3711 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3713 static inline tree *
3714 gimple_omp_taskreg_clauses_ptr (gimple gs)
3716 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3717 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3718 return &gs->gimple_omp_parallel.clauses;
3722 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3723 GS. */
3725 static inline void
3726 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
3728 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3729 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3730 gs->gimple_omp_parallel.clauses = clauses;
3734 /* Return the child function used to hold the body of OMP_TASK GS. */
3736 static inline tree
3737 gimple_omp_taskreg_child_fn (const_gimple gs)
3739 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3740 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3741 return gs->gimple_omp_parallel.child_fn;
3744 /* Return a pointer to the child function used to hold the body of
3745 OMP_TASK GS. */
3747 static inline tree *
3748 gimple_omp_taskreg_child_fn_ptr (gimple gs)
3750 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3751 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3752 return &gs->gimple_omp_parallel.child_fn;
3756 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3758 static inline void
3759 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
3761 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3762 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3763 gs->gimple_omp_parallel.child_fn = child_fn;
3767 /* Return the artificial argument used to send variables and values
3768 from the parent to the children threads in OMP_TASK GS. */
3770 static inline tree
3771 gimple_omp_taskreg_data_arg (const_gimple gs)
3773 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3774 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3775 return gs->gimple_omp_parallel.data_arg;
3779 /* Return a pointer to the data argument for OMP_TASK GS. */
3781 static inline tree *
3782 gimple_omp_taskreg_data_arg_ptr (gimple gs)
3784 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3785 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3786 return &gs->gimple_omp_parallel.data_arg;
3790 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3792 static inline void
3793 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
3795 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3796 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3797 gs->gimple_omp_parallel.data_arg = data_arg;
3801 /* Return the copy function used to hold the body of OMP_TASK GS. */
3803 static inline tree
3804 gimple_omp_task_copy_fn (const_gimple gs)
3806 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3807 return gs->gimple_omp_task.copy_fn;
3810 /* Return a pointer to the copy function used to hold the body of
3811 OMP_TASK GS. */
3813 static inline tree *
3814 gimple_omp_task_copy_fn_ptr (gimple gs)
3816 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3817 return &gs->gimple_omp_task.copy_fn;
3821 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
3823 static inline void
3824 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
3826 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3827 gs->gimple_omp_task.copy_fn = copy_fn;
3831 /* Return size of the data block in bytes in OMP_TASK GS. */
3833 static inline tree
3834 gimple_omp_task_arg_size (const_gimple gs)
3836 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3837 return gs->gimple_omp_task.arg_size;
3841 /* Return a pointer to the data block size for OMP_TASK GS. */
3843 static inline tree *
3844 gimple_omp_task_arg_size_ptr (gimple gs)
3846 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3847 return &gs->gimple_omp_task.arg_size;
3851 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
3853 static inline void
3854 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
3856 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3857 gs->gimple_omp_task.arg_size = arg_size;
3861 /* Return align of the data block in bytes in OMP_TASK GS. */
3863 static inline tree
3864 gimple_omp_task_arg_align (const_gimple gs)
3866 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3867 return gs->gimple_omp_task.arg_align;
3871 /* Return a pointer to the data block align for OMP_TASK GS. */
3873 static inline tree *
3874 gimple_omp_task_arg_align_ptr (gimple gs)
3876 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3877 return &gs->gimple_omp_task.arg_align;
3881 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
3883 static inline void
3884 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
3886 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3887 gs->gimple_omp_task.arg_align = arg_align;
3891 /* Return the clauses associated with OMP_SINGLE GS. */
3893 static inline tree
3894 gimple_omp_single_clauses (const_gimple gs)
3896 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
3897 return gs->gimple_omp_single.clauses;
3901 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
3903 static inline tree *
3904 gimple_omp_single_clauses_ptr (gimple gs)
3906 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
3907 return &gs->gimple_omp_single.clauses;
3911 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
3913 static inline void
3914 gimple_omp_single_set_clauses (gimple gs, tree clauses)
3916 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
3917 gs->gimple_omp_single.clauses = clauses;
3921 /* Return the clauses associated with OMP_SECTIONS GS. */
3923 static inline tree
3924 gimple_omp_sections_clauses (const_gimple gs)
3926 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3927 return gs->gimple_omp_sections.clauses;
3931 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
3933 static inline tree *
3934 gimple_omp_sections_clauses_ptr (gimple gs)
3936 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3937 return &gs->gimple_omp_sections.clauses;
3941 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
3942 GS. */
3944 static inline void
3945 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
3947 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3948 gs->gimple_omp_sections.clauses = clauses;
3952 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
3953 in GS. */
3955 static inline tree
3956 gimple_omp_sections_control (const_gimple gs)
3958 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3959 return gs->gimple_omp_sections.control;
3963 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
3964 GS. */
3966 static inline tree *
3967 gimple_omp_sections_control_ptr (gimple gs)
3969 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3970 return &gs->gimple_omp_sections.control;
3974 /* Set CONTROL to be the set of clauses associated with the
3975 GIMPLE_OMP_SECTIONS in GS. */
3977 static inline void
3978 gimple_omp_sections_set_control (gimple gs, tree control)
3980 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3981 gs->gimple_omp_sections.control = control;
3985 /* Set COND to be the condition code for OMP_FOR GS. */
3987 static inline void
3988 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
3990 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3991 gcc_assert (TREE_CODE_CLASS (cond) == tcc_comparison);
3992 gcc_assert (i < gs->gimple_omp_for.collapse);
3993 gs->gimple_omp_for.iter[i].cond = cond;
3997 /* Return the condition code associated with OMP_FOR GS. */
3999 static inline enum tree_code
4000 gimple_omp_for_cond (const_gimple gs, size_t i)
4002 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4003 gcc_assert (i < gs->gimple_omp_for.collapse);
4004 return gs->gimple_omp_for.iter[i].cond;
4008 /* Set the value being stored in an atomic store. */
4010 static inline void
4011 gimple_omp_atomic_store_set_val (gimple g, tree val)
4013 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4014 g->gimple_omp_atomic_store.val = val;
4018 /* Return the value being stored in an atomic store. */
4020 static inline tree
4021 gimple_omp_atomic_store_val (const_gimple g)
4023 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4024 return g->gimple_omp_atomic_store.val;
4028 /* Return a pointer to the value being stored in an atomic store. */
4030 static inline tree *
4031 gimple_omp_atomic_store_val_ptr (gimple g)
4033 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4034 return &g->gimple_omp_atomic_store.val;
4038 /* Set the LHS of an atomic load. */
4040 static inline void
4041 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4043 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4044 g->gimple_omp_atomic_load.lhs = lhs;
4048 /* Get the LHS of an atomic load. */
4050 static inline tree
4051 gimple_omp_atomic_load_lhs (const_gimple g)
4053 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4054 return g->gimple_omp_atomic_load.lhs;
4058 /* Return a pointer to the LHS of an atomic load. */
4060 static inline tree *
4061 gimple_omp_atomic_load_lhs_ptr (gimple g)
4063 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4064 return &g->gimple_omp_atomic_load.lhs;
4068 /* Set the RHS of an atomic load. */
4070 static inline void
4071 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4073 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4074 g->gimple_omp_atomic_load.rhs = rhs;
4078 /* Get the RHS of an atomic load. */
4080 static inline tree
4081 gimple_omp_atomic_load_rhs (const_gimple g)
4083 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4084 return g->gimple_omp_atomic_load.rhs;
4088 /* Return a pointer to the RHS of an atomic load. */
4090 static inline tree *
4091 gimple_omp_atomic_load_rhs_ptr (gimple g)
4093 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4094 return &g->gimple_omp_atomic_load.rhs;
4098 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4100 static inline tree
4101 gimple_omp_continue_control_def (const_gimple g)
4103 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4104 return g->gimple_omp_continue.control_def;
4107 /* The same as above, but return the address. */
4109 static inline tree *
4110 gimple_omp_continue_control_def_ptr (gimple g)
4112 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4113 return &g->gimple_omp_continue.control_def;
4116 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4118 static inline void
4119 gimple_omp_continue_set_control_def (gimple g, tree def)
4121 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4122 g->gimple_omp_continue.control_def = def;
4126 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4128 static inline tree
4129 gimple_omp_continue_control_use (const_gimple g)
4131 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4132 return g->gimple_omp_continue.control_use;
4136 /* The same as above, but return the address. */
4138 static inline tree *
4139 gimple_omp_continue_control_use_ptr (gimple g)
4141 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4142 return &g->gimple_omp_continue.control_use;
4146 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4148 static inline void
4149 gimple_omp_continue_set_control_use (gimple g, tree use)
4151 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4152 g->gimple_omp_continue.control_use = use;
4156 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4158 static inline tree *
4159 gimple_return_retval_ptr (const_gimple gs)
4161 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4162 gcc_assert (gimple_num_ops (gs) == 1);
4163 return gimple_op_ptr (gs, 0);
4166 /* Return the return value for GIMPLE_RETURN GS. */
4168 static inline tree
4169 gimple_return_retval (const_gimple gs)
4171 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4172 gcc_assert (gimple_num_ops (gs) == 1);
4173 return gimple_op (gs, 0);
4177 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4179 static inline void
4180 gimple_return_set_retval (gimple gs, tree retval)
4182 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4183 gcc_assert (gimple_num_ops (gs) == 1);
4184 gcc_assert (retval == NULL_TREE
4185 || TREE_CODE (retval) == RESULT_DECL
4186 || is_gimple_val (retval));
4187 gimple_set_op (gs, 0, retval);
4191 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4193 static inline bool
4194 is_gimple_omp (const_gimple stmt)
4196 return (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
4197 || gimple_code (stmt) == GIMPLE_OMP_TASK
4198 || gimple_code (stmt) == GIMPLE_OMP_FOR
4199 || gimple_code (stmt) == GIMPLE_OMP_SECTIONS
4200 || gimple_code (stmt) == GIMPLE_OMP_SECTIONS_SWITCH
4201 || gimple_code (stmt) == GIMPLE_OMP_SINGLE
4202 || gimple_code (stmt) == GIMPLE_OMP_SECTION
4203 || gimple_code (stmt) == GIMPLE_OMP_MASTER
4204 || gimple_code (stmt) == GIMPLE_OMP_ORDERED
4205 || gimple_code (stmt) == GIMPLE_OMP_CRITICAL
4206 || gimple_code (stmt) == GIMPLE_OMP_RETURN
4207 || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD
4208 || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE
4209 || gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
4213 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4215 static inline bool
4216 gimple_nop_p (const_gimple g)
4218 return gimple_code (g) == GIMPLE_NOP;
4222 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4224 static inline enum br_predictor
4225 gimple_predict_predictor (gimple gs)
4227 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4228 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4232 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4234 static inline void
4235 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4237 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4238 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4239 | (unsigned) predictor;
4243 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4245 static inline enum prediction
4246 gimple_predict_outcome (gimple gs)
4248 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4249 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4253 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4255 static inline void
4256 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4258 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4259 if (outcome == TAKEN)
4260 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4261 else
4262 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4266 /* Return the type of the main expression computed by STMT. Return
4267 void_type_node if the statement computes nothing. */
4269 static inline tree
4270 gimple_expr_type (const_gimple stmt)
4272 enum gimple_code code = gimple_code (stmt);
4274 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4276 tree type;
4277 /* In general we want to pass out a type that can be substituted
4278 for both the RHS and the LHS types if there is a possibly
4279 useless conversion involved. That means returning the
4280 original RHS type as far as we can reconstruct it. */
4281 if (code == GIMPLE_CALL)
4282 type = gimple_call_return_type (stmt);
4283 else
4284 switch (gimple_assign_rhs_code (stmt))
4286 case POINTER_PLUS_EXPR:
4287 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4288 break;
4290 default:
4291 /* As fallback use the type of the LHS. */
4292 type = TREE_TYPE (gimple_get_lhs (stmt));
4293 break;
4295 return type;
4297 else if (code == GIMPLE_COND)
4298 return boolean_type_node;
4299 else
4300 return void_type_node;
4304 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4306 static inline gimple_stmt_iterator
4307 gsi_start (gimple_seq seq)
4309 gimple_stmt_iterator i;
4311 i.ptr = gimple_seq_first (seq);
4312 i.seq = seq;
4313 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4315 return i;
4319 /* Return a new iterator pointing to the first statement in basic block BB. */
4321 static inline gimple_stmt_iterator
4322 gsi_start_bb (basic_block bb)
4324 gimple_stmt_iterator i;
4325 gimple_seq seq;
4327 seq = bb_seq (bb);
4328 i.ptr = gimple_seq_first (seq);
4329 i.seq = seq;
4330 i.bb = bb;
4332 return i;
4336 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4338 static inline gimple_stmt_iterator
4339 gsi_last (gimple_seq seq)
4341 gimple_stmt_iterator i;
4343 i.ptr = gimple_seq_last (seq);
4344 i.seq = seq;
4345 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4347 return i;
4351 /* Return a new iterator pointing to the last statement in basic block BB. */
4353 static inline gimple_stmt_iterator
4354 gsi_last_bb (basic_block bb)
4356 gimple_stmt_iterator i;
4357 gimple_seq seq;
4359 seq = bb_seq (bb);
4360 i.ptr = gimple_seq_last (seq);
4361 i.seq = seq;
4362 i.bb = bb;
4364 return i;
4368 /* Return true if I is at the end of its sequence. */
4370 static inline bool
4371 gsi_end_p (gimple_stmt_iterator i)
4373 return i.ptr == NULL;
4377 /* Return true if I is one statement before the end of its sequence. */
4379 static inline bool
4380 gsi_one_before_end_p (gimple_stmt_iterator i)
4382 return i.ptr != NULL && i.ptr->next == NULL;
4386 /* Advance the iterator to the next gimple statement. */
4388 static inline void
4389 gsi_next (gimple_stmt_iterator *i)
4391 i->ptr = i->ptr->next;
4394 /* Advance the iterator to the previous gimple statement. */
4396 static inline void
4397 gsi_prev (gimple_stmt_iterator *i)
4399 i->ptr = i->ptr->prev;
4402 /* Return the current stmt. */
4404 static inline gimple
4405 gsi_stmt (gimple_stmt_iterator i)
4407 return i.ptr->stmt;
4410 /* Return a block statement iterator that points to the first non-label
4411 statement in block BB. */
4413 static inline gimple_stmt_iterator
4414 gsi_after_labels (basic_block bb)
4416 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4418 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4419 gsi_next (&gsi);
4421 return gsi;
4424 /* Advance the iterator to the next non-debug gimple statement. */
4426 static inline void
4427 gsi_next_nondebug (gimple_stmt_iterator *i)
4431 gsi_next (i);
4433 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4436 /* Advance the iterator to the next non-debug gimple statement. */
4438 static inline void
4439 gsi_prev_nondebug (gimple_stmt_iterator *i)
4443 gsi_prev (i);
4445 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4448 /* Return a new iterator pointing to the first non-debug statement in
4449 basic block BB. */
4451 static inline gimple_stmt_iterator
4452 gsi_start_nondebug_bb (basic_block bb)
4454 gimple_stmt_iterator i = gsi_start_bb (bb);
4456 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4457 gsi_next_nondebug (&i);
4459 return i;
4462 /* Return a new iterator pointing to the last non-debug statement in
4463 basic block BB. */
4465 static inline gimple_stmt_iterator
4466 gsi_last_nondebug_bb (basic_block bb)
4468 gimple_stmt_iterator i = gsi_last_bb (bb);
4470 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4471 gsi_prev_nondebug (&i);
4473 return i;
4476 /* Return a pointer to the current stmt.
4478 NOTE: You may want to use gsi_replace on the iterator itself,
4479 as this performs additional bookkeeping that will not be done
4480 if you simply assign through a pointer returned by gsi_stmt_ptr. */
4482 static inline gimple *
4483 gsi_stmt_ptr (gimple_stmt_iterator *i)
4485 return &i->ptr->stmt;
4489 /* Return the basic block associated with this iterator. */
4491 static inline basic_block
4492 gsi_bb (gimple_stmt_iterator i)
4494 return i.bb;
4498 /* Return the sequence associated with this iterator. */
4500 static inline gimple_seq
4501 gsi_seq (gimple_stmt_iterator i)
4503 return i.seq;
4507 enum gsi_iterator_update
4509 GSI_NEW_STMT, /* Only valid when single statement is added, move
4510 iterator to it. */
4511 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
4512 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
4513 for linking other statements in the same
4514 direction. */
4517 /* In gimple-iterator.c */
4518 gimple_stmt_iterator gsi_start_phis (basic_block);
4519 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
4520 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
4521 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
4522 void gsi_insert_before (gimple_stmt_iterator *, gimple,
4523 enum gsi_iterator_update);
4524 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
4525 enum gsi_iterator_update);
4526 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
4527 enum gsi_iterator_update);
4528 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
4529 enum gsi_iterator_update);
4530 void gsi_insert_after (gimple_stmt_iterator *, gimple,
4531 enum gsi_iterator_update);
4532 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
4533 enum gsi_iterator_update);
4534 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
4535 enum gsi_iterator_update);
4536 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
4537 enum gsi_iterator_update);
4538 void gsi_remove (gimple_stmt_iterator *, bool);
4539 gimple_stmt_iterator gsi_for_stmt (gimple);
4540 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
4541 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
4542 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
4543 void gsi_insert_on_edge (edge, gimple);
4544 void gsi_insert_seq_on_edge (edge, gimple_seq);
4545 basic_block gsi_insert_on_edge_immediate (edge, gimple);
4546 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
4547 void gsi_commit_one_edge_insert (edge, basic_block *);
4548 void gsi_commit_edge_inserts (void);
4549 gimple gimple_call_copy_skip_args (gimple, bitmap);
4552 /* Convenience routines to walk all statements of a gimple function.
4553 Note that this is useful exclusively before the code is converted
4554 into SSA form. Once the program is in SSA form, the standard
4555 operand interface should be used to analyze/modify statements. */
4556 struct walk_stmt_info
4558 /* Points to the current statement being walked. */
4559 gimple_stmt_iterator gsi;
4561 /* Additional data that the callback functions may want to carry
4562 through the recursion. */
4563 void *info;
4565 /* Pointer map used to mark visited tree nodes when calling
4566 walk_tree on each operand. If set to NULL, duplicate tree nodes
4567 will be visited more than once. */
4568 struct pointer_set_t *pset;
4570 /* Indicates whether the operand being examined may be replaced
4571 with something that matches is_gimple_val (if true) or something
4572 slightly more complicated (if false). "Something" technically
4573 means the common subset of is_gimple_lvalue and is_gimple_rhs,
4574 but we never try to form anything more complicated than that, so
4575 we don't bother checking.
4577 Also note that CALLBACK should update this flag while walking the
4578 sub-expressions of a statement. For instance, when walking the
4579 statement 'foo (&var)', the flag VAL_ONLY will initially be set
4580 to true, however, when walking &var, the operand of that
4581 ADDR_EXPR does not need to be a GIMPLE value. */
4582 bool val_only;
4584 /* True if we are currently walking the LHS of an assignment. */
4585 bool is_lhs;
4587 /* Optional. Set to true by the callback functions if they made any
4588 changes. */
4589 bool changed;
4591 /* True if we're interested in location information. */
4592 bool want_locations;
4594 /* Operand returned by the callbacks. This is set when calling
4595 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
4596 returns non-NULL, this field will contain the tree returned by
4597 the last callback. */
4598 tree callback_result;
4601 /* Callback for walk_gimple_stmt. Called for every statement found
4602 during traversal. The first argument points to the statement to
4603 walk. The second argument is a flag that the callback sets to
4604 'true' if it the callback handled all the operands and
4605 sub-statements of the statement (the default value of this flag is
4606 'false'). The third argument is an anonymous pointer to data
4607 to be used by the callback. */
4608 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
4609 struct walk_stmt_info *);
4611 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
4612 struct walk_stmt_info *);
4613 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
4614 struct walk_stmt_info *);
4615 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
4617 #ifdef GATHER_STATISTICS
4618 /* Enum and arrays used for allocation stats. Keep in sync with
4619 gimple.c:gimple_alloc_kind_names. */
4620 enum gimple_alloc_kind
4622 gimple_alloc_kind_assign, /* Assignments. */
4623 gimple_alloc_kind_phi, /* PHI nodes. */
4624 gimple_alloc_kind_cond, /* Conditionals. */
4625 gimple_alloc_kind_seq, /* Sequences. */
4626 gimple_alloc_kind_rest, /* Everything else. */
4627 gimple_alloc_kind_all
4630 extern int gimple_alloc_counts[];
4631 extern int gimple_alloc_sizes[];
4633 /* Return the allocation kind for a given stmt CODE. */
4634 static inline enum gimple_alloc_kind
4635 gimple_alloc_kind (enum gimple_code code)
4637 switch (code)
4639 case GIMPLE_ASSIGN:
4640 return gimple_alloc_kind_assign;
4641 case GIMPLE_PHI:
4642 return gimple_alloc_kind_phi;
4643 case GIMPLE_COND:
4644 return gimple_alloc_kind_cond;
4645 default:
4646 return gimple_alloc_kind_rest;
4649 #endif /* GATHER_STATISTICS */
4651 extern void dump_gimple_statistics (void);
4653 #endif /* GCC_GIMPLE_H */