Remove _GNU_SOURCE from AM_CPPFLAGS
[official-gcc.git] / gcc / gimple.h
blob572cabcc57fb77263f755ecc2db30b534aac431b
1 /* Gimple IR definitions.
3 Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "pointer-set.h"
26 #include "vec.h"
27 #include "vecprim.h"
28 #include "vecir.h"
29 #include "ggc.h"
30 #include "basic-block.h"
31 #include "tree-ssa-operands.h"
32 #include "tree-ssa-alias.h"
34 struct gimple_seq_node_d;
35 typedef struct gimple_seq_node_d *gimple_seq_node;
36 typedef const struct gimple_seq_node_d *const_gimple_seq_node;
38 /* For each block, the PHI nodes that need to be rewritten are stored into
39 these vectors. */
40 typedef VEC(gimple, heap) *gimple_vec;
41 DEF_VEC_P (gimple_vec);
42 DEF_VEC_ALLOC_P (gimple_vec, heap);
44 enum gimple_code {
45 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
46 #include "gimple.def"
47 #undef DEFGSCODE
48 LAST_AND_UNUSED_GIMPLE_CODE
51 extern const char *const gimple_code_name[];
52 extern const unsigned char gimple_rhs_class_table[];
54 /* Error out if a gimple tuple is addressed incorrectly. */
55 #if defined ENABLE_GIMPLE_CHECKING
56 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
57 extern void gimple_check_failed (const_gimple, const char *, int, \
58 const char *, enum gimple_code, \
59 enum tree_code) ATTRIBUTE_NORETURN;
61 #define GIMPLE_CHECK(GS, CODE) \
62 do { \
63 const_gimple __gs = (GS); \
64 if (gimple_code (__gs) != (CODE)) \
65 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
66 (CODE), ERROR_MARK); \
67 } while (0)
68 #else /* not ENABLE_GIMPLE_CHECKING */
69 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
70 #define GIMPLE_CHECK(GS, CODE) (void)0
71 #endif
73 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
74 get_gimple_rhs_class. */
75 enum gimple_rhs_class
77 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
78 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
79 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
80 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
81 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
82 name, a _DECL, a _REF, etc. */
85 /* Specific flags for individual GIMPLE statements. These flags are
86 always stored in gimple_statement_base.subcode and they may only be
87 defined for statement codes that do not use sub-codes.
89 Values for the masks can overlap as long as the overlapping values
90 are never used in the same statement class.
92 The maximum mask value that can be defined is 1 << 15 (i.e., each
93 statement code can hold up to 16 bitflags).
95 Keep this list sorted. */
96 enum gf_mask {
97 GF_ASM_INPUT = 1 << 0,
98 GF_ASM_VOLATILE = 1 << 1,
99 GF_CALL_CANNOT_INLINE = 1 << 0,
100 GF_CALL_FROM_THUNK = 1 << 1,
101 GF_CALL_RETURN_SLOT_OPT = 1 << 2,
102 GF_CALL_TAILCALL = 1 << 3,
103 GF_CALL_VA_ARG_PACK = 1 << 4,
104 GF_CALL_NOTHROW = 1 << 5,
105 GF_OMP_PARALLEL_COMBINED = 1 << 0,
107 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
108 a thread synchronization via some sort of barrier. The exact barrier
109 that would otherwise be emitted is dependent on the OMP statement with
110 which this return is associated. */
111 GF_OMP_RETURN_NOWAIT = 1 << 0,
113 GF_OMP_SECTION_LAST = 1 << 0,
114 GF_PREDICT_TAKEN = 1 << 15
117 /* Currently, there's only one type of gimple debug stmt. Others are
118 envisioned, for example, to enable the generation of is_stmt notes
119 in line number information, to mark sequence points, etc. This
120 subcode is to be used to tell them apart. */
121 enum gimple_debug_subcode {
122 GIMPLE_DEBUG_BIND = 0
125 /* Masks for selecting a pass local flag (PLF) to work on. These
126 masks are used by gimple_set_plf and gimple_plf. */
127 enum plf_mask {
128 GF_PLF_1 = 1 << 0,
129 GF_PLF_2 = 1 << 1
132 /* A node in a gimple_seq_d. */
133 struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) gimple_seq_node_d {
134 gimple stmt;
135 struct gimple_seq_node_d *prev;
136 struct gimple_seq_node_d *next;
139 /* A double-linked sequence of gimple statements. */
140 struct GTY ((chain_next ("%h.next_free"))) gimple_seq_d {
141 /* First and last statements in the sequence. */
142 gimple_seq_node first;
143 gimple_seq_node last;
145 /* Sequences are created/destroyed frequently. To minimize
146 allocation activity, deallocated sequences are kept in a pool of
147 available sequences. This is the pointer to the next free
148 sequence in the pool. */
149 gimple_seq next_free;
153 /* Return the first node in GIMPLE sequence S. */
155 static inline gimple_seq_node
156 gimple_seq_first (const_gimple_seq s)
158 return s ? s->first : NULL;
162 /* Return the first statement in GIMPLE sequence S. */
164 static inline gimple
165 gimple_seq_first_stmt (const_gimple_seq s)
167 gimple_seq_node n = gimple_seq_first (s);
168 return (n) ? n->stmt : NULL;
172 /* Return the last node in GIMPLE sequence S. */
174 static inline gimple_seq_node
175 gimple_seq_last (const_gimple_seq s)
177 return s ? s->last : NULL;
181 /* Return the last statement in GIMPLE sequence S. */
183 static inline gimple
184 gimple_seq_last_stmt (const_gimple_seq s)
186 gimple_seq_node n = gimple_seq_last (s);
187 return (n) ? n->stmt : NULL;
191 /* Set the last node in GIMPLE sequence S to LAST. */
193 static inline void
194 gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
196 s->last = last;
200 /* Set the first node in GIMPLE sequence S to FIRST. */
202 static inline void
203 gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
205 s->first = first;
209 /* Return true if GIMPLE sequence S is empty. */
211 static inline bool
212 gimple_seq_empty_p (const_gimple_seq s)
214 return s == NULL || s->first == NULL;
218 void gimple_seq_add_stmt (gimple_seq *, gimple);
220 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
221 *SEQ_P is NULL, a new sequence is allocated. This function is
222 similar to gimple_seq_add_stmt, but does not scan the operands.
223 During gimplification, we need to manipulate statement sequences
224 before the def/use vectors have been constructed. */
225 void gimplify_seq_add_stmt (gimple_seq *, gimple);
227 /* Allocate a new sequence and initialize its first element with STMT. */
229 static inline gimple_seq
230 gimple_seq_alloc_with_stmt (gimple stmt)
232 gimple_seq seq = NULL;
233 gimple_seq_add_stmt (&seq, stmt);
234 return seq;
238 /* Returns the sequence of statements in BB. */
240 static inline gimple_seq
241 bb_seq (const_basic_block bb)
243 return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
247 /* Sets the sequence of statements in BB to SEQ. */
249 static inline void
250 set_bb_seq (basic_block bb, gimple_seq seq)
252 gcc_checking_assert (!(bb->flags & BB_RTL));
253 bb->il.gimple->seq = seq;
256 /* Iterator object for GIMPLE statement sequences. */
258 typedef struct
260 /* Sequence node holding the current statement. */
261 gimple_seq_node ptr;
263 /* Sequence and basic block holding the statement. These fields
264 are necessary to handle edge cases such as when statement is
265 added to an empty basic block or when the last statement of a
266 block/sequence is removed. */
267 gimple_seq seq;
268 basic_block bb;
269 } gimple_stmt_iterator;
272 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
273 are for 64 bit hosts. */
275 struct GTY(()) gimple_statement_base {
276 /* [ WORD 1 ]
277 Main identifying code for a tuple. */
278 ENUM_BITFIELD(gimple_code) code : 8;
280 /* Nonzero if a warning should not be emitted on this tuple. */
281 unsigned int no_warning : 1;
283 /* Nonzero if this tuple has been visited. Passes are responsible
284 for clearing this bit before using it. */
285 unsigned int visited : 1;
287 /* Nonzero if this tuple represents a non-temporal move. */
288 unsigned int nontemporal_move : 1;
290 /* Pass local flags. These flags are free for any pass to use as
291 they see fit. Passes should not assume that these flags contain
292 any useful value when the pass starts. Any initial state that
293 the pass requires should be set on entry to the pass. See
294 gimple_set_plf and gimple_plf for usage. */
295 unsigned int plf : 2;
297 /* Nonzero if this statement has been modified and needs to have its
298 operands rescanned. */
299 unsigned modified : 1;
301 /* Nonzero if this statement contains volatile operands. */
302 unsigned has_volatile_ops : 1;
304 /* Padding to get subcode to 16 bit alignment. */
305 unsigned pad : 1;
307 /* The SUBCODE field can be used for tuple-specific flags for tuples
308 that do not require subcodes. Note that SUBCODE should be at
309 least as wide as tree codes, as several tuples store tree codes
310 in there. */
311 unsigned int subcode : 16;
313 /* UID of this statement. This is used by passes that want to
314 assign IDs to statements. It must be assigned and used by each
315 pass. By default it should be assumed to contain garbage. */
316 unsigned uid;
318 /* [ WORD 2 ]
319 Locus information for debug info. */
320 location_t location;
322 /* Number of operands in this tuple. */
323 unsigned num_ops;
325 /* [ WORD 3 ]
326 Basic block holding this statement. */
327 struct basic_block_def *bb;
329 /* [ WORD 4 ]
330 Lexical block holding this statement. */
331 tree block;
335 /* Base structure for tuples with operands. */
337 struct GTY(()) gimple_statement_with_ops_base
339 /* [ WORD 1-4 ] */
340 struct gimple_statement_base gsbase;
342 /* [ WORD 5-6 ]
343 SSA operand vectors. NOTE: It should be possible to
344 amalgamate these vectors with the operand vector OP. However,
345 the SSA operand vectors are organized differently and contain
346 more information (like immediate use chaining). */
347 struct def_optype_d GTY((skip (""))) *def_ops;
348 struct use_optype_d GTY((skip (""))) *use_ops;
352 /* Statements that take register operands. */
354 struct GTY(()) gimple_statement_with_ops
356 /* [ WORD 1-6 ] */
357 struct gimple_statement_with_ops_base opbase;
359 /* [ WORD 7 ]
360 Operand vector. NOTE! This must always be the last field
361 of this structure. In particular, this means that this
362 structure cannot be embedded inside another one. */
363 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
367 /* Base for statements that take both memory and register operands. */
369 struct GTY(()) gimple_statement_with_memory_ops_base
371 /* [ WORD 1-6 ] */
372 struct gimple_statement_with_ops_base opbase;
374 /* [ WORD 7-8 ]
375 Virtual operands for this statement. The GC will pick them
376 up via the ssa_names array. */
377 tree GTY((skip (""))) vdef;
378 tree GTY((skip (""))) vuse;
382 /* Statements that take both memory and register operands. */
384 struct GTY(()) gimple_statement_with_memory_ops
386 /* [ WORD 1-8 ] */
387 struct gimple_statement_with_memory_ops_base membase;
389 /* [ WORD 9 ]
390 Operand vector. NOTE! This must always be the last field
391 of this structure. In particular, this means that this
392 structure cannot be embedded inside another one. */
393 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
397 /* Call statements that take both memory and register operands. */
399 struct GTY(()) gimple_statement_call
401 /* [ WORD 1-8 ] */
402 struct gimple_statement_with_memory_ops_base membase;
404 /* [ WORD 9-12 ] */
405 struct pt_solution call_used;
406 struct pt_solution call_clobbered;
408 /* [ WORD 13 ] */
409 tree fntype;
411 /* [ WORD 14 ]
412 Operand vector. NOTE! This must always be the last field
413 of this structure. In particular, this means that this
414 structure cannot be embedded inside another one. */
415 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
419 /* OpenMP statements (#pragma omp). */
421 struct GTY(()) gimple_statement_omp {
422 /* [ WORD 1-4 ] */
423 struct gimple_statement_base gsbase;
425 /* [ WORD 5 ] */
426 gimple_seq body;
430 /* GIMPLE_BIND */
432 struct GTY(()) gimple_statement_bind {
433 /* [ WORD 1-4 ] */
434 struct gimple_statement_base gsbase;
436 /* [ WORD 5 ]
437 Variables declared in this scope. */
438 tree vars;
440 /* [ WORD 6 ]
441 This is different than the BLOCK field in gimple_statement_base,
442 which is analogous to TREE_BLOCK (i.e., the lexical block holding
443 this statement). This field is the equivalent of BIND_EXPR_BLOCK
444 in tree land (i.e., the lexical scope defined by this bind). See
445 gimple-low.c. */
446 tree block;
448 /* [ WORD 7 ] */
449 gimple_seq body;
453 /* GIMPLE_CATCH */
455 struct GTY(()) gimple_statement_catch {
456 /* [ WORD 1-4 ] */
457 struct gimple_statement_base gsbase;
459 /* [ WORD 5 ] */
460 tree types;
462 /* [ WORD 6 ] */
463 gimple_seq handler;
467 /* GIMPLE_EH_FILTER */
469 struct GTY(()) gimple_statement_eh_filter {
470 /* [ WORD 1-4 ] */
471 struct gimple_statement_base gsbase;
473 /* [ WORD 5 ]
474 Filter types. */
475 tree types;
477 /* [ WORD 6 ]
478 Failure actions. */
479 gimple_seq failure;
483 /* GIMPLE_EH_MUST_NOT_THROW */
485 struct GTY(()) gimple_statement_eh_mnt {
486 /* [ WORD 1-4 ] */
487 struct gimple_statement_base gsbase;
489 /* [ WORD 5 ] Abort function decl. */
490 tree fndecl;
493 /* GIMPLE_PHI */
495 struct GTY(()) gimple_statement_phi {
496 /* [ WORD 1-4 ] */
497 struct gimple_statement_base gsbase;
499 /* [ WORD 5 ] */
500 unsigned capacity;
501 unsigned nargs;
503 /* [ WORD 6 ] */
504 tree result;
506 /* [ WORD 7 ] */
507 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
511 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
513 struct GTY(()) gimple_statement_eh_ctrl
515 /* [ WORD 1-4 ] */
516 struct gimple_statement_base gsbase;
518 /* [ WORD 5 ]
519 Exception region number. */
520 int region;
524 /* GIMPLE_TRY */
526 struct GTY(()) gimple_statement_try {
527 /* [ WORD 1-4 ] */
528 struct gimple_statement_base gsbase;
530 /* [ WORD 5 ]
531 Expression to evaluate. */
532 gimple_seq eval;
534 /* [ WORD 6 ]
535 Cleanup expression. */
536 gimple_seq cleanup;
539 /* Kind of GIMPLE_TRY statements. */
540 enum gimple_try_flags
542 /* A try/catch. */
543 GIMPLE_TRY_CATCH = 1 << 0,
545 /* A try/finally. */
546 GIMPLE_TRY_FINALLY = 1 << 1,
547 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
549 /* Analogous to TRY_CATCH_IS_CLEANUP. */
550 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
553 /* GIMPLE_WITH_CLEANUP_EXPR */
555 struct GTY(()) gimple_statement_wce {
556 /* [ WORD 1-4 ] */
557 struct gimple_statement_base gsbase;
559 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
560 executed if an exception is thrown, not on normal exit of its
561 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
562 in TARGET_EXPRs. */
564 /* [ WORD 5 ]
565 Cleanup expression. */
566 gimple_seq cleanup;
570 /* GIMPLE_ASM */
572 struct GTY(()) gimple_statement_asm
574 /* [ WORD 1-8 ] */
575 struct gimple_statement_with_memory_ops_base membase;
577 /* [ WORD 9 ]
578 __asm__ statement. */
579 const char *string;
581 /* [ WORD 10 ]
582 Number of inputs, outputs, clobbers, labels. */
583 unsigned char ni;
584 unsigned char no;
585 unsigned char nc;
586 unsigned char nl;
588 /* [ WORD 11 ]
589 Operand vector. NOTE! This must always be the last field
590 of this structure. In particular, this means that this
591 structure cannot be embedded inside another one. */
592 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
595 /* GIMPLE_OMP_CRITICAL */
597 struct GTY(()) gimple_statement_omp_critical {
598 /* [ WORD 1-5 ] */
599 struct gimple_statement_omp omp;
601 /* [ WORD 6 ]
602 Critical section name. */
603 tree name;
607 struct GTY(()) gimple_omp_for_iter {
608 /* Condition code. */
609 enum tree_code cond;
611 /* Index variable. */
612 tree index;
614 /* Initial value. */
615 tree initial;
617 /* Final value. */
618 tree final;
620 /* Increment. */
621 tree incr;
624 /* GIMPLE_OMP_FOR */
626 struct GTY(()) gimple_statement_omp_for {
627 /* [ WORD 1-5 ] */
628 struct gimple_statement_omp omp;
630 /* [ WORD 6 ] */
631 tree clauses;
633 /* [ WORD 7 ]
634 Number of elements in iter array. */
635 size_t collapse;
637 /* [ WORD 8 ] */
638 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
640 /* [ WORD 9 ]
641 Pre-body evaluated before the loop body begins. */
642 gimple_seq pre_body;
646 /* GIMPLE_OMP_PARALLEL */
648 struct GTY(()) gimple_statement_omp_parallel {
649 /* [ WORD 1-5 ] */
650 struct gimple_statement_omp omp;
652 /* [ WORD 6 ]
653 Clauses. */
654 tree clauses;
656 /* [ WORD 7 ]
657 Child function holding the body of the parallel region. */
658 tree child_fn;
660 /* [ WORD 8 ]
661 Shared data argument. */
662 tree data_arg;
666 /* GIMPLE_OMP_TASK */
668 struct GTY(()) gimple_statement_omp_task {
669 /* [ WORD 1-8 ] */
670 struct gimple_statement_omp_parallel par;
672 /* [ WORD 9 ]
673 Child function holding firstprivate initialization if needed. */
674 tree copy_fn;
676 /* [ WORD 10-11 ]
677 Size and alignment in bytes of the argument data block. */
678 tree arg_size;
679 tree arg_align;
683 /* GIMPLE_OMP_SECTION */
684 /* Uses struct gimple_statement_omp. */
687 /* GIMPLE_OMP_SECTIONS */
689 struct GTY(()) gimple_statement_omp_sections {
690 /* [ WORD 1-5 ] */
691 struct gimple_statement_omp omp;
693 /* [ WORD 6 ] */
694 tree clauses;
696 /* [ WORD 7 ]
697 The control variable used for deciding which of the sections to
698 execute. */
699 tree control;
702 /* GIMPLE_OMP_CONTINUE.
704 Note: This does not inherit from gimple_statement_omp, because we
705 do not need the body field. */
707 struct GTY(()) gimple_statement_omp_continue {
708 /* [ WORD 1-4 ] */
709 struct gimple_statement_base gsbase;
711 /* [ WORD 5 ] */
712 tree control_def;
714 /* [ WORD 6 ] */
715 tree control_use;
718 /* GIMPLE_OMP_SINGLE */
720 struct GTY(()) gimple_statement_omp_single {
721 /* [ WORD 1-5 ] */
722 struct gimple_statement_omp omp;
724 /* [ WORD 6 ] */
725 tree clauses;
729 /* GIMPLE_OMP_ATOMIC_LOAD.
730 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
731 contains a sequence, which we don't need here. */
733 struct GTY(()) gimple_statement_omp_atomic_load {
734 /* [ WORD 1-4 ] */
735 struct gimple_statement_base gsbase;
737 /* [ WORD 5-6 ] */
738 tree rhs, lhs;
741 /* GIMPLE_OMP_ATOMIC_STORE.
742 See note on GIMPLE_OMP_ATOMIC_LOAD. */
744 struct GTY(()) gimple_statement_omp_atomic_store {
745 /* [ WORD 1-4 ] */
746 struct gimple_statement_base gsbase;
748 /* [ WORD 5 ] */
749 tree val;
752 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
753 enum gimple_statement_structure_enum {
754 #include "gsstruct.def"
755 LAST_GSS_ENUM
757 #undef DEFGSSTRUCT
760 /* Define the overall contents of a gimple tuple. It may be any of the
761 structures declared above for various types of tuples. */
763 union GTY ((desc ("gimple_statement_structure (&%h)"), variable_size)) gimple_statement_d {
764 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
765 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
766 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
767 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
768 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
769 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
770 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
771 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
772 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
773 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
774 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
775 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
776 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
777 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
778 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
779 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
780 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
781 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
782 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
783 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
784 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
785 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
786 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
787 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
790 /* In gimple.c. */
792 /* Offset in bytes to the location of the operand vector.
793 Zero if there is no operand vector for this tuple structure. */
794 extern size_t const gimple_ops_offset_[];
796 /* Map GIMPLE codes to GSS codes. */
797 extern enum gimple_statement_structure_enum const gss_for_code_[];
799 /* This variable holds the currently expanded gimple statement for purposes
800 of comminucating the profile info to the builtin expanders. */
801 extern gimple currently_expanding_gimple_stmt;
803 gimple gimple_build_return (tree);
805 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
806 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
808 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
810 gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
811 tree, tree MEM_STAT_DECL);
812 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
813 gimple_build_assign_with_ops_stat (c, o1, o2, o3, NULL_TREE MEM_STAT_INFO)
814 #define gimple_build_assign_with_ops3(c,o1,o2,o3,o4) \
815 gimple_build_assign_with_ops_stat (c, o1, o2, o3, o4 MEM_STAT_INFO)
817 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
818 #define gimple_build_debug_bind(var,val,stmt) \
819 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
821 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
822 gimple gimple_build_call (tree, unsigned, ...);
823 gimple gimple_build_call_from_tree (tree);
824 gimple gimplify_assign (tree, tree, gimple_seq *);
825 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
826 gimple gimple_build_label (tree label);
827 gimple gimple_build_goto (tree dest);
828 gimple gimple_build_nop (void);
829 gimple gimple_build_bind (tree, gimple_seq, tree);
830 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
831 VEC(tree,gc) *, VEC(tree,gc) *);
832 gimple gimple_build_catch (tree, gimple_seq);
833 gimple gimple_build_eh_filter (tree, gimple_seq);
834 gimple gimple_build_eh_must_not_throw (tree);
835 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
836 gimple gimple_build_wce (gimple_seq);
837 gimple gimple_build_resx (int);
838 gimple gimple_build_eh_dispatch (int);
839 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
840 gimple gimple_build_switch (unsigned, tree, tree, ...);
841 gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
842 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
843 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
844 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
845 gimple gimple_build_omp_critical (gimple_seq, tree);
846 gimple gimple_build_omp_section (gimple_seq);
847 gimple gimple_build_omp_continue (tree, tree);
848 gimple gimple_build_omp_master (gimple_seq);
849 gimple gimple_build_omp_return (bool);
850 gimple gimple_build_omp_ordered (gimple_seq);
851 gimple gimple_build_omp_sections (gimple_seq, tree);
852 gimple gimple_build_omp_sections_switch (void);
853 gimple gimple_build_omp_single (gimple_seq, tree);
854 gimple gimple_build_cdt (tree, tree);
855 gimple gimple_build_omp_atomic_load (tree, tree);
856 gimple gimple_build_omp_atomic_store (tree);
857 gimple gimple_build_predict (enum br_predictor, enum prediction);
858 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
859 void sort_case_labels (VEC(tree,heap) *);
860 void gimple_set_body (tree, gimple_seq);
861 gimple_seq gimple_body (tree);
862 bool gimple_has_body_p (tree);
863 gimple_seq gimple_seq_alloc (void);
864 void gimple_seq_free (gimple_seq);
865 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
866 gimple_seq gimple_seq_copy (gimple_seq);
867 int gimple_call_flags (const_gimple);
868 int gimple_call_return_flags (const_gimple);
869 int gimple_call_arg_flags (const_gimple, unsigned);
870 void gimple_call_reset_alias_info (gimple);
871 bool gimple_assign_copy_p (gimple);
872 bool gimple_assign_ssa_name_copy_p (gimple);
873 bool gimple_assign_unary_nop_p (gimple);
874 void gimple_set_bb (gimple, struct basic_block_def *);
875 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
876 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
877 tree, tree, tree);
878 tree gimple_get_lhs (const_gimple);
879 void gimple_set_lhs (gimple, tree);
880 void gimple_replace_lhs (gimple, tree);
881 gimple gimple_copy (gimple);
882 void gimple_set_modified (gimple, bool);
883 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
884 gimple gimple_build_cond_from_tree (tree, tree, tree);
885 void gimple_cond_set_condition_from_tree (gimple, tree);
886 bool gimple_has_side_effects (const_gimple);
887 bool gimple_rhs_has_side_effects (const_gimple);
888 bool gimple_could_trap_p (gimple);
889 bool gimple_could_trap_p_1 (gimple, bool, bool);
890 bool gimple_assign_rhs_could_trap_p (gimple);
891 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
892 bool empty_body_p (gimple_seq);
893 unsigned get_gimple_rhs_num_ops (enum tree_code);
894 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
895 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
896 const char *gimple_decl_printable_name (tree, int);
897 bool gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace);
898 tree gimple_get_virt_mehtod_for_binfo (HOST_WIDE_INT, tree, tree *, bool);
899 void gimple_adjust_this_by_delta (gimple_stmt_iterator *, tree);
900 /* Returns true iff T is a valid GIMPLE statement. */
901 extern bool is_gimple_stmt (tree);
903 /* Returns true iff TYPE is a valid type for a scalar register variable. */
904 extern bool is_gimple_reg_type (tree);
905 /* Returns true iff T is a scalar register variable. */
906 extern bool is_gimple_reg (tree);
907 /* Returns true iff T is any sort of variable. */
908 extern bool is_gimple_variable (tree);
909 /* Returns true iff T is any sort of symbol. */
910 extern bool is_gimple_id (tree);
911 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
912 extern bool is_gimple_min_lval (tree);
913 /* Returns true iff T is something whose address can be taken. */
914 extern bool is_gimple_addressable (tree);
915 /* Returns true iff T is any valid GIMPLE lvalue. */
916 extern bool is_gimple_lvalue (tree);
918 /* Returns true iff T is a GIMPLE address. */
919 bool is_gimple_address (const_tree);
920 /* Returns true iff T is a GIMPLE invariant address. */
921 bool is_gimple_invariant_address (const_tree);
922 /* Returns true iff T is a GIMPLE invariant address at interprocedural
923 level. */
924 bool is_gimple_ip_invariant_address (const_tree);
925 /* Returns true iff T is a valid GIMPLE constant. */
926 bool is_gimple_constant (const_tree);
927 /* Returns true iff T is a GIMPLE restricted function invariant. */
928 extern bool is_gimple_min_invariant (const_tree);
929 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
930 extern bool is_gimple_ip_invariant (const_tree);
931 /* Returns true iff T is a GIMPLE rvalue. */
932 extern bool is_gimple_val (tree);
933 /* Returns true iff T is a GIMPLE asm statement input. */
934 extern bool is_gimple_asm_val (tree);
935 /* Returns true iff T is a valid address operand of a MEM_REF. */
936 bool is_gimple_mem_ref_addr (tree);
937 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
938 GIMPLE temporary, a renamed user variable, or something else,
939 respectively. */
940 extern bool is_gimple_reg_rhs (tree);
941 extern bool is_gimple_mem_rhs (tree);
943 /* Returns true iff T is a valid if-statement condition. */
944 extern bool is_gimple_condexpr (tree);
946 /* Returns true iff T is a variable that does not need to live in memory. */
947 extern bool is_gimple_non_addressable (tree t);
949 /* Returns true iff T is a valid call address expression. */
950 extern bool is_gimple_call_addr (tree);
951 /* If T makes a function call, returns the CALL_EXPR operand. */
952 extern tree get_call_expr_in (tree t);
954 extern void recalculate_side_effects (tree);
955 extern bool gimple_compare_field_offset (tree, tree);
956 extern tree gimple_register_type (tree);
957 extern tree gimple_register_canonical_type (tree);
958 enum gtc_mode { GTC_MERGE = 0, GTC_DIAG = 1 };
959 extern bool gimple_types_compatible_p (tree, tree, enum gtc_mode);
960 extern void print_gimple_types_stats (void);
961 extern void free_gimple_type_tables (void);
962 extern tree gimple_unsigned_type (tree);
963 extern tree gimple_signed_type (tree);
964 extern alias_set_type gimple_get_alias_set (tree);
965 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
966 unsigned *);
967 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
968 bool (*)(gimple, tree, void *),
969 bool (*)(gimple, tree, void *),
970 bool (*)(gimple, tree, void *));
971 extern bool walk_stmt_load_store_ops (gimple, void *,
972 bool (*)(gimple, tree, void *),
973 bool (*)(gimple, tree, void *));
974 extern bool gimple_ior_addresses_taken (bitmap, gimple);
975 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
977 /* In gimplify.c */
978 extern tree create_tmp_var_raw (tree, const char *);
979 extern tree create_tmp_var_name (const char *);
980 extern tree create_tmp_var (tree, const char *);
981 extern tree create_tmp_reg (tree, const char *);
982 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
983 extern tree get_formal_tmp_var (tree, gimple_seq *);
984 extern void declare_vars (tree, gimple, bool);
985 extern void annotate_all_with_location (gimple_seq, location_t);
987 /* Validation of GIMPLE expressions. Note that these predicates only check
988 the basic form of the expression, they don't recurse to make sure that
989 underlying nodes are also of the right form. */
990 typedef bool (*gimple_predicate)(tree);
993 /* FIXME we should deduce this from the predicate. */
994 enum fallback {
995 fb_none = 0, /* Do not generate a temporary. */
997 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
998 gimplified expression. */
1000 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
1001 gimplified expression. */
1003 fb_mayfail = 4, /* Gimplification may fail. Error issued
1004 afterwards. */
1005 fb_either= fb_rvalue | fb_lvalue
1008 typedef int fallback_t;
1010 enum gimplify_status {
1011 GS_ERROR = -2, /* Something Bad Seen. */
1012 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
1013 GS_OK = 0, /* We did something, maybe more to do. */
1014 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1017 struct gimplify_ctx
1019 struct gimplify_ctx *prev_context;
1021 VEC(gimple,heap) *bind_expr_stack;
1022 tree temps;
1023 gimple_seq conditional_cleanups;
1024 tree exit_label;
1025 tree return_temp;
1027 VEC(tree,heap) *case_labels;
1028 /* The formal temporary table. Should this be persistent? */
1029 htab_t temp_htab;
1031 int conditions;
1032 bool save_stack;
1033 bool into_ssa;
1034 bool allow_rhs_cond_expr;
1037 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1038 bool (*) (tree), fallback_t);
1039 extern void gimplify_type_sizes (tree, gimple_seq *);
1040 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1041 extern bool gimplify_stmt (tree *, gimple_seq *);
1042 extern gimple gimplify_body (tree *, tree, bool);
1043 extern void push_gimplify_context (struct gimplify_ctx *);
1044 extern void pop_gimplify_context (gimple);
1045 extern void gimplify_and_add (tree, gimple_seq *);
1047 /* Miscellaneous helpers. */
1048 extern void gimple_add_tmp_var (tree);
1049 extern gimple gimple_current_bind_expr (void);
1050 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1051 extern tree voidify_wrapper_expr (tree, tree);
1052 extern tree build_and_jump (tree *);
1053 extern tree force_labels_r (tree *, int *, void *);
1054 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1055 gimple_seq *);
1056 struct gimplify_omp_ctx;
1057 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1058 extern tree gimple_boolify (tree);
1059 extern gimple_predicate rhs_predicate_for (tree);
1060 extern tree canonicalize_cond_expr_cond (tree);
1062 /* In omp-low.c. */
1063 extern tree omp_reduction_init (tree, tree);
1065 /* In tree-nested.c. */
1066 extern void lower_nested_functions (tree);
1067 extern void insert_field_into_struct (tree, tree);
1069 /* In gimplify.c. */
1070 extern void gimplify_function_tree (tree);
1072 /* In cfgexpand.c. */
1073 extern tree gimple_assign_rhs_to_tree (gimple);
1075 /* In builtins.c */
1076 extern bool validate_gimple_arglist (const_gimple, ...);
1078 /* In tree-ssa.c */
1079 extern bool tree_ssa_useless_type_conversion (tree);
1080 extern tree tree_ssa_strip_useless_type_conversions (tree);
1081 extern bool useless_type_conversion_p (tree, tree);
1082 extern bool types_compatible_p (tree, tree);
1084 /* Return the code for GIMPLE statement G. */
1086 static inline enum gimple_code
1087 gimple_code (const_gimple g)
1089 return g->gsbase.code;
1093 /* Return the GSS code used by a GIMPLE code. */
1095 static inline enum gimple_statement_structure_enum
1096 gss_for_code (enum gimple_code code)
1098 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1099 return gss_for_code_[code];
1103 /* Return which GSS code is used by GS. */
1105 static inline enum gimple_statement_structure_enum
1106 gimple_statement_structure (gimple gs)
1108 return gss_for_code (gimple_code (gs));
1112 /* Return true if statement G has sub-statements. This is only true for
1113 High GIMPLE statements. */
1115 static inline bool
1116 gimple_has_substatements (gimple g)
1118 switch (gimple_code (g))
1120 case GIMPLE_BIND:
1121 case GIMPLE_CATCH:
1122 case GIMPLE_EH_FILTER:
1123 case GIMPLE_TRY:
1124 case GIMPLE_OMP_FOR:
1125 case GIMPLE_OMP_MASTER:
1126 case GIMPLE_OMP_ORDERED:
1127 case GIMPLE_OMP_SECTION:
1128 case GIMPLE_OMP_PARALLEL:
1129 case GIMPLE_OMP_TASK:
1130 case GIMPLE_OMP_SECTIONS:
1131 case GIMPLE_OMP_SINGLE:
1132 case GIMPLE_OMP_CRITICAL:
1133 case GIMPLE_WITH_CLEANUP_EXPR:
1134 return true;
1136 default:
1137 return false;
1142 /* Return the basic block holding statement G. */
1144 static inline struct basic_block_def *
1145 gimple_bb (const_gimple g)
1147 return g->gsbase.bb;
1151 /* Return the lexical scope block holding statement G. */
1153 static inline tree
1154 gimple_block (const_gimple g)
1156 return g->gsbase.block;
1160 /* Set BLOCK to be the lexical scope block holding statement G. */
1162 static inline void
1163 gimple_set_block (gimple g, tree block)
1165 g->gsbase.block = block;
1169 /* Return location information for statement G. */
1171 static inline location_t
1172 gimple_location (const_gimple g)
1174 return g->gsbase.location;
1177 /* Return pointer to location information for statement G. */
1179 static inline const location_t *
1180 gimple_location_ptr (const_gimple g)
1182 return &g->gsbase.location;
1186 /* Set location information for statement G. */
1188 static inline void
1189 gimple_set_location (gimple g, location_t location)
1191 g->gsbase.location = location;
1195 /* Return true if G contains location information. */
1197 static inline bool
1198 gimple_has_location (const_gimple g)
1200 return gimple_location (g) != UNKNOWN_LOCATION;
1204 /* Return the file name of the location of STMT. */
1206 static inline const char *
1207 gimple_filename (const_gimple stmt)
1209 return LOCATION_FILE (gimple_location (stmt));
1213 /* Return the line number of the location of STMT. */
1215 static inline int
1216 gimple_lineno (const_gimple stmt)
1218 return LOCATION_LINE (gimple_location (stmt));
1222 /* Determine whether SEQ is a singleton. */
1224 static inline bool
1225 gimple_seq_singleton_p (gimple_seq seq)
1227 return ((gimple_seq_first (seq) != NULL)
1228 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1231 /* Return true if no warnings should be emitted for statement STMT. */
1233 static inline bool
1234 gimple_no_warning_p (const_gimple stmt)
1236 return stmt->gsbase.no_warning;
1239 /* Set the no_warning flag of STMT to NO_WARNING. */
1241 static inline void
1242 gimple_set_no_warning (gimple stmt, bool no_warning)
1244 stmt->gsbase.no_warning = (unsigned) no_warning;
1247 /* Set the visited status on statement STMT to VISITED_P. */
1249 static inline void
1250 gimple_set_visited (gimple stmt, bool visited_p)
1252 stmt->gsbase.visited = (unsigned) visited_p;
1256 /* Return the visited status for statement STMT. */
1258 static inline bool
1259 gimple_visited_p (gimple stmt)
1261 return stmt->gsbase.visited;
1265 /* Set pass local flag PLF on statement STMT to VAL_P. */
1267 static inline void
1268 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1270 if (val_p)
1271 stmt->gsbase.plf |= (unsigned int) plf;
1272 else
1273 stmt->gsbase.plf &= ~((unsigned int) plf);
1277 /* Return the value of pass local flag PLF on statement STMT. */
1279 static inline unsigned int
1280 gimple_plf (gimple stmt, enum plf_mask plf)
1282 return stmt->gsbase.plf & ((unsigned int) plf);
1286 /* Set the UID of statement. */
1288 static inline void
1289 gimple_set_uid (gimple g, unsigned uid)
1291 g->gsbase.uid = uid;
1295 /* Return the UID of statement. */
1297 static inline unsigned
1298 gimple_uid (const_gimple g)
1300 return g->gsbase.uid;
1304 /* Return true if GIMPLE statement G has register or memory operands. */
1306 static inline bool
1307 gimple_has_ops (const_gimple g)
1309 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1313 /* Return true if GIMPLE statement G has memory operands. */
1315 static inline bool
1316 gimple_has_mem_ops (const_gimple g)
1318 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1322 /* Return the set of DEF operands for statement G. */
1324 static inline struct def_optype_d *
1325 gimple_def_ops (const_gimple g)
1327 if (!gimple_has_ops (g))
1328 return NULL;
1329 return g->gsops.opbase.def_ops;
1333 /* Set DEF to be the set of DEF operands for statement G. */
1335 static inline void
1336 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1338 gcc_gimple_checking_assert (gimple_has_ops (g));
1339 g->gsops.opbase.def_ops = def;
1343 /* Return the set of USE operands for statement G. */
1345 static inline struct use_optype_d *
1346 gimple_use_ops (const_gimple g)
1348 if (!gimple_has_ops (g))
1349 return NULL;
1350 return g->gsops.opbase.use_ops;
1354 /* Set USE to be the set of USE operands for statement G. */
1356 static inline void
1357 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1359 gcc_gimple_checking_assert (gimple_has_ops (g));
1360 g->gsops.opbase.use_ops = use;
1364 /* Return the set of VUSE operand for statement G. */
1366 static inline use_operand_p
1367 gimple_vuse_op (const_gimple g)
1369 struct use_optype_d *ops;
1370 if (!gimple_has_mem_ops (g))
1371 return NULL_USE_OPERAND_P;
1372 ops = g->gsops.opbase.use_ops;
1373 if (ops
1374 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1375 return USE_OP_PTR (ops);
1376 return NULL_USE_OPERAND_P;
1379 /* Return the set of VDEF operand for statement G. */
1381 static inline def_operand_p
1382 gimple_vdef_op (const_gimple g)
1384 struct def_optype_d *ops;
1385 if (!gimple_has_mem_ops (g))
1386 return NULL_DEF_OPERAND_P;
1387 ops = g->gsops.opbase.def_ops;
1388 if (ops
1389 && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1390 return DEF_OP_PTR (ops);
1391 return NULL_DEF_OPERAND_P;
1395 /* Return the single VUSE operand of the statement G. */
1397 static inline tree
1398 gimple_vuse (const_gimple g)
1400 if (!gimple_has_mem_ops (g))
1401 return NULL_TREE;
1402 return g->gsmembase.vuse;
1405 /* Return the single VDEF operand of the statement G. */
1407 static inline tree
1408 gimple_vdef (const_gimple g)
1410 if (!gimple_has_mem_ops (g))
1411 return NULL_TREE;
1412 return g->gsmembase.vdef;
1415 /* Return the single VUSE operand of the statement G. */
1417 static inline tree *
1418 gimple_vuse_ptr (gimple g)
1420 if (!gimple_has_mem_ops (g))
1421 return NULL;
1422 return &g->gsmembase.vuse;
1425 /* Return the single VDEF operand of the statement G. */
1427 static inline tree *
1428 gimple_vdef_ptr (gimple g)
1430 if (!gimple_has_mem_ops (g))
1431 return NULL;
1432 return &g->gsmembase.vdef;
1435 /* Set the single VUSE operand of the statement G. */
1437 static inline void
1438 gimple_set_vuse (gimple g, tree vuse)
1440 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1441 g->gsmembase.vuse = vuse;
1444 /* Set the single VDEF operand of the statement G. */
1446 static inline void
1447 gimple_set_vdef (gimple g, tree vdef)
1449 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1450 g->gsmembase.vdef = vdef;
1454 /* Return true if statement G has operands and the modified field has
1455 been set. */
1457 static inline bool
1458 gimple_modified_p (const_gimple g)
1460 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1464 /* Return the tree code for the expression computed by STMT. This is
1465 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1466 GIMPLE_CALL, return CALL_EXPR as the expression code for
1467 consistency. This is useful when the caller needs to deal with the
1468 three kinds of computation that GIMPLE supports. */
1470 static inline enum tree_code
1471 gimple_expr_code (const_gimple stmt)
1473 enum gimple_code code = gimple_code (stmt);
1474 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1475 return (enum tree_code) stmt->gsbase.subcode;
1476 else
1478 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1479 return CALL_EXPR;
1484 /* Mark statement S as modified, and update it. */
1486 static inline void
1487 update_stmt (gimple s)
1489 if (gimple_has_ops (s))
1491 gimple_set_modified (s, true);
1492 update_stmt_operands (s);
1496 /* Update statement S if it has been optimized. */
1498 static inline void
1499 update_stmt_if_modified (gimple s)
1501 if (gimple_modified_p (s))
1502 update_stmt_operands (s);
1505 /* Return true if statement STMT contains volatile operands. */
1507 static inline bool
1508 gimple_has_volatile_ops (const_gimple stmt)
1510 if (gimple_has_mem_ops (stmt))
1511 return stmt->gsbase.has_volatile_ops;
1512 else
1513 return false;
1517 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1519 static inline void
1520 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1522 if (gimple_has_mem_ops (stmt))
1523 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1527 /* Return true if statement STMT may access memory. */
1529 static inline bool
1530 gimple_references_memory_p (gimple stmt)
1532 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1536 /* Return the subcode for OMP statement S. */
1538 static inline unsigned
1539 gimple_omp_subcode (const_gimple s)
1541 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1542 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1543 return s->gsbase.subcode;
1546 /* Set the subcode for OMP statement S to SUBCODE. */
1548 static inline void
1549 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1551 /* We only have 16 bits for the subcode. Assert that we are not
1552 overflowing it. */
1553 gcc_gimple_checking_assert (subcode < (1 << 16));
1554 s->gsbase.subcode = subcode;
1557 /* Set the nowait flag on OMP_RETURN statement S. */
1559 static inline void
1560 gimple_omp_return_set_nowait (gimple s)
1562 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1563 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1567 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1568 flag set. */
1570 static inline bool
1571 gimple_omp_return_nowait_p (const_gimple g)
1573 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1574 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1578 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1579 flag set. */
1581 static inline bool
1582 gimple_omp_section_last_p (const_gimple g)
1584 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1585 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1589 /* Set the GF_OMP_SECTION_LAST flag on G. */
1591 static inline void
1592 gimple_omp_section_set_last (gimple g)
1594 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1595 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1599 /* Return true if OMP parallel statement G has the
1600 GF_OMP_PARALLEL_COMBINED flag set. */
1602 static inline bool
1603 gimple_omp_parallel_combined_p (const_gimple g)
1605 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1606 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1610 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1611 value of COMBINED_P. */
1613 static inline void
1614 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1616 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1617 if (combined_p)
1618 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1619 else
1620 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1624 /* Return the number of operands for statement GS. */
1626 static inline unsigned
1627 gimple_num_ops (const_gimple gs)
1629 return gs->gsbase.num_ops;
1633 /* Set the number of operands for statement GS. */
1635 static inline void
1636 gimple_set_num_ops (gimple gs, unsigned num_ops)
1638 gs->gsbase.num_ops = num_ops;
1642 /* Return the array of operands for statement GS. */
1644 static inline tree *
1645 gimple_ops (gimple gs)
1647 size_t off;
1649 /* All the tuples have their operand vector at the very bottom
1650 of the structure. Note that those structures that do not
1651 have an operand vector have a zero offset. */
1652 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1653 gcc_gimple_checking_assert (off != 0);
1655 return (tree *) ((char *) gs + off);
1659 /* Return operand I for statement GS. */
1661 static inline tree
1662 gimple_op (const_gimple gs, unsigned i)
1664 if (gimple_has_ops (gs))
1666 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1667 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1669 else
1670 return NULL_TREE;
1673 /* Return a pointer to operand I for statement GS. */
1675 static inline tree *
1676 gimple_op_ptr (const_gimple gs, unsigned i)
1678 if (gimple_has_ops (gs))
1680 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1681 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1683 else
1684 return NULL;
1687 /* Set operand I of statement GS to OP. */
1689 static inline void
1690 gimple_set_op (gimple gs, unsigned i, tree op)
1692 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1694 /* Note. It may be tempting to assert that OP matches
1695 is_gimple_operand, but that would be wrong. Different tuples
1696 accept slightly different sets of tree operands. Each caller
1697 should perform its own validation. */
1698 gimple_ops (gs)[i] = op;
1701 /* Return true if GS is a GIMPLE_ASSIGN. */
1703 static inline bool
1704 is_gimple_assign (const_gimple gs)
1706 return gimple_code (gs) == GIMPLE_ASSIGN;
1709 /* Determine if expression CODE is one of the valid expressions that can
1710 be used on the RHS of GIMPLE assignments. */
1712 static inline enum gimple_rhs_class
1713 get_gimple_rhs_class (enum tree_code code)
1715 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1718 /* Return the LHS of assignment statement GS. */
1720 static inline tree
1721 gimple_assign_lhs (const_gimple gs)
1723 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1724 return gimple_op (gs, 0);
1728 /* Return a pointer to the LHS of assignment statement GS. */
1730 static inline tree *
1731 gimple_assign_lhs_ptr (const_gimple gs)
1733 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1734 return gimple_op_ptr (gs, 0);
1738 /* Set LHS to be the LHS operand of assignment statement GS. */
1740 static inline void
1741 gimple_assign_set_lhs (gimple gs, tree lhs)
1743 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1744 gimple_set_op (gs, 0, lhs);
1746 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1747 SSA_NAME_DEF_STMT (lhs) = gs;
1751 /* Return the first operand on the RHS of assignment statement GS. */
1753 static inline tree
1754 gimple_assign_rhs1 (const_gimple gs)
1756 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1757 return gimple_op (gs, 1);
1761 /* Return a pointer to the first operand on the RHS of assignment
1762 statement GS. */
1764 static inline tree *
1765 gimple_assign_rhs1_ptr (const_gimple gs)
1767 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1768 return gimple_op_ptr (gs, 1);
1771 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1773 static inline void
1774 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1776 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1778 gimple_set_op (gs, 1, rhs);
1782 /* Return the second operand on the RHS of assignment statement GS.
1783 If GS does not have two operands, NULL is returned instead. */
1785 static inline tree
1786 gimple_assign_rhs2 (const_gimple gs)
1788 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1790 if (gimple_num_ops (gs) >= 3)
1791 return gimple_op (gs, 2);
1792 else
1793 return NULL_TREE;
1797 /* Return a pointer to the second operand on the RHS of assignment
1798 statement GS. */
1800 static inline tree *
1801 gimple_assign_rhs2_ptr (const_gimple gs)
1803 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1804 return gimple_op_ptr (gs, 2);
1808 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1810 static inline void
1811 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1813 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1815 gimple_set_op (gs, 2, rhs);
1818 /* Return the third operand on the RHS of assignment statement GS.
1819 If GS does not have two operands, NULL is returned instead. */
1821 static inline tree
1822 gimple_assign_rhs3 (const_gimple gs)
1824 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1826 if (gimple_num_ops (gs) >= 4)
1827 return gimple_op (gs, 3);
1828 else
1829 return NULL_TREE;
1832 /* Return a pointer to the third operand on the RHS of assignment
1833 statement GS. */
1835 static inline tree *
1836 gimple_assign_rhs3_ptr (const_gimple gs)
1838 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1839 return gimple_op_ptr (gs, 3);
1843 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1845 static inline void
1846 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1848 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1850 gimple_set_op (gs, 3, rhs);
1853 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1854 to see only a maximum of two operands. */
1856 static inline void
1857 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1858 tree op1, tree op2)
1860 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1863 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1864 to see only a maximum of two operands. */
1866 static inline void
1867 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1868 tree *op1)
1870 tree op2;
1871 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1872 gcc_assert (op2 == NULL_TREE);
1875 /* Returns true if GS is a nontemporal move. */
1877 static inline bool
1878 gimple_assign_nontemporal_move_p (const_gimple gs)
1880 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1881 return gs->gsbase.nontemporal_move;
1884 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1886 static inline void
1887 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1889 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1890 gs->gsbase.nontemporal_move = nontemporal;
1894 /* Return the code of the expression computed on the rhs of assignment
1895 statement GS. In case that the RHS is a single object, returns the
1896 tree code of the object. */
1898 static inline enum tree_code
1899 gimple_assign_rhs_code (const_gimple gs)
1901 enum tree_code code;
1902 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1904 code = (enum tree_code) gs->gsbase.subcode;
1905 /* While we initially set subcode to the TREE_CODE of the rhs for
1906 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
1907 in sync when we rewrite stmts into SSA form or do SSA propagations. */
1908 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1909 code = TREE_CODE (gimple_assign_rhs1 (gs));
1911 return code;
1915 /* Set CODE to be the code for the expression computed on the RHS of
1916 assignment S. */
1918 static inline void
1919 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
1921 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
1922 s->gsbase.subcode = code;
1926 /* Return the gimple rhs class of the code of the expression computed on
1927 the rhs of assignment statement GS.
1928 This will never return GIMPLE_INVALID_RHS. */
1930 static inline enum gimple_rhs_class
1931 gimple_assign_rhs_class (const_gimple gs)
1933 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
1936 /* Return true if GS is an assignment with a singleton RHS, i.e.,
1937 there is no operator associated with the assignment itself.
1938 Unlike gimple_assign_copy_p, this predicate returns true for
1939 any RHS operand, including those that perform an operation
1940 and do not have the semantics of a copy, such as COND_EXPR. */
1942 static inline bool
1943 gimple_assign_single_p (gimple gs)
1945 return (is_gimple_assign (gs)
1946 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
1950 /* Return true if S is a type-cast assignment. */
1952 static inline bool
1953 gimple_assign_cast_p (gimple s)
1955 if (is_gimple_assign (s))
1957 enum tree_code sc = gimple_assign_rhs_code (s);
1958 return CONVERT_EXPR_CODE_P (sc)
1959 || sc == VIEW_CONVERT_EXPR
1960 || sc == FIX_TRUNC_EXPR;
1963 return false;
1967 /* Return true if GS is a GIMPLE_CALL. */
1969 static inline bool
1970 is_gimple_call (const_gimple gs)
1972 return gimple_code (gs) == GIMPLE_CALL;
1975 /* Return the LHS of call statement GS. */
1977 static inline tree
1978 gimple_call_lhs (const_gimple gs)
1980 GIMPLE_CHECK (gs, GIMPLE_CALL);
1981 return gimple_op (gs, 0);
1985 /* Return a pointer to the LHS of call statement GS. */
1987 static inline tree *
1988 gimple_call_lhs_ptr (const_gimple gs)
1990 GIMPLE_CHECK (gs, GIMPLE_CALL);
1991 return gimple_op_ptr (gs, 0);
1995 /* Set LHS to be the LHS operand of call statement GS. */
1997 static inline void
1998 gimple_call_set_lhs (gimple gs, tree lhs)
2000 GIMPLE_CHECK (gs, GIMPLE_CALL);
2001 gimple_set_op (gs, 0, lhs);
2002 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2003 SSA_NAME_DEF_STMT (lhs) = gs;
2007 /* Return the function type of the function called by GS. */
2009 static inline tree
2010 gimple_call_fntype (const_gimple gs)
2012 GIMPLE_CHECK (gs, GIMPLE_CALL);
2013 return gs->gimple_call.fntype;
2016 /* Set the type of the function called by GS to FNTYPE. */
2018 static inline void
2019 gimple_call_set_fntype (gimple gs, tree fntype)
2021 GIMPLE_CHECK (gs, GIMPLE_CALL);
2022 gs->gimple_call.fntype = fntype;
2026 /* Return the tree node representing the function called by call
2027 statement GS. */
2029 static inline tree
2030 gimple_call_fn (const_gimple gs)
2032 GIMPLE_CHECK (gs, GIMPLE_CALL);
2033 return gimple_op (gs, 1);
2036 /* Return a pointer to the tree node representing the function called by call
2037 statement GS. */
2039 static inline tree *
2040 gimple_call_fn_ptr (const_gimple gs)
2042 GIMPLE_CHECK (gs, GIMPLE_CALL);
2043 return gimple_op_ptr (gs, 1);
2047 /* Set FN to be the function called by call statement GS. */
2049 static inline void
2050 gimple_call_set_fn (gimple gs, tree fn)
2052 GIMPLE_CHECK (gs, GIMPLE_CALL);
2053 gimple_set_op (gs, 1, fn);
2057 /* Set FNDECL to be the function called by call statement GS. */
2059 static inline void
2060 gimple_call_set_fndecl (gimple gs, tree decl)
2062 GIMPLE_CHECK (gs, GIMPLE_CALL);
2063 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2067 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2068 Otherwise return NULL. This function is analogous to
2069 get_callee_fndecl in tree land. */
2071 static inline tree
2072 gimple_call_fndecl (const_gimple gs)
2074 tree addr = gimple_call_fn (gs);
2075 if (TREE_CODE (addr) == ADDR_EXPR)
2077 tree fndecl = TREE_OPERAND (addr, 0);
2078 if (TREE_CODE (fndecl) == MEM_REF)
2080 if (TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2081 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2082 return TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2083 else
2084 return NULL_TREE;
2086 return TREE_OPERAND (addr, 0);
2088 return NULL_TREE;
2092 /* Return the type returned by call statement GS. */
2094 static inline tree
2095 gimple_call_return_type (const_gimple gs)
2097 tree type = gimple_call_fntype (gs);
2099 /* The type returned by a function is the type of its
2100 function type. */
2101 return TREE_TYPE (type);
2105 /* Return the static chain for call statement GS. */
2107 static inline tree
2108 gimple_call_chain (const_gimple gs)
2110 GIMPLE_CHECK (gs, GIMPLE_CALL);
2111 return gimple_op (gs, 2);
2115 /* Return a pointer to the static chain for call statement GS. */
2117 static inline tree *
2118 gimple_call_chain_ptr (const_gimple gs)
2120 GIMPLE_CHECK (gs, GIMPLE_CALL);
2121 return gimple_op_ptr (gs, 2);
2124 /* Set CHAIN to be the static chain for call statement GS. */
2126 static inline void
2127 gimple_call_set_chain (gimple gs, tree chain)
2129 GIMPLE_CHECK (gs, GIMPLE_CALL);
2131 gimple_set_op (gs, 2, chain);
2135 /* Return the number of arguments used by call statement GS. */
2137 static inline unsigned
2138 gimple_call_num_args (const_gimple gs)
2140 unsigned num_ops;
2141 GIMPLE_CHECK (gs, GIMPLE_CALL);
2142 num_ops = gimple_num_ops (gs);
2143 return num_ops - 3;
2147 /* Return the argument at position INDEX for call statement GS. */
2149 static inline tree
2150 gimple_call_arg (const_gimple gs, unsigned index)
2152 GIMPLE_CHECK (gs, GIMPLE_CALL);
2153 return gimple_op (gs, index + 3);
2157 /* Return a pointer to the argument at position INDEX for call
2158 statement GS. */
2160 static inline tree *
2161 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2163 GIMPLE_CHECK (gs, GIMPLE_CALL);
2164 return gimple_op_ptr (gs, index + 3);
2168 /* Set ARG to be the argument at position INDEX for call statement GS. */
2170 static inline void
2171 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2173 GIMPLE_CHECK (gs, GIMPLE_CALL);
2174 gimple_set_op (gs, index + 3, arg);
2178 /* If TAIL_P is true, mark call statement S as being a tail call
2179 (i.e., a call just before the exit of a function). These calls are
2180 candidate for tail call optimization. */
2182 static inline void
2183 gimple_call_set_tail (gimple s, bool tail_p)
2185 GIMPLE_CHECK (s, GIMPLE_CALL);
2186 if (tail_p)
2187 s->gsbase.subcode |= GF_CALL_TAILCALL;
2188 else
2189 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2193 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2195 static inline bool
2196 gimple_call_tail_p (gimple s)
2198 GIMPLE_CHECK (s, GIMPLE_CALL);
2199 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2203 /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
2205 static inline void
2206 gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
2208 GIMPLE_CHECK (s, GIMPLE_CALL);
2209 if (inlinable_p)
2210 s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
2211 else
2212 s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
2216 /* Return true if GIMPLE_CALL S cannot be inlined. */
2218 static inline bool
2219 gimple_call_cannot_inline_p (gimple s)
2221 GIMPLE_CHECK (s, GIMPLE_CALL);
2222 return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0;
2226 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2227 slot optimization. This transformation uses the target of the call
2228 expansion as the return slot for calls that return in memory. */
2230 static inline void
2231 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2233 GIMPLE_CHECK (s, GIMPLE_CALL);
2234 if (return_slot_opt_p)
2235 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2236 else
2237 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2241 /* Return true if S is marked for return slot optimization. */
2243 static inline bool
2244 gimple_call_return_slot_opt_p (gimple s)
2246 GIMPLE_CHECK (s, GIMPLE_CALL);
2247 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2251 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2252 thunk to the thunked-to function. */
2254 static inline void
2255 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2257 GIMPLE_CHECK (s, GIMPLE_CALL);
2258 if (from_thunk_p)
2259 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2260 else
2261 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2265 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2267 static inline bool
2268 gimple_call_from_thunk_p (gimple s)
2270 GIMPLE_CHECK (s, GIMPLE_CALL);
2271 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2275 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2276 argument pack in its argument list. */
2278 static inline void
2279 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2281 GIMPLE_CHECK (s, GIMPLE_CALL);
2282 if (pass_arg_pack_p)
2283 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2284 else
2285 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2289 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2290 argument pack in its argument list. */
2292 static inline bool
2293 gimple_call_va_arg_pack_p (gimple s)
2295 GIMPLE_CHECK (s, GIMPLE_CALL);
2296 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2300 /* Return true if S is a noreturn call. */
2302 static inline bool
2303 gimple_call_noreturn_p (gimple s)
2305 GIMPLE_CHECK (s, GIMPLE_CALL);
2306 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2310 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2311 even if the called function can throw in other cases. */
2313 static inline void
2314 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2316 GIMPLE_CHECK (s, GIMPLE_CALL);
2317 if (nothrow_p)
2318 s->gsbase.subcode |= GF_CALL_NOTHROW;
2319 else
2320 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2323 /* Return true if S is a nothrow call. */
2325 static inline bool
2326 gimple_call_nothrow_p (gimple s)
2328 GIMPLE_CHECK (s, GIMPLE_CALL);
2329 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2333 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2335 static inline void
2336 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2338 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2339 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2340 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2344 /* Return a pointer to the points-to solution for the set of call-used
2345 variables of the call CALL. */
2347 static inline struct pt_solution *
2348 gimple_call_use_set (gimple call)
2350 GIMPLE_CHECK (call, GIMPLE_CALL);
2351 return &call->gimple_call.call_used;
2355 /* Return a pointer to the points-to solution for the set of call-used
2356 variables of the call CALL. */
2358 static inline struct pt_solution *
2359 gimple_call_clobber_set (gimple call)
2361 GIMPLE_CHECK (call, GIMPLE_CALL);
2362 return &call->gimple_call.call_clobbered;
2366 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2367 non-NULL lhs. */
2369 static inline bool
2370 gimple_has_lhs (gimple stmt)
2372 return (is_gimple_assign (stmt)
2373 || (is_gimple_call (stmt)
2374 && gimple_call_lhs (stmt) != NULL_TREE));
2378 /* Return the code of the predicate computed by conditional statement GS. */
2380 static inline enum tree_code
2381 gimple_cond_code (const_gimple gs)
2383 GIMPLE_CHECK (gs, GIMPLE_COND);
2384 return (enum tree_code) gs->gsbase.subcode;
2388 /* Set CODE to be the predicate code for the conditional statement GS. */
2390 static inline void
2391 gimple_cond_set_code (gimple gs, enum tree_code code)
2393 GIMPLE_CHECK (gs, GIMPLE_COND);
2394 gs->gsbase.subcode = code;
2398 /* Return the LHS of the predicate computed by conditional statement GS. */
2400 static inline tree
2401 gimple_cond_lhs (const_gimple gs)
2403 GIMPLE_CHECK (gs, GIMPLE_COND);
2404 return gimple_op (gs, 0);
2407 /* Return the pointer to the LHS of the predicate computed by conditional
2408 statement GS. */
2410 static inline tree *
2411 gimple_cond_lhs_ptr (const_gimple gs)
2413 GIMPLE_CHECK (gs, GIMPLE_COND);
2414 return gimple_op_ptr (gs, 0);
2417 /* Set LHS to be the LHS operand of the predicate computed by
2418 conditional statement GS. */
2420 static inline void
2421 gimple_cond_set_lhs (gimple gs, tree lhs)
2423 GIMPLE_CHECK (gs, GIMPLE_COND);
2424 gimple_set_op (gs, 0, lhs);
2428 /* Return the RHS operand of the predicate computed by conditional GS. */
2430 static inline tree
2431 gimple_cond_rhs (const_gimple gs)
2433 GIMPLE_CHECK (gs, GIMPLE_COND);
2434 return gimple_op (gs, 1);
2437 /* Return the pointer to the RHS operand of the predicate computed by
2438 conditional GS. */
2440 static inline tree *
2441 gimple_cond_rhs_ptr (const_gimple gs)
2443 GIMPLE_CHECK (gs, GIMPLE_COND);
2444 return gimple_op_ptr (gs, 1);
2448 /* Set RHS to be the RHS operand of the predicate computed by
2449 conditional statement GS. */
2451 static inline void
2452 gimple_cond_set_rhs (gimple gs, tree rhs)
2454 GIMPLE_CHECK (gs, GIMPLE_COND);
2455 gimple_set_op (gs, 1, rhs);
2459 /* Return the label used by conditional statement GS when its
2460 predicate evaluates to true. */
2462 static inline tree
2463 gimple_cond_true_label (const_gimple gs)
2465 GIMPLE_CHECK (gs, GIMPLE_COND);
2466 return gimple_op (gs, 2);
2470 /* Set LABEL to be the label used by conditional statement GS when its
2471 predicate evaluates to true. */
2473 static inline void
2474 gimple_cond_set_true_label (gimple gs, tree label)
2476 GIMPLE_CHECK (gs, GIMPLE_COND);
2477 gimple_set_op (gs, 2, label);
2481 /* Set LABEL to be the label used by conditional statement GS when its
2482 predicate evaluates to false. */
2484 static inline void
2485 gimple_cond_set_false_label (gimple gs, tree label)
2487 GIMPLE_CHECK (gs, GIMPLE_COND);
2488 gimple_set_op (gs, 3, label);
2492 /* Return the label used by conditional statement GS when its
2493 predicate evaluates to false. */
2495 static inline tree
2496 gimple_cond_false_label (const_gimple gs)
2498 GIMPLE_CHECK (gs, GIMPLE_COND);
2499 return gimple_op (gs, 3);
2503 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2505 static inline void
2506 gimple_cond_make_false (gimple gs)
2508 gimple_cond_set_lhs (gs, boolean_true_node);
2509 gimple_cond_set_rhs (gs, boolean_false_node);
2510 gs->gsbase.subcode = EQ_EXPR;
2514 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2516 static inline void
2517 gimple_cond_make_true (gimple gs)
2519 gimple_cond_set_lhs (gs, boolean_true_node);
2520 gimple_cond_set_rhs (gs, boolean_true_node);
2521 gs->gsbase.subcode = EQ_EXPR;
2524 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2525 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2527 static inline bool
2528 gimple_cond_true_p (const_gimple gs)
2530 tree lhs = gimple_cond_lhs (gs);
2531 tree rhs = gimple_cond_rhs (gs);
2532 enum tree_code code = gimple_cond_code (gs);
2534 if (lhs != boolean_true_node && lhs != boolean_false_node)
2535 return false;
2537 if (rhs != boolean_true_node && rhs != boolean_false_node)
2538 return false;
2540 if (code == NE_EXPR && lhs != rhs)
2541 return true;
2543 if (code == EQ_EXPR && lhs == rhs)
2544 return true;
2546 return false;
2549 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2550 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2552 static inline bool
2553 gimple_cond_false_p (const_gimple gs)
2555 tree lhs = gimple_cond_lhs (gs);
2556 tree rhs = gimple_cond_rhs (gs);
2557 enum tree_code code = gimple_cond_code (gs);
2559 if (lhs != boolean_true_node && lhs != boolean_false_node)
2560 return false;
2562 if (rhs != boolean_true_node && rhs != boolean_false_node)
2563 return false;
2565 if (code == NE_EXPR && lhs == rhs)
2566 return true;
2568 if (code == EQ_EXPR && lhs != rhs)
2569 return true;
2571 return false;
2574 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2575 'if (var == 1)' */
2577 static inline bool
2578 gimple_cond_single_var_p (gimple gs)
2580 if (gimple_cond_code (gs) == NE_EXPR
2581 && gimple_cond_rhs (gs) == boolean_false_node)
2582 return true;
2584 if (gimple_cond_code (gs) == EQ_EXPR
2585 && gimple_cond_rhs (gs) == boolean_true_node)
2586 return true;
2588 return false;
2591 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2593 static inline void
2594 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2596 gimple_cond_set_code (stmt, code);
2597 gimple_cond_set_lhs (stmt, lhs);
2598 gimple_cond_set_rhs (stmt, rhs);
2601 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2603 static inline tree
2604 gimple_label_label (const_gimple gs)
2606 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2607 return gimple_op (gs, 0);
2611 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2612 GS. */
2614 static inline void
2615 gimple_label_set_label (gimple gs, tree label)
2617 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2618 gimple_set_op (gs, 0, label);
2622 /* Return the destination of the unconditional jump GS. */
2624 static inline tree
2625 gimple_goto_dest (const_gimple gs)
2627 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2628 return gimple_op (gs, 0);
2632 /* Set DEST to be the destination of the unconditonal jump GS. */
2634 static inline void
2635 gimple_goto_set_dest (gimple gs, tree dest)
2637 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2638 gimple_set_op (gs, 0, dest);
2642 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2644 static inline tree
2645 gimple_bind_vars (const_gimple gs)
2647 GIMPLE_CHECK (gs, GIMPLE_BIND);
2648 return gs->gimple_bind.vars;
2652 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2653 statement GS. */
2655 static inline void
2656 gimple_bind_set_vars (gimple gs, tree vars)
2658 GIMPLE_CHECK (gs, GIMPLE_BIND);
2659 gs->gimple_bind.vars = vars;
2663 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2664 statement GS. */
2666 static inline void
2667 gimple_bind_append_vars (gimple gs, tree vars)
2669 GIMPLE_CHECK (gs, GIMPLE_BIND);
2670 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2674 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2676 static inline gimple_seq
2677 gimple_bind_body (gimple gs)
2679 GIMPLE_CHECK (gs, GIMPLE_BIND);
2680 return gs->gimple_bind.body;
2684 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2685 statement GS. */
2687 static inline void
2688 gimple_bind_set_body (gimple gs, gimple_seq seq)
2690 GIMPLE_CHECK (gs, GIMPLE_BIND);
2691 gs->gimple_bind.body = seq;
2695 /* Append a statement to the end of a GIMPLE_BIND's body. */
2697 static inline void
2698 gimple_bind_add_stmt (gimple gs, gimple stmt)
2700 GIMPLE_CHECK (gs, GIMPLE_BIND);
2701 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2705 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2707 static inline void
2708 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2710 GIMPLE_CHECK (gs, GIMPLE_BIND);
2711 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2715 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2716 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2718 static inline tree
2719 gimple_bind_block (const_gimple gs)
2721 GIMPLE_CHECK (gs, GIMPLE_BIND);
2722 return gs->gimple_bind.block;
2726 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2727 statement GS. */
2729 static inline void
2730 gimple_bind_set_block (gimple gs, tree block)
2732 GIMPLE_CHECK (gs, GIMPLE_BIND);
2733 gcc_gimple_checking_assert (block == NULL_TREE
2734 || TREE_CODE (block) == BLOCK);
2735 gs->gimple_bind.block = block;
2739 /* Return the number of input operands for GIMPLE_ASM GS. */
2741 static inline unsigned
2742 gimple_asm_ninputs (const_gimple gs)
2744 GIMPLE_CHECK (gs, GIMPLE_ASM);
2745 return gs->gimple_asm.ni;
2749 /* Return the number of output operands for GIMPLE_ASM GS. */
2751 static inline unsigned
2752 gimple_asm_noutputs (const_gimple gs)
2754 GIMPLE_CHECK (gs, GIMPLE_ASM);
2755 return gs->gimple_asm.no;
2759 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2761 static inline unsigned
2762 gimple_asm_nclobbers (const_gimple gs)
2764 GIMPLE_CHECK (gs, GIMPLE_ASM);
2765 return gs->gimple_asm.nc;
2768 /* Return the number of label operands for GIMPLE_ASM GS. */
2770 static inline unsigned
2771 gimple_asm_nlabels (const_gimple gs)
2773 GIMPLE_CHECK (gs, GIMPLE_ASM);
2774 return gs->gimple_asm.nl;
2777 /* Return input operand INDEX of GIMPLE_ASM GS. */
2779 static inline tree
2780 gimple_asm_input_op (const_gimple gs, unsigned index)
2782 GIMPLE_CHECK (gs, GIMPLE_ASM);
2783 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2784 return gimple_op (gs, index);
2787 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2789 static inline tree *
2790 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2792 GIMPLE_CHECK (gs, GIMPLE_ASM);
2793 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2794 return gimple_op_ptr (gs, index);
2798 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2800 static inline void
2801 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2803 GIMPLE_CHECK (gs, GIMPLE_ASM);
2804 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
2805 && TREE_CODE (in_op) == TREE_LIST);
2806 gimple_set_op (gs, index, in_op);
2810 /* Return output operand INDEX of GIMPLE_ASM GS. */
2812 static inline tree
2813 gimple_asm_output_op (const_gimple gs, unsigned index)
2815 GIMPLE_CHECK (gs, GIMPLE_ASM);
2816 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2817 return gimple_op (gs, index + gs->gimple_asm.ni);
2820 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2822 static inline tree *
2823 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2825 GIMPLE_CHECK (gs, GIMPLE_ASM);
2826 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2827 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2831 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2833 static inline void
2834 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2836 GIMPLE_CHECK (gs, GIMPLE_ASM);
2837 gcc_gimple_checking_assert (index <= gs->gimple_asm.no
2838 && TREE_CODE (out_op) == TREE_LIST);
2839 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2843 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2845 static inline tree
2846 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2848 GIMPLE_CHECK (gs, GIMPLE_ASM);
2849 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
2850 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2854 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2856 static inline void
2857 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2859 GIMPLE_CHECK (gs, GIMPLE_ASM);
2860 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
2861 && TREE_CODE (clobber_op) == TREE_LIST);
2862 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2865 /* Return label operand INDEX of GIMPLE_ASM GS. */
2867 static inline tree
2868 gimple_asm_label_op (const_gimple gs, unsigned index)
2870 GIMPLE_CHECK (gs, GIMPLE_ASM);
2871 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
2872 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
2875 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
2877 static inline void
2878 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
2880 GIMPLE_CHECK (gs, GIMPLE_ASM);
2881 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
2882 && TREE_CODE (label_op) == TREE_LIST);
2883 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
2886 /* Return the string representing the assembly instruction in
2887 GIMPLE_ASM GS. */
2889 static inline const char *
2890 gimple_asm_string (const_gimple gs)
2892 GIMPLE_CHECK (gs, GIMPLE_ASM);
2893 return gs->gimple_asm.string;
2897 /* Return true if GS is an asm statement marked volatile. */
2899 static inline bool
2900 gimple_asm_volatile_p (const_gimple gs)
2902 GIMPLE_CHECK (gs, GIMPLE_ASM);
2903 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
2907 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
2909 static inline void
2910 gimple_asm_set_volatile (gimple gs, bool volatile_p)
2912 GIMPLE_CHECK (gs, GIMPLE_ASM);
2913 if (volatile_p)
2914 gs->gsbase.subcode |= GF_ASM_VOLATILE;
2915 else
2916 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
2920 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
2922 static inline void
2923 gimple_asm_set_input (gimple gs, bool input_p)
2925 GIMPLE_CHECK (gs, GIMPLE_ASM);
2926 if (input_p)
2927 gs->gsbase.subcode |= GF_ASM_INPUT;
2928 else
2929 gs->gsbase.subcode &= ~GF_ASM_INPUT;
2933 /* Return true if asm GS is an ASM_INPUT. */
2935 static inline bool
2936 gimple_asm_input_p (const_gimple gs)
2938 GIMPLE_CHECK (gs, GIMPLE_ASM);
2939 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
2943 /* Return the types handled by GIMPLE_CATCH statement GS. */
2945 static inline tree
2946 gimple_catch_types (const_gimple gs)
2948 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2949 return gs->gimple_catch.types;
2953 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
2955 static inline tree *
2956 gimple_catch_types_ptr (gimple gs)
2958 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2959 return &gs->gimple_catch.types;
2963 /* Return the GIMPLE sequence representing the body of the handler of
2964 GIMPLE_CATCH statement GS. */
2966 static inline gimple_seq
2967 gimple_catch_handler (gimple gs)
2969 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2970 return gs->gimple_catch.handler;
2974 /* Return a pointer to the GIMPLE sequence representing the body of
2975 the handler of GIMPLE_CATCH statement GS. */
2977 static inline gimple_seq *
2978 gimple_catch_handler_ptr (gimple gs)
2980 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2981 return &gs->gimple_catch.handler;
2985 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
2987 static inline void
2988 gimple_catch_set_types (gimple gs, tree t)
2990 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2991 gs->gimple_catch.types = t;
2995 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
2997 static inline void
2998 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3000 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3001 gs->gimple_catch.handler = handler;
3005 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3007 static inline tree
3008 gimple_eh_filter_types (const_gimple gs)
3010 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3011 return gs->gimple_eh_filter.types;
3015 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3016 GS. */
3018 static inline tree *
3019 gimple_eh_filter_types_ptr (gimple gs)
3021 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3022 return &gs->gimple_eh_filter.types;
3026 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3027 statement fails. */
3029 static inline gimple_seq
3030 gimple_eh_filter_failure (gimple gs)
3032 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3033 return gs->gimple_eh_filter.failure;
3037 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3039 static inline void
3040 gimple_eh_filter_set_types (gimple gs, tree types)
3042 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3043 gs->gimple_eh_filter.types = types;
3047 /* Set FAILURE to be the sequence of statements to execute on failure
3048 for GIMPLE_EH_FILTER GS. */
3050 static inline void
3051 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3053 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3054 gs->gimple_eh_filter.failure = failure;
3057 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3059 static inline tree
3060 gimple_eh_must_not_throw_fndecl (gimple gs)
3062 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3063 return gs->gimple_eh_mnt.fndecl;
3066 /* Set the function decl to be called by GS to DECL. */
3068 static inline void
3069 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3071 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3072 gs->gimple_eh_mnt.fndecl = decl;
3076 /* GIMPLE_TRY accessors. */
3078 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3079 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3081 static inline enum gimple_try_flags
3082 gimple_try_kind (const_gimple gs)
3084 GIMPLE_CHECK (gs, GIMPLE_TRY);
3085 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3089 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3091 static inline void
3092 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3094 GIMPLE_CHECK (gs, GIMPLE_TRY);
3095 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3096 || kind == GIMPLE_TRY_FINALLY);
3097 if (gimple_try_kind (gs) != kind)
3098 gs->gsbase.subcode = (unsigned int) kind;
3102 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3104 static inline bool
3105 gimple_try_catch_is_cleanup (const_gimple gs)
3107 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3108 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3112 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3114 static inline gimple_seq
3115 gimple_try_eval (gimple gs)
3117 GIMPLE_CHECK (gs, GIMPLE_TRY);
3118 return gs->gimple_try.eval;
3122 /* Return the sequence of statements used as the cleanup body for
3123 GIMPLE_TRY GS. */
3125 static inline gimple_seq
3126 gimple_try_cleanup (gimple gs)
3128 GIMPLE_CHECK (gs, GIMPLE_TRY);
3129 return gs->gimple_try.cleanup;
3133 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3135 static inline void
3136 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3138 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3139 if (catch_is_cleanup)
3140 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3141 else
3142 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3146 /* Set EVAL to be the sequence of statements to use as the body for
3147 GIMPLE_TRY GS. */
3149 static inline void
3150 gimple_try_set_eval (gimple gs, gimple_seq eval)
3152 GIMPLE_CHECK (gs, GIMPLE_TRY);
3153 gs->gimple_try.eval = eval;
3157 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3158 body for GIMPLE_TRY GS. */
3160 static inline void
3161 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3163 GIMPLE_CHECK (gs, GIMPLE_TRY);
3164 gs->gimple_try.cleanup = cleanup;
3168 /* Return the cleanup sequence for cleanup statement GS. */
3170 static inline gimple_seq
3171 gimple_wce_cleanup (gimple gs)
3173 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3174 return gs->gimple_wce.cleanup;
3178 /* Set CLEANUP to be the cleanup sequence for GS. */
3180 static inline void
3181 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3183 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3184 gs->gimple_wce.cleanup = cleanup;
3188 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3190 static inline bool
3191 gimple_wce_cleanup_eh_only (const_gimple gs)
3193 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3194 return gs->gsbase.subcode != 0;
3198 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3200 static inline void
3201 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3203 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3204 gs->gsbase.subcode = (unsigned int) eh_only_p;
3208 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3210 static inline unsigned
3211 gimple_phi_capacity (const_gimple gs)
3213 GIMPLE_CHECK (gs, GIMPLE_PHI);
3214 return gs->gimple_phi.capacity;
3218 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3219 be exactly the number of incoming edges for the basic block holding
3220 GS. */
3222 static inline unsigned
3223 gimple_phi_num_args (const_gimple gs)
3225 GIMPLE_CHECK (gs, GIMPLE_PHI);
3226 return gs->gimple_phi.nargs;
3230 /* Return the SSA name created by GIMPLE_PHI GS. */
3232 static inline tree
3233 gimple_phi_result (const_gimple gs)
3235 GIMPLE_CHECK (gs, GIMPLE_PHI);
3236 return gs->gimple_phi.result;
3239 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3241 static inline tree *
3242 gimple_phi_result_ptr (gimple gs)
3244 GIMPLE_CHECK (gs, GIMPLE_PHI);
3245 return &gs->gimple_phi.result;
3248 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3250 static inline void
3251 gimple_phi_set_result (gimple gs, tree result)
3253 GIMPLE_CHECK (gs, GIMPLE_PHI);
3254 gs->gimple_phi.result = result;
3258 /* Return the PHI argument corresponding to incoming edge INDEX for
3259 GIMPLE_PHI GS. */
3261 static inline struct phi_arg_d *
3262 gimple_phi_arg (gimple gs, unsigned index)
3264 GIMPLE_CHECK (gs, GIMPLE_PHI);
3265 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3266 return &(gs->gimple_phi.args[index]);
3269 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3270 for GIMPLE_PHI GS. */
3272 static inline void
3273 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3275 GIMPLE_CHECK (gs, GIMPLE_PHI);
3276 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3277 gs->gimple_phi.args[index] = *phiarg;
3280 /* Return the region number for GIMPLE_RESX GS. */
3282 static inline int
3283 gimple_resx_region (const_gimple gs)
3285 GIMPLE_CHECK (gs, GIMPLE_RESX);
3286 return gs->gimple_eh_ctrl.region;
3289 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3291 static inline void
3292 gimple_resx_set_region (gimple gs, int region)
3294 GIMPLE_CHECK (gs, GIMPLE_RESX);
3295 gs->gimple_eh_ctrl.region = region;
3298 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3300 static inline int
3301 gimple_eh_dispatch_region (const_gimple gs)
3303 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3304 return gs->gimple_eh_ctrl.region;
3307 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3309 static inline void
3310 gimple_eh_dispatch_set_region (gimple gs, int region)
3312 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3313 gs->gimple_eh_ctrl.region = region;
3316 /* Return the number of labels associated with the switch statement GS. */
3318 static inline unsigned
3319 gimple_switch_num_labels (const_gimple gs)
3321 unsigned num_ops;
3322 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3323 num_ops = gimple_num_ops (gs);
3324 gcc_gimple_checking_assert (num_ops > 1);
3325 return num_ops - 1;
3329 /* Set NLABELS to be the number of labels for the switch statement GS. */
3331 static inline void
3332 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3334 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3335 gimple_set_num_ops (g, nlabels + 1);
3339 /* Return the index variable used by the switch statement GS. */
3341 static inline tree
3342 gimple_switch_index (const_gimple gs)
3344 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3345 return gimple_op (gs, 0);
3349 /* Return a pointer to the index variable for the switch statement GS. */
3351 static inline tree *
3352 gimple_switch_index_ptr (const_gimple gs)
3354 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3355 return gimple_op_ptr (gs, 0);
3359 /* Set INDEX to be the index variable for switch statement GS. */
3361 static inline void
3362 gimple_switch_set_index (gimple gs, tree index)
3364 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3365 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3366 gimple_set_op (gs, 0, index);
3370 /* Return the label numbered INDEX. The default label is 0, followed by any
3371 labels in a switch statement. */
3373 static inline tree
3374 gimple_switch_label (const_gimple gs, unsigned index)
3376 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3377 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3378 return gimple_op (gs, index + 1);
3381 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3383 static inline void
3384 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3386 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3387 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3388 && (label == NULL_TREE
3389 || TREE_CODE (label) == CASE_LABEL_EXPR));
3390 gimple_set_op (gs, index + 1, label);
3393 /* Return the default label for a switch statement. */
3395 static inline tree
3396 gimple_switch_default_label (const_gimple gs)
3398 return gimple_switch_label (gs, 0);
3401 /* Set the default label for a switch statement. */
3403 static inline void
3404 gimple_switch_set_default_label (gimple gs, tree label)
3406 gimple_switch_set_label (gs, 0, label);
3409 /* Return true if GS is a GIMPLE_DEBUG statement. */
3411 static inline bool
3412 is_gimple_debug (const_gimple gs)
3414 return gimple_code (gs) == GIMPLE_DEBUG;
3417 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3419 static inline bool
3420 gimple_debug_bind_p (const_gimple s)
3422 if (is_gimple_debug (s))
3423 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3425 return false;
3428 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3430 static inline tree
3431 gimple_debug_bind_get_var (gimple dbg)
3433 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3434 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3435 return gimple_op (dbg, 0);
3438 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3439 statement. */
3441 static inline tree
3442 gimple_debug_bind_get_value (gimple dbg)
3444 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3445 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3446 return gimple_op (dbg, 1);
3449 /* Return a pointer to the value bound to the variable in a
3450 GIMPLE_DEBUG bind statement. */
3452 static inline tree *
3453 gimple_debug_bind_get_value_ptr (gimple dbg)
3455 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3456 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3457 return gimple_op_ptr (dbg, 1);
3460 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3462 static inline void
3463 gimple_debug_bind_set_var (gimple dbg, tree var)
3465 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3466 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3467 gimple_set_op (dbg, 0, var);
3470 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3471 statement. */
3473 static inline void
3474 gimple_debug_bind_set_value (gimple dbg, tree value)
3476 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3477 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3478 gimple_set_op (dbg, 1, value);
3481 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3482 optimized away. */
3483 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3485 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3486 statement. */
3488 static inline void
3489 gimple_debug_bind_reset_value (gimple dbg)
3491 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3492 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3493 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3496 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3497 value. */
3499 static inline bool
3500 gimple_debug_bind_has_value_p (gimple dbg)
3502 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3503 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3504 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3507 #undef GIMPLE_DEBUG_BIND_NOVALUE
3509 /* Return the body for the OMP statement GS. */
3511 static inline gimple_seq
3512 gimple_omp_body (gimple gs)
3514 return gs->omp.body;
3517 /* Set BODY to be the body for the OMP statement GS. */
3519 static inline void
3520 gimple_omp_set_body (gimple gs, gimple_seq body)
3522 gs->omp.body = body;
3526 /* Return the name associated with OMP_CRITICAL statement GS. */
3528 static inline tree
3529 gimple_omp_critical_name (const_gimple gs)
3531 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3532 return gs->gimple_omp_critical.name;
3536 /* Return a pointer to the name associated with OMP critical statement GS. */
3538 static inline tree *
3539 gimple_omp_critical_name_ptr (gimple gs)
3541 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3542 return &gs->gimple_omp_critical.name;
3546 /* Set NAME to be the name associated with OMP critical statement GS. */
3548 static inline void
3549 gimple_omp_critical_set_name (gimple gs, tree name)
3551 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3552 gs->gimple_omp_critical.name = name;
3556 /* Return the clauses associated with OMP_FOR GS. */
3558 static inline tree
3559 gimple_omp_for_clauses (const_gimple gs)
3561 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3562 return gs->gimple_omp_for.clauses;
3566 /* Return a pointer to the OMP_FOR GS. */
3568 static inline tree *
3569 gimple_omp_for_clauses_ptr (gimple gs)
3571 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3572 return &gs->gimple_omp_for.clauses;
3576 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3578 static inline void
3579 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3581 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3582 gs->gimple_omp_for.clauses = clauses;
3586 /* Get the collapse count of OMP_FOR GS. */
3588 static inline size_t
3589 gimple_omp_for_collapse (gimple gs)
3591 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3592 return gs->gimple_omp_for.collapse;
3596 /* Return the index variable for OMP_FOR GS. */
3598 static inline tree
3599 gimple_omp_for_index (const_gimple gs, size_t i)
3601 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3602 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3603 return gs->gimple_omp_for.iter[i].index;
3607 /* Return a pointer to the index variable for OMP_FOR GS. */
3609 static inline tree *
3610 gimple_omp_for_index_ptr (gimple gs, size_t i)
3612 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3613 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3614 return &gs->gimple_omp_for.iter[i].index;
3618 /* Set INDEX to be the index variable for OMP_FOR GS. */
3620 static inline void
3621 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3623 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3624 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3625 gs->gimple_omp_for.iter[i].index = index;
3629 /* Return the initial value for OMP_FOR GS. */
3631 static inline tree
3632 gimple_omp_for_initial (const_gimple gs, size_t i)
3634 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3635 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3636 return gs->gimple_omp_for.iter[i].initial;
3640 /* Return a pointer to the initial value for OMP_FOR GS. */
3642 static inline tree *
3643 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3645 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3646 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3647 return &gs->gimple_omp_for.iter[i].initial;
3651 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3653 static inline void
3654 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3656 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3657 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3658 gs->gimple_omp_for.iter[i].initial = initial;
3662 /* Return the final value for OMP_FOR GS. */
3664 static inline tree
3665 gimple_omp_for_final (const_gimple gs, size_t i)
3667 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3668 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3669 return gs->gimple_omp_for.iter[i].final;
3673 /* Return a pointer to the final value for OMP_FOR GS. */
3675 static inline tree *
3676 gimple_omp_for_final_ptr (gimple gs, size_t i)
3678 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3679 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3680 return &gs->gimple_omp_for.iter[i].final;
3684 /* Set FINAL to be the final value for OMP_FOR GS. */
3686 static inline void
3687 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3689 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3690 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3691 gs->gimple_omp_for.iter[i].final = final;
3695 /* Return the increment value for OMP_FOR GS. */
3697 static inline tree
3698 gimple_omp_for_incr (const_gimple gs, size_t i)
3700 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3701 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3702 return gs->gimple_omp_for.iter[i].incr;
3706 /* Return a pointer to the increment value for OMP_FOR GS. */
3708 static inline tree *
3709 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3711 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3712 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3713 return &gs->gimple_omp_for.iter[i].incr;
3717 /* Set INCR to be the increment value for OMP_FOR GS. */
3719 static inline void
3720 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3722 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3723 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3724 gs->gimple_omp_for.iter[i].incr = incr;
3728 /* Return the sequence of statements to execute before the OMP_FOR
3729 statement GS starts. */
3731 static inline gimple_seq
3732 gimple_omp_for_pre_body (gimple gs)
3734 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3735 return gs->gimple_omp_for.pre_body;
3739 /* Set PRE_BODY to be the sequence of statements to execute before the
3740 OMP_FOR statement GS starts. */
3742 static inline void
3743 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3745 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3746 gs->gimple_omp_for.pre_body = pre_body;
3750 /* Return the clauses associated with OMP_PARALLEL GS. */
3752 static inline tree
3753 gimple_omp_parallel_clauses (const_gimple gs)
3755 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3756 return gs->gimple_omp_parallel.clauses;
3760 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3762 static inline tree *
3763 gimple_omp_parallel_clauses_ptr (gimple gs)
3765 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3766 return &gs->gimple_omp_parallel.clauses;
3770 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
3771 GS. */
3773 static inline void
3774 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
3776 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3777 gs->gimple_omp_parallel.clauses = clauses;
3781 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
3783 static inline tree
3784 gimple_omp_parallel_child_fn (const_gimple gs)
3786 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3787 return gs->gimple_omp_parallel.child_fn;
3790 /* Return a pointer to the child function used to hold the body of
3791 OMP_PARALLEL GS. */
3793 static inline tree *
3794 gimple_omp_parallel_child_fn_ptr (gimple gs)
3796 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3797 return &gs->gimple_omp_parallel.child_fn;
3801 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
3803 static inline void
3804 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
3806 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3807 gs->gimple_omp_parallel.child_fn = child_fn;
3811 /* Return the artificial argument used to send variables and values
3812 from the parent to the children threads in OMP_PARALLEL GS. */
3814 static inline tree
3815 gimple_omp_parallel_data_arg (const_gimple gs)
3817 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3818 return gs->gimple_omp_parallel.data_arg;
3822 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
3824 static inline tree *
3825 gimple_omp_parallel_data_arg_ptr (gimple gs)
3827 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3828 return &gs->gimple_omp_parallel.data_arg;
3832 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
3834 static inline void
3835 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
3837 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3838 gs->gimple_omp_parallel.data_arg = data_arg;
3842 /* Return the clauses associated with OMP_TASK GS. */
3844 static inline tree
3845 gimple_omp_task_clauses (const_gimple gs)
3847 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3848 return gs->gimple_omp_parallel.clauses;
3852 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3854 static inline tree *
3855 gimple_omp_task_clauses_ptr (gimple gs)
3857 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3858 return &gs->gimple_omp_parallel.clauses;
3862 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3863 GS. */
3865 static inline void
3866 gimple_omp_task_set_clauses (gimple gs, tree clauses)
3868 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3869 gs->gimple_omp_parallel.clauses = clauses;
3873 /* Return the child function used to hold the body of OMP_TASK GS. */
3875 static inline tree
3876 gimple_omp_task_child_fn (const_gimple gs)
3878 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3879 return gs->gimple_omp_parallel.child_fn;
3882 /* Return a pointer to the child function used to hold the body of
3883 OMP_TASK GS. */
3885 static inline tree *
3886 gimple_omp_task_child_fn_ptr (gimple gs)
3888 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3889 return &gs->gimple_omp_parallel.child_fn;
3893 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3895 static inline void
3896 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
3898 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3899 gs->gimple_omp_parallel.child_fn = child_fn;
3903 /* Return the artificial argument used to send variables and values
3904 from the parent to the children threads in OMP_TASK GS. */
3906 static inline tree
3907 gimple_omp_task_data_arg (const_gimple gs)
3909 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3910 return gs->gimple_omp_parallel.data_arg;
3914 /* Return a pointer to the data argument for OMP_TASK GS. */
3916 static inline tree *
3917 gimple_omp_task_data_arg_ptr (gimple gs)
3919 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3920 return &gs->gimple_omp_parallel.data_arg;
3924 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3926 static inline void
3927 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
3929 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3930 gs->gimple_omp_parallel.data_arg = data_arg;
3934 /* Return the clauses associated with OMP_TASK GS. */
3936 static inline tree
3937 gimple_omp_taskreg_clauses (const_gimple gs)
3939 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3940 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3941 return gs->gimple_omp_parallel.clauses;
3945 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3947 static inline tree *
3948 gimple_omp_taskreg_clauses_ptr (gimple gs)
3950 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3951 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3952 return &gs->gimple_omp_parallel.clauses;
3956 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3957 GS. */
3959 static inline void
3960 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
3962 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3963 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3964 gs->gimple_omp_parallel.clauses = clauses;
3968 /* Return the child function used to hold the body of OMP_TASK GS. */
3970 static inline tree
3971 gimple_omp_taskreg_child_fn (const_gimple gs)
3973 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3974 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3975 return gs->gimple_omp_parallel.child_fn;
3978 /* Return a pointer to the child function used to hold the body of
3979 OMP_TASK GS. */
3981 static inline tree *
3982 gimple_omp_taskreg_child_fn_ptr (gimple gs)
3984 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3985 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3986 return &gs->gimple_omp_parallel.child_fn;
3990 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3992 static inline void
3993 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
3995 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3996 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3997 gs->gimple_omp_parallel.child_fn = child_fn;
4001 /* Return the artificial argument used to send variables and values
4002 from the parent to the children threads in OMP_TASK GS. */
4004 static inline tree
4005 gimple_omp_taskreg_data_arg (const_gimple gs)
4007 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4008 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4009 return gs->gimple_omp_parallel.data_arg;
4013 /* Return a pointer to the data argument for OMP_TASK GS. */
4015 static inline tree *
4016 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4018 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4019 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4020 return &gs->gimple_omp_parallel.data_arg;
4024 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4026 static inline void
4027 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4029 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4030 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4031 gs->gimple_omp_parallel.data_arg = data_arg;
4035 /* Return the copy function used to hold the body of OMP_TASK GS. */
4037 static inline tree
4038 gimple_omp_task_copy_fn (const_gimple gs)
4040 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4041 return gs->gimple_omp_task.copy_fn;
4044 /* Return a pointer to the copy function used to hold the body of
4045 OMP_TASK GS. */
4047 static inline tree *
4048 gimple_omp_task_copy_fn_ptr (gimple gs)
4050 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4051 return &gs->gimple_omp_task.copy_fn;
4055 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4057 static inline void
4058 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4060 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4061 gs->gimple_omp_task.copy_fn = copy_fn;
4065 /* Return size of the data block in bytes in OMP_TASK GS. */
4067 static inline tree
4068 gimple_omp_task_arg_size (const_gimple gs)
4070 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4071 return gs->gimple_omp_task.arg_size;
4075 /* Return a pointer to the data block size for OMP_TASK GS. */
4077 static inline tree *
4078 gimple_omp_task_arg_size_ptr (gimple gs)
4080 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4081 return &gs->gimple_omp_task.arg_size;
4085 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4087 static inline void
4088 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4090 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4091 gs->gimple_omp_task.arg_size = arg_size;
4095 /* Return align of the data block in bytes in OMP_TASK GS. */
4097 static inline tree
4098 gimple_omp_task_arg_align (const_gimple gs)
4100 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4101 return gs->gimple_omp_task.arg_align;
4105 /* Return a pointer to the data block align for OMP_TASK GS. */
4107 static inline tree *
4108 gimple_omp_task_arg_align_ptr (gimple gs)
4110 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4111 return &gs->gimple_omp_task.arg_align;
4115 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4117 static inline void
4118 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4120 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4121 gs->gimple_omp_task.arg_align = arg_align;
4125 /* Return the clauses associated with OMP_SINGLE GS. */
4127 static inline tree
4128 gimple_omp_single_clauses (const_gimple gs)
4130 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4131 return gs->gimple_omp_single.clauses;
4135 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4137 static inline tree *
4138 gimple_omp_single_clauses_ptr (gimple gs)
4140 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4141 return &gs->gimple_omp_single.clauses;
4145 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4147 static inline void
4148 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4150 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4151 gs->gimple_omp_single.clauses = clauses;
4155 /* Return the clauses associated with OMP_SECTIONS GS. */
4157 static inline tree
4158 gimple_omp_sections_clauses (const_gimple gs)
4160 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4161 return gs->gimple_omp_sections.clauses;
4165 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4167 static inline tree *
4168 gimple_omp_sections_clauses_ptr (gimple gs)
4170 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4171 return &gs->gimple_omp_sections.clauses;
4175 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4176 GS. */
4178 static inline void
4179 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4181 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4182 gs->gimple_omp_sections.clauses = clauses;
4186 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4187 in GS. */
4189 static inline tree
4190 gimple_omp_sections_control (const_gimple gs)
4192 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4193 return gs->gimple_omp_sections.control;
4197 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4198 GS. */
4200 static inline tree *
4201 gimple_omp_sections_control_ptr (gimple gs)
4203 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4204 return &gs->gimple_omp_sections.control;
4208 /* Set CONTROL to be the set of clauses associated with the
4209 GIMPLE_OMP_SECTIONS in GS. */
4211 static inline void
4212 gimple_omp_sections_set_control (gimple gs, tree control)
4214 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4215 gs->gimple_omp_sections.control = control;
4219 /* Set COND to be the condition code for OMP_FOR GS. */
4221 static inline void
4222 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4224 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4225 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4226 && i < gs->gimple_omp_for.collapse);
4227 gs->gimple_omp_for.iter[i].cond = cond;
4231 /* Return the condition code associated with OMP_FOR GS. */
4233 static inline enum tree_code
4234 gimple_omp_for_cond (const_gimple gs, size_t i)
4236 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4237 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4238 return gs->gimple_omp_for.iter[i].cond;
4242 /* Set the value being stored in an atomic store. */
4244 static inline void
4245 gimple_omp_atomic_store_set_val (gimple g, tree val)
4247 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4248 g->gimple_omp_atomic_store.val = val;
4252 /* Return the value being stored in an atomic store. */
4254 static inline tree
4255 gimple_omp_atomic_store_val (const_gimple g)
4257 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4258 return g->gimple_omp_atomic_store.val;
4262 /* Return a pointer to the value being stored in an atomic store. */
4264 static inline tree *
4265 gimple_omp_atomic_store_val_ptr (gimple g)
4267 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4268 return &g->gimple_omp_atomic_store.val;
4272 /* Set the LHS of an atomic load. */
4274 static inline void
4275 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4277 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4278 g->gimple_omp_atomic_load.lhs = lhs;
4282 /* Get the LHS of an atomic load. */
4284 static inline tree
4285 gimple_omp_atomic_load_lhs (const_gimple g)
4287 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4288 return g->gimple_omp_atomic_load.lhs;
4292 /* Return a pointer to the LHS of an atomic load. */
4294 static inline tree *
4295 gimple_omp_atomic_load_lhs_ptr (gimple g)
4297 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4298 return &g->gimple_omp_atomic_load.lhs;
4302 /* Set the RHS of an atomic load. */
4304 static inline void
4305 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4307 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4308 g->gimple_omp_atomic_load.rhs = rhs;
4312 /* Get the RHS of an atomic load. */
4314 static inline tree
4315 gimple_omp_atomic_load_rhs (const_gimple g)
4317 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4318 return g->gimple_omp_atomic_load.rhs;
4322 /* Return a pointer to the RHS of an atomic load. */
4324 static inline tree *
4325 gimple_omp_atomic_load_rhs_ptr (gimple g)
4327 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4328 return &g->gimple_omp_atomic_load.rhs;
4332 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4334 static inline tree
4335 gimple_omp_continue_control_def (const_gimple g)
4337 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4338 return g->gimple_omp_continue.control_def;
4341 /* The same as above, but return the address. */
4343 static inline tree *
4344 gimple_omp_continue_control_def_ptr (gimple g)
4346 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4347 return &g->gimple_omp_continue.control_def;
4350 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4352 static inline void
4353 gimple_omp_continue_set_control_def (gimple g, tree def)
4355 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4356 g->gimple_omp_continue.control_def = def;
4360 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4362 static inline tree
4363 gimple_omp_continue_control_use (const_gimple g)
4365 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4366 return g->gimple_omp_continue.control_use;
4370 /* The same as above, but return the address. */
4372 static inline tree *
4373 gimple_omp_continue_control_use_ptr (gimple g)
4375 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4376 return &g->gimple_omp_continue.control_use;
4380 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4382 static inline void
4383 gimple_omp_continue_set_control_use (gimple g, tree use)
4385 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4386 g->gimple_omp_continue.control_use = use;
4390 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4392 static inline tree *
4393 gimple_return_retval_ptr (const_gimple gs)
4395 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4396 return gimple_op_ptr (gs, 0);
4399 /* Return the return value for GIMPLE_RETURN GS. */
4401 static inline tree
4402 gimple_return_retval (const_gimple gs)
4404 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4405 return gimple_op (gs, 0);
4409 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4411 static inline void
4412 gimple_return_set_retval (gimple gs, tree retval)
4414 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4415 gimple_set_op (gs, 0, retval);
4419 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4421 #define CASE_GIMPLE_OMP \
4422 case GIMPLE_OMP_PARALLEL: \
4423 case GIMPLE_OMP_TASK: \
4424 case GIMPLE_OMP_FOR: \
4425 case GIMPLE_OMP_SECTIONS: \
4426 case GIMPLE_OMP_SECTIONS_SWITCH: \
4427 case GIMPLE_OMP_SINGLE: \
4428 case GIMPLE_OMP_SECTION: \
4429 case GIMPLE_OMP_MASTER: \
4430 case GIMPLE_OMP_ORDERED: \
4431 case GIMPLE_OMP_CRITICAL: \
4432 case GIMPLE_OMP_RETURN: \
4433 case GIMPLE_OMP_ATOMIC_LOAD: \
4434 case GIMPLE_OMP_ATOMIC_STORE: \
4435 case GIMPLE_OMP_CONTINUE
4437 static inline bool
4438 is_gimple_omp (const_gimple stmt)
4440 switch (gimple_code (stmt))
4442 CASE_GIMPLE_OMP:
4443 return true;
4444 default:
4445 return false;
4450 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4452 static inline bool
4453 gimple_nop_p (const_gimple g)
4455 return gimple_code (g) == GIMPLE_NOP;
4459 /* Return true if GS is a GIMPLE_RESX. */
4461 static inline bool
4462 is_gimple_resx (const_gimple gs)
4464 return gimple_code (gs) == GIMPLE_RESX;
4467 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4469 static inline enum br_predictor
4470 gimple_predict_predictor (gimple gs)
4472 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4473 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4477 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4479 static inline void
4480 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4482 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4483 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4484 | (unsigned) predictor;
4488 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4490 static inline enum prediction
4491 gimple_predict_outcome (gimple gs)
4493 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4494 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4498 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4500 static inline void
4501 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4503 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4504 if (outcome == TAKEN)
4505 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4506 else
4507 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4511 /* Return the type of the main expression computed by STMT. Return
4512 void_type_node if the statement computes nothing. */
4514 static inline tree
4515 gimple_expr_type (const_gimple stmt)
4517 enum gimple_code code = gimple_code (stmt);
4519 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4521 tree type;
4522 /* In general we want to pass out a type that can be substituted
4523 for both the RHS and the LHS types if there is a possibly
4524 useless conversion involved. That means returning the
4525 original RHS type as far as we can reconstruct it. */
4526 if (code == GIMPLE_CALL)
4527 type = gimple_call_return_type (stmt);
4528 else
4529 switch (gimple_assign_rhs_code (stmt))
4531 case POINTER_PLUS_EXPR:
4532 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4533 break;
4535 default:
4536 /* As fallback use the type of the LHS. */
4537 type = TREE_TYPE (gimple_get_lhs (stmt));
4538 break;
4540 return type;
4542 else if (code == GIMPLE_COND)
4543 return boolean_type_node;
4544 else
4545 return void_type_node;
4549 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4551 static inline gimple_stmt_iterator
4552 gsi_start (gimple_seq seq)
4554 gimple_stmt_iterator i;
4556 i.ptr = gimple_seq_first (seq);
4557 i.seq = seq;
4558 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4560 return i;
4564 /* Return a new iterator pointing to the first statement in basic block BB. */
4566 static inline gimple_stmt_iterator
4567 gsi_start_bb (basic_block bb)
4569 gimple_stmt_iterator i;
4570 gimple_seq seq;
4572 seq = bb_seq (bb);
4573 i.ptr = gimple_seq_first (seq);
4574 i.seq = seq;
4575 i.bb = bb;
4577 return i;
4581 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4583 static inline gimple_stmt_iterator
4584 gsi_last (gimple_seq seq)
4586 gimple_stmt_iterator i;
4588 i.ptr = gimple_seq_last (seq);
4589 i.seq = seq;
4590 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4592 return i;
4596 /* Return a new iterator pointing to the last statement in basic block BB. */
4598 static inline gimple_stmt_iterator
4599 gsi_last_bb (basic_block bb)
4601 gimple_stmt_iterator i;
4602 gimple_seq seq;
4604 seq = bb_seq (bb);
4605 i.ptr = gimple_seq_last (seq);
4606 i.seq = seq;
4607 i.bb = bb;
4609 return i;
4613 /* Return true if I is at the end of its sequence. */
4615 static inline bool
4616 gsi_end_p (gimple_stmt_iterator i)
4618 return i.ptr == NULL;
4622 /* Return true if I is one statement before the end of its sequence. */
4624 static inline bool
4625 gsi_one_before_end_p (gimple_stmt_iterator i)
4627 return i.ptr != NULL && i.ptr->next == NULL;
4631 /* Advance the iterator to the next gimple statement. */
4633 static inline void
4634 gsi_next (gimple_stmt_iterator *i)
4636 i->ptr = i->ptr->next;
4639 /* Advance the iterator to the previous gimple statement. */
4641 static inline void
4642 gsi_prev (gimple_stmt_iterator *i)
4644 i->ptr = i->ptr->prev;
4647 /* Return the current stmt. */
4649 static inline gimple
4650 gsi_stmt (gimple_stmt_iterator i)
4652 return i.ptr->stmt;
4655 /* Return a block statement iterator that points to the first non-label
4656 statement in block BB. */
4658 static inline gimple_stmt_iterator
4659 gsi_after_labels (basic_block bb)
4661 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4663 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4664 gsi_next (&gsi);
4666 return gsi;
4669 /* Advance the iterator to the next non-debug gimple statement. */
4671 static inline void
4672 gsi_next_nondebug (gimple_stmt_iterator *i)
4676 gsi_next (i);
4678 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4681 /* Advance the iterator to the next non-debug gimple statement. */
4683 static inline void
4684 gsi_prev_nondebug (gimple_stmt_iterator *i)
4688 gsi_prev (i);
4690 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4693 /* Return a new iterator pointing to the first non-debug statement in
4694 basic block BB. */
4696 static inline gimple_stmt_iterator
4697 gsi_start_nondebug_bb (basic_block bb)
4699 gimple_stmt_iterator i = gsi_start_bb (bb);
4701 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4702 gsi_next_nondebug (&i);
4704 return i;
4707 /* Return a new iterator pointing to the last non-debug statement in
4708 basic block BB. */
4710 static inline gimple_stmt_iterator
4711 gsi_last_nondebug_bb (basic_block bb)
4713 gimple_stmt_iterator i = gsi_last_bb (bb);
4715 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4716 gsi_prev_nondebug (&i);
4718 return i;
4721 /* Return a pointer to the current stmt.
4723 NOTE: You may want to use gsi_replace on the iterator itself,
4724 as this performs additional bookkeeping that will not be done
4725 if you simply assign through a pointer returned by gsi_stmt_ptr. */
4727 static inline gimple *
4728 gsi_stmt_ptr (gimple_stmt_iterator *i)
4730 return &i->ptr->stmt;
4734 /* Return the basic block associated with this iterator. */
4736 static inline basic_block
4737 gsi_bb (gimple_stmt_iterator i)
4739 return i.bb;
4743 /* Return the sequence associated with this iterator. */
4745 static inline gimple_seq
4746 gsi_seq (gimple_stmt_iterator i)
4748 return i.seq;
4752 enum gsi_iterator_update
4754 GSI_NEW_STMT, /* Only valid when single statement is added, move
4755 iterator to it. */
4756 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
4757 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
4758 for linking other statements in the same
4759 direction. */
4762 /* In gimple-iterator.c */
4763 gimple_stmt_iterator gsi_start_phis (basic_block);
4764 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
4765 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
4766 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
4767 void gsi_insert_before (gimple_stmt_iterator *, gimple,
4768 enum gsi_iterator_update);
4769 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
4770 enum gsi_iterator_update);
4771 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
4772 enum gsi_iterator_update);
4773 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
4774 enum gsi_iterator_update);
4775 void gsi_insert_after (gimple_stmt_iterator *, gimple,
4776 enum gsi_iterator_update);
4777 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
4778 enum gsi_iterator_update);
4779 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
4780 enum gsi_iterator_update);
4781 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
4782 enum gsi_iterator_update);
4783 void gsi_remove (gimple_stmt_iterator *, bool);
4784 gimple_stmt_iterator gsi_for_stmt (gimple);
4785 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
4786 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
4787 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
4788 void gsi_insert_on_edge (edge, gimple);
4789 void gsi_insert_seq_on_edge (edge, gimple_seq);
4790 basic_block gsi_insert_on_edge_immediate (edge, gimple);
4791 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
4792 void gsi_commit_one_edge_insert (edge, basic_block *);
4793 void gsi_commit_edge_inserts (void);
4794 gimple gimple_call_copy_skip_args (gimple, bitmap);
4797 /* Convenience routines to walk all statements of a gimple function.
4798 Note that this is useful exclusively before the code is converted
4799 into SSA form. Once the program is in SSA form, the standard
4800 operand interface should be used to analyze/modify statements. */
4801 struct walk_stmt_info
4803 /* Points to the current statement being walked. */
4804 gimple_stmt_iterator gsi;
4806 /* Additional data that the callback functions may want to carry
4807 through the recursion. */
4808 void *info;
4810 /* Pointer map used to mark visited tree nodes when calling
4811 walk_tree on each operand. If set to NULL, duplicate tree nodes
4812 will be visited more than once. */
4813 struct pointer_set_t *pset;
4815 /* Indicates whether the operand being examined may be replaced
4816 with something that matches is_gimple_val (if true) or something
4817 slightly more complicated (if false). "Something" technically
4818 means the common subset of is_gimple_lvalue and is_gimple_rhs,
4819 but we never try to form anything more complicated than that, so
4820 we don't bother checking.
4822 Also note that CALLBACK should update this flag while walking the
4823 sub-expressions of a statement. For instance, when walking the
4824 statement 'foo (&var)', the flag VAL_ONLY will initially be set
4825 to true, however, when walking &var, the operand of that
4826 ADDR_EXPR does not need to be a GIMPLE value. */
4827 bool val_only;
4829 /* True if we are currently walking the LHS of an assignment. */
4830 bool is_lhs;
4832 /* Optional. Set to true by the callback functions if they made any
4833 changes. */
4834 bool changed;
4836 /* True if we're interested in location information. */
4837 bool want_locations;
4839 /* Operand returned by the callbacks. This is set when calling
4840 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
4841 returns non-NULL, this field will contain the tree returned by
4842 the last callback. */
4843 tree callback_result;
4846 /* Callback for walk_gimple_stmt. Called for every statement found
4847 during traversal. The first argument points to the statement to
4848 walk. The second argument is a flag that the callback sets to
4849 'true' if it the callback handled all the operands and
4850 sub-statements of the statement (the default value of this flag is
4851 'false'). The third argument is an anonymous pointer to data
4852 to be used by the callback. */
4853 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
4854 struct walk_stmt_info *);
4856 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
4857 struct walk_stmt_info *);
4858 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
4859 struct walk_stmt_info *);
4860 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
4862 #ifdef GATHER_STATISTICS
4863 /* Enum and arrays used for allocation stats. Keep in sync with
4864 gimple.c:gimple_alloc_kind_names. */
4865 enum gimple_alloc_kind
4867 gimple_alloc_kind_assign, /* Assignments. */
4868 gimple_alloc_kind_phi, /* PHI nodes. */
4869 gimple_alloc_kind_cond, /* Conditionals. */
4870 gimple_alloc_kind_seq, /* Sequences. */
4871 gimple_alloc_kind_rest, /* Everything else. */
4872 gimple_alloc_kind_all
4875 extern int gimple_alloc_counts[];
4876 extern int gimple_alloc_sizes[];
4878 /* Return the allocation kind for a given stmt CODE. */
4879 static inline enum gimple_alloc_kind
4880 gimple_alloc_kind (enum gimple_code code)
4882 switch (code)
4884 case GIMPLE_ASSIGN:
4885 return gimple_alloc_kind_assign;
4886 case GIMPLE_PHI:
4887 return gimple_alloc_kind_phi;
4888 case GIMPLE_COND:
4889 return gimple_alloc_kind_cond;
4890 default:
4891 return gimple_alloc_kind_rest;
4894 #endif /* GATHER_STATISTICS */
4896 extern void dump_gimple_statistics (void);
4898 /* In gimple-fold.c. */
4899 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
4900 tree gimple_fold_builtin (gimple);
4901 bool fold_stmt (gimple_stmt_iterator *);
4902 bool fold_stmt_inplace (gimple);
4903 tree maybe_fold_offset_to_address (location_t, tree, tree, tree);
4904 tree maybe_fold_offset_to_reference (location_t, tree, tree, tree);
4905 tree maybe_fold_stmt_addition (location_t, tree, tree, tree);
4906 tree get_symbol_constant_value (tree);
4907 tree canonicalize_constructor_val (tree);
4908 bool may_propagate_address_into_dereference (tree, tree);
4909 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
4910 enum tree_code, tree, tree);
4911 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
4912 enum tree_code, tree, tree);
4914 #endif /* GCC_GIMPLE_H */