gcc:
[official-gcc.git] / gcc / gimple.h
blob150b836d55f8b25d6aa1406cd4c9cdb70fcb1e31
1 /* Gimple IR definitions.
3 Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "pointer-set.h"
26 #include "vec.h"
27 #include "vecprim.h"
28 #include "vecir.h"
29 #include "ggc.h"
30 #include "tm.h"
31 #include "hard-reg-set.h"
32 #include "basic-block.h"
33 #include "tree-ssa-operands.h"
34 #include "tree-ssa-alias.h"
36 struct gimple_seq_node_d;
37 typedef struct gimple_seq_node_d *gimple_seq_node;
38 typedef const struct gimple_seq_node_d *const_gimple_seq_node;
40 /* For each block, the PHI nodes that need to be rewritten are stored into
41 these vectors. */
42 typedef VEC(gimple, heap) *gimple_vec;
43 DEF_VEC_P (gimple_vec);
44 DEF_VEC_ALLOC_P (gimple_vec, heap);
46 enum gimple_code {
47 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
48 #include "gimple.def"
49 #undef DEFGSCODE
50 LAST_AND_UNUSED_GIMPLE_CODE
53 extern const char *const gimple_code_name[];
54 extern const unsigned char gimple_rhs_class_table[];
56 /* Error out if a gimple tuple is addressed incorrectly. */
57 #if defined ENABLE_GIMPLE_CHECKING
58 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
59 extern void gimple_check_failed (const_gimple, const char *, int, \
60 const char *, enum gimple_code, \
61 enum tree_code) ATTRIBUTE_NORETURN;
63 #define GIMPLE_CHECK(GS, CODE) \
64 do { \
65 const_gimple __gs = (GS); \
66 if (gimple_code (__gs) != (CODE)) \
67 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
68 (CODE), ERROR_MARK); \
69 } while (0)
70 #else /* not ENABLE_GIMPLE_CHECKING */
71 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
72 #define GIMPLE_CHECK(GS, CODE) (void)0
73 #endif
75 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
76 get_gimple_rhs_class. */
77 enum gimple_rhs_class
79 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
80 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
81 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
82 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
83 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
84 name, a _DECL, a _REF, etc. */
87 /* Specific flags for individual GIMPLE statements. These flags are
88 always stored in gimple_statement_base.subcode and they may only be
89 defined for statement codes that do not use sub-codes.
91 Values for the masks can overlap as long as the overlapping values
92 are never used in the same statement class.
94 The maximum mask value that can be defined is 1 << 15 (i.e., each
95 statement code can hold up to 16 bitflags).
97 Keep this list sorted. */
98 enum gf_mask {
99 GF_ASM_INPUT = 1 << 0,
100 GF_ASM_VOLATILE = 1 << 1,
101 GF_CALL_CANNOT_INLINE = 1 << 0,
102 GF_CALL_FROM_THUNK = 1 << 1,
103 GF_CALL_RETURN_SLOT_OPT = 1 << 2,
104 GF_CALL_TAILCALL = 1 << 3,
105 GF_CALL_VA_ARG_PACK = 1 << 4,
106 GF_CALL_NOTHROW = 1 << 5,
107 GF_OMP_PARALLEL_COMBINED = 1 << 0,
109 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
110 a thread synchronization via some sort of barrier. The exact barrier
111 that would otherwise be emitted is dependent on the OMP statement with
112 which this return is associated. */
113 GF_OMP_RETURN_NOWAIT = 1 << 0,
115 GF_OMP_SECTION_LAST = 1 << 0,
116 GF_PREDICT_TAKEN = 1 << 15
119 /* Currently, there's only one type of gimple debug stmt. Others are
120 envisioned, for example, to enable the generation of is_stmt notes
121 in line number information, to mark sequence points, etc. This
122 subcode is to be used to tell them apart. */
123 enum gimple_debug_subcode {
124 GIMPLE_DEBUG_BIND = 0
127 /* Masks for selecting a pass local flag (PLF) to work on. These
128 masks are used by gimple_set_plf and gimple_plf. */
129 enum plf_mask {
130 GF_PLF_1 = 1 << 0,
131 GF_PLF_2 = 1 << 1
134 /* A node in a gimple_seq_d. */
135 struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) gimple_seq_node_d {
136 gimple stmt;
137 struct gimple_seq_node_d *prev;
138 struct gimple_seq_node_d *next;
141 /* A double-linked sequence of gimple statements. */
142 struct GTY ((chain_next ("%h.next_free"))) gimple_seq_d {
143 /* First and last statements in the sequence. */
144 gimple_seq_node first;
145 gimple_seq_node last;
147 /* Sequences are created/destroyed frequently. To minimize
148 allocation activity, deallocated sequences are kept in a pool of
149 available sequences. This is the pointer to the next free
150 sequence in the pool. */
151 gimple_seq next_free;
155 /* Return the first node in GIMPLE sequence S. */
157 static inline gimple_seq_node
158 gimple_seq_first (const_gimple_seq s)
160 return s ? s->first : NULL;
164 /* Return the first statement in GIMPLE sequence S. */
166 static inline gimple
167 gimple_seq_first_stmt (const_gimple_seq s)
169 gimple_seq_node n = gimple_seq_first (s);
170 return (n) ? n->stmt : NULL;
174 /* Return the last node in GIMPLE sequence S. */
176 static inline gimple_seq_node
177 gimple_seq_last (const_gimple_seq s)
179 return s ? s->last : NULL;
183 /* Return the last statement in GIMPLE sequence S. */
185 static inline gimple
186 gimple_seq_last_stmt (const_gimple_seq s)
188 gimple_seq_node n = gimple_seq_last (s);
189 return (n) ? n->stmt : NULL;
193 /* Set the last node in GIMPLE sequence S to LAST. */
195 static inline void
196 gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
198 s->last = last;
202 /* Set the first node in GIMPLE sequence S to FIRST. */
204 static inline void
205 gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
207 s->first = first;
211 /* Return true if GIMPLE sequence S is empty. */
213 static inline bool
214 gimple_seq_empty_p (const_gimple_seq s)
216 return s == NULL || s->first == NULL;
220 void gimple_seq_add_stmt (gimple_seq *, gimple);
222 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
223 *SEQ_P is NULL, a new sequence is allocated. This function is
224 similar to gimple_seq_add_stmt, but does not scan the operands.
225 During gimplification, we need to manipulate statement sequences
226 before the def/use vectors have been constructed. */
227 void gimplify_seq_add_stmt (gimple_seq *, gimple);
229 /* Allocate a new sequence and initialize its first element with STMT. */
231 static inline gimple_seq
232 gimple_seq_alloc_with_stmt (gimple stmt)
234 gimple_seq seq = NULL;
235 gimple_seq_add_stmt (&seq, stmt);
236 return seq;
240 /* Returns the sequence of statements in BB. */
242 static inline gimple_seq
243 bb_seq (const_basic_block bb)
245 return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
249 /* Sets the sequence of statements in BB to SEQ. */
251 static inline void
252 set_bb_seq (basic_block bb, gimple_seq seq)
254 gcc_checking_assert (!(bb->flags & BB_RTL));
255 bb->il.gimple->seq = seq;
258 /* Iterator object for GIMPLE statement sequences. */
260 typedef struct
262 /* Sequence node holding the current statement. */
263 gimple_seq_node ptr;
265 /* Sequence and basic block holding the statement. These fields
266 are necessary to handle edge cases such as when statement is
267 added to an empty basic block or when the last statement of a
268 block/sequence is removed. */
269 gimple_seq seq;
270 basic_block bb;
271 } gimple_stmt_iterator;
274 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
275 are for 64 bit hosts. */
277 struct GTY(()) gimple_statement_base {
278 /* [ WORD 1 ]
279 Main identifying code for a tuple. */
280 ENUM_BITFIELD(gimple_code) code : 8;
282 /* Nonzero if a warning should not be emitted on this tuple. */
283 unsigned int no_warning : 1;
285 /* Nonzero if this tuple has been visited. Passes are responsible
286 for clearing this bit before using it. */
287 unsigned int visited : 1;
289 /* Nonzero if this tuple represents a non-temporal move. */
290 unsigned int nontemporal_move : 1;
292 /* Pass local flags. These flags are free for any pass to use as
293 they see fit. Passes should not assume that these flags contain
294 any useful value when the pass starts. Any initial state that
295 the pass requires should be set on entry to the pass. See
296 gimple_set_plf and gimple_plf for usage. */
297 unsigned int plf : 2;
299 /* Nonzero if this statement has been modified and needs to have its
300 operands rescanned. */
301 unsigned modified : 1;
303 /* Nonzero if this statement contains volatile operands. */
304 unsigned has_volatile_ops : 1;
306 /* Padding to get subcode to 16 bit alignment. */
307 unsigned pad : 1;
309 /* The SUBCODE field can be used for tuple-specific flags for tuples
310 that do not require subcodes. Note that SUBCODE should be at
311 least as wide as tree codes, as several tuples store tree codes
312 in there. */
313 unsigned int subcode : 16;
315 /* UID of this statement. This is used by passes that want to
316 assign IDs to statements. It must be assigned and used by each
317 pass. By default it should be assumed to contain garbage. */
318 unsigned uid;
320 /* [ WORD 2 ]
321 Locus information for debug info. */
322 location_t location;
324 /* Number of operands in this tuple. */
325 unsigned num_ops;
327 /* [ WORD 3 ]
328 Basic block holding this statement. */
329 struct basic_block_def *bb;
331 /* [ WORD 4 ]
332 Lexical block holding this statement. */
333 tree block;
337 /* Base structure for tuples with operands. */
339 struct GTY(()) gimple_statement_with_ops_base
341 /* [ WORD 1-4 ] */
342 struct gimple_statement_base gsbase;
344 /* [ WORD 5-6 ]
345 SSA operand vectors. NOTE: It should be possible to
346 amalgamate these vectors with the operand vector OP. However,
347 the SSA operand vectors are organized differently and contain
348 more information (like immediate use chaining). */
349 struct def_optype_d GTY((skip (""))) *def_ops;
350 struct use_optype_d GTY((skip (""))) *use_ops;
354 /* Statements that take register operands. */
356 struct GTY(()) gimple_statement_with_ops
358 /* [ WORD 1-6 ] */
359 struct gimple_statement_with_ops_base opbase;
361 /* [ WORD 7 ]
362 Operand vector. NOTE! This must always be the last field
363 of this structure. In particular, this means that this
364 structure cannot be embedded inside another one. */
365 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
369 /* Base for statements that take both memory and register operands. */
371 struct GTY(()) gimple_statement_with_memory_ops_base
373 /* [ WORD 1-6 ] */
374 struct gimple_statement_with_ops_base opbase;
376 /* [ WORD 7-8 ]
377 Virtual operands for this statement. The GC will pick them
378 up via the ssa_names array. */
379 tree GTY((skip (""))) vdef;
380 tree GTY((skip (""))) vuse;
384 /* Statements that take both memory and register operands. */
386 struct GTY(()) gimple_statement_with_memory_ops
388 /* [ WORD 1-8 ] */
389 struct gimple_statement_with_memory_ops_base membase;
391 /* [ WORD 9 ]
392 Operand vector. NOTE! This must always be the last field
393 of this structure. In particular, this means that this
394 structure cannot be embedded inside another one. */
395 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
399 /* Call statements that take both memory and register operands. */
401 struct GTY(()) gimple_statement_call
403 /* [ WORD 1-8 ] */
404 struct gimple_statement_with_memory_ops_base membase;
406 /* [ WORD 9-12 ] */
407 struct pt_solution call_used;
408 struct pt_solution call_clobbered;
410 /* [ WORD 13 ]
411 Operand vector. NOTE! This must always be the last field
412 of this structure. In particular, this means that this
413 structure cannot be embedded inside another one. */
414 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
418 /* OpenMP statements (#pragma omp). */
420 struct GTY(()) gimple_statement_omp {
421 /* [ WORD 1-4 ] */
422 struct gimple_statement_base gsbase;
424 /* [ WORD 5 ] */
425 gimple_seq body;
429 /* GIMPLE_BIND */
431 struct GTY(()) gimple_statement_bind {
432 /* [ WORD 1-4 ] */
433 struct gimple_statement_base gsbase;
435 /* [ WORD 5 ]
436 Variables declared in this scope. */
437 tree vars;
439 /* [ WORD 6 ]
440 This is different than the BLOCK field in gimple_statement_base,
441 which is analogous to TREE_BLOCK (i.e., the lexical block holding
442 this statement). This field is the equivalent of BIND_EXPR_BLOCK
443 in tree land (i.e., the lexical scope defined by this bind). See
444 gimple-low.c. */
445 tree block;
447 /* [ WORD 7 ] */
448 gimple_seq body;
452 /* GIMPLE_CATCH */
454 struct GTY(()) gimple_statement_catch {
455 /* [ WORD 1-4 ] */
456 struct gimple_statement_base gsbase;
458 /* [ WORD 5 ] */
459 tree types;
461 /* [ WORD 6 ] */
462 gimple_seq handler;
466 /* GIMPLE_EH_FILTER */
468 struct GTY(()) gimple_statement_eh_filter {
469 /* [ WORD 1-4 ] */
470 struct gimple_statement_base gsbase;
472 /* [ WORD 5 ]
473 Filter types. */
474 tree types;
476 /* [ WORD 6 ]
477 Failure actions. */
478 gimple_seq failure;
482 /* GIMPLE_EH_MUST_NOT_THROW */
484 struct GTY(()) gimple_statement_eh_mnt {
485 /* [ WORD 1-4 ] */
486 struct gimple_statement_base gsbase;
488 /* [ WORD 5 ] Abort function decl. */
489 tree fndecl;
492 /* GIMPLE_PHI */
494 struct GTY(()) gimple_statement_phi {
495 /* [ WORD 1-4 ] */
496 struct gimple_statement_base gsbase;
498 /* [ WORD 5 ] */
499 unsigned capacity;
500 unsigned nargs;
502 /* [ WORD 6 ] */
503 tree result;
505 /* [ WORD 7 ] */
506 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
510 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
512 struct GTY(()) gimple_statement_eh_ctrl
514 /* [ WORD 1-4 ] */
515 struct gimple_statement_base gsbase;
517 /* [ WORD 5 ]
518 Exception region number. */
519 int region;
523 /* GIMPLE_TRY */
525 struct GTY(()) gimple_statement_try {
526 /* [ WORD 1-4 ] */
527 struct gimple_statement_base gsbase;
529 /* [ WORD 5 ]
530 Expression to evaluate. */
531 gimple_seq eval;
533 /* [ WORD 6 ]
534 Cleanup expression. */
535 gimple_seq cleanup;
538 /* Kind of GIMPLE_TRY statements. */
539 enum gimple_try_flags
541 /* A try/catch. */
542 GIMPLE_TRY_CATCH = 1 << 0,
544 /* A try/finally. */
545 GIMPLE_TRY_FINALLY = 1 << 1,
546 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
548 /* Analogous to TRY_CATCH_IS_CLEANUP. */
549 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
552 /* GIMPLE_WITH_CLEANUP_EXPR */
554 struct GTY(()) gimple_statement_wce {
555 /* [ WORD 1-4 ] */
556 struct gimple_statement_base gsbase;
558 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
559 executed if an exception is thrown, not on normal exit of its
560 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
561 in TARGET_EXPRs. */
563 /* [ WORD 5 ]
564 Cleanup expression. */
565 gimple_seq cleanup;
569 /* GIMPLE_ASM */
571 struct GTY(()) gimple_statement_asm
573 /* [ WORD 1-8 ] */
574 struct gimple_statement_with_memory_ops_base membase;
576 /* [ WORD 9 ]
577 __asm__ statement. */
578 const char *string;
580 /* [ WORD 10 ]
581 Number of inputs, outputs, clobbers, labels. */
582 unsigned char ni;
583 unsigned char no;
584 unsigned char nc;
585 unsigned char nl;
587 /* [ WORD 11 ]
588 Operand vector. NOTE! This must always be the last field
589 of this structure. In particular, this means that this
590 structure cannot be embedded inside another one. */
591 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
594 /* GIMPLE_OMP_CRITICAL */
596 struct GTY(()) gimple_statement_omp_critical {
597 /* [ WORD 1-5 ] */
598 struct gimple_statement_omp omp;
600 /* [ WORD 6 ]
601 Critical section name. */
602 tree name;
606 struct GTY(()) gimple_omp_for_iter {
607 /* Condition code. */
608 enum tree_code cond;
610 /* Index variable. */
611 tree index;
613 /* Initial value. */
614 tree initial;
616 /* Final value. */
617 tree final;
619 /* Increment. */
620 tree incr;
623 /* GIMPLE_OMP_FOR */
625 struct GTY(()) gimple_statement_omp_for {
626 /* [ WORD 1-5 ] */
627 struct gimple_statement_omp omp;
629 /* [ WORD 6 ] */
630 tree clauses;
632 /* [ WORD 7 ]
633 Number of elements in iter array. */
634 size_t collapse;
636 /* [ WORD 8 ] */
637 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
639 /* [ WORD 9 ]
640 Pre-body evaluated before the loop body begins. */
641 gimple_seq pre_body;
645 /* GIMPLE_OMP_PARALLEL */
647 struct GTY(()) gimple_statement_omp_parallel {
648 /* [ WORD 1-5 ] */
649 struct gimple_statement_omp omp;
651 /* [ WORD 6 ]
652 Clauses. */
653 tree clauses;
655 /* [ WORD 7 ]
656 Child function holding the body of the parallel region. */
657 tree child_fn;
659 /* [ WORD 8 ]
660 Shared data argument. */
661 tree data_arg;
665 /* GIMPLE_OMP_TASK */
667 struct GTY(()) gimple_statement_omp_task {
668 /* [ WORD 1-8 ] */
669 struct gimple_statement_omp_parallel par;
671 /* [ WORD 9 ]
672 Child function holding firstprivate initialization if needed. */
673 tree copy_fn;
675 /* [ WORD 10-11 ]
676 Size and alignment in bytes of the argument data block. */
677 tree arg_size;
678 tree arg_align;
682 /* GIMPLE_OMP_SECTION */
683 /* Uses struct gimple_statement_omp. */
686 /* GIMPLE_OMP_SECTIONS */
688 struct GTY(()) gimple_statement_omp_sections {
689 /* [ WORD 1-5 ] */
690 struct gimple_statement_omp omp;
692 /* [ WORD 6 ] */
693 tree clauses;
695 /* [ WORD 7 ]
696 The control variable used for deciding which of the sections to
697 execute. */
698 tree control;
701 /* GIMPLE_OMP_CONTINUE.
703 Note: This does not inherit from gimple_statement_omp, because we
704 do not need the body field. */
706 struct GTY(()) gimple_statement_omp_continue {
707 /* [ WORD 1-4 ] */
708 struct gimple_statement_base gsbase;
710 /* [ WORD 5 ] */
711 tree control_def;
713 /* [ WORD 6 ] */
714 tree control_use;
717 /* GIMPLE_OMP_SINGLE */
719 struct GTY(()) gimple_statement_omp_single {
720 /* [ WORD 1-5 ] */
721 struct gimple_statement_omp omp;
723 /* [ WORD 6 ] */
724 tree clauses;
728 /* GIMPLE_OMP_ATOMIC_LOAD.
729 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
730 contains a sequence, which we don't need here. */
732 struct GTY(()) gimple_statement_omp_atomic_load {
733 /* [ WORD 1-4 ] */
734 struct gimple_statement_base gsbase;
736 /* [ WORD 5-6 ] */
737 tree rhs, lhs;
740 /* GIMPLE_OMP_ATOMIC_STORE.
741 See note on GIMPLE_OMP_ATOMIC_LOAD. */
743 struct GTY(()) gimple_statement_omp_atomic_store {
744 /* [ WORD 1-4 ] */
745 struct gimple_statement_base gsbase;
747 /* [ WORD 5 ] */
748 tree val;
751 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
752 enum gimple_statement_structure_enum {
753 #include "gsstruct.def"
754 LAST_GSS_ENUM
756 #undef DEFGSSTRUCT
759 /* Define the overall contents of a gimple tuple. It may be any of the
760 structures declared above for various types of tuples. */
762 union GTY ((desc ("gimple_statement_structure (&%h)"), variable_size)) gimple_statement_d {
763 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
764 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
765 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
766 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
767 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
768 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
769 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
770 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
771 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
772 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
773 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
774 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
775 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
776 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
777 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
778 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
779 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
780 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
781 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
782 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
783 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
784 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
785 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
786 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
789 /* In gimple.c. */
791 /* Offset in bytes to the location of the operand vector.
792 Zero if there is no operand vector for this tuple structure. */
793 extern size_t const gimple_ops_offset_[];
795 /* Map GIMPLE codes to GSS codes. */
796 extern enum gimple_statement_structure_enum const gss_for_code_[];
798 /* This variable holds the currently expanded gimple statement for purposes
799 of comminucating the profile info to the builtin expanders. */
800 extern gimple currently_expanding_gimple_stmt;
802 gimple gimple_build_return (tree);
804 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
805 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
807 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
809 gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
810 tree, tree MEM_STAT_DECL);
811 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
812 gimple_build_assign_with_ops_stat (c, o1, o2, o3, NULL_TREE MEM_STAT_INFO)
813 #define gimple_build_assign_with_ops3(c,o1,o2,o3,o4) \
814 gimple_build_assign_with_ops_stat (c, o1, o2, o3, o4 MEM_STAT_INFO)
816 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
817 #define gimple_build_debug_bind(var,val,stmt) \
818 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
820 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
821 gimple gimple_build_call (tree, unsigned, ...);
822 gimple gimple_build_call_from_tree (tree);
823 gimple gimplify_assign (tree, tree, gimple_seq *);
824 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
825 gimple gimple_build_label (tree label);
826 gimple gimple_build_goto (tree dest);
827 gimple gimple_build_nop (void);
828 gimple gimple_build_bind (tree, gimple_seq, tree);
829 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
830 VEC(tree,gc) *, VEC(tree,gc) *);
831 gimple gimple_build_catch (tree, gimple_seq);
832 gimple gimple_build_eh_filter (tree, gimple_seq);
833 gimple gimple_build_eh_must_not_throw (tree);
834 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
835 gimple gimple_build_wce (gimple_seq);
836 gimple gimple_build_resx (int);
837 gimple gimple_build_eh_dispatch (int);
838 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
839 gimple gimple_build_switch (unsigned, tree, tree, ...);
840 gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
841 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
842 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
843 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
844 gimple gimple_build_omp_critical (gimple_seq, tree);
845 gimple gimple_build_omp_section (gimple_seq);
846 gimple gimple_build_omp_continue (tree, tree);
847 gimple gimple_build_omp_master (gimple_seq);
848 gimple gimple_build_omp_return (bool);
849 gimple gimple_build_omp_ordered (gimple_seq);
850 gimple gimple_build_omp_sections (gimple_seq, tree);
851 gimple gimple_build_omp_sections_switch (void);
852 gimple gimple_build_omp_single (gimple_seq, tree);
853 gimple gimple_build_cdt (tree, tree);
854 gimple gimple_build_omp_atomic_load (tree, tree);
855 gimple gimple_build_omp_atomic_store (tree);
856 gimple gimple_build_predict (enum br_predictor, enum prediction);
857 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
858 void sort_case_labels (VEC(tree,heap) *);
859 void gimple_set_body (tree, gimple_seq);
860 gimple_seq gimple_body (tree);
861 bool gimple_has_body_p (tree);
862 gimple_seq gimple_seq_alloc (void);
863 void gimple_seq_free (gimple_seq);
864 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
865 gimple_seq gimple_seq_copy (gimple_seq);
866 int gimple_call_flags (const_gimple);
867 int gimple_call_return_flags (const_gimple);
868 int gimple_call_arg_flags (const_gimple, unsigned);
869 void gimple_call_reset_alias_info (gimple);
870 bool gimple_assign_copy_p (gimple);
871 bool gimple_assign_ssa_name_copy_p (gimple);
872 bool gimple_assign_single_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 tree gimple_fold_obj_type_ref (tree, tree);
898 tree gimple_get_relevant_ref_binfo (tree ref, tree known_binfo);
899 tree gimple_fold_obj_type_ref_known_binfo (HOST_WIDE_INT, tree);
901 /* Returns true iff T is a valid GIMPLE statement. */
902 extern bool is_gimple_stmt (tree);
904 /* Returns true iff TYPE is a valid type for a scalar register variable. */
905 extern bool is_gimple_reg_type (tree);
906 /* Returns true iff T is a scalar register variable. */
907 extern bool is_gimple_reg (tree);
908 /* Returns true iff T is any sort of variable. */
909 extern bool is_gimple_variable (tree);
910 /* Returns true iff T is any sort of symbol. */
911 extern bool is_gimple_id (tree);
912 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
913 extern bool is_gimple_min_lval (tree);
914 /* Returns true iff T is something whose address can be taken. */
915 extern bool is_gimple_addressable (tree);
916 /* Returns true iff T is any valid GIMPLE lvalue. */
917 extern bool is_gimple_lvalue (tree);
919 /* Returns true iff T is a GIMPLE address. */
920 bool is_gimple_address (const_tree);
921 /* Returns true iff T is a GIMPLE invariant address. */
922 bool is_gimple_invariant_address (const_tree);
923 /* Returns true iff T is a GIMPLE invariant address at interprocedural
924 level. */
925 bool is_gimple_ip_invariant_address (const_tree);
926 /* Returns true iff T is a valid GIMPLE constant. */
927 bool is_gimple_constant (const_tree);
928 /* Returns true iff T is a GIMPLE restricted function invariant. */
929 extern bool is_gimple_min_invariant (const_tree);
930 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
931 extern bool is_gimple_ip_invariant (const_tree);
932 /* Returns true iff T is a GIMPLE rvalue. */
933 extern bool is_gimple_val (tree);
934 /* Returns true iff T is a GIMPLE asm statement input. */
935 extern bool is_gimple_asm_val (tree);
936 /* Returns true iff T is a valid address operand of a MEM_REF. */
937 bool is_gimple_mem_ref_addr (tree);
938 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
939 GIMPLE temporary, a renamed user variable, or something else,
940 respectively. */
941 extern bool is_gimple_reg_rhs (tree);
942 extern bool is_gimple_mem_rhs (tree);
944 /* Returns true iff T is a valid if-statement condition. */
945 extern bool is_gimple_condexpr (tree);
947 /* Returns true iff T is a type conversion. */
948 extern bool is_gimple_cast (tree);
949 /* Returns true iff T is a variable that does not need to live in memory. */
950 extern bool is_gimple_non_addressable (tree t);
952 /* Returns true iff T is a valid call address expression. */
953 extern bool is_gimple_call_addr (tree);
954 /* If T makes a function call, returns the CALL_EXPR operand. */
955 extern tree get_call_expr_in (tree t);
957 extern void recalculate_side_effects (tree);
958 extern bool gimple_compare_field_offset (tree, tree);
959 extern tree gimple_register_type (tree);
960 extern tree gimple_register_canonical_type (tree);
961 enum gtc_mode { GTC_MERGE = 0, GTC_DIAG = 1 };
962 extern bool gimple_types_compatible_p (tree, tree, enum gtc_mode);
963 extern void print_gimple_types_stats (void);
964 extern void free_gimple_type_tables (void);
965 extern tree gimple_unsigned_type (tree);
966 extern tree gimple_signed_type (tree);
967 extern alias_set_type gimple_get_alias_set (tree);
968 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
969 unsigned *);
970 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
971 bool (*)(gimple, tree, void *),
972 bool (*)(gimple, tree, void *),
973 bool (*)(gimple, tree, void *));
974 extern bool walk_stmt_load_store_ops (gimple, void *,
975 bool (*)(gimple, tree, void *),
976 bool (*)(gimple, tree, void *));
977 extern bool gimple_ior_addresses_taken (bitmap, gimple);
978 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
980 /* In gimplify.c */
981 extern tree create_tmp_var_raw (tree, const char *);
982 extern tree create_tmp_var_name (const char *);
983 extern tree create_tmp_var (tree, const char *);
984 extern tree create_tmp_reg (tree, const char *);
985 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
986 extern tree get_formal_tmp_var (tree, gimple_seq *);
987 extern void declare_vars (tree, gimple, bool);
988 extern void annotate_all_with_location (gimple_seq, location_t);
990 /* Validation of GIMPLE expressions. Note that these predicates only check
991 the basic form of the expression, they don't recurse to make sure that
992 underlying nodes are also of the right form. */
993 typedef bool (*gimple_predicate)(tree);
996 /* FIXME we should deduce this from the predicate. */
997 enum fallback {
998 fb_none = 0, /* Do not generate a temporary. */
1000 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
1001 gimplified expression. */
1003 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
1004 gimplified expression. */
1006 fb_mayfail = 4, /* Gimplification may fail. Error issued
1007 afterwards. */
1008 fb_either= fb_rvalue | fb_lvalue
1011 typedef int fallback_t;
1013 enum gimplify_status {
1014 GS_ERROR = -2, /* Something Bad Seen. */
1015 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
1016 GS_OK = 0, /* We did something, maybe more to do. */
1017 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1020 struct gimplify_ctx
1022 struct gimplify_ctx *prev_context;
1024 VEC(gimple,heap) *bind_expr_stack;
1025 tree temps;
1026 gimple_seq conditional_cleanups;
1027 tree exit_label;
1028 tree return_temp;
1030 VEC(tree,heap) *case_labels;
1031 /* The formal temporary table. Should this be persistent? */
1032 htab_t temp_htab;
1034 int conditions;
1035 bool save_stack;
1036 bool into_ssa;
1037 bool allow_rhs_cond_expr;
1040 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1041 bool (*) (tree), fallback_t);
1042 extern void gimplify_type_sizes (tree, gimple_seq *);
1043 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1044 extern bool gimplify_stmt (tree *, gimple_seq *);
1045 extern gimple gimplify_body (tree *, tree, bool);
1046 extern void push_gimplify_context (struct gimplify_ctx *);
1047 extern void pop_gimplify_context (gimple);
1048 extern void gimplify_and_add (tree, gimple_seq *);
1050 /* Miscellaneous helpers. */
1051 extern void gimple_add_tmp_var (tree);
1052 extern gimple gimple_current_bind_expr (void);
1053 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1054 extern tree voidify_wrapper_expr (tree, tree);
1055 extern tree build_and_jump (tree *);
1056 extern tree force_labels_r (tree *, int *, void *);
1057 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1058 gimple_seq *);
1059 struct gimplify_omp_ctx;
1060 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1061 extern tree gimple_boolify (tree);
1062 extern gimple_predicate rhs_predicate_for (tree);
1063 extern tree canonicalize_cond_expr_cond (tree);
1065 /* In omp-low.c. */
1066 extern tree omp_reduction_init (tree, tree);
1068 /* In tree-nested.c. */
1069 extern void lower_nested_functions (tree);
1070 extern void insert_field_into_struct (tree, tree);
1072 /* In gimplify.c. */
1073 extern void gimplify_function_tree (tree);
1075 /* In cfgexpand.c. */
1076 extern tree gimple_assign_rhs_to_tree (gimple);
1078 /* In builtins.c */
1079 extern bool validate_gimple_arglist (const_gimple, ...);
1081 /* In tree-ssa.c */
1082 extern bool tree_ssa_useless_type_conversion (tree);
1083 extern tree tree_ssa_strip_useless_type_conversions (tree);
1084 extern bool useless_type_conversion_p (tree, tree);
1085 extern bool types_compatible_p (tree, tree);
1087 /* Return the code for GIMPLE statement G. */
1089 static inline enum gimple_code
1090 gimple_code (const_gimple g)
1092 return g->gsbase.code;
1096 /* Return the GSS code used by a GIMPLE code. */
1098 static inline enum gimple_statement_structure_enum
1099 gss_for_code (enum gimple_code code)
1101 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1102 return gss_for_code_[code];
1106 /* Return which GSS code is used by GS. */
1108 static inline enum gimple_statement_structure_enum
1109 gimple_statement_structure (gimple gs)
1111 return gss_for_code (gimple_code (gs));
1115 /* Return true if statement G has sub-statements. This is only true for
1116 High GIMPLE statements. */
1118 static inline bool
1119 gimple_has_substatements (gimple g)
1121 switch (gimple_code (g))
1123 case GIMPLE_BIND:
1124 case GIMPLE_CATCH:
1125 case GIMPLE_EH_FILTER:
1126 case GIMPLE_TRY:
1127 case GIMPLE_OMP_FOR:
1128 case GIMPLE_OMP_MASTER:
1129 case GIMPLE_OMP_ORDERED:
1130 case GIMPLE_OMP_SECTION:
1131 case GIMPLE_OMP_PARALLEL:
1132 case GIMPLE_OMP_TASK:
1133 case GIMPLE_OMP_SECTIONS:
1134 case GIMPLE_OMP_SINGLE:
1135 case GIMPLE_OMP_CRITICAL:
1136 case GIMPLE_WITH_CLEANUP_EXPR:
1137 return true;
1139 default:
1140 return false;
1145 /* Return the basic block holding statement G. */
1147 static inline struct basic_block_def *
1148 gimple_bb (const_gimple g)
1150 return g->gsbase.bb;
1154 /* Return the lexical scope block holding statement G. */
1156 static inline tree
1157 gimple_block (const_gimple g)
1159 return g->gsbase.block;
1163 /* Set BLOCK to be the lexical scope block holding statement G. */
1165 static inline void
1166 gimple_set_block (gimple g, tree block)
1168 g->gsbase.block = block;
1172 /* Return location information for statement G. */
1174 static inline location_t
1175 gimple_location (const_gimple g)
1177 return g->gsbase.location;
1180 /* Return pointer to location information for statement G. */
1182 static inline const location_t *
1183 gimple_location_ptr (const_gimple g)
1185 return &g->gsbase.location;
1189 /* Set location information for statement G. */
1191 static inline void
1192 gimple_set_location (gimple g, location_t location)
1194 g->gsbase.location = location;
1198 /* Return true if G contains location information. */
1200 static inline bool
1201 gimple_has_location (const_gimple g)
1203 return gimple_location (g) != UNKNOWN_LOCATION;
1207 /* Return the file name of the location of STMT. */
1209 static inline const char *
1210 gimple_filename (const_gimple stmt)
1212 return LOCATION_FILE (gimple_location (stmt));
1216 /* Return the line number of the location of STMT. */
1218 static inline int
1219 gimple_lineno (const_gimple stmt)
1221 return LOCATION_LINE (gimple_location (stmt));
1225 /* Determine whether SEQ is a singleton. */
1227 static inline bool
1228 gimple_seq_singleton_p (gimple_seq seq)
1230 return ((gimple_seq_first (seq) != NULL)
1231 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1234 /* Return true if no warnings should be emitted for statement STMT. */
1236 static inline bool
1237 gimple_no_warning_p (const_gimple stmt)
1239 return stmt->gsbase.no_warning;
1242 /* Set the no_warning flag of STMT to NO_WARNING. */
1244 static inline void
1245 gimple_set_no_warning (gimple stmt, bool no_warning)
1247 stmt->gsbase.no_warning = (unsigned) no_warning;
1250 /* Set the visited status on statement STMT to VISITED_P. */
1252 static inline void
1253 gimple_set_visited (gimple stmt, bool visited_p)
1255 stmt->gsbase.visited = (unsigned) visited_p;
1259 /* Return the visited status for statement STMT. */
1261 static inline bool
1262 gimple_visited_p (gimple stmt)
1264 return stmt->gsbase.visited;
1268 /* Set pass local flag PLF on statement STMT to VAL_P. */
1270 static inline void
1271 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1273 if (val_p)
1274 stmt->gsbase.plf |= (unsigned int) plf;
1275 else
1276 stmt->gsbase.plf &= ~((unsigned int) plf);
1280 /* Return the value of pass local flag PLF on statement STMT. */
1282 static inline unsigned int
1283 gimple_plf (gimple stmt, enum plf_mask plf)
1285 return stmt->gsbase.plf & ((unsigned int) plf);
1289 /* Set the UID of statement. */
1291 static inline void
1292 gimple_set_uid (gimple g, unsigned uid)
1294 g->gsbase.uid = uid;
1298 /* Return the UID of statement. */
1300 static inline unsigned
1301 gimple_uid (const_gimple g)
1303 return g->gsbase.uid;
1307 /* Return true if GIMPLE statement G has register or memory operands. */
1309 static inline bool
1310 gimple_has_ops (const_gimple g)
1312 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1316 /* Return true if GIMPLE statement G has memory operands. */
1318 static inline bool
1319 gimple_has_mem_ops (const_gimple g)
1321 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1325 /* Return the set of DEF operands for statement G. */
1327 static inline struct def_optype_d *
1328 gimple_def_ops (const_gimple g)
1330 if (!gimple_has_ops (g))
1331 return NULL;
1332 return g->gsops.opbase.def_ops;
1336 /* Set DEF to be the set of DEF operands for statement G. */
1338 static inline void
1339 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1341 gcc_gimple_checking_assert (gimple_has_ops (g));
1342 g->gsops.opbase.def_ops = def;
1346 /* Return the set of USE operands for statement G. */
1348 static inline struct use_optype_d *
1349 gimple_use_ops (const_gimple g)
1351 if (!gimple_has_ops (g))
1352 return NULL;
1353 return g->gsops.opbase.use_ops;
1357 /* Set USE to be the set of USE operands for statement G. */
1359 static inline void
1360 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1362 gcc_gimple_checking_assert (gimple_has_ops (g));
1363 g->gsops.opbase.use_ops = use;
1367 /* Return the set of VUSE operand for statement G. */
1369 static inline use_operand_p
1370 gimple_vuse_op (const_gimple g)
1372 struct use_optype_d *ops;
1373 if (!gimple_has_mem_ops (g))
1374 return NULL_USE_OPERAND_P;
1375 ops = g->gsops.opbase.use_ops;
1376 if (ops
1377 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1378 return USE_OP_PTR (ops);
1379 return NULL_USE_OPERAND_P;
1382 /* Return the set of VDEF operand for statement G. */
1384 static inline def_operand_p
1385 gimple_vdef_op (const_gimple g)
1387 struct def_optype_d *ops;
1388 if (!gimple_has_mem_ops (g))
1389 return NULL_DEF_OPERAND_P;
1390 ops = g->gsops.opbase.def_ops;
1391 if (ops
1392 && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1393 return DEF_OP_PTR (ops);
1394 return NULL_DEF_OPERAND_P;
1398 /* Return the single VUSE operand of the statement G. */
1400 static inline tree
1401 gimple_vuse (const_gimple g)
1403 if (!gimple_has_mem_ops (g))
1404 return NULL_TREE;
1405 return g->gsmembase.vuse;
1408 /* Return the single VDEF operand of the statement G. */
1410 static inline tree
1411 gimple_vdef (const_gimple g)
1413 if (!gimple_has_mem_ops (g))
1414 return NULL_TREE;
1415 return g->gsmembase.vdef;
1418 /* Return the single VUSE operand of the statement G. */
1420 static inline tree *
1421 gimple_vuse_ptr (gimple g)
1423 if (!gimple_has_mem_ops (g))
1424 return NULL;
1425 return &g->gsmembase.vuse;
1428 /* Return the single VDEF operand of the statement G. */
1430 static inline tree *
1431 gimple_vdef_ptr (gimple g)
1433 if (!gimple_has_mem_ops (g))
1434 return NULL;
1435 return &g->gsmembase.vdef;
1438 /* Set the single VUSE operand of the statement G. */
1440 static inline void
1441 gimple_set_vuse (gimple g, tree vuse)
1443 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1444 g->gsmembase.vuse = vuse;
1447 /* Set the single VDEF operand of the statement G. */
1449 static inline void
1450 gimple_set_vdef (gimple g, tree vdef)
1452 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1453 g->gsmembase.vdef = vdef;
1457 /* Return true if statement G has operands and the modified field has
1458 been set. */
1460 static inline bool
1461 gimple_modified_p (const_gimple g)
1463 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1467 /* Return the tree code for the expression computed by STMT. This is
1468 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1469 GIMPLE_CALL, return CALL_EXPR as the expression code for
1470 consistency. This is useful when the caller needs to deal with the
1471 three kinds of computation that GIMPLE supports. */
1473 static inline enum tree_code
1474 gimple_expr_code (const_gimple stmt)
1476 enum gimple_code code = gimple_code (stmt);
1477 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1478 return (enum tree_code) stmt->gsbase.subcode;
1479 else
1481 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1482 return CALL_EXPR;
1487 /* Mark statement S as modified, and update it. */
1489 static inline void
1490 update_stmt (gimple s)
1492 if (gimple_has_ops (s))
1494 gimple_set_modified (s, true);
1495 update_stmt_operands (s);
1499 /* Update statement S if it has been optimized. */
1501 static inline void
1502 update_stmt_if_modified (gimple s)
1504 if (gimple_modified_p (s))
1505 update_stmt_operands (s);
1508 /* Return true if statement STMT contains volatile operands. */
1510 static inline bool
1511 gimple_has_volatile_ops (const_gimple stmt)
1513 if (gimple_has_mem_ops (stmt))
1514 return stmt->gsbase.has_volatile_ops;
1515 else
1516 return false;
1520 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1522 static inline void
1523 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1525 if (gimple_has_mem_ops (stmt))
1526 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1530 /* Return true if statement STMT may access memory. */
1532 static inline bool
1533 gimple_references_memory_p (gimple stmt)
1535 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1539 /* Return the subcode for OMP statement S. */
1541 static inline unsigned
1542 gimple_omp_subcode (const_gimple s)
1544 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1545 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1546 return s->gsbase.subcode;
1549 /* Set the subcode for OMP statement S to SUBCODE. */
1551 static inline void
1552 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1554 /* We only have 16 bits for the subcode. Assert that we are not
1555 overflowing it. */
1556 gcc_gimple_checking_assert (subcode < (1 << 16));
1557 s->gsbase.subcode = subcode;
1560 /* Set the nowait flag on OMP_RETURN statement S. */
1562 static inline void
1563 gimple_omp_return_set_nowait (gimple s)
1565 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1566 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1570 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1571 flag set. */
1573 static inline bool
1574 gimple_omp_return_nowait_p (const_gimple g)
1576 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1577 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1581 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1582 flag set. */
1584 static inline bool
1585 gimple_omp_section_last_p (const_gimple g)
1587 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1588 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1592 /* Set the GF_OMP_SECTION_LAST flag on G. */
1594 static inline void
1595 gimple_omp_section_set_last (gimple g)
1597 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1598 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1602 /* Return true if OMP parallel statement G has the
1603 GF_OMP_PARALLEL_COMBINED flag set. */
1605 static inline bool
1606 gimple_omp_parallel_combined_p (const_gimple g)
1608 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1609 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1613 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1614 value of COMBINED_P. */
1616 static inline void
1617 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1619 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1620 if (combined_p)
1621 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1622 else
1623 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1627 /* Return the number of operands for statement GS. */
1629 static inline unsigned
1630 gimple_num_ops (const_gimple gs)
1632 return gs->gsbase.num_ops;
1636 /* Set the number of operands for statement GS. */
1638 static inline void
1639 gimple_set_num_ops (gimple gs, unsigned num_ops)
1641 gs->gsbase.num_ops = num_ops;
1645 /* Return the array of operands for statement GS. */
1647 static inline tree *
1648 gimple_ops (gimple gs)
1650 size_t off;
1652 /* All the tuples have their operand vector at the very bottom
1653 of the structure. Note that those structures that do not
1654 have an operand vector have a zero offset. */
1655 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1656 gcc_gimple_checking_assert (off != 0);
1658 return (tree *) ((char *) gs + off);
1662 /* Return operand I for statement GS. */
1664 static inline tree
1665 gimple_op (const_gimple gs, unsigned i)
1667 if (gimple_has_ops (gs))
1669 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1670 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1672 else
1673 return NULL_TREE;
1676 /* Return a pointer to operand I for statement GS. */
1678 static inline tree *
1679 gimple_op_ptr (const_gimple gs, unsigned i)
1681 if (gimple_has_ops (gs))
1683 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1684 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1686 else
1687 return NULL;
1690 /* Set operand I of statement GS to OP. */
1692 static inline void
1693 gimple_set_op (gimple gs, unsigned i, tree op)
1695 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1697 /* Note. It may be tempting to assert that OP matches
1698 is_gimple_operand, but that would be wrong. Different tuples
1699 accept slightly different sets of tree operands. Each caller
1700 should perform its own validation. */
1701 gimple_ops (gs)[i] = op;
1704 /* Return true if GS is a GIMPLE_ASSIGN. */
1706 static inline bool
1707 is_gimple_assign (const_gimple gs)
1709 return gimple_code (gs) == GIMPLE_ASSIGN;
1712 /* Determine if expression CODE is one of the valid expressions that can
1713 be used on the RHS of GIMPLE assignments. */
1715 static inline enum gimple_rhs_class
1716 get_gimple_rhs_class (enum tree_code code)
1718 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1721 /* Return the LHS of assignment statement GS. */
1723 static inline tree
1724 gimple_assign_lhs (const_gimple gs)
1726 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1727 return gimple_op (gs, 0);
1731 /* Return a pointer to the LHS of assignment statement GS. */
1733 static inline tree *
1734 gimple_assign_lhs_ptr (const_gimple gs)
1736 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1737 return gimple_op_ptr (gs, 0);
1741 /* Set LHS to be the LHS operand of assignment statement GS. */
1743 static inline void
1744 gimple_assign_set_lhs (gimple gs, tree lhs)
1746 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1747 gimple_set_op (gs, 0, lhs);
1749 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1750 SSA_NAME_DEF_STMT (lhs) = gs;
1754 /* Return the first operand on the RHS of assignment statement GS. */
1756 static inline tree
1757 gimple_assign_rhs1 (const_gimple gs)
1759 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1760 return gimple_op (gs, 1);
1764 /* Return a pointer to the first operand on the RHS of assignment
1765 statement GS. */
1767 static inline tree *
1768 gimple_assign_rhs1_ptr (const_gimple gs)
1770 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1771 return gimple_op_ptr (gs, 1);
1774 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1776 static inline void
1777 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1779 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1781 gimple_set_op (gs, 1, rhs);
1785 /* Return the second operand on the RHS of assignment statement GS.
1786 If GS does not have two operands, NULL is returned instead. */
1788 static inline tree
1789 gimple_assign_rhs2 (const_gimple gs)
1791 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1793 if (gimple_num_ops (gs) >= 3)
1794 return gimple_op (gs, 2);
1795 else
1796 return NULL_TREE;
1800 /* Return a pointer to the second operand on the RHS of assignment
1801 statement GS. */
1803 static inline tree *
1804 gimple_assign_rhs2_ptr (const_gimple gs)
1806 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1807 return gimple_op_ptr (gs, 2);
1811 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1813 static inline void
1814 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1816 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1818 gimple_set_op (gs, 2, rhs);
1821 /* Return the third operand on the RHS of assignment statement GS.
1822 If GS does not have two operands, NULL is returned instead. */
1824 static inline tree
1825 gimple_assign_rhs3 (const_gimple gs)
1827 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1829 if (gimple_num_ops (gs) >= 4)
1830 return gimple_op (gs, 3);
1831 else
1832 return NULL_TREE;
1835 /* Return a pointer to the third operand on the RHS of assignment
1836 statement GS. */
1838 static inline tree *
1839 gimple_assign_rhs3_ptr (const_gimple gs)
1841 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1842 return gimple_op_ptr (gs, 3);
1846 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1848 static inline void
1849 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1851 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1853 gimple_set_op (gs, 3, rhs);
1856 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1857 to see only a maximum of two operands. */
1859 static inline void
1860 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1861 tree op1, tree op2)
1863 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1866 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1867 to see only a maximum of two operands. */
1869 static inline void
1870 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1871 tree *op1)
1873 tree op2;
1874 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1875 gcc_assert (op2 == NULL_TREE);
1878 /* Returns true if GS is a nontemporal move. */
1880 static inline bool
1881 gimple_assign_nontemporal_move_p (const_gimple gs)
1883 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1884 return gs->gsbase.nontemporal_move;
1887 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1889 static inline void
1890 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1892 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1893 gs->gsbase.nontemporal_move = nontemporal;
1897 /* Return the code of the expression computed on the rhs of assignment
1898 statement GS. In case that the RHS is a single object, returns the
1899 tree code of the object. */
1901 static inline enum tree_code
1902 gimple_assign_rhs_code (const_gimple gs)
1904 enum tree_code code;
1905 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1907 code = gimple_expr_code (gs);
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));
1937 /* Return true if S is a type-cast assignment. */
1939 static inline bool
1940 gimple_assign_cast_p (gimple s)
1942 if (is_gimple_assign (s))
1944 enum tree_code sc = gimple_assign_rhs_code (s);
1945 return CONVERT_EXPR_CODE_P (sc)
1946 || sc == VIEW_CONVERT_EXPR
1947 || sc == FIX_TRUNC_EXPR;
1950 return false;
1954 /* Return true if GS is a GIMPLE_CALL. */
1956 static inline bool
1957 is_gimple_call (const_gimple gs)
1959 return gimple_code (gs) == GIMPLE_CALL;
1962 /* Return the LHS of call statement GS. */
1964 static inline tree
1965 gimple_call_lhs (const_gimple gs)
1967 GIMPLE_CHECK (gs, GIMPLE_CALL);
1968 return gimple_op (gs, 0);
1972 /* Return a pointer to the LHS of call statement GS. */
1974 static inline tree *
1975 gimple_call_lhs_ptr (const_gimple gs)
1977 GIMPLE_CHECK (gs, GIMPLE_CALL);
1978 return gimple_op_ptr (gs, 0);
1982 /* Set LHS to be the LHS operand of call statement GS. */
1984 static inline void
1985 gimple_call_set_lhs (gimple gs, tree lhs)
1987 GIMPLE_CHECK (gs, GIMPLE_CALL);
1988 gimple_set_op (gs, 0, lhs);
1989 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1990 SSA_NAME_DEF_STMT (lhs) = gs;
1994 /* Return the tree node representing the function called by call
1995 statement GS. */
1997 static inline tree
1998 gimple_call_fn (const_gimple gs)
2000 GIMPLE_CHECK (gs, GIMPLE_CALL);
2001 return gimple_op (gs, 1);
2005 /* Return a pointer to the tree node representing the function called by call
2006 statement GS. */
2008 static inline tree *
2009 gimple_call_fn_ptr (const_gimple gs)
2011 GIMPLE_CHECK (gs, GIMPLE_CALL);
2012 return gimple_op_ptr (gs, 1);
2016 /* Set FN to be the function called by call statement GS. */
2018 static inline void
2019 gimple_call_set_fn (gimple gs, tree fn)
2021 GIMPLE_CHECK (gs, GIMPLE_CALL);
2022 gimple_set_op (gs, 1, fn);
2026 /* Set FNDECL to be the function called by call statement GS. */
2028 static inline void
2029 gimple_call_set_fndecl (gimple gs, tree decl)
2031 GIMPLE_CHECK (gs, GIMPLE_CALL);
2032 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2036 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2037 Otherwise return NULL. This function is analogous to
2038 get_callee_fndecl in tree land. */
2040 static inline tree
2041 gimple_call_fndecl (const_gimple gs)
2043 tree addr = gimple_call_fn (gs);
2044 if (TREE_CODE (addr) == ADDR_EXPR)
2046 tree fndecl = TREE_OPERAND (addr, 0);
2047 if (TREE_CODE (fndecl) == MEM_REF)
2049 if (TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2050 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2051 return TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2052 else
2053 return NULL_TREE;
2055 return TREE_OPERAND (addr, 0);
2057 return NULL_TREE;
2061 /* Return the type returned by call statement GS. */
2063 static inline tree
2064 gimple_call_return_type (const_gimple gs)
2066 tree fn = gimple_call_fn (gs);
2067 tree type = TREE_TYPE (fn);
2069 /* See through the pointer. */
2070 type = TREE_TYPE (type);
2072 /* The type returned by a FUNCTION_DECL is the type of its
2073 function type. */
2074 return TREE_TYPE (type);
2078 /* Return the static chain for call statement GS. */
2080 static inline tree
2081 gimple_call_chain (const_gimple gs)
2083 GIMPLE_CHECK (gs, GIMPLE_CALL);
2084 return gimple_op (gs, 2);
2088 /* Return a pointer to the static chain for call statement GS. */
2090 static inline tree *
2091 gimple_call_chain_ptr (const_gimple gs)
2093 GIMPLE_CHECK (gs, GIMPLE_CALL);
2094 return gimple_op_ptr (gs, 2);
2097 /* Set CHAIN to be the static chain for call statement GS. */
2099 static inline void
2100 gimple_call_set_chain (gimple gs, tree chain)
2102 GIMPLE_CHECK (gs, GIMPLE_CALL);
2104 gimple_set_op (gs, 2, chain);
2108 /* Return the number of arguments used by call statement GS. */
2110 static inline unsigned
2111 gimple_call_num_args (const_gimple gs)
2113 unsigned num_ops;
2114 GIMPLE_CHECK (gs, GIMPLE_CALL);
2115 num_ops = gimple_num_ops (gs);
2116 return num_ops - 3;
2120 /* Return the argument at position INDEX for call statement GS. */
2122 static inline tree
2123 gimple_call_arg (const_gimple gs, unsigned index)
2125 GIMPLE_CHECK (gs, GIMPLE_CALL);
2126 return gimple_op (gs, index + 3);
2130 /* Return a pointer to the argument at position INDEX for call
2131 statement GS. */
2133 static inline tree *
2134 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2136 GIMPLE_CHECK (gs, GIMPLE_CALL);
2137 return gimple_op_ptr (gs, index + 3);
2141 /* Set ARG to be the argument at position INDEX for call statement GS. */
2143 static inline void
2144 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2146 GIMPLE_CHECK (gs, GIMPLE_CALL);
2147 gimple_set_op (gs, index + 3, arg);
2151 /* If TAIL_P is true, mark call statement S as being a tail call
2152 (i.e., a call just before the exit of a function). These calls are
2153 candidate for tail call optimization. */
2155 static inline void
2156 gimple_call_set_tail (gimple s, bool tail_p)
2158 GIMPLE_CHECK (s, GIMPLE_CALL);
2159 if (tail_p)
2160 s->gsbase.subcode |= GF_CALL_TAILCALL;
2161 else
2162 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2166 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2168 static inline bool
2169 gimple_call_tail_p (gimple s)
2171 GIMPLE_CHECK (s, GIMPLE_CALL);
2172 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2176 /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
2178 static inline void
2179 gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
2181 GIMPLE_CHECK (s, GIMPLE_CALL);
2182 if (inlinable_p)
2183 s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
2184 else
2185 s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
2189 /* Return true if GIMPLE_CALL S cannot be inlined. */
2191 static inline bool
2192 gimple_call_cannot_inline_p (gimple s)
2194 GIMPLE_CHECK (s, GIMPLE_CALL);
2195 return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0;
2199 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2200 slot optimization. This transformation uses the target of the call
2201 expansion as the return slot for calls that return in memory. */
2203 static inline void
2204 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2206 GIMPLE_CHECK (s, GIMPLE_CALL);
2207 if (return_slot_opt_p)
2208 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2209 else
2210 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2214 /* Return true if S is marked for return slot optimization. */
2216 static inline bool
2217 gimple_call_return_slot_opt_p (gimple s)
2219 GIMPLE_CHECK (s, GIMPLE_CALL);
2220 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2224 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2225 thunk to the thunked-to function. */
2227 static inline void
2228 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2230 GIMPLE_CHECK (s, GIMPLE_CALL);
2231 if (from_thunk_p)
2232 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2233 else
2234 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2238 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2240 static inline bool
2241 gimple_call_from_thunk_p (gimple s)
2243 GIMPLE_CHECK (s, GIMPLE_CALL);
2244 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2248 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2249 argument pack in its argument list. */
2251 static inline void
2252 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2254 GIMPLE_CHECK (s, GIMPLE_CALL);
2255 if (pass_arg_pack_p)
2256 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2257 else
2258 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2262 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2263 argument pack in its argument list. */
2265 static inline bool
2266 gimple_call_va_arg_pack_p (gimple s)
2268 GIMPLE_CHECK (s, GIMPLE_CALL);
2269 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2273 /* Return true if S is a noreturn call. */
2275 static inline bool
2276 gimple_call_noreturn_p (gimple s)
2278 GIMPLE_CHECK (s, GIMPLE_CALL);
2279 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2283 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2284 even if the called function can throw in other cases. */
2286 static inline void
2287 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2289 GIMPLE_CHECK (s, GIMPLE_CALL);
2290 if (nothrow_p)
2291 s->gsbase.subcode |= GF_CALL_NOTHROW;
2292 else
2293 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2296 /* Return true if S is a nothrow call. */
2298 static inline bool
2299 gimple_call_nothrow_p (gimple s)
2301 GIMPLE_CHECK (s, GIMPLE_CALL);
2302 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2306 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2308 static inline void
2309 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2311 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2312 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2313 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2317 /* Return a pointer to the points-to solution for the set of call-used
2318 variables of the call CALL. */
2320 static inline struct pt_solution *
2321 gimple_call_use_set (gimple call)
2323 GIMPLE_CHECK (call, GIMPLE_CALL);
2324 return &call->gimple_call.call_used;
2328 /* Return a pointer to the points-to solution for the set of call-used
2329 variables of the call CALL. */
2331 static inline struct pt_solution *
2332 gimple_call_clobber_set (gimple call)
2334 GIMPLE_CHECK (call, GIMPLE_CALL);
2335 return &call->gimple_call.call_clobbered;
2339 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2340 non-NULL lhs. */
2342 static inline bool
2343 gimple_has_lhs (gimple stmt)
2345 return (is_gimple_assign (stmt)
2346 || (is_gimple_call (stmt)
2347 && gimple_call_lhs (stmt) != NULL_TREE));
2351 /* Return the code of the predicate computed by conditional statement GS. */
2353 static inline enum tree_code
2354 gimple_cond_code (const_gimple gs)
2356 GIMPLE_CHECK (gs, GIMPLE_COND);
2357 return (enum tree_code) gs->gsbase.subcode;
2361 /* Set CODE to be the predicate code for the conditional statement GS. */
2363 static inline void
2364 gimple_cond_set_code (gimple gs, enum tree_code code)
2366 GIMPLE_CHECK (gs, GIMPLE_COND);
2367 gs->gsbase.subcode = code;
2371 /* Return the LHS of the predicate computed by conditional statement GS. */
2373 static inline tree
2374 gimple_cond_lhs (const_gimple gs)
2376 GIMPLE_CHECK (gs, GIMPLE_COND);
2377 return gimple_op (gs, 0);
2380 /* Return the pointer to the LHS of the predicate computed by conditional
2381 statement GS. */
2383 static inline tree *
2384 gimple_cond_lhs_ptr (const_gimple gs)
2386 GIMPLE_CHECK (gs, GIMPLE_COND);
2387 return gimple_op_ptr (gs, 0);
2390 /* Set LHS to be the LHS operand of the predicate computed by
2391 conditional statement GS. */
2393 static inline void
2394 gimple_cond_set_lhs (gimple gs, tree lhs)
2396 GIMPLE_CHECK (gs, GIMPLE_COND);
2397 gimple_set_op (gs, 0, lhs);
2401 /* Return the RHS operand of the predicate computed by conditional GS. */
2403 static inline tree
2404 gimple_cond_rhs (const_gimple gs)
2406 GIMPLE_CHECK (gs, GIMPLE_COND);
2407 return gimple_op (gs, 1);
2410 /* Return the pointer to the RHS operand of the predicate computed by
2411 conditional GS. */
2413 static inline tree *
2414 gimple_cond_rhs_ptr (const_gimple gs)
2416 GIMPLE_CHECK (gs, GIMPLE_COND);
2417 return gimple_op_ptr (gs, 1);
2421 /* Set RHS to be the RHS operand of the predicate computed by
2422 conditional statement GS. */
2424 static inline void
2425 gimple_cond_set_rhs (gimple gs, tree rhs)
2427 GIMPLE_CHECK (gs, GIMPLE_COND);
2428 gimple_set_op (gs, 1, rhs);
2432 /* Return the label used by conditional statement GS when its
2433 predicate evaluates to true. */
2435 static inline tree
2436 gimple_cond_true_label (const_gimple gs)
2438 GIMPLE_CHECK (gs, GIMPLE_COND);
2439 return gimple_op (gs, 2);
2443 /* Set LABEL to be the label used by conditional statement GS when its
2444 predicate evaluates to true. */
2446 static inline void
2447 gimple_cond_set_true_label (gimple gs, tree label)
2449 GIMPLE_CHECK (gs, GIMPLE_COND);
2450 gimple_set_op (gs, 2, label);
2454 /* Set LABEL to be the label used by conditional statement GS when its
2455 predicate evaluates to false. */
2457 static inline void
2458 gimple_cond_set_false_label (gimple gs, tree label)
2460 GIMPLE_CHECK (gs, GIMPLE_COND);
2461 gimple_set_op (gs, 3, label);
2465 /* Return the label used by conditional statement GS when its
2466 predicate evaluates to false. */
2468 static inline tree
2469 gimple_cond_false_label (const_gimple gs)
2471 GIMPLE_CHECK (gs, GIMPLE_COND);
2472 return gimple_op (gs, 3);
2476 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2478 static inline void
2479 gimple_cond_make_false (gimple gs)
2481 gimple_cond_set_lhs (gs, boolean_true_node);
2482 gimple_cond_set_rhs (gs, boolean_false_node);
2483 gs->gsbase.subcode = EQ_EXPR;
2487 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2489 static inline void
2490 gimple_cond_make_true (gimple gs)
2492 gimple_cond_set_lhs (gs, boolean_true_node);
2493 gimple_cond_set_rhs (gs, boolean_true_node);
2494 gs->gsbase.subcode = EQ_EXPR;
2497 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2498 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2500 static inline bool
2501 gimple_cond_true_p (const_gimple gs)
2503 tree lhs = gimple_cond_lhs (gs);
2504 tree rhs = gimple_cond_rhs (gs);
2505 enum tree_code code = gimple_cond_code (gs);
2507 if (lhs != boolean_true_node && lhs != boolean_false_node)
2508 return false;
2510 if (rhs != boolean_true_node && rhs != boolean_false_node)
2511 return false;
2513 if (code == NE_EXPR && lhs != rhs)
2514 return true;
2516 if (code == EQ_EXPR && lhs == rhs)
2517 return true;
2519 return false;
2522 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2523 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2525 static inline bool
2526 gimple_cond_false_p (const_gimple gs)
2528 tree lhs = gimple_cond_lhs (gs);
2529 tree rhs = gimple_cond_rhs (gs);
2530 enum tree_code code = gimple_cond_code (gs);
2532 if (lhs != boolean_true_node && lhs != boolean_false_node)
2533 return false;
2535 if (rhs != boolean_true_node && rhs != boolean_false_node)
2536 return false;
2538 if (code == NE_EXPR && lhs == rhs)
2539 return true;
2541 if (code == EQ_EXPR && lhs != rhs)
2542 return true;
2544 return false;
2547 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2548 'if (var == 1)' */
2550 static inline bool
2551 gimple_cond_single_var_p (gimple gs)
2553 if (gimple_cond_code (gs) == NE_EXPR
2554 && gimple_cond_rhs (gs) == boolean_false_node)
2555 return true;
2557 if (gimple_cond_code (gs) == EQ_EXPR
2558 && gimple_cond_rhs (gs) == boolean_true_node)
2559 return true;
2561 return false;
2564 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2566 static inline void
2567 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2569 gimple_cond_set_code (stmt, code);
2570 gimple_cond_set_lhs (stmt, lhs);
2571 gimple_cond_set_rhs (stmt, rhs);
2574 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2576 static inline tree
2577 gimple_label_label (const_gimple gs)
2579 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2580 return gimple_op (gs, 0);
2584 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2585 GS. */
2587 static inline void
2588 gimple_label_set_label (gimple gs, tree label)
2590 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2591 gimple_set_op (gs, 0, label);
2595 /* Return the destination of the unconditional jump GS. */
2597 static inline tree
2598 gimple_goto_dest (const_gimple gs)
2600 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2601 return gimple_op (gs, 0);
2605 /* Set DEST to be the destination of the unconditonal jump GS. */
2607 static inline void
2608 gimple_goto_set_dest (gimple gs, tree dest)
2610 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2611 gimple_set_op (gs, 0, dest);
2615 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2617 static inline tree
2618 gimple_bind_vars (const_gimple gs)
2620 GIMPLE_CHECK (gs, GIMPLE_BIND);
2621 return gs->gimple_bind.vars;
2625 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2626 statement GS. */
2628 static inline void
2629 gimple_bind_set_vars (gimple gs, tree vars)
2631 GIMPLE_CHECK (gs, GIMPLE_BIND);
2632 gs->gimple_bind.vars = vars;
2636 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2637 statement GS. */
2639 static inline void
2640 gimple_bind_append_vars (gimple gs, tree vars)
2642 GIMPLE_CHECK (gs, GIMPLE_BIND);
2643 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2647 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2649 static inline gimple_seq
2650 gimple_bind_body (gimple gs)
2652 GIMPLE_CHECK (gs, GIMPLE_BIND);
2653 return gs->gimple_bind.body;
2657 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2658 statement GS. */
2660 static inline void
2661 gimple_bind_set_body (gimple gs, gimple_seq seq)
2663 GIMPLE_CHECK (gs, GIMPLE_BIND);
2664 gs->gimple_bind.body = seq;
2668 /* Append a statement to the end of a GIMPLE_BIND's body. */
2670 static inline void
2671 gimple_bind_add_stmt (gimple gs, gimple stmt)
2673 GIMPLE_CHECK (gs, GIMPLE_BIND);
2674 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2678 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2680 static inline void
2681 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2683 GIMPLE_CHECK (gs, GIMPLE_BIND);
2684 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2688 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2689 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2691 static inline tree
2692 gimple_bind_block (const_gimple gs)
2694 GIMPLE_CHECK (gs, GIMPLE_BIND);
2695 return gs->gimple_bind.block;
2699 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2700 statement GS. */
2702 static inline void
2703 gimple_bind_set_block (gimple gs, tree block)
2705 GIMPLE_CHECK (gs, GIMPLE_BIND);
2706 gcc_gimple_checking_assert (block == NULL_TREE
2707 || TREE_CODE (block) == BLOCK);
2708 gs->gimple_bind.block = block;
2712 /* Return the number of input operands for GIMPLE_ASM GS. */
2714 static inline unsigned
2715 gimple_asm_ninputs (const_gimple gs)
2717 GIMPLE_CHECK (gs, GIMPLE_ASM);
2718 return gs->gimple_asm.ni;
2722 /* Return the number of output operands for GIMPLE_ASM GS. */
2724 static inline unsigned
2725 gimple_asm_noutputs (const_gimple gs)
2727 GIMPLE_CHECK (gs, GIMPLE_ASM);
2728 return gs->gimple_asm.no;
2732 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2734 static inline unsigned
2735 gimple_asm_nclobbers (const_gimple gs)
2737 GIMPLE_CHECK (gs, GIMPLE_ASM);
2738 return gs->gimple_asm.nc;
2741 /* Return the number of label operands for GIMPLE_ASM GS. */
2743 static inline unsigned
2744 gimple_asm_nlabels (const_gimple gs)
2746 GIMPLE_CHECK (gs, GIMPLE_ASM);
2747 return gs->gimple_asm.nl;
2750 /* Return input operand INDEX of GIMPLE_ASM GS. */
2752 static inline tree
2753 gimple_asm_input_op (const_gimple gs, unsigned index)
2755 GIMPLE_CHECK (gs, GIMPLE_ASM);
2756 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2757 return gimple_op (gs, index);
2760 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2762 static inline tree *
2763 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2765 GIMPLE_CHECK (gs, GIMPLE_ASM);
2766 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2767 return gimple_op_ptr (gs, index);
2771 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2773 static inline void
2774 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2776 GIMPLE_CHECK (gs, GIMPLE_ASM);
2777 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
2778 && TREE_CODE (in_op) == TREE_LIST);
2779 gimple_set_op (gs, index, in_op);
2783 /* Return output operand INDEX of GIMPLE_ASM GS. */
2785 static inline tree
2786 gimple_asm_output_op (const_gimple gs, unsigned index)
2788 GIMPLE_CHECK (gs, GIMPLE_ASM);
2789 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2790 return gimple_op (gs, index + gs->gimple_asm.ni);
2793 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2795 static inline tree *
2796 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2798 GIMPLE_CHECK (gs, GIMPLE_ASM);
2799 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2800 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2804 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2806 static inline void
2807 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2809 GIMPLE_CHECK (gs, GIMPLE_ASM);
2810 gcc_gimple_checking_assert (index <= gs->gimple_asm.no
2811 && TREE_CODE (out_op) == TREE_LIST);
2812 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2816 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2818 static inline tree
2819 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2821 GIMPLE_CHECK (gs, GIMPLE_ASM);
2822 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
2823 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2827 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2829 static inline void
2830 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2832 GIMPLE_CHECK (gs, GIMPLE_ASM);
2833 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
2834 && TREE_CODE (clobber_op) == TREE_LIST);
2835 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2838 /* Return label operand INDEX of GIMPLE_ASM GS. */
2840 static inline tree
2841 gimple_asm_label_op (const_gimple gs, unsigned index)
2843 GIMPLE_CHECK (gs, GIMPLE_ASM);
2844 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
2845 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
2848 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
2850 static inline void
2851 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
2853 GIMPLE_CHECK (gs, GIMPLE_ASM);
2854 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
2855 && TREE_CODE (label_op) == TREE_LIST);
2856 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
2859 /* Return the string representing the assembly instruction in
2860 GIMPLE_ASM GS. */
2862 static inline const char *
2863 gimple_asm_string (const_gimple gs)
2865 GIMPLE_CHECK (gs, GIMPLE_ASM);
2866 return gs->gimple_asm.string;
2870 /* Return true if GS is an asm statement marked volatile. */
2872 static inline bool
2873 gimple_asm_volatile_p (const_gimple gs)
2875 GIMPLE_CHECK (gs, GIMPLE_ASM);
2876 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
2880 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
2882 static inline void
2883 gimple_asm_set_volatile (gimple gs, bool volatile_p)
2885 GIMPLE_CHECK (gs, GIMPLE_ASM);
2886 if (volatile_p)
2887 gs->gsbase.subcode |= GF_ASM_VOLATILE;
2888 else
2889 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
2893 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
2895 static inline void
2896 gimple_asm_set_input (gimple gs, bool input_p)
2898 GIMPLE_CHECK (gs, GIMPLE_ASM);
2899 if (input_p)
2900 gs->gsbase.subcode |= GF_ASM_INPUT;
2901 else
2902 gs->gsbase.subcode &= ~GF_ASM_INPUT;
2906 /* Return true if asm GS is an ASM_INPUT. */
2908 static inline bool
2909 gimple_asm_input_p (const_gimple gs)
2911 GIMPLE_CHECK (gs, GIMPLE_ASM);
2912 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
2916 /* Return the types handled by GIMPLE_CATCH statement GS. */
2918 static inline tree
2919 gimple_catch_types (const_gimple gs)
2921 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2922 return gs->gimple_catch.types;
2926 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
2928 static inline tree *
2929 gimple_catch_types_ptr (gimple gs)
2931 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2932 return &gs->gimple_catch.types;
2936 /* Return the GIMPLE sequence representing the body of the handler of
2937 GIMPLE_CATCH statement GS. */
2939 static inline gimple_seq
2940 gimple_catch_handler (gimple gs)
2942 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2943 return gs->gimple_catch.handler;
2947 /* Return a pointer to the GIMPLE sequence representing the body of
2948 the handler of GIMPLE_CATCH statement GS. */
2950 static inline gimple_seq *
2951 gimple_catch_handler_ptr (gimple gs)
2953 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2954 return &gs->gimple_catch.handler;
2958 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
2960 static inline void
2961 gimple_catch_set_types (gimple gs, tree t)
2963 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2964 gs->gimple_catch.types = t;
2968 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
2970 static inline void
2971 gimple_catch_set_handler (gimple gs, gimple_seq handler)
2973 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2974 gs->gimple_catch.handler = handler;
2978 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
2980 static inline tree
2981 gimple_eh_filter_types (const_gimple gs)
2983 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2984 return gs->gimple_eh_filter.types;
2988 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
2989 GS. */
2991 static inline tree *
2992 gimple_eh_filter_types_ptr (gimple gs)
2994 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2995 return &gs->gimple_eh_filter.types;
2999 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3000 statement fails. */
3002 static inline gimple_seq
3003 gimple_eh_filter_failure (gimple gs)
3005 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3006 return gs->gimple_eh_filter.failure;
3010 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3012 static inline void
3013 gimple_eh_filter_set_types (gimple gs, tree types)
3015 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3016 gs->gimple_eh_filter.types = types;
3020 /* Set FAILURE to be the sequence of statements to execute on failure
3021 for GIMPLE_EH_FILTER GS. */
3023 static inline void
3024 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3026 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3027 gs->gimple_eh_filter.failure = failure;
3030 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3032 static inline tree
3033 gimple_eh_must_not_throw_fndecl (gimple gs)
3035 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3036 return gs->gimple_eh_mnt.fndecl;
3039 /* Set the function decl to be called by GS to DECL. */
3041 static inline void
3042 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3044 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3045 gs->gimple_eh_mnt.fndecl = decl;
3049 /* GIMPLE_TRY accessors. */
3051 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3052 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3054 static inline enum gimple_try_flags
3055 gimple_try_kind (const_gimple gs)
3057 GIMPLE_CHECK (gs, GIMPLE_TRY);
3058 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3062 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3064 static inline void
3065 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3067 GIMPLE_CHECK (gs, GIMPLE_TRY);
3068 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3069 || kind == GIMPLE_TRY_FINALLY);
3070 if (gimple_try_kind (gs) != kind)
3071 gs->gsbase.subcode = (unsigned int) kind;
3075 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3077 static inline bool
3078 gimple_try_catch_is_cleanup (const_gimple gs)
3080 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3081 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3085 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3087 static inline gimple_seq
3088 gimple_try_eval (gimple gs)
3090 GIMPLE_CHECK (gs, GIMPLE_TRY);
3091 return gs->gimple_try.eval;
3095 /* Return the sequence of statements used as the cleanup body for
3096 GIMPLE_TRY GS. */
3098 static inline gimple_seq
3099 gimple_try_cleanup (gimple gs)
3101 GIMPLE_CHECK (gs, GIMPLE_TRY);
3102 return gs->gimple_try.cleanup;
3106 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3108 static inline void
3109 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3111 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3112 if (catch_is_cleanup)
3113 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3114 else
3115 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3119 /* Set EVAL to be the sequence of statements to use as the body for
3120 GIMPLE_TRY GS. */
3122 static inline void
3123 gimple_try_set_eval (gimple gs, gimple_seq eval)
3125 GIMPLE_CHECK (gs, GIMPLE_TRY);
3126 gs->gimple_try.eval = eval;
3130 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3131 body for GIMPLE_TRY GS. */
3133 static inline void
3134 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3136 GIMPLE_CHECK (gs, GIMPLE_TRY);
3137 gs->gimple_try.cleanup = cleanup;
3141 /* Return the cleanup sequence for cleanup statement GS. */
3143 static inline gimple_seq
3144 gimple_wce_cleanup (gimple gs)
3146 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3147 return gs->gimple_wce.cleanup;
3151 /* Set CLEANUP to be the cleanup sequence for GS. */
3153 static inline void
3154 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3156 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3157 gs->gimple_wce.cleanup = cleanup;
3161 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3163 static inline bool
3164 gimple_wce_cleanup_eh_only (const_gimple gs)
3166 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3167 return gs->gsbase.subcode != 0;
3171 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3173 static inline void
3174 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3176 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3177 gs->gsbase.subcode = (unsigned int) eh_only_p;
3181 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3183 static inline unsigned
3184 gimple_phi_capacity (const_gimple gs)
3186 GIMPLE_CHECK (gs, GIMPLE_PHI);
3187 return gs->gimple_phi.capacity;
3191 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3192 be exactly the number of incoming edges for the basic block holding
3193 GS. */
3195 static inline unsigned
3196 gimple_phi_num_args (const_gimple gs)
3198 GIMPLE_CHECK (gs, GIMPLE_PHI);
3199 return gs->gimple_phi.nargs;
3203 /* Return the SSA name created by GIMPLE_PHI GS. */
3205 static inline tree
3206 gimple_phi_result (const_gimple gs)
3208 GIMPLE_CHECK (gs, GIMPLE_PHI);
3209 return gs->gimple_phi.result;
3212 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3214 static inline tree *
3215 gimple_phi_result_ptr (gimple gs)
3217 GIMPLE_CHECK (gs, GIMPLE_PHI);
3218 return &gs->gimple_phi.result;
3221 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3223 static inline void
3224 gimple_phi_set_result (gimple gs, tree result)
3226 GIMPLE_CHECK (gs, GIMPLE_PHI);
3227 gs->gimple_phi.result = result;
3231 /* Return the PHI argument corresponding to incoming edge INDEX for
3232 GIMPLE_PHI GS. */
3234 static inline struct phi_arg_d *
3235 gimple_phi_arg (gimple gs, unsigned index)
3237 GIMPLE_CHECK (gs, GIMPLE_PHI);
3238 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3239 return &(gs->gimple_phi.args[index]);
3242 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3243 for GIMPLE_PHI GS. */
3245 static inline void
3246 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3248 GIMPLE_CHECK (gs, GIMPLE_PHI);
3249 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3250 gs->gimple_phi.args[index] = *phiarg;
3253 /* Return the region number for GIMPLE_RESX GS. */
3255 static inline int
3256 gimple_resx_region (const_gimple gs)
3258 GIMPLE_CHECK (gs, GIMPLE_RESX);
3259 return gs->gimple_eh_ctrl.region;
3262 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3264 static inline void
3265 gimple_resx_set_region (gimple gs, int region)
3267 GIMPLE_CHECK (gs, GIMPLE_RESX);
3268 gs->gimple_eh_ctrl.region = region;
3271 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3273 static inline int
3274 gimple_eh_dispatch_region (const_gimple gs)
3276 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3277 return gs->gimple_eh_ctrl.region;
3280 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3282 static inline void
3283 gimple_eh_dispatch_set_region (gimple gs, int region)
3285 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3286 gs->gimple_eh_ctrl.region = region;
3289 /* Return the number of labels associated with the switch statement GS. */
3291 static inline unsigned
3292 gimple_switch_num_labels (const_gimple gs)
3294 unsigned num_ops;
3295 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3296 num_ops = gimple_num_ops (gs);
3297 gcc_gimple_checking_assert (num_ops > 1);
3298 return num_ops - 1;
3302 /* Set NLABELS to be the number of labels for the switch statement GS. */
3304 static inline void
3305 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3307 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3308 gimple_set_num_ops (g, nlabels + 1);
3312 /* Return the index variable used by the switch statement GS. */
3314 static inline tree
3315 gimple_switch_index (const_gimple gs)
3317 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3318 return gimple_op (gs, 0);
3322 /* Return a pointer to the index variable for the switch statement GS. */
3324 static inline tree *
3325 gimple_switch_index_ptr (const_gimple gs)
3327 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3328 return gimple_op_ptr (gs, 0);
3332 /* Set INDEX to be the index variable for switch statement GS. */
3334 static inline void
3335 gimple_switch_set_index (gimple gs, tree index)
3337 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3338 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3339 gimple_set_op (gs, 0, index);
3343 /* Return the label numbered INDEX. The default label is 0, followed by any
3344 labels in a switch statement. */
3346 static inline tree
3347 gimple_switch_label (const_gimple gs, unsigned index)
3349 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3350 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3351 return gimple_op (gs, index + 1);
3354 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3356 static inline void
3357 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3359 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3360 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3361 && (label == NULL_TREE
3362 || TREE_CODE (label) == CASE_LABEL_EXPR));
3363 gimple_set_op (gs, index + 1, label);
3366 /* Return the default label for a switch statement. */
3368 static inline tree
3369 gimple_switch_default_label (const_gimple gs)
3371 return gimple_switch_label (gs, 0);
3374 /* Set the default label for a switch statement. */
3376 static inline void
3377 gimple_switch_set_default_label (gimple gs, tree label)
3379 gimple_switch_set_label (gs, 0, label);
3382 /* Return true if GS is a GIMPLE_DEBUG statement. */
3384 static inline bool
3385 is_gimple_debug (const_gimple gs)
3387 return gimple_code (gs) == GIMPLE_DEBUG;
3390 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3392 static inline bool
3393 gimple_debug_bind_p (const_gimple s)
3395 if (is_gimple_debug (s))
3396 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3398 return false;
3401 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3403 static inline tree
3404 gimple_debug_bind_get_var (gimple dbg)
3406 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3407 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3408 return gimple_op (dbg, 0);
3411 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3412 statement. */
3414 static inline tree
3415 gimple_debug_bind_get_value (gimple dbg)
3417 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3418 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3419 return gimple_op (dbg, 1);
3422 /* Return a pointer to the value bound to the variable in a
3423 GIMPLE_DEBUG bind statement. */
3425 static inline tree *
3426 gimple_debug_bind_get_value_ptr (gimple dbg)
3428 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3429 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3430 return gimple_op_ptr (dbg, 1);
3433 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3435 static inline void
3436 gimple_debug_bind_set_var (gimple dbg, tree var)
3438 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3439 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3440 gimple_set_op (dbg, 0, var);
3443 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3444 statement. */
3446 static inline void
3447 gimple_debug_bind_set_value (gimple dbg, tree value)
3449 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3450 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3451 gimple_set_op (dbg, 1, value);
3454 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3455 optimized away. */
3456 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3458 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3459 statement. */
3461 static inline void
3462 gimple_debug_bind_reset_value (gimple dbg)
3464 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3465 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3466 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3469 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3470 value. */
3472 static inline bool
3473 gimple_debug_bind_has_value_p (gimple dbg)
3475 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3476 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3477 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3480 #undef GIMPLE_DEBUG_BIND_NOVALUE
3482 /* Return the body for the OMP statement GS. */
3484 static inline gimple_seq
3485 gimple_omp_body (gimple gs)
3487 return gs->omp.body;
3490 /* Set BODY to be the body for the OMP statement GS. */
3492 static inline void
3493 gimple_omp_set_body (gimple gs, gimple_seq body)
3495 gs->omp.body = body;
3499 /* Return the name associated with OMP_CRITICAL statement GS. */
3501 static inline tree
3502 gimple_omp_critical_name (const_gimple gs)
3504 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3505 return gs->gimple_omp_critical.name;
3509 /* Return a pointer to the name associated with OMP critical statement GS. */
3511 static inline tree *
3512 gimple_omp_critical_name_ptr (gimple gs)
3514 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3515 return &gs->gimple_omp_critical.name;
3519 /* Set NAME to be the name associated with OMP critical statement GS. */
3521 static inline void
3522 gimple_omp_critical_set_name (gimple gs, tree name)
3524 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3525 gs->gimple_omp_critical.name = name;
3529 /* Return the clauses associated with OMP_FOR GS. */
3531 static inline tree
3532 gimple_omp_for_clauses (const_gimple gs)
3534 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3535 return gs->gimple_omp_for.clauses;
3539 /* Return a pointer to the OMP_FOR GS. */
3541 static inline tree *
3542 gimple_omp_for_clauses_ptr (gimple gs)
3544 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3545 return &gs->gimple_omp_for.clauses;
3549 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3551 static inline void
3552 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3554 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3555 gs->gimple_omp_for.clauses = clauses;
3559 /* Get the collapse count of OMP_FOR GS. */
3561 static inline size_t
3562 gimple_omp_for_collapse (gimple gs)
3564 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3565 return gs->gimple_omp_for.collapse;
3569 /* Return the index variable for OMP_FOR GS. */
3571 static inline tree
3572 gimple_omp_for_index (const_gimple gs, size_t i)
3574 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3575 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3576 return gs->gimple_omp_for.iter[i].index;
3580 /* Return a pointer to the index variable for OMP_FOR GS. */
3582 static inline tree *
3583 gimple_omp_for_index_ptr (gimple gs, size_t i)
3585 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3586 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3587 return &gs->gimple_omp_for.iter[i].index;
3591 /* Set INDEX to be the index variable for OMP_FOR GS. */
3593 static inline void
3594 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3596 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3597 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3598 gs->gimple_omp_for.iter[i].index = index;
3602 /* Return the initial value for OMP_FOR GS. */
3604 static inline tree
3605 gimple_omp_for_initial (const_gimple gs, size_t i)
3607 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3608 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3609 return gs->gimple_omp_for.iter[i].initial;
3613 /* Return a pointer to the initial value for OMP_FOR GS. */
3615 static inline tree *
3616 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3618 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3619 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3620 return &gs->gimple_omp_for.iter[i].initial;
3624 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3626 static inline void
3627 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3629 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3630 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3631 gs->gimple_omp_for.iter[i].initial = initial;
3635 /* Return the final value for OMP_FOR GS. */
3637 static inline tree
3638 gimple_omp_for_final (const_gimple gs, size_t i)
3640 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3641 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3642 return gs->gimple_omp_for.iter[i].final;
3646 /* Return a pointer to the final value for OMP_FOR GS. */
3648 static inline tree *
3649 gimple_omp_for_final_ptr (gimple gs, size_t i)
3651 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3652 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3653 return &gs->gimple_omp_for.iter[i].final;
3657 /* Set FINAL to be the final value for OMP_FOR GS. */
3659 static inline void
3660 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3662 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3663 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3664 gs->gimple_omp_for.iter[i].final = final;
3668 /* Return the increment value for OMP_FOR GS. */
3670 static inline tree
3671 gimple_omp_for_incr (const_gimple gs, size_t i)
3673 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3674 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3675 return gs->gimple_omp_for.iter[i].incr;
3679 /* Return a pointer to the increment value for OMP_FOR GS. */
3681 static inline tree *
3682 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3684 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3685 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3686 return &gs->gimple_omp_for.iter[i].incr;
3690 /* Set INCR to be the increment value for OMP_FOR GS. */
3692 static inline void
3693 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3695 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3696 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3697 gs->gimple_omp_for.iter[i].incr = incr;
3701 /* Return the sequence of statements to execute before the OMP_FOR
3702 statement GS starts. */
3704 static inline gimple_seq
3705 gimple_omp_for_pre_body (gimple gs)
3707 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3708 return gs->gimple_omp_for.pre_body;
3712 /* Set PRE_BODY to be the sequence of statements to execute before the
3713 OMP_FOR statement GS starts. */
3715 static inline void
3716 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3718 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3719 gs->gimple_omp_for.pre_body = pre_body;
3723 /* Return the clauses associated with OMP_PARALLEL GS. */
3725 static inline tree
3726 gimple_omp_parallel_clauses (const_gimple gs)
3728 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3729 return gs->gimple_omp_parallel.clauses;
3733 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3735 static inline tree *
3736 gimple_omp_parallel_clauses_ptr (gimple gs)
3738 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3739 return &gs->gimple_omp_parallel.clauses;
3743 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
3744 GS. */
3746 static inline void
3747 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
3749 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3750 gs->gimple_omp_parallel.clauses = clauses;
3754 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
3756 static inline tree
3757 gimple_omp_parallel_child_fn (const_gimple gs)
3759 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3760 return gs->gimple_omp_parallel.child_fn;
3763 /* Return a pointer to the child function used to hold the body of
3764 OMP_PARALLEL GS. */
3766 static inline tree *
3767 gimple_omp_parallel_child_fn_ptr (gimple gs)
3769 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3770 return &gs->gimple_omp_parallel.child_fn;
3774 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
3776 static inline void
3777 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
3779 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3780 gs->gimple_omp_parallel.child_fn = child_fn;
3784 /* Return the artificial argument used to send variables and values
3785 from the parent to the children threads in OMP_PARALLEL GS. */
3787 static inline tree
3788 gimple_omp_parallel_data_arg (const_gimple gs)
3790 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3791 return gs->gimple_omp_parallel.data_arg;
3795 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
3797 static inline tree *
3798 gimple_omp_parallel_data_arg_ptr (gimple gs)
3800 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3801 return &gs->gimple_omp_parallel.data_arg;
3805 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
3807 static inline void
3808 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
3810 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3811 gs->gimple_omp_parallel.data_arg = data_arg;
3815 /* Return the clauses associated with OMP_TASK GS. */
3817 static inline tree
3818 gimple_omp_task_clauses (const_gimple gs)
3820 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3821 return gs->gimple_omp_parallel.clauses;
3825 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3827 static inline tree *
3828 gimple_omp_task_clauses_ptr (gimple gs)
3830 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3831 return &gs->gimple_omp_parallel.clauses;
3835 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3836 GS. */
3838 static inline void
3839 gimple_omp_task_set_clauses (gimple gs, tree clauses)
3841 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3842 gs->gimple_omp_parallel.clauses = clauses;
3846 /* Return the child function used to hold the body of OMP_TASK GS. */
3848 static inline tree
3849 gimple_omp_task_child_fn (const_gimple gs)
3851 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3852 return gs->gimple_omp_parallel.child_fn;
3855 /* Return a pointer to the child function used to hold the body of
3856 OMP_TASK GS. */
3858 static inline tree *
3859 gimple_omp_task_child_fn_ptr (gimple gs)
3861 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3862 return &gs->gimple_omp_parallel.child_fn;
3866 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3868 static inline void
3869 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
3871 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3872 gs->gimple_omp_parallel.child_fn = child_fn;
3876 /* Return the artificial argument used to send variables and values
3877 from the parent to the children threads in OMP_TASK GS. */
3879 static inline tree
3880 gimple_omp_task_data_arg (const_gimple gs)
3882 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3883 return gs->gimple_omp_parallel.data_arg;
3887 /* Return a pointer to the data argument for OMP_TASK GS. */
3889 static inline tree *
3890 gimple_omp_task_data_arg_ptr (gimple gs)
3892 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3893 return &gs->gimple_omp_parallel.data_arg;
3897 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3899 static inline void
3900 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
3902 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3903 gs->gimple_omp_parallel.data_arg = data_arg;
3907 /* Return the clauses associated with OMP_TASK GS. */
3909 static inline tree
3910 gimple_omp_taskreg_clauses (const_gimple gs)
3912 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3913 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3914 return gs->gimple_omp_parallel.clauses;
3918 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3920 static inline tree *
3921 gimple_omp_taskreg_clauses_ptr (gimple gs)
3923 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3924 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3925 return &gs->gimple_omp_parallel.clauses;
3929 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3930 GS. */
3932 static inline void
3933 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
3935 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3936 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3937 gs->gimple_omp_parallel.clauses = clauses;
3941 /* Return the child function used to hold the body of OMP_TASK GS. */
3943 static inline tree
3944 gimple_omp_taskreg_child_fn (const_gimple gs)
3946 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3947 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3948 return gs->gimple_omp_parallel.child_fn;
3951 /* Return a pointer to the child function used to hold the body of
3952 OMP_TASK GS. */
3954 static inline tree *
3955 gimple_omp_taskreg_child_fn_ptr (gimple gs)
3957 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3958 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3959 return &gs->gimple_omp_parallel.child_fn;
3963 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3965 static inline void
3966 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
3968 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3969 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3970 gs->gimple_omp_parallel.child_fn = child_fn;
3974 /* Return the artificial argument used to send variables and values
3975 from the parent to the children threads in OMP_TASK GS. */
3977 static inline tree
3978 gimple_omp_taskreg_data_arg (const_gimple gs)
3980 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3981 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3982 return gs->gimple_omp_parallel.data_arg;
3986 /* Return a pointer to the data argument for OMP_TASK GS. */
3988 static inline tree *
3989 gimple_omp_taskreg_data_arg_ptr (gimple gs)
3991 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3992 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3993 return &gs->gimple_omp_parallel.data_arg;
3997 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3999 static inline void
4000 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4002 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4003 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4004 gs->gimple_omp_parallel.data_arg = data_arg;
4008 /* Return the copy function used to hold the body of OMP_TASK GS. */
4010 static inline tree
4011 gimple_omp_task_copy_fn (const_gimple gs)
4013 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4014 return gs->gimple_omp_task.copy_fn;
4017 /* Return a pointer to the copy function used to hold the body of
4018 OMP_TASK GS. */
4020 static inline tree *
4021 gimple_omp_task_copy_fn_ptr (gimple gs)
4023 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4024 return &gs->gimple_omp_task.copy_fn;
4028 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4030 static inline void
4031 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4033 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4034 gs->gimple_omp_task.copy_fn = copy_fn;
4038 /* Return size of the data block in bytes in OMP_TASK GS. */
4040 static inline tree
4041 gimple_omp_task_arg_size (const_gimple gs)
4043 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4044 return gs->gimple_omp_task.arg_size;
4048 /* Return a pointer to the data block size for OMP_TASK GS. */
4050 static inline tree *
4051 gimple_omp_task_arg_size_ptr (gimple gs)
4053 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4054 return &gs->gimple_omp_task.arg_size;
4058 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4060 static inline void
4061 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4063 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4064 gs->gimple_omp_task.arg_size = arg_size;
4068 /* Return align of the data block in bytes in OMP_TASK GS. */
4070 static inline tree
4071 gimple_omp_task_arg_align (const_gimple gs)
4073 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4074 return gs->gimple_omp_task.arg_align;
4078 /* Return a pointer to the data block align for OMP_TASK GS. */
4080 static inline tree *
4081 gimple_omp_task_arg_align_ptr (gimple gs)
4083 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4084 return &gs->gimple_omp_task.arg_align;
4088 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4090 static inline void
4091 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4093 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4094 gs->gimple_omp_task.arg_align = arg_align;
4098 /* Return the clauses associated with OMP_SINGLE GS. */
4100 static inline tree
4101 gimple_omp_single_clauses (const_gimple gs)
4103 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4104 return gs->gimple_omp_single.clauses;
4108 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4110 static inline tree *
4111 gimple_omp_single_clauses_ptr (gimple gs)
4113 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4114 return &gs->gimple_omp_single.clauses;
4118 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4120 static inline void
4121 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4123 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4124 gs->gimple_omp_single.clauses = clauses;
4128 /* Return the clauses associated with OMP_SECTIONS GS. */
4130 static inline tree
4131 gimple_omp_sections_clauses (const_gimple gs)
4133 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4134 return gs->gimple_omp_sections.clauses;
4138 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4140 static inline tree *
4141 gimple_omp_sections_clauses_ptr (gimple gs)
4143 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4144 return &gs->gimple_omp_sections.clauses;
4148 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4149 GS. */
4151 static inline void
4152 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4154 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4155 gs->gimple_omp_sections.clauses = clauses;
4159 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4160 in GS. */
4162 static inline tree
4163 gimple_omp_sections_control (const_gimple gs)
4165 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4166 return gs->gimple_omp_sections.control;
4170 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4171 GS. */
4173 static inline tree *
4174 gimple_omp_sections_control_ptr (gimple gs)
4176 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4177 return &gs->gimple_omp_sections.control;
4181 /* Set CONTROL to be the set of clauses associated with the
4182 GIMPLE_OMP_SECTIONS in GS. */
4184 static inline void
4185 gimple_omp_sections_set_control (gimple gs, tree control)
4187 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4188 gs->gimple_omp_sections.control = control;
4192 /* Set COND to be the condition code for OMP_FOR GS. */
4194 static inline void
4195 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4197 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4198 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4199 && i < gs->gimple_omp_for.collapse);
4200 gs->gimple_omp_for.iter[i].cond = cond;
4204 /* Return the condition code associated with OMP_FOR GS. */
4206 static inline enum tree_code
4207 gimple_omp_for_cond (const_gimple gs, size_t i)
4209 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4210 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4211 return gs->gimple_omp_for.iter[i].cond;
4215 /* Set the value being stored in an atomic store. */
4217 static inline void
4218 gimple_omp_atomic_store_set_val (gimple g, tree val)
4220 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4221 g->gimple_omp_atomic_store.val = val;
4225 /* Return the value being stored in an atomic store. */
4227 static inline tree
4228 gimple_omp_atomic_store_val (const_gimple g)
4230 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4231 return g->gimple_omp_atomic_store.val;
4235 /* Return a pointer to the value being stored in an atomic store. */
4237 static inline tree *
4238 gimple_omp_atomic_store_val_ptr (gimple g)
4240 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4241 return &g->gimple_omp_atomic_store.val;
4245 /* Set the LHS of an atomic load. */
4247 static inline void
4248 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4250 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4251 g->gimple_omp_atomic_load.lhs = lhs;
4255 /* Get the LHS of an atomic load. */
4257 static inline tree
4258 gimple_omp_atomic_load_lhs (const_gimple g)
4260 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4261 return g->gimple_omp_atomic_load.lhs;
4265 /* Return a pointer to the LHS of an atomic load. */
4267 static inline tree *
4268 gimple_omp_atomic_load_lhs_ptr (gimple g)
4270 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4271 return &g->gimple_omp_atomic_load.lhs;
4275 /* Set the RHS of an atomic load. */
4277 static inline void
4278 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4280 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4281 g->gimple_omp_atomic_load.rhs = rhs;
4285 /* Get the RHS of an atomic load. */
4287 static inline tree
4288 gimple_omp_atomic_load_rhs (const_gimple g)
4290 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4291 return g->gimple_omp_atomic_load.rhs;
4295 /* Return a pointer to the RHS of an atomic load. */
4297 static inline tree *
4298 gimple_omp_atomic_load_rhs_ptr (gimple g)
4300 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4301 return &g->gimple_omp_atomic_load.rhs;
4305 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4307 static inline tree
4308 gimple_omp_continue_control_def (const_gimple g)
4310 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4311 return g->gimple_omp_continue.control_def;
4314 /* The same as above, but return the address. */
4316 static inline tree *
4317 gimple_omp_continue_control_def_ptr (gimple g)
4319 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4320 return &g->gimple_omp_continue.control_def;
4323 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4325 static inline void
4326 gimple_omp_continue_set_control_def (gimple g, tree def)
4328 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4329 g->gimple_omp_continue.control_def = def;
4333 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4335 static inline tree
4336 gimple_omp_continue_control_use (const_gimple g)
4338 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4339 return g->gimple_omp_continue.control_use;
4343 /* The same as above, but return the address. */
4345 static inline tree *
4346 gimple_omp_continue_control_use_ptr (gimple g)
4348 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4349 return &g->gimple_omp_continue.control_use;
4353 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4355 static inline void
4356 gimple_omp_continue_set_control_use (gimple g, tree use)
4358 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4359 g->gimple_omp_continue.control_use = use;
4363 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4365 static inline tree *
4366 gimple_return_retval_ptr (const_gimple gs)
4368 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4369 return gimple_op_ptr (gs, 0);
4372 /* Return the return value for GIMPLE_RETURN GS. */
4374 static inline tree
4375 gimple_return_retval (const_gimple gs)
4377 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4378 return gimple_op (gs, 0);
4382 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4384 static inline void
4385 gimple_return_set_retval (gimple gs, tree retval)
4387 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4388 gimple_set_op (gs, 0, retval);
4392 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4394 #define CASE_GIMPLE_OMP \
4395 case GIMPLE_OMP_PARALLEL: \
4396 case GIMPLE_OMP_TASK: \
4397 case GIMPLE_OMP_FOR: \
4398 case GIMPLE_OMP_SECTIONS: \
4399 case GIMPLE_OMP_SECTIONS_SWITCH: \
4400 case GIMPLE_OMP_SINGLE: \
4401 case GIMPLE_OMP_SECTION: \
4402 case GIMPLE_OMP_MASTER: \
4403 case GIMPLE_OMP_ORDERED: \
4404 case GIMPLE_OMP_CRITICAL: \
4405 case GIMPLE_OMP_RETURN: \
4406 case GIMPLE_OMP_ATOMIC_LOAD: \
4407 case GIMPLE_OMP_ATOMIC_STORE: \
4408 case GIMPLE_OMP_CONTINUE
4410 static inline bool
4411 is_gimple_omp (const_gimple stmt)
4413 switch (gimple_code (stmt))
4415 CASE_GIMPLE_OMP:
4416 return true;
4417 default:
4418 return false;
4423 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4425 static inline bool
4426 gimple_nop_p (const_gimple g)
4428 return gimple_code (g) == GIMPLE_NOP;
4432 /* Return true if GS is a GIMPLE_RESX. */
4434 static inline bool
4435 is_gimple_resx (const_gimple gs)
4437 return gimple_code (gs) == GIMPLE_RESX;
4440 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4442 static inline enum br_predictor
4443 gimple_predict_predictor (gimple gs)
4445 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4446 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4450 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4452 static inline void
4453 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4455 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4456 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4457 | (unsigned) predictor;
4461 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4463 static inline enum prediction
4464 gimple_predict_outcome (gimple gs)
4466 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4467 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4471 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4473 static inline void
4474 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4476 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4477 if (outcome == TAKEN)
4478 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4479 else
4480 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4484 /* Return the type of the main expression computed by STMT. Return
4485 void_type_node if the statement computes nothing. */
4487 static inline tree
4488 gimple_expr_type (const_gimple stmt)
4490 enum gimple_code code = gimple_code (stmt);
4492 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4494 tree type;
4495 /* In general we want to pass out a type that can be substituted
4496 for both the RHS and the LHS types if there is a possibly
4497 useless conversion involved. That means returning the
4498 original RHS type as far as we can reconstruct it. */
4499 if (code == GIMPLE_CALL)
4500 type = gimple_call_return_type (stmt);
4501 else
4502 switch (gimple_assign_rhs_code (stmt))
4504 case POINTER_PLUS_EXPR:
4505 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4506 break;
4508 default:
4509 /* As fallback use the type of the LHS. */
4510 type = TREE_TYPE (gimple_get_lhs (stmt));
4511 break;
4513 return type;
4515 else if (code == GIMPLE_COND)
4516 return boolean_type_node;
4517 else
4518 return void_type_node;
4522 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4524 static inline gimple_stmt_iterator
4525 gsi_start (gimple_seq seq)
4527 gimple_stmt_iterator i;
4529 i.ptr = gimple_seq_first (seq);
4530 i.seq = seq;
4531 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4533 return i;
4537 /* Return a new iterator pointing to the first statement in basic block BB. */
4539 static inline gimple_stmt_iterator
4540 gsi_start_bb (basic_block bb)
4542 gimple_stmt_iterator i;
4543 gimple_seq seq;
4545 seq = bb_seq (bb);
4546 i.ptr = gimple_seq_first (seq);
4547 i.seq = seq;
4548 i.bb = bb;
4550 return i;
4554 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4556 static inline gimple_stmt_iterator
4557 gsi_last (gimple_seq seq)
4559 gimple_stmt_iterator i;
4561 i.ptr = gimple_seq_last (seq);
4562 i.seq = seq;
4563 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4565 return i;
4569 /* Return a new iterator pointing to the last statement in basic block BB. */
4571 static inline gimple_stmt_iterator
4572 gsi_last_bb (basic_block bb)
4574 gimple_stmt_iterator i;
4575 gimple_seq seq;
4577 seq = bb_seq (bb);
4578 i.ptr = gimple_seq_last (seq);
4579 i.seq = seq;
4580 i.bb = bb;
4582 return i;
4586 /* Return true if I is at the end of its sequence. */
4588 static inline bool
4589 gsi_end_p (gimple_stmt_iterator i)
4591 return i.ptr == NULL;
4595 /* Return true if I is one statement before the end of its sequence. */
4597 static inline bool
4598 gsi_one_before_end_p (gimple_stmt_iterator i)
4600 return i.ptr != NULL && i.ptr->next == NULL;
4604 /* Advance the iterator to the next gimple statement. */
4606 static inline void
4607 gsi_next (gimple_stmt_iterator *i)
4609 i->ptr = i->ptr->next;
4612 /* Advance the iterator to the previous gimple statement. */
4614 static inline void
4615 gsi_prev (gimple_stmt_iterator *i)
4617 i->ptr = i->ptr->prev;
4620 /* Return the current stmt. */
4622 static inline gimple
4623 gsi_stmt (gimple_stmt_iterator i)
4625 return i.ptr->stmt;
4628 /* Return a block statement iterator that points to the first non-label
4629 statement in block BB. */
4631 static inline gimple_stmt_iterator
4632 gsi_after_labels (basic_block bb)
4634 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4636 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4637 gsi_next (&gsi);
4639 return gsi;
4642 /* Advance the iterator to the next non-debug gimple statement. */
4644 static inline void
4645 gsi_next_nondebug (gimple_stmt_iterator *i)
4649 gsi_next (i);
4651 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4654 /* Advance the iterator to the next non-debug gimple statement. */
4656 static inline void
4657 gsi_prev_nondebug (gimple_stmt_iterator *i)
4661 gsi_prev (i);
4663 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4666 /* Return a new iterator pointing to the first non-debug statement in
4667 basic block BB. */
4669 static inline gimple_stmt_iterator
4670 gsi_start_nondebug_bb (basic_block bb)
4672 gimple_stmt_iterator i = gsi_start_bb (bb);
4674 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4675 gsi_next_nondebug (&i);
4677 return i;
4680 /* Return a new iterator pointing to the last non-debug statement in
4681 basic block BB. */
4683 static inline gimple_stmt_iterator
4684 gsi_last_nondebug_bb (basic_block bb)
4686 gimple_stmt_iterator i = gsi_last_bb (bb);
4688 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4689 gsi_prev_nondebug (&i);
4691 return i;
4694 /* Return a pointer to the current stmt.
4696 NOTE: You may want to use gsi_replace on the iterator itself,
4697 as this performs additional bookkeeping that will not be done
4698 if you simply assign through a pointer returned by gsi_stmt_ptr. */
4700 static inline gimple *
4701 gsi_stmt_ptr (gimple_stmt_iterator *i)
4703 return &i->ptr->stmt;
4707 /* Return the basic block associated with this iterator. */
4709 static inline basic_block
4710 gsi_bb (gimple_stmt_iterator i)
4712 return i.bb;
4716 /* Return the sequence associated with this iterator. */
4718 static inline gimple_seq
4719 gsi_seq (gimple_stmt_iterator i)
4721 return i.seq;
4725 enum gsi_iterator_update
4727 GSI_NEW_STMT, /* Only valid when single statement is added, move
4728 iterator to it. */
4729 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
4730 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
4731 for linking other statements in the same
4732 direction. */
4735 /* In gimple-iterator.c */
4736 gimple_stmt_iterator gsi_start_phis (basic_block);
4737 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
4738 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
4739 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
4740 void gsi_insert_before (gimple_stmt_iterator *, gimple,
4741 enum gsi_iterator_update);
4742 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
4743 enum gsi_iterator_update);
4744 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
4745 enum gsi_iterator_update);
4746 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
4747 enum gsi_iterator_update);
4748 void gsi_insert_after (gimple_stmt_iterator *, gimple,
4749 enum gsi_iterator_update);
4750 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
4751 enum gsi_iterator_update);
4752 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
4753 enum gsi_iterator_update);
4754 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
4755 enum gsi_iterator_update);
4756 void gsi_remove (gimple_stmt_iterator *, bool);
4757 gimple_stmt_iterator gsi_for_stmt (gimple);
4758 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
4759 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
4760 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
4761 void gsi_insert_on_edge (edge, gimple);
4762 void gsi_insert_seq_on_edge (edge, gimple_seq);
4763 basic_block gsi_insert_on_edge_immediate (edge, gimple);
4764 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
4765 void gsi_commit_one_edge_insert (edge, basic_block *);
4766 void gsi_commit_edge_inserts (void);
4767 gimple gimple_call_copy_skip_args (gimple, bitmap);
4770 /* Convenience routines to walk all statements of a gimple function.
4771 Note that this is useful exclusively before the code is converted
4772 into SSA form. Once the program is in SSA form, the standard
4773 operand interface should be used to analyze/modify statements. */
4774 struct walk_stmt_info
4776 /* Points to the current statement being walked. */
4777 gimple_stmt_iterator gsi;
4779 /* Additional data that the callback functions may want to carry
4780 through the recursion. */
4781 void *info;
4783 /* Pointer map used to mark visited tree nodes when calling
4784 walk_tree on each operand. If set to NULL, duplicate tree nodes
4785 will be visited more than once. */
4786 struct pointer_set_t *pset;
4788 /* Indicates whether the operand being examined may be replaced
4789 with something that matches is_gimple_val (if true) or something
4790 slightly more complicated (if false). "Something" technically
4791 means the common subset of is_gimple_lvalue and is_gimple_rhs,
4792 but we never try to form anything more complicated than that, so
4793 we don't bother checking.
4795 Also note that CALLBACK should update this flag while walking the
4796 sub-expressions of a statement. For instance, when walking the
4797 statement 'foo (&var)', the flag VAL_ONLY will initially be set
4798 to true, however, when walking &var, the operand of that
4799 ADDR_EXPR does not need to be a GIMPLE value. */
4800 bool val_only;
4802 /* True if we are currently walking the LHS of an assignment. */
4803 bool is_lhs;
4805 /* Optional. Set to true by the callback functions if they made any
4806 changes. */
4807 bool changed;
4809 /* True if we're interested in location information. */
4810 bool want_locations;
4812 /* Operand returned by the callbacks. This is set when calling
4813 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
4814 returns non-NULL, this field will contain the tree returned by
4815 the last callback. */
4816 tree callback_result;
4819 /* Callback for walk_gimple_stmt. Called for every statement found
4820 during traversal. The first argument points to the statement to
4821 walk. The second argument is a flag that the callback sets to
4822 'true' if it the callback handled all the operands and
4823 sub-statements of the statement (the default value of this flag is
4824 'false'). The third argument is an anonymous pointer to data
4825 to be used by the callback. */
4826 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
4827 struct walk_stmt_info *);
4829 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
4830 struct walk_stmt_info *);
4831 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
4832 struct walk_stmt_info *);
4833 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
4835 #ifdef GATHER_STATISTICS
4836 /* Enum and arrays used for allocation stats. Keep in sync with
4837 gimple.c:gimple_alloc_kind_names. */
4838 enum gimple_alloc_kind
4840 gimple_alloc_kind_assign, /* Assignments. */
4841 gimple_alloc_kind_phi, /* PHI nodes. */
4842 gimple_alloc_kind_cond, /* Conditionals. */
4843 gimple_alloc_kind_seq, /* Sequences. */
4844 gimple_alloc_kind_rest, /* Everything else. */
4845 gimple_alloc_kind_all
4848 extern int gimple_alloc_counts[];
4849 extern int gimple_alloc_sizes[];
4851 /* Return the allocation kind for a given stmt CODE. */
4852 static inline enum gimple_alloc_kind
4853 gimple_alloc_kind (enum gimple_code code)
4855 switch (code)
4857 case GIMPLE_ASSIGN:
4858 return gimple_alloc_kind_assign;
4859 case GIMPLE_PHI:
4860 return gimple_alloc_kind_phi;
4861 case GIMPLE_COND:
4862 return gimple_alloc_kind_cond;
4863 default:
4864 return gimple_alloc_kind_rest;
4867 #endif /* GATHER_STATISTICS */
4869 extern void dump_gimple_statistics (void);
4871 /* In gimple-fold.c. */
4872 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
4873 tree gimple_fold_builtin (gimple);
4874 bool fold_stmt (gimple_stmt_iterator *);
4875 bool fold_stmt_inplace (gimple);
4876 tree maybe_fold_offset_to_address (location_t, tree, tree, tree);
4877 tree maybe_fold_offset_to_reference (location_t, tree, tree, tree);
4878 tree maybe_fold_stmt_addition (location_t, tree, tree, tree);
4879 tree get_symbol_constant_value (tree);
4880 tree canonicalize_constructor_val (tree);
4881 bool may_propagate_address_into_dereference (tree, tree);
4882 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
4883 enum tree_code, tree, tree);
4884 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
4885 enum tree_code, tree, tree);
4887 #endif /* GCC_GIMPLE_H */