2011-08-19 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / gimple.h
blob27b20482876acf9455abede717b4865cbcad3a8e
1 /* Gimple IR definitions.
3 Copyright 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "pointer-set.h"
26 #include "vec.h"
27 #include "vecprim.h"
28 #include "vecir.h"
29 #include "ggc.h"
30 #include "basic-block.h"
31 #include "tree-ssa-operands.h"
32 #include "tree-ssa-alias.h"
33 #include "internal-fn.h"
35 struct gimple_seq_node_d;
36 typedef struct gimple_seq_node_d *gimple_seq_node;
37 typedef const struct gimple_seq_node_d *const_gimple_seq_node;
39 /* For each block, the PHI nodes that need to be rewritten are stored into
40 these vectors. */
41 typedef VEC(gimple, heap) *gimple_vec;
42 DEF_VEC_P (gimple_vec);
43 DEF_VEC_ALLOC_P (gimple_vec, heap);
45 enum gimple_code {
46 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
47 #include "gimple.def"
48 #undef DEFGSCODE
49 LAST_AND_UNUSED_GIMPLE_CODE
52 extern const char *const gimple_code_name[];
53 extern const unsigned char gimple_rhs_class_table[];
55 /* Error out if a gimple tuple is addressed incorrectly. */
56 #if defined ENABLE_GIMPLE_CHECKING
57 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
58 extern void gimple_check_failed (const_gimple, const char *, int, \
59 const char *, enum gimple_code, \
60 enum tree_code) ATTRIBUTE_NORETURN;
62 #define GIMPLE_CHECK(GS, CODE) \
63 do { \
64 const_gimple __gs = (GS); \
65 if (gimple_code (__gs) != (CODE)) \
66 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
67 (CODE), ERROR_MARK); \
68 } while (0)
69 #else /* not ENABLE_GIMPLE_CHECKING */
70 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
71 #define GIMPLE_CHECK(GS, CODE) (void)0
72 #endif
74 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
75 get_gimple_rhs_class. */
76 enum gimple_rhs_class
78 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
79 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
80 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
81 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
82 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
83 name, a _DECL, a _REF, etc. */
86 /* Specific flags for individual GIMPLE statements. These flags are
87 always stored in gimple_statement_base.subcode and they may only be
88 defined for statement codes that do not use sub-codes.
90 Values for the masks can overlap as long as the overlapping values
91 are never used in the same statement class.
93 The maximum mask value that can be defined is 1 << 15 (i.e., each
94 statement code can hold up to 16 bitflags).
96 Keep this list sorted. */
97 enum gf_mask {
98 GF_ASM_INPUT = 1 << 0,
99 GF_ASM_VOLATILE = 1 << 1,
100 GF_CALL_CANNOT_INLINE = 1 << 0,
101 GF_CALL_FROM_THUNK = 1 << 1,
102 GF_CALL_RETURN_SLOT_OPT = 1 << 2,
103 GF_CALL_TAILCALL = 1 << 3,
104 GF_CALL_VA_ARG_PACK = 1 << 4,
105 GF_CALL_NOTHROW = 1 << 5,
106 GF_CALL_ALLOCA_FOR_VAR = 1 << 6,
107 GF_CALL_INTERNAL = 1 << 7,
108 GF_OMP_PARALLEL_COMBINED = 1 << 0,
110 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
111 a thread synchronization via some sort of barrier. The exact barrier
112 that would otherwise be emitted is dependent on the OMP statement with
113 which this return is associated. */
114 GF_OMP_RETURN_NOWAIT = 1 << 0,
116 GF_OMP_SECTION_LAST = 1 << 0,
117 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
118 GF_PREDICT_TAKEN = 1 << 15
121 /* Currently, there are only two types of gimple debug stmt. Others are
122 envisioned, for example, to enable the generation of is_stmt notes
123 in line number information, to mark sequence points, etc. This
124 subcode is to be used to tell them apart. */
125 enum gimple_debug_subcode {
126 GIMPLE_DEBUG_BIND = 0,
127 GIMPLE_DEBUG_SOURCE_BIND = 1
130 /* Masks for selecting a pass local flag (PLF) to work on. These
131 masks are used by gimple_set_plf and gimple_plf. */
132 enum plf_mask {
133 GF_PLF_1 = 1 << 0,
134 GF_PLF_2 = 1 << 1
137 /* A node in a gimple_seq_d. */
138 struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) gimple_seq_node_d {
139 gimple stmt;
140 struct gimple_seq_node_d *prev;
141 struct gimple_seq_node_d *next;
144 /* A double-linked sequence of gimple statements. */
145 struct GTY ((chain_next ("%h.next_free"))) gimple_seq_d {
146 /* First and last statements in the sequence. */
147 gimple_seq_node first;
148 gimple_seq_node last;
150 /* Sequences are created/destroyed frequently. To minimize
151 allocation activity, deallocated sequences are kept in a pool of
152 available sequences. This is the pointer to the next free
153 sequence in the pool. */
154 gimple_seq next_free;
158 /* Return the first node in GIMPLE sequence S. */
160 static inline gimple_seq_node
161 gimple_seq_first (const_gimple_seq s)
163 return s ? s->first : NULL;
167 /* Return the first statement in GIMPLE sequence S. */
169 static inline gimple
170 gimple_seq_first_stmt (const_gimple_seq s)
172 gimple_seq_node n = gimple_seq_first (s);
173 return (n) ? n->stmt : NULL;
177 /* Return the last node in GIMPLE sequence S. */
179 static inline gimple_seq_node
180 gimple_seq_last (const_gimple_seq s)
182 return s ? s->last : NULL;
186 /* Return the last statement in GIMPLE sequence S. */
188 static inline gimple
189 gimple_seq_last_stmt (const_gimple_seq s)
191 gimple_seq_node n = gimple_seq_last (s);
192 return (n) ? n->stmt : NULL;
196 /* Set the last node in GIMPLE sequence S to LAST. */
198 static inline void
199 gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
201 s->last = last;
205 /* Set the first node in GIMPLE sequence S to FIRST. */
207 static inline void
208 gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
210 s->first = first;
214 /* Return true if GIMPLE sequence S is empty. */
216 static inline bool
217 gimple_seq_empty_p (const_gimple_seq s)
219 return s == NULL || s->first == NULL;
223 void gimple_seq_add_stmt (gimple_seq *, gimple);
225 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
226 *SEQ_P is NULL, a new sequence is allocated. This function is
227 similar to gimple_seq_add_stmt, but does not scan the operands.
228 During gimplification, we need to manipulate statement sequences
229 before the def/use vectors have been constructed. */
230 void gimplify_seq_add_stmt (gimple_seq *, gimple);
232 /* Allocate a new sequence and initialize its first element with STMT. */
234 static inline gimple_seq
235 gimple_seq_alloc_with_stmt (gimple stmt)
237 gimple_seq seq = NULL;
238 gimple_seq_add_stmt (&seq, stmt);
239 return seq;
243 /* Returns the sequence of statements in BB. */
245 static inline gimple_seq
246 bb_seq (const_basic_block bb)
248 return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
252 /* Sets the sequence of statements in BB to SEQ. */
254 static inline void
255 set_bb_seq (basic_block bb, gimple_seq seq)
257 gcc_checking_assert (!(bb->flags & BB_RTL));
258 bb->il.gimple->seq = seq;
261 /* Iterator object for GIMPLE statement sequences. */
263 typedef struct
265 /* Sequence node holding the current statement. */
266 gimple_seq_node ptr;
268 /* Sequence and basic block holding the statement. These fields
269 are necessary to handle edge cases such as when statement is
270 added to an empty basic block or when the last statement of a
271 block/sequence is removed. */
272 gimple_seq seq;
273 basic_block bb;
274 } gimple_stmt_iterator;
277 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
278 are for 64 bit hosts. */
280 struct GTY(()) gimple_statement_base {
281 /* [ WORD 1 ]
282 Main identifying code for a tuple. */
283 ENUM_BITFIELD(gimple_code) code : 8;
285 /* Nonzero if a warning should not be emitted on this tuple. */
286 unsigned int no_warning : 1;
288 /* Nonzero if this tuple has been visited. Passes are responsible
289 for clearing this bit before using it. */
290 unsigned int visited : 1;
292 /* Nonzero if this tuple represents a non-temporal move. */
293 unsigned int nontemporal_move : 1;
295 /* Pass local flags. These flags are free for any pass to use as
296 they see fit. Passes should not assume that these flags contain
297 any useful value when the pass starts. Any initial state that
298 the pass requires should be set on entry to the pass. See
299 gimple_set_plf and gimple_plf for usage. */
300 unsigned int plf : 2;
302 /* Nonzero if this statement has been modified and needs to have its
303 operands rescanned. */
304 unsigned modified : 1;
306 /* Nonzero if this statement contains volatile operands. */
307 unsigned has_volatile_ops : 1;
309 /* Padding to get subcode to 16 bit alignment. */
310 unsigned pad : 1;
312 /* The SUBCODE field can be used for tuple-specific flags for tuples
313 that do not require subcodes. Note that SUBCODE should be at
314 least as wide as tree codes, as several tuples store tree codes
315 in there. */
316 unsigned int subcode : 16;
318 /* UID of this statement. This is used by passes that want to
319 assign IDs to statements. It must be assigned and used by each
320 pass. By default it should be assumed to contain garbage. */
321 unsigned uid;
323 /* [ WORD 2 ]
324 Locus information for debug info. */
325 location_t location;
327 /* Number of operands in this tuple. */
328 unsigned num_ops;
330 /* [ WORD 3 ]
331 Basic block holding this statement. */
332 struct basic_block_def *bb;
334 /* [ WORD 4 ]
335 Lexical block holding this statement. */
336 tree block;
340 /* Base structure for tuples with operands. */
342 struct GTY(()) gimple_statement_with_ops_base
344 /* [ WORD 1-4 ] */
345 struct gimple_statement_base gsbase;
347 /* [ WORD 5-6 ]
348 SSA operand vectors. NOTE: It should be possible to
349 amalgamate these vectors with the operand vector OP. However,
350 the SSA operand vectors are organized differently and contain
351 more information (like immediate use chaining). */
352 struct def_optype_d GTY((skip (""))) *def_ops;
353 struct use_optype_d GTY((skip (""))) *use_ops;
357 /* Statements that take register operands. */
359 struct GTY(()) gimple_statement_with_ops
361 /* [ WORD 1-6 ] */
362 struct gimple_statement_with_ops_base opbase;
364 /* [ WORD 7 ]
365 Operand vector. NOTE! This must always be the last field
366 of this structure. In particular, this means that this
367 structure cannot be embedded inside another one. */
368 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
372 /* Base for statements that take both memory and register operands. */
374 struct GTY(()) gimple_statement_with_memory_ops_base
376 /* [ WORD 1-6 ] */
377 struct gimple_statement_with_ops_base opbase;
379 /* [ WORD 7-8 ]
380 Virtual operands for this statement. The GC will pick them
381 up via the ssa_names array. */
382 tree GTY((skip (""))) vdef;
383 tree GTY((skip (""))) vuse;
387 /* Statements that take both memory and register operands. */
389 struct GTY(()) gimple_statement_with_memory_ops
391 /* [ WORD 1-8 ] */
392 struct gimple_statement_with_memory_ops_base membase;
394 /* [ WORD 9 ]
395 Operand vector. NOTE! This must always be the last field
396 of this structure. In particular, this means that this
397 structure cannot be embedded inside another one. */
398 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
402 /* Call statements that take both memory and register operands. */
404 struct GTY(()) gimple_statement_call
406 /* [ WORD 1-8 ] */
407 struct gimple_statement_with_memory_ops_base membase;
409 /* [ WORD 9-12 ] */
410 struct pt_solution call_used;
411 struct pt_solution call_clobbered;
413 /* [ WORD 13 ] */
414 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
415 tree GTY ((tag ("0"))) fntype;
416 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
417 } u;
419 /* [ WORD 14 ]
420 Operand vector. NOTE! This must always be the last field
421 of this structure. In particular, this means that this
422 structure cannot be embedded inside another one. */
423 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
427 /* OpenMP statements (#pragma omp). */
429 struct GTY(()) gimple_statement_omp {
430 /* [ WORD 1-4 ] */
431 struct gimple_statement_base gsbase;
433 /* [ WORD 5 ] */
434 gimple_seq body;
438 /* GIMPLE_BIND */
440 struct GTY(()) gimple_statement_bind {
441 /* [ WORD 1-4 ] */
442 struct gimple_statement_base gsbase;
444 /* [ WORD 5 ]
445 Variables declared in this scope. */
446 tree vars;
448 /* [ WORD 6 ]
449 This is different than the BLOCK field in gimple_statement_base,
450 which is analogous to TREE_BLOCK (i.e., the lexical block holding
451 this statement). This field is the equivalent of BIND_EXPR_BLOCK
452 in tree land (i.e., the lexical scope defined by this bind). See
453 gimple-low.c. */
454 tree block;
456 /* [ WORD 7 ] */
457 gimple_seq body;
461 /* GIMPLE_CATCH */
463 struct GTY(()) gimple_statement_catch {
464 /* [ WORD 1-4 ] */
465 struct gimple_statement_base gsbase;
467 /* [ WORD 5 ] */
468 tree types;
470 /* [ WORD 6 ] */
471 gimple_seq handler;
475 /* GIMPLE_EH_FILTER */
477 struct GTY(()) gimple_statement_eh_filter {
478 /* [ WORD 1-4 ] */
479 struct gimple_statement_base gsbase;
481 /* [ WORD 5 ]
482 Filter types. */
483 tree types;
485 /* [ WORD 6 ]
486 Failure actions. */
487 gimple_seq failure;
491 /* GIMPLE_EH_MUST_NOT_THROW */
493 struct GTY(()) gimple_statement_eh_mnt {
494 /* [ WORD 1-4 ] */
495 struct gimple_statement_base gsbase;
497 /* [ WORD 5 ] Abort function decl. */
498 tree fndecl;
501 /* GIMPLE_PHI */
503 struct GTY(()) gimple_statement_phi {
504 /* [ WORD 1-4 ] */
505 struct gimple_statement_base gsbase;
507 /* [ WORD 5 ] */
508 unsigned capacity;
509 unsigned nargs;
511 /* [ WORD 6 ] */
512 tree result;
514 /* [ WORD 7 ] */
515 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
519 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
521 struct GTY(()) gimple_statement_eh_ctrl
523 /* [ WORD 1-4 ] */
524 struct gimple_statement_base gsbase;
526 /* [ WORD 5 ]
527 Exception region number. */
528 int region;
532 /* GIMPLE_TRY */
534 struct GTY(()) gimple_statement_try {
535 /* [ WORD 1-4 ] */
536 struct gimple_statement_base gsbase;
538 /* [ WORD 5 ]
539 Expression to evaluate. */
540 gimple_seq eval;
542 /* [ WORD 6 ]
543 Cleanup expression. */
544 gimple_seq cleanup;
547 /* Kind of GIMPLE_TRY statements. */
548 enum gimple_try_flags
550 /* A try/catch. */
551 GIMPLE_TRY_CATCH = 1 << 0,
553 /* A try/finally. */
554 GIMPLE_TRY_FINALLY = 1 << 1,
555 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
557 /* Analogous to TRY_CATCH_IS_CLEANUP. */
558 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
561 /* GIMPLE_WITH_CLEANUP_EXPR */
563 struct GTY(()) gimple_statement_wce {
564 /* [ WORD 1-4 ] */
565 struct gimple_statement_base gsbase;
567 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
568 executed if an exception is thrown, not on normal exit of its
569 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
570 in TARGET_EXPRs. */
572 /* [ WORD 5 ]
573 Cleanup expression. */
574 gimple_seq cleanup;
578 /* GIMPLE_ASM */
580 struct GTY(()) gimple_statement_asm
582 /* [ WORD 1-8 ] */
583 struct gimple_statement_with_memory_ops_base membase;
585 /* [ WORD 9 ]
586 __asm__ statement. */
587 const char *string;
589 /* [ WORD 10 ]
590 Number of inputs, outputs, clobbers, labels. */
591 unsigned char ni;
592 unsigned char no;
593 unsigned char nc;
594 unsigned char nl;
596 /* [ WORD 11 ]
597 Operand vector. NOTE! This must always be the last field
598 of this structure. In particular, this means that this
599 structure cannot be embedded inside another one. */
600 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
603 /* GIMPLE_OMP_CRITICAL */
605 struct GTY(()) gimple_statement_omp_critical {
606 /* [ WORD 1-5 ] */
607 struct gimple_statement_omp omp;
609 /* [ WORD 6 ]
610 Critical section name. */
611 tree name;
615 struct GTY(()) gimple_omp_for_iter {
616 /* Condition code. */
617 enum tree_code cond;
619 /* Index variable. */
620 tree index;
622 /* Initial value. */
623 tree initial;
625 /* Final value. */
626 tree final;
628 /* Increment. */
629 tree incr;
632 /* GIMPLE_OMP_FOR */
634 struct GTY(()) gimple_statement_omp_for {
635 /* [ WORD 1-5 ] */
636 struct gimple_statement_omp omp;
638 /* [ WORD 6 ] */
639 tree clauses;
641 /* [ WORD 7 ]
642 Number of elements in iter array. */
643 size_t collapse;
645 /* [ WORD 8 ] */
646 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
648 /* [ WORD 9 ]
649 Pre-body evaluated before the loop body begins. */
650 gimple_seq pre_body;
654 /* GIMPLE_OMP_PARALLEL */
656 struct GTY(()) gimple_statement_omp_parallel {
657 /* [ WORD 1-5 ] */
658 struct gimple_statement_omp omp;
660 /* [ WORD 6 ]
661 Clauses. */
662 tree clauses;
664 /* [ WORD 7 ]
665 Child function holding the body of the parallel region. */
666 tree child_fn;
668 /* [ WORD 8 ]
669 Shared data argument. */
670 tree data_arg;
674 /* GIMPLE_OMP_TASK */
676 struct GTY(()) gimple_statement_omp_task {
677 /* [ WORD 1-8 ] */
678 struct gimple_statement_omp_parallel par;
680 /* [ WORD 9 ]
681 Child function holding firstprivate initialization if needed. */
682 tree copy_fn;
684 /* [ WORD 10-11 ]
685 Size and alignment in bytes of the argument data block. */
686 tree arg_size;
687 tree arg_align;
691 /* GIMPLE_OMP_SECTION */
692 /* Uses struct gimple_statement_omp. */
695 /* GIMPLE_OMP_SECTIONS */
697 struct GTY(()) gimple_statement_omp_sections {
698 /* [ WORD 1-5 ] */
699 struct gimple_statement_omp omp;
701 /* [ WORD 6 ] */
702 tree clauses;
704 /* [ WORD 7 ]
705 The control variable used for deciding which of the sections to
706 execute. */
707 tree control;
710 /* GIMPLE_OMP_CONTINUE.
712 Note: This does not inherit from gimple_statement_omp, because we
713 do not need the body field. */
715 struct GTY(()) gimple_statement_omp_continue {
716 /* [ WORD 1-4 ] */
717 struct gimple_statement_base gsbase;
719 /* [ WORD 5 ] */
720 tree control_def;
722 /* [ WORD 6 ] */
723 tree control_use;
726 /* GIMPLE_OMP_SINGLE */
728 struct GTY(()) gimple_statement_omp_single {
729 /* [ WORD 1-5 ] */
730 struct gimple_statement_omp omp;
732 /* [ WORD 6 ] */
733 tree clauses;
737 /* GIMPLE_OMP_ATOMIC_LOAD.
738 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
739 contains a sequence, which we don't need here. */
741 struct GTY(()) gimple_statement_omp_atomic_load {
742 /* [ WORD 1-4 ] */
743 struct gimple_statement_base gsbase;
745 /* [ WORD 5-6 ] */
746 tree rhs, lhs;
749 /* GIMPLE_OMP_ATOMIC_STORE.
750 See note on GIMPLE_OMP_ATOMIC_LOAD. */
752 struct GTY(()) gimple_statement_omp_atomic_store {
753 /* [ WORD 1-4 ] */
754 struct gimple_statement_base gsbase;
756 /* [ WORD 5 ] */
757 tree val;
760 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
761 enum gimple_statement_structure_enum {
762 #include "gsstruct.def"
763 LAST_GSS_ENUM
765 #undef DEFGSSTRUCT
768 /* Define the overall contents of a gimple tuple. It may be any of the
769 structures declared above for various types of tuples. */
771 union GTY ((desc ("gimple_statement_structure (&%h)"), variable_size)) gimple_statement_d {
772 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
773 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
774 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
775 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
776 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
777 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
778 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
779 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
780 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
781 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
782 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
783 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
784 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
785 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
786 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
787 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
788 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
789 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
790 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
791 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
792 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
793 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
794 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
795 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
798 /* In gimple.c. */
800 /* Offset in bytes to the location of the operand vector.
801 Zero if there is no operand vector for this tuple structure. */
802 extern size_t const gimple_ops_offset_[];
804 /* Map GIMPLE codes to GSS codes. */
805 extern enum gimple_statement_structure_enum const gss_for_code_[];
807 /* This variable holds the currently expanded gimple statement for purposes
808 of comminucating the profile info to the builtin expanders. */
809 extern gimple currently_expanding_gimple_stmt;
811 gimple gimple_build_return (tree);
813 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
814 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
816 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
818 gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
819 tree, tree MEM_STAT_DECL);
820 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
821 gimple_build_assign_with_ops_stat (c, o1, o2, o3, NULL_TREE MEM_STAT_INFO)
822 #define gimple_build_assign_with_ops3(c,o1,o2,o3,o4) \
823 gimple_build_assign_with_ops_stat (c, o1, o2, o3, o4 MEM_STAT_INFO)
825 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
826 #define gimple_build_debug_bind(var,val,stmt) \
827 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
828 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
829 #define gimple_build_debug_source_bind(var,val,stmt) \
830 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
832 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
833 gimple gimple_build_call (tree, unsigned, ...);
834 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
835 gimple gimple_build_call_internal_vec (enum internal_fn, VEC(tree, heap) *);
836 gimple gimple_build_call_from_tree (tree);
837 gimple gimplify_assign (tree, tree, gimple_seq *);
838 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
839 gimple gimple_build_label (tree label);
840 gimple gimple_build_goto (tree dest);
841 gimple gimple_build_nop (void);
842 gimple gimple_build_bind (tree, gimple_seq, tree);
843 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
844 VEC(tree,gc) *, VEC(tree,gc) *);
845 gimple gimple_build_catch (tree, gimple_seq);
846 gimple gimple_build_eh_filter (tree, gimple_seq);
847 gimple gimple_build_eh_must_not_throw (tree);
848 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
849 gimple gimple_build_wce (gimple_seq);
850 gimple gimple_build_resx (int);
851 gimple gimple_build_eh_dispatch (int);
852 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
853 gimple gimple_build_switch (unsigned, tree, tree, ...);
854 gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
855 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
856 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
857 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
858 gimple gimple_build_omp_critical (gimple_seq, tree);
859 gimple gimple_build_omp_section (gimple_seq);
860 gimple gimple_build_omp_continue (tree, tree);
861 gimple gimple_build_omp_master (gimple_seq);
862 gimple gimple_build_omp_return (bool);
863 gimple gimple_build_omp_ordered (gimple_seq);
864 gimple gimple_build_omp_sections (gimple_seq, tree);
865 gimple gimple_build_omp_sections_switch (void);
866 gimple gimple_build_omp_single (gimple_seq, tree);
867 gimple gimple_build_cdt (tree, tree);
868 gimple gimple_build_omp_atomic_load (tree, tree);
869 gimple gimple_build_omp_atomic_store (tree);
870 gimple gimple_build_predict (enum br_predictor, enum prediction);
871 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
872 void sort_case_labels (VEC(tree,heap) *);
873 void gimple_set_body (tree, gimple_seq);
874 gimple_seq gimple_body (tree);
875 bool gimple_has_body_p (tree);
876 gimple_seq gimple_seq_alloc (void);
877 void gimple_seq_free (gimple_seq);
878 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
879 gimple_seq gimple_seq_copy (gimple_seq);
880 bool gimple_call_same_target_p (const_gimple, const_gimple);
881 int gimple_call_flags (const_gimple);
882 int gimple_call_return_flags (const_gimple);
883 int gimple_call_arg_flags (const_gimple, unsigned);
884 void gimple_call_reset_alias_info (gimple);
885 bool gimple_assign_copy_p (gimple);
886 bool gimple_assign_ssa_name_copy_p (gimple);
887 bool gimple_assign_unary_nop_p (gimple);
888 void gimple_set_bb (gimple, struct basic_block_def *);
889 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
890 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
891 tree, tree, tree);
892 tree gimple_get_lhs (const_gimple);
893 void gimple_set_lhs (gimple, tree);
894 void gimple_replace_lhs (gimple, tree);
895 gimple gimple_copy (gimple);
896 void gimple_set_modified (gimple, bool);
897 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
898 gimple gimple_build_cond_from_tree (tree, tree, tree);
899 void gimple_cond_set_condition_from_tree (gimple, tree);
900 bool gimple_has_side_effects (const_gimple);
901 bool gimple_rhs_has_side_effects (const_gimple);
902 bool gimple_could_trap_p (gimple);
903 bool gimple_could_trap_p_1 (gimple, bool, bool);
904 bool gimple_assign_rhs_could_trap_p (gimple);
905 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
906 bool empty_body_p (gimple_seq);
907 unsigned get_gimple_rhs_num_ops (enum tree_code);
908 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
909 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
910 const char *gimple_decl_printable_name (tree, int);
911 bool gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace);
912 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree, tree *);
913 void gimple_adjust_this_by_delta (gimple_stmt_iterator *, tree);
914 tree gimple_extract_devirt_binfo_from_cst (tree);
915 /* Returns true iff T is a valid GIMPLE statement. */
916 extern bool is_gimple_stmt (tree);
918 /* Returns true iff TYPE is a valid type for a scalar register variable. */
919 extern bool is_gimple_reg_type (tree);
920 /* Returns true iff T is a scalar register variable. */
921 extern bool is_gimple_reg (tree);
922 /* Returns true iff T is any sort of variable. */
923 extern bool is_gimple_variable (tree);
924 /* Returns true iff T is any sort of symbol. */
925 extern bool is_gimple_id (tree);
926 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
927 extern bool is_gimple_min_lval (tree);
928 /* Returns true iff T is something whose address can be taken. */
929 extern bool is_gimple_addressable (tree);
930 /* Returns true iff T is any valid GIMPLE lvalue. */
931 extern bool is_gimple_lvalue (tree);
933 /* Returns true iff T is a GIMPLE address. */
934 bool is_gimple_address (const_tree);
935 /* Returns true iff T is a GIMPLE invariant address. */
936 bool is_gimple_invariant_address (const_tree);
937 /* Returns true iff T is a GIMPLE invariant address at interprocedural
938 level. */
939 bool is_gimple_ip_invariant_address (const_tree);
940 /* Returns true iff T is a valid GIMPLE constant. */
941 bool is_gimple_constant (const_tree);
942 /* Returns true iff T is a GIMPLE restricted function invariant. */
943 extern bool is_gimple_min_invariant (const_tree);
944 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
945 extern bool is_gimple_ip_invariant (const_tree);
946 /* Returns true iff T is a GIMPLE rvalue. */
947 extern bool is_gimple_val (tree);
948 /* Returns true iff T is a GIMPLE asm statement input. */
949 extern bool is_gimple_asm_val (tree);
950 /* Returns true iff T is a valid address operand of a MEM_REF. */
951 bool is_gimple_mem_ref_addr (tree);
952 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
953 GIMPLE temporary, a renamed user variable, or something else,
954 respectively. */
955 extern bool is_gimple_reg_rhs (tree);
956 extern bool is_gimple_mem_rhs (tree);
958 /* Returns true iff T is a valid if-statement condition. */
959 extern bool is_gimple_condexpr (tree);
961 /* Returns true iff T is a variable that does not need to live in memory. */
962 extern bool is_gimple_non_addressable (tree t);
964 /* Returns true iff T is a valid call address expression. */
965 extern bool is_gimple_call_addr (tree);
966 /* If T makes a function call, returns the CALL_EXPR operand. */
967 extern tree get_call_expr_in (tree t);
969 extern void recalculate_side_effects (tree);
970 extern bool gimple_compare_field_offset (tree, tree);
971 extern tree gimple_register_type (tree);
972 extern tree gimple_register_canonical_type (tree);
973 extern void print_gimple_types_stats (void);
974 extern void free_gimple_type_tables (void);
975 extern tree gimple_unsigned_type (tree);
976 extern tree gimple_signed_type (tree);
977 extern alias_set_type gimple_get_alias_set (tree);
978 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
979 unsigned *);
980 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
981 bool (*)(gimple, tree, void *),
982 bool (*)(gimple, tree, void *),
983 bool (*)(gimple, tree, void *));
984 extern bool walk_stmt_load_store_ops (gimple, void *,
985 bool (*)(gimple, tree, void *),
986 bool (*)(gimple, tree, void *));
987 extern bool gimple_ior_addresses_taken (bitmap, gimple);
988 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
989 extern bool gimple_asm_clobbers_memory_p (const_gimple);
991 /* In gimplify.c */
992 extern tree create_tmp_var_raw (tree, const char *);
993 extern tree create_tmp_var_name (const char *);
994 extern tree create_tmp_var (tree, const char *);
995 extern tree create_tmp_reg (tree, const char *);
996 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
997 extern tree get_formal_tmp_var (tree, gimple_seq *);
998 extern void declare_vars (tree, gimple, bool);
999 extern void annotate_all_with_location (gimple_seq, location_t);
1001 /* Validation of GIMPLE expressions. Note that these predicates only check
1002 the basic form of the expression, they don't recurse to make sure that
1003 underlying nodes are also of the right form. */
1004 typedef bool (*gimple_predicate)(tree);
1007 /* FIXME we should deduce this from the predicate. */
1008 enum fallback {
1009 fb_none = 0, /* Do not generate a temporary. */
1011 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
1012 gimplified expression. */
1014 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
1015 gimplified expression. */
1017 fb_mayfail = 4, /* Gimplification may fail. Error issued
1018 afterwards. */
1019 fb_either= fb_rvalue | fb_lvalue
1022 typedef int fallback_t;
1024 enum gimplify_status {
1025 GS_ERROR = -2, /* Something Bad Seen. */
1026 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
1027 GS_OK = 0, /* We did something, maybe more to do. */
1028 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1031 struct gimplify_ctx
1033 struct gimplify_ctx *prev_context;
1035 VEC(gimple,heap) *bind_expr_stack;
1036 tree temps;
1037 gimple_seq conditional_cleanups;
1038 tree exit_label;
1039 tree return_temp;
1041 VEC(tree,heap) *case_labels;
1042 /* The formal temporary table. Should this be persistent? */
1043 htab_t temp_htab;
1045 int conditions;
1046 bool save_stack;
1047 bool into_ssa;
1048 bool allow_rhs_cond_expr;
1051 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1052 bool (*) (tree), fallback_t);
1053 extern void gimplify_type_sizes (tree, gimple_seq *);
1054 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1055 extern bool gimplify_stmt (tree *, gimple_seq *);
1056 extern gimple gimplify_body (tree *, tree, bool);
1057 extern void push_gimplify_context (struct gimplify_ctx *);
1058 extern void pop_gimplify_context (gimple);
1059 extern void gimplify_and_add (tree, gimple_seq *);
1061 /* Miscellaneous helpers. */
1062 extern void gimple_add_tmp_var (tree);
1063 extern gimple gimple_current_bind_expr (void);
1064 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1065 extern tree voidify_wrapper_expr (tree, tree);
1066 extern tree build_and_jump (tree *);
1067 extern tree force_labels_r (tree *, int *, void *);
1068 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1069 gimple_seq *);
1070 struct gimplify_omp_ctx;
1071 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1072 extern tree gimple_boolify (tree);
1073 extern gimple_predicate rhs_predicate_for (tree);
1074 extern tree canonicalize_cond_expr_cond (tree);
1076 /* In omp-low.c. */
1077 extern tree omp_reduction_init (tree, tree);
1079 /* In tree-nested.c. */
1080 extern void lower_nested_functions (tree);
1081 extern void insert_field_into_struct (tree, tree);
1083 /* In gimplify.c. */
1084 extern void gimplify_function_tree (tree);
1086 /* In cfgexpand.c. */
1087 extern tree gimple_assign_rhs_to_tree (gimple);
1089 /* In builtins.c */
1090 extern bool validate_gimple_arglist (const_gimple, ...);
1092 /* In tree-ssa.c */
1093 extern bool tree_ssa_useless_type_conversion (tree);
1094 extern tree tree_ssa_strip_useless_type_conversions (tree);
1095 extern bool useless_type_conversion_p (tree, tree);
1096 extern bool types_compatible_p (tree, tree);
1098 /* Return the code for GIMPLE statement G. */
1100 static inline enum gimple_code
1101 gimple_code (const_gimple g)
1103 return g->gsbase.code;
1107 /* Return the GSS code used by a GIMPLE code. */
1109 static inline enum gimple_statement_structure_enum
1110 gss_for_code (enum gimple_code code)
1112 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1113 return gss_for_code_[code];
1117 /* Return which GSS code is used by GS. */
1119 static inline enum gimple_statement_structure_enum
1120 gimple_statement_structure (gimple gs)
1122 return gss_for_code (gimple_code (gs));
1126 /* Return true if statement G has sub-statements. This is only true for
1127 High GIMPLE statements. */
1129 static inline bool
1130 gimple_has_substatements (gimple g)
1132 switch (gimple_code (g))
1134 case GIMPLE_BIND:
1135 case GIMPLE_CATCH:
1136 case GIMPLE_EH_FILTER:
1137 case GIMPLE_TRY:
1138 case GIMPLE_OMP_FOR:
1139 case GIMPLE_OMP_MASTER:
1140 case GIMPLE_OMP_ORDERED:
1141 case GIMPLE_OMP_SECTION:
1142 case GIMPLE_OMP_PARALLEL:
1143 case GIMPLE_OMP_TASK:
1144 case GIMPLE_OMP_SECTIONS:
1145 case GIMPLE_OMP_SINGLE:
1146 case GIMPLE_OMP_CRITICAL:
1147 case GIMPLE_WITH_CLEANUP_EXPR:
1148 return true;
1150 default:
1151 return false;
1156 /* Return the basic block holding statement G. */
1158 static inline struct basic_block_def *
1159 gimple_bb (const_gimple g)
1161 return g->gsbase.bb;
1165 /* Return the lexical scope block holding statement G. */
1167 static inline tree
1168 gimple_block (const_gimple g)
1170 return g->gsbase.block;
1174 /* Set BLOCK to be the lexical scope block holding statement G. */
1176 static inline void
1177 gimple_set_block (gimple g, tree block)
1179 g->gsbase.block = block;
1183 /* Return location information for statement G. */
1185 static inline location_t
1186 gimple_location (const_gimple g)
1188 return g->gsbase.location;
1191 /* Return pointer to location information for statement G. */
1193 static inline const location_t *
1194 gimple_location_ptr (const_gimple g)
1196 return &g->gsbase.location;
1200 /* Set location information for statement G. */
1202 static inline void
1203 gimple_set_location (gimple g, location_t location)
1205 g->gsbase.location = location;
1209 /* Return true if G contains location information. */
1211 static inline bool
1212 gimple_has_location (const_gimple g)
1214 return gimple_location (g) != UNKNOWN_LOCATION;
1218 /* Return the file name of the location of STMT. */
1220 static inline const char *
1221 gimple_filename (const_gimple stmt)
1223 return LOCATION_FILE (gimple_location (stmt));
1227 /* Return the line number of the location of STMT. */
1229 static inline int
1230 gimple_lineno (const_gimple stmt)
1232 return LOCATION_LINE (gimple_location (stmt));
1236 /* Determine whether SEQ is a singleton. */
1238 static inline bool
1239 gimple_seq_singleton_p (gimple_seq seq)
1241 return ((gimple_seq_first (seq) != NULL)
1242 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1245 /* Return true if no warnings should be emitted for statement STMT. */
1247 static inline bool
1248 gimple_no_warning_p (const_gimple stmt)
1250 return stmt->gsbase.no_warning;
1253 /* Set the no_warning flag of STMT to NO_WARNING. */
1255 static inline void
1256 gimple_set_no_warning (gimple stmt, bool no_warning)
1258 stmt->gsbase.no_warning = (unsigned) no_warning;
1261 /* Set the visited status on statement STMT to VISITED_P. */
1263 static inline void
1264 gimple_set_visited (gimple stmt, bool visited_p)
1266 stmt->gsbase.visited = (unsigned) visited_p;
1270 /* Return the visited status for statement STMT. */
1272 static inline bool
1273 gimple_visited_p (gimple stmt)
1275 return stmt->gsbase.visited;
1279 /* Set pass local flag PLF on statement STMT to VAL_P. */
1281 static inline void
1282 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1284 if (val_p)
1285 stmt->gsbase.plf |= (unsigned int) plf;
1286 else
1287 stmt->gsbase.plf &= ~((unsigned int) plf);
1291 /* Return the value of pass local flag PLF on statement STMT. */
1293 static inline unsigned int
1294 gimple_plf (gimple stmt, enum plf_mask plf)
1296 return stmt->gsbase.plf & ((unsigned int) plf);
1300 /* Set the UID of statement. */
1302 static inline void
1303 gimple_set_uid (gimple g, unsigned uid)
1305 g->gsbase.uid = uid;
1309 /* Return the UID of statement. */
1311 static inline unsigned
1312 gimple_uid (const_gimple g)
1314 return g->gsbase.uid;
1318 /* Return true if GIMPLE statement G has register or memory operands. */
1320 static inline bool
1321 gimple_has_ops (const_gimple g)
1323 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1327 /* Return true if GIMPLE statement G has memory operands. */
1329 static inline bool
1330 gimple_has_mem_ops (const_gimple g)
1332 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1336 /* Return the set of DEF operands for statement G. */
1338 static inline struct def_optype_d *
1339 gimple_def_ops (const_gimple g)
1341 if (!gimple_has_ops (g))
1342 return NULL;
1343 return g->gsops.opbase.def_ops;
1347 /* Set DEF to be the set of DEF operands for statement G. */
1349 static inline void
1350 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1352 gcc_gimple_checking_assert (gimple_has_ops (g));
1353 g->gsops.opbase.def_ops = def;
1357 /* Return the set of USE operands for statement G. */
1359 static inline struct use_optype_d *
1360 gimple_use_ops (const_gimple g)
1362 if (!gimple_has_ops (g))
1363 return NULL;
1364 return g->gsops.opbase.use_ops;
1368 /* Set USE to be the set of USE operands for statement G. */
1370 static inline void
1371 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1373 gcc_gimple_checking_assert (gimple_has_ops (g));
1374 g->gsops.opbase.use_ops = use;
1378 /* Return the set of VUSE operand for statement G. */
1380 static inline use_operand_p
1381 gimple_vuse_op (const_gimple g)
1383 struct use_optype_d *ops;
1384 if (!gimple_has_mem_ops (g))
1385 return NULL_USE_OPERAND_P;
1386 ops = g->gsops.opbase.use_ops;
1387 if (ops
1388 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1389 return USE_OP_PTR (ops);
1390 return NULL_USE_OPERAND_P;
1393 /* Return the set of VDEF operand for statement G. */
1395 static inline def_operand_p
1396 gimple_vdef_op (const_gimple g)
1398 struct def_optype_d *ops;
1399 if (!gimple_has_mem_ops (g))
1400 return NULL_DEF_OPERAND_P;
1401 ops = g->gsops.opbase.def_ops;
1402 if (ops
1403 && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1404 return DEF_OP_PTR (ops);
1405 return NULL_DEF_OPERAND_P;
1409 /* Return the single VUSE operand of the statement G. */
1411 static inline tree
1412 gimple_vuse (const_gimple g)
1414 if (!gimple_has_mem_ops (g))
1415 return NULL_TREE;
1416 return g->gsmembase.vuse;
1419 /* Return the single VDEF operand of the statement G. */
1421 static inline tree
1422 gimple_vdef (const_gimple g)
1424 if (!gimple_has_mem_ops (g))
1425 return NULL_TREE;
1426 return g->gsmembase.vdef;
1429 /* Return the single VUSE operand of the statement G. */
1431 static inline tree *
1432 gimple_vuse_ptr (gimple g)
1434 if (!gimple_has_mem_ops (g))
1435 return NULL;
1436 return &g->gsmembase.vuse;
1439 /* Return the single VDEF operand of the statement G. */
1441 static inline tree *
1442 gimple_vdef_ptr (gimple g)
1444 if (!gimple_has_mem_ops (g))
1445 return NULL;
1446 return &g->gsmembase.vdef;
1449 /* Set the single VUSE operand of the statement G. */
1451 static inline void
1452 gimple_set_vuse (gimple g, tree vuse)
1454 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1455 g->gsmembase.vuse = vuse;
1458 /* Set the single VDEF operand of the statement G. */
1460 static inline void
1461 gimple_set_vdef (gimple g, tree vdef)
1463 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1464 g->gsmembase.vdef = vdef;
1468 /* Return true if statement G has operands and the modified field has
1469 been set. */
1471 static inline bool
1472 gimple_modified_p (const_gimple g)
1474 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1478 /* Return the tree code for the expression computed by STMT. This is
1479 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1480 GIMPLE_CALL, return CALL_EXPR as the expression code for
1481 consistency. This is useful when the caller needs to deal with the
1482 three kinds of computation that GIMPLE supports. */
1484 static inline enum tree_code
1485 gimple_expr_code (const_gimple stmt)
1487 enum gimple_code code = gimple_code (stmt);
1488 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1489 return (enum tree_code) stmt->gsbase.subcode;
1490 else
1492 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1493 return CALL_EXPR;
1498 /* Mark statement S as modified, and update it. */
1500 static inline void
1501 update_stmt (gimple s)
1503 if (gimple_has_ops (s))
1505 gimple_set_modified (s, true);
1506 update_stmt_operands (s);
1510 /* Update statement S if it has been optimized. */
1512 static inline void
1513 update_stmt_if_modified (gimple s)
1515 if (gimple_modified_p (s))
1516 update_stmt_operands (s);
1519 /* Return true if statement STMT contains volatile operands. */
1521 static inline bool
1522 gimple_has_volatile_ops (const_gimple stmt)
1524 if (gimple_has_mem_ops (stmt))
1525 return stmt->gsbase.has_volatile_ops;
1526 else
1527 return false;
1531 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1533 static inline void
1534 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1536 if (gimple_has_mem_ops (stmt))
1537 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1541 /* Return true if statement STMT may access memory. */
1543 static inline bool
1544 gimple_references_memory_p (gimple stmt)
1546 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1550 /* Return the subcode for OMP statement S. */
1552 static inline unsigned
1553 gimple_omp_subcode (const_gimple s)
1555 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1556 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1557 return s->gsbase.subcode;
1560 /* Set the subcode for OMP statement S to SUBCODE. */
1562 static inline void
1563 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1565 /* We only have 16 bits for the subcode. Assert that we are not
1566 overflowing it. */
1567 gcc_gimple_checking_assert (subcode < (1 << 16));
1568 s->gsbase.subcode = subcode;
1571 /* Set the nowait flag on OMP_RETURN statement S. */
1573 static inline void
1574 gimple_omp_return_set_nowait (gimple s)
1576 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1577 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1581 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1582 flag set. */
1584 static inline bool
1585 gimple_omp_return_nowait_p (const_gimple g)
1587 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1588 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1592 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1593 flag set. */
1595 static inline bool
1596 gimple_omp_section_last_p (const_gimple g)
1598 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1599 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1603 /* Set the GF_OMP_SECTION_LAST flag on G. */
1605 static inline void
1606 gimple_omp_section_set_last (gimple g)
1608 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1609 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1613 /* Return true if OMP parallel statement G has the
1614 GF_OMP_PARALLEL_COMBINED flag set. */
1616 static inline bool
1617 gimple_omp_parallel_combined_p (const_gimple g)
1619 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1620 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1624 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1625 value of COMBINED_P. */
1627 static inline void
1628 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1630 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1631 if (combined_p)
1632 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1633 else
1634 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1638 /* Return true if OMP atomic load/store statement G has the
1639 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1641 static inline bool
1642 gimple_omp_atomic_need_value_p (const_gimple g)
1644 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1645 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1646 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1650 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1652 static inline void
1653 gimple_omp_atomic_set_need_value (gimple g)
1655 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1656 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1657 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1661 /* Return the number of operands for statement GS. */
1663 static inline unsigned
1664 gimple_num_ops (const_gimple gs)
1666 return gs->gsbase.num_ops;
1670 /* Set the number of operands for statement GS. */
1672 static inline void
1673 gimple_set_num_ops (gimple gs, unsigned num_ops)
1675 gs->gsbase.num_ops = num_ops;
1679 /* Return the array of operands for statement GS. */
1681 static inline tree *
1682 gimple_ops (gimple gs)
1684 size_t off;
1686 /* All the tuples have their operand vector at the very bottom
1687 of the structure. Note that those structures that do not
1688 have an operand vector have a zero offset. */
1689 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1690 gcc_gimple_checking_assert (off != 0);
1692 return (tree *) ((char *) gs + off);
1696 /* Return operand I for statement GS. */
1698 static inline tree
1699 gimple_op (const_gimple gs, unsigned i)
1701 if (gimple_has_ops (gs))
1703 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1704 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1706 else
1707 return NULL_TREE;
1710 /* Return a pointer to operand I for statement GS. */
1712 static inline tree *
1713 gimple_op_ptr (const_gimple gs, unsigned i)
1715 if (gimple_has_ops (gs))
1717 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1718 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1720 else
1721 return NULL;
1724 /* Set operand I of statement GS to OP. */
1726 static inline void
1727 gimple_set_op (gimple gs, unsigned i, tree op)
1729 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1731 /* Note. It may be tempting to assert that OP matches
1732 is_gimple_operand, but that would be wrong. Different tuples
1733 accept slightly different sets of tree operands. Each caller
1734 should perform its own validation. */
1735 gimple_ops (gs)[i] = op;
1738 /* Return true if GS is a GIMPLE_ASSIGN. */
1740 static inline bool
1741 is_gimple_assign (const_gimple gs)
1743 return gimple_code (gs) == GIMPLE_ASSIGN;
1746 /* Determine if expression CODE is one of the valid expressions that can
1747 be used on the RHS of GIMPLE assignments. */
1749 static inline enum gimple_rhs_class
1750 get_gimple_rhs_class (enum tree_code code)
1752 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1755 /* Return the LHS of assignment statement GS. */
1757 static inline tree
1758 gimple_assign_lhs (const_gimple gs)
1760 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1761 return gimple_op (gs, 0);
1765 /* Return a pointer to the LHS of assignment statement GS. */
1767 static inline tree *
1768 gimple_assign_lhs_ptr (const_gimple gs)
1770 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1771 return gimple_op_ptr (gs, 0);
1775 /* Set LHS to be the LHS operand of assignment statement GS. */
1777 static inline void
1778 gimple_assign_set_lhs (gimple gs, tree lhs)
1780 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1781 gimple_set_op (gs, 0, lhs);
1783 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1784 SSA_NAME_DEF_STMT (lhs) = gs;
1788 /* Return the first operand on the RHS of assignment statement GS. */
1790 static inline tree
1791 gimple_assign_rhs1 (const_gimple gs)
1793 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1794 return gimple_op (gs, 1);
1798 /* Return a pointer to the first operand on the RHS of assignment
1799 statement GS. */
1801 static inline tree *
1802 gimple_assign_rhs1_ptr (const_gimple gs)
1804 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1805 return gimple_op_ptr (gs, 1);
1808 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1810 static inline void
1811 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1813 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1815 gimple_set_op (gs, 1, rhs);
1819 /* Return the second operand on the RHS of assignment statement GS.
1820 If GS does not have two operands, NULL is returned instead. */
1822 static inline tree
1823 gimple_assign_rhs2 (const_gimple gs)
1825 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1827 if (gimple_num_ops (gs) >= 3)
1828 return gimple_op (gs, 2);
1829 else
1830 return NULL_TREE;
1834 /* Return a pointer to the second operand on the RHS of assignment
1835 statement GS. */
1837 static inline tree *
1838 gimple_assign_rhs2_ptr (const_gimple gs)
1840 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1841 return gimple_op_ptr (gs, 2);
1845 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1847 static inline void
1848 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1850 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1852 gimple_set_op (gs, 2, rhs);
1855 /* Return the third operand on the RHS of assignment statement GS.
1856 If GS does not have two operands, NULL is returned instead. */
1858 static inline tree
1859 gimple_assign_rhs3 (const_gimple gs)
1861 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1863 if (gimple_num_ops (gs) >= 4)
1864 return gimple_op (gs, 3);
1865 else
1866 return NULL_TREE;
1869 /* Return a pointer to the third operand on the RHS of assignment
1870 statement GS. */
1872 static inline tree *
1873 gimple_assign_rhs3_ptr (const_gimple gs)
1875 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1876 return gimple_op_ptr (gs, 3);
1880 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1882 static inline void
1883 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1885 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1887 gimple_set_op (gs, 3, rhs);
1890 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1891 to see only a maximum of two operands. */
1893 static inline void
1894 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1895 tree op1, tree op2)
1897 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1900 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1901 to see only a maximum of two operands. */
1903 static inline void
1904 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1905 tree *op1)
1907 tree op2;
1908 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1909 gcc_assert (op2 == NULL_TREE);
1912 /* Returns true if GS is a nontemporal move. */
1914 static inline bool
1915 gimple_assign_nontemporal_move_p (const_gimple gs)
1917 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1918 return gs->gsbase.nontemporal_move;
1921 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1923 static inline void
1924 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1926 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1927 gs->gsbase.nontemporal_move = nontemporal;
1931 /* Return the code of the expression computed on the rhs of assignment
1932 statement GS. In case that the RHS is a single object, returns the
1933 tree code of the object. */
1935 static inline enum tree_code
1936 gimple_assign_rhs_code (const_gimple gs)
1938 enum tree_code code;
1939 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1941 code = (enum tree_code) gs->gsbase.subcode;
1942 /* While we initially set subcode to the TREE_CODE of the rhs for
1943 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
1944 in sync when we rewrite stmts into SSA form or do SSA propagations. */
1945 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1946 code = TREE_CODE (gimple_assign_rhs1 (gs));
1948 return code;
1952 /* Set CODE to be the code for the expression computed on the RHS of
1953 assignment S. */
1955 static inline void
1956 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
1958 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
1959 s->gsbase.subcode = code;
1963 /* Return the gimple rhs class of the code of the expression computed on
1964 the rhs of assignment statement GS.
1965 This will never return GIMPLE_INVALID_RHS. */
1967 static inline enum gimple_rhs_class
1968 gimple_assign_rhs_class (const_gimple gs)
1970 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
1973 /* Return true if GS is an assignment with a singleton RHS, i.e.,
1974 there is no operator associated with the assignment itself.
1975 Unlike gimple_assign_copy_p, this predicate returns true for
1976 any RHS operand, including those that perform an operation
1977 and do not have the semantics of a copy, such as COND_EXPR. */
1979 static inline bool
1980 gimple_assign_single_p (gimple gs)
1982 return (is_gimple_assign (gs)
1983 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
1987 /* Return true if S is a type-cast assignment. */
1989 static inline bool
1990 gimple_assign_cast_p (gimple s)
1992 if (is_gimple_assign (s))
1994 enum tree_code sc = gimple_assign_rhs_code (s);
1995 return CONVERT_EXPR_CODE_P (sc)
1996 || sc == VIEW_CONVERT_EXPR
1997 || sc == FIX_TRUNC_EXPR;
2000 return false;
2004 /* Return true if GS is a GIMPLE_CALL. */
2006 static inline bool
2007 is_gimple_call (const_gimple gs)
2009 return gimple_code (gs) == GIMPLE_CALL;
2012 /* Return the LHS of call statement GS. */
2014 static inline tree
2015 gimple_call_lhs (const_gimple gs)
2017 GIMPLE_CHECK (gs, GIMPLE_CALL);
2018 return gimple_op (gs, 0);
2022 /* Return a pointer to the LHS of call statement GS. */
2024 static inline tree *
2025 gimple_call_lhs_ptr (const_gimple gs)
2027 GIMPLE_CHECK (gs, GIMPLE_CALL);
2028 return gimple_op_ptr (gs, 0);
2032 /* Set LHS to be the LHS operand of call statement GS. */
2034 static inline void
2035 gimple_call_set_lhs (gimple gs, tree lhs)
2037 GIMPLE_CHECK (gs, GIMPLE_CALL);
2038 gimple_set_op (gs, 0, lhs);
2039 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2040 SSA_NAME_DEF_STMT (lhs) = gs;
2044 /* Return true if call GS calls an internal-only function, as enumerated
2045 by internal_fn. */
2047 static inline bool
2048 gimple_call_internal_p (const_gimple gs)
2050 GIMPLE_CHECK (gs, GIMPLE_CALL);
2051 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2055 /* Return the target of internal call GS. */
2057 static inline enum internal_fn
2058 gimple_call_internal_fn (const_gimple gs)
2060 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2061 return gs->gimple_call.u.internal_fn;
2065 /* Return the function type of the function called by GS. */
2067 static inline tree
2068 gimple_call_fntype (const_gimple gs)
2070 GIMPLE_CHECK (gs, GIMPLE_CALL);
2071 if (gimple_call_internal_p (gs))
2072 return NULL_TREE;
2073 return gs->gimple_call.u.fntype;
2076 /* Set the type of the function called by GS to FNTYPE. */
2078 static inline void
2079 gimple_call_set_fntype (gimple gs, tree fntype)
2081 GIMPLE_CHECK (gs, GIMPLE_CALL);
2082 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2083 gs->gimple_call.u.fntype = fntype;
2087 /* Return the tree node representing the function called by call
2088 statement GS. */
2090 static inline tree
2091 gimple_call_fn (const_gimple gs)
2093 GIMPLE_CHECK (gs, GIMPLE_CALL);
2094 return gimple_op (gs, 1);
2097 /* Return a pointer to the tree node representing the function called by call
2098 statement GS. */
2100 static inline tree *
2101 gimple_call_fn_ptr (const_gimple gs)
2103 GIMPLE_CHECK (gs, GIMPLE_CALL);
2104 return gimple_op_ptr (gs, 1);
2108 /* Set FN to be the function called by call statement GS. */
2110 static inline void
2111 gimple_call_set_fn (gimple gs, tree fn)
2113 GIMPLE_CHECK (gs, GIMPLE_CALL);
2114 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2115 gimple_set_op (gs, 1, fn);
2119 /* Set FNDECL to be the function called by call statement GS. */
2121 static inline void
2122 gimple_call_set_fndecl (gimple gs, tree decl)
2124 GIMPLE_CHECK (gs, GIMPLE_CALL);
2125 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2126 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2130 /* Set internal function FN to be the function called by call statement GS. */
2132 static inline void
2133 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2135 GIMPLE_CHECK (gs, GIMPLE_CALL);
2136 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2137 gs->gimple_call.u.internal_fn = fn;
2141 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2142 associated with the callee if known. Otherwise return NULL_TREE. */
2144 static inline tree
2145 gimple_call_addr_fndecl (const_tree fn)
2147 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2149 tree fndecl = TREE_OPERAND (fn, 0);
2150 if (TREE_CODE (fndecl) == MEM_REF
2151 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2152 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2153 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2154 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2155 return fndecl;
2157 return NULL_TREE;
2160 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2161 Otherwise return NULL. This function is analogous to
2162 get_callee_fndecl in tree land. */
2164 static inline tree
2165 gimple_call_fndecl (const_gimple gs)
2167 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2171 /* Return the type returned by call statement GS. */
2173 static inline tree
2174 gimple_call_return_type (const_gimple gs)
2176 tree type = gimple_call_fntype (gs);
2178 if (type == NULL_TREE)
2179 return TREE_TYPE (gimple_call_lhs (gs));
2181 /* The type returned by a function is the type of its
2182 function type. */
2183 return TREE_TYPE (type);
2187 /* Return the static chain for call statement GS. */
2189 static inline tree
2190 gimple_call_chain (const_gimple gs)
2192 GIMPLE_CHECK (gs, GIMPLE_CALL);
2193 return gimple_op (gs, 2);
2197 /* Return a pointer to the static chain for call statement GS. */
2199 static inline tree *
2200 gimple_call_chain_ptr (const_gimple gs)
2202 GIMPLE_CHECK (gs, GIMPLE_CALL);
2203 return gimple_op_ptr (gs, 2);
2206 /* Set CHAIN to be the static chain for call statement GS. */
2208 static inline void
2209 gimple_call_set_chain (gimple gs, tree chain)
2211 GIMPLE_CHECK (gs, GIMPLE_CALL);
2213 gimple_set_op (gs, 2, chain);
2217 /* Return the number of arguments used by call statement GS. */
2219 static inline unsigned
2220 gimple_call_num_args (const_gimple gs)
2222 unsigned num_ops;
2223 GIMPLE_CHECK (gs, GIMPLE_CALL);
2224 num_ops = gimple_num_ops (gs);
2225 return num_ops - 3;
2229 /* Return the argument at position INDEX for call statement GS. */
2231 static inline tree
2232 gimple_call_arg (const_gimple gs, unsigned index)
2234 GIMPLE_CHECK (gs, GIMPLE_CALL);
2235 return gimple_op (gs, index + 3);
2239 /* Return a pointer to the argument at position INDEX for call
2240 statement GS. */
2242 static inline tree *
2243 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2245 GIMPLE_CHECK (gs, GIMPLE_CALL);
2246 return gimple_op_ptr (gs, index + 3);
2250 /* Set ARG to be the argument at position INDEX for call statement GS. */
2252 static inline void
2253 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2255 GIMPLE_CHECK (gs, GIMPLE_CALL);
2256 gimple_set_op (gs, index + 3, arg);
2260 /* If TAIL_P is true, mark call statement S as being a tail call
2261 (i.e., a call just before the exit of a function). These calls are
2262 candidate for tail call optimization. */
2264 static inline void
2265 gimple_call_set_tail (gimple s, bool tail_p)
2267 GIMPLE_CHECK (s, GIMPLE_CALL);
2268 if (tail_p)
2269 s->gsbase.subcode |= GF_CALL_TAILCALL;
2270 else
2271 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2275 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2277 static inline bool
2278 gimple_call_tail_p (gimple s)
2280 GIMPLE_CHECK (s, GIMPLE_CALL);
2281 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2285 /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
2287 static inline void
2288 gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
2290 GIMPLE_CHECK (s, GIMPLE_CALL);
2291 if (inlinable_p)
2292 s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
2293 else
2294 s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
2298 /* Return true if GIMPLE_CALL S cannot be inlined. */
2300 static inline bool
2301 gimple_call_cannot_inline_p (gimple s)
2303 GIMPLE_CHECK (s, GIMPLE_CALL);
2304 return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0;
2308 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2309 slot optimization. This transformation uses the target of the call
2310 expansion as the return slot for calls that return in memory. */
2312 static inline void
2313 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2315 GIMPLE_CHECK (s, GIMPLE_CALL);
2316 if (return_slot_opt_p)
2317 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2318 else
2319 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2323 /* Return true if S is marked for return slot optimization. */
2325 static inline bool
2326 gimple_call_return_slot_opt_p (gimple s)
2328 GIMPLE_CHECK (s, GIMPLE_CALL);
2329 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2333 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2334 thunk to the thunked-to function. */
2336 static inline void
2337 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2339 GIMPLE_CHECK (s, GIMPLE_CALL);
2340 if (from_thunk_p)
2341 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2342 else
2343 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2347 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2349 static inline bool
2350 gimple_call_from_thunk_p (gimple s)
2352 GIMPLE_CHECK (s, GIMPLE_CALL);
2353 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2357 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2358 argument pack in its argument list. */
2360 static inline void
2361 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2363 GIMPLE_CHECK (s, GIMPLE_CALL);
2364 if (pass_arg_pack_p)
2365 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2366 else
2367 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2371 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2372 argument pack in its argument list. */
2374 static inline bool
2375 gimple_call_va_arg_pack_p (gimple s)
2377 GIMPLE_CHECK (s, GIMPLE_CALL);
2378 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2382 /* Return true if S is a noreturn call. */
2384 static inline bool
2385 gimple_call_noreturn_p (gimple s)
2387 GIMPLE_CHECK (s, GIMPLE_CALL);
2388 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2392 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2393 even if the called function can throw in other cases. */
2395 static inline void
2396 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2398 GIMPLE_CHECK (s, GIMPLE_CALL);
2399 if (nothrow_p)
2400 s->gsbase.subcode |= GF_CALL_NOTHROW;
2401 else
2402 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2405 /* Return true if S is a nothrow call. */
2407 static inline bool
2408 gimple_call_nothrow_p (gimple s)
2410 GIMPLE_CHECK (s, GIMPLE_CALL);
2411 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2414 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2415 is known to be emitted for VLA objects. Those are wrapped by
2416 stack_save/stack_restore calls and hence can't lead to unbounded
2417 stack growth even when they occur in loops. */
2419 static inline void
2420 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2422 GIMPLE_CHECK (s, GIMPLE_CALL);
2423 if (for_var)
2424 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2425 else
2426 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2429 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2431 static inline bool
2432 gimple_call_alloca_for_var_p (gimple s)
2434 GIMPLE_CHECK (s, GIMPLE_CALL);
2435 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2438 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2440 static inline void
2441 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2443 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2444 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2445 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2449 /* Return a pointer to the points-to solution for the set of call-used
2450 variables of the call CALL. */
2452 static inline struct pt_solution *
2453 gimple_call_use_set (gimple call)
2455 GIMPLE_CHECK (call, GIMPLE_CALL);
2456 return &call->gimple_call.call_used;
2460 /* Return a pointer to the points-to solution for the set of call-used
2461 variables of the call CALL. */
2463 static inline struct pt_solution *
2464 gimple_call_clobber_set (gimple call)
2466 GIMPLE_CHECK (call, GIMPLE_CALL);
2467 return &call->gimple_call.call_clobbered;
2471 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2472 non-NULL lhs. */
2474 static inline bool
2475 gimple_has_lhs (gimple stmt)
2477 return (is_gimple_assign (stmt)
2478 || (is_gimple_call (stmt)
2479 && gimple_call_lhs (stmt) != NULL_TREE));
2483 /* Return the code of the predicate computed by conditional statement GS. */
2485 static inline enum tree_code
2486 gimple_cond_code (const_gimple gs)
2488 GIMPLE_CHECK (gs, GIMPLE_COND);
2489 return (enum tree_code) gs->gsbase.subcode;
2493 /* Set CODE to be the predicate code for the conditional statement GS. */
2495 static inline void
2496 gimple_cond_set_code (gimple gs, enum tree_code code)
2498 GIMPLE_CHECK (gs, GIMPLE_COND);
2499 gs->gsbase.subcode = code;
2503 /* Return the LHS of the predicate computed by conditional statement GS. */
2505 static inline tree
2506 gimple_cond_lhs (const_gimple gs)
2508 GIMPLE_CHECK (gs, GIMPLE_COND);
2509 return gimple_op (gs, 0);
2512 /* Return the pointer to the LHS of the predicate computed by conditional
2513 statement GS. */
2515 static inline tree *
2516 gimple_cond_lhs_ptr (const_gimple gs)
2518 GIMPLE_CHECK (gs, GIMPLE_COND);
2519 return gimple_op_ptr (gs, 0);
2522 /* Set LHS to be the LHS operand of the predicate computed by
2523 conditional statement GS. */
2525 static inline void
2526 gimple_cond_set_lhs (gimple gs, tree lhs)
2528 GIMPLE_CHECK (gs, GIMPLE_COND);
2529 gimple_set_op (gs, 0, lhs);
2533 /* Return the RHS operand of the predicate computed by conditional GS. */
2535 static inline tree
2536 gimple_cond_rhs (const_gimple gs)
2538 GIMPLE_CHECK (gs, GIMPLE_COND);
2539 return gimple_op (gs, 1);
2542 /* Return the pointer to the RHS operand of the predicate computed by
2543 conditional GS. */
2545 static inline tree *
2546 gimple_cond_rhs_ptr (const_gimple gs)
2548 GIMPLE_CHECK (gs, GIMPLE_COND);
2549 return gimple_op_ptr (gs, 1);
2553 /* Set RHS to be the RHS operand of the predicate computed by
2554 conditional statement GS. */
2556 static inline void
2557 gimple_cond_set_rhs (gimple gs, tree rhs)
2559 GIMPLE_CHECK (gs, GIMPLE_COND);
2560 gimple_set_op (gs, 1, rhs);
2564 /* Return the label used by conditional statement GS when its
2565 predicate evaluates to true. */
2567 static inline tree
2568 gimple_cond_true_label (const_gimple gs)
2570 GIMPLE_CHECK (gs, GIMPLE_COND);
2571 return gimple_op (gs, 2);
2575 /* Set LABEL to be the label used by conditional statement GS when its
2576 predicate evaluates to true. */
2578 static inline void
2579 gimple_cond_set_true_label (gimple gs, tree label)
2581 GIMPLE_CHECK (gs, GIMPLE_COND);
2582 gimple_set_op (gs, 2, label);
2586 /* Set LABEL to be the label used by conditional statement GS when its
2587 predicate evaluates to false. */
2589 static inline void
2590 gimple_cond_set_false_label (gimple gs, tree label)
2592 GIMPLE_CHECK (gs, GIMPLE_COND);
2593 gimple_set_op (gs, 3, label);
2597 /* Return the label used by conditional statement GS when its
2598 predicate evaluates to false. */
2600 static inline tree
2601 gimple_cond_false_label (const_gimple gs)
2603 GIMPLE_CHECK (gs, GIMPLE_COND);
2604 return gimple_op (gs, 3);
2608 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2610 static inline void
2611 gimple_cond_make_false (gimple gs)
2613 gimple_cond_set_lhs (gs, boolean_true_node);
2614 gimple_cond_set_rhs (gs, boolean_false_node);
2615 gs->gsbase.subcode = EQ_EXPR;
2619 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2621 static inline void
2622 gimple_cond_make_true (gimple gs)
2624 gimple_cond_set_lhs (gs, boolean_true_node);
2625 gimple_cond_set_rhs (gs, boolean_true_node);
2626 gs->gsbase.subcode = EQ_EXPR;
2629 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2630 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2632 static inline bool
2633 gimple_cond_true_p (const_gimple gs)
2635 tree lhs = gimple_cond_lhs (gs);
2636 tree rhs = gimple_cond_rhs (gs);
2637 enum tree_code code = gimple_cond_code (gs);
2639 if (lhs != boolean_true_node && lhs != boolean_false_node)
2640 return false;
2642 if (rhs != boolean_true_node && rhs != boolean_false_node)
2643 return false;
2645 if (code == NE_EXPR && lhs != rhs)
2646 return true;
2648 if (code == EQ_EXPR && lhs == rhs)
2649 return true;
2651 return false;
2654 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2655 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2657 static inline bool
2658 gimple_cond_false_p (const_gimple gs)
2660 tree lhs = gimple_cond_lhs (gs);
2661 tree rhs = gimple_cond_rhs (gs);
2662 enum tree_code code = gimple_cond_code (gs);
2664 if (lhs != boolean_true_node && lhs != boolean_false_node)
2665 return false;
2667 if (rhs != boolean_true_node && rhs != boolean_false_node)
2668 return false;
2670 if (code == NE_EXPR && lhs == rhs)
2671 return true;
2673 if (code == EQ_EXPR && lhs != rhs)
2674 return true;
2676 return false;
2679 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2680 'if (var == 1)' */
2682 static inline bool
2683 gimple_cond_single_var_p (gimple gs)
2685 if (gimple_cond_code (gs) == NE_EXPR
2686 && gimple_cond_rhs (gs) == boolean_false_node)
2687 return true;
2689 if (gimple_cond_code (gs) == EQ_EXPR
2690 && gimple_cond_rhs (gs) == boolean_true_node)
2691 return true;
2693 return false;
2696 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2698 static inline void
2699 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2701 gimple_cond_set_code (stmt, code);
2702 gimple_cond_set_lhs (stmt, lhs);
2703 gimple_cond_set_rhs (stmt, rhs);
2706 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2708 static inline tree
2709 gimple_label_label (const_gimple gs)
2711 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2712 return gimple_op (gs, 0);
2716 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2717 GS. */
2719 static inline void
2720 gimple_label_set_label (gimple gs, tree label)
2722 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2723 gimple_set_op (gs, 0, label);
2727 /* Return the destination of the unconditional jump GS. */
2729 static inline tree
2730 gimple_goto_dest (const_gimple gs)
2732 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2733 return gimple_op (gs, 0);
2737 /* Set DEST to be the destination of the unconditonal jump GS. */
2739 static inline void
2740 gimple_goto_set_dest (gimple gs, tree dest)
2742 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2743 gimple_set_op (gs, 0, dest);
2747 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2749 static inline tree
2750 gimple_bind_vars (const_gimple gs)
2752 GIMPLE_CHECK (gs, GIMPLE_BIND);
2753 return gs->gimple_bind.vars;
2757 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2758 statement GS. */
2760 static inline void
2761 gimple_bind_set_vars (gimple gs, tree vars)
2763 GIMPLE_CHECK (gs, GIMPLE_BIND);
2764 gs->gimple_bind.vars = vars;
2768 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2769 statement GS. */
2771 static inline void
2772 gimple_bind_append_vars (gimple gs, tree vars)
2774 GIMPLE_CHECK (gs, GIMPLE_BIND);
2775 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2779 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2781 static inline gimple_seq
2782 gimple_bind_body (gimple gs)
2784 GIMPLE_CHECK (gs, GIMPLE_BIND);
2785 return gs->gimple_bind.body;
2789 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2790 statement GS. */
2792 static inline void
2793 gimple_bind_set_body (gimple gs, gimple_seq seq)
2795 GIMPLE_CHECK (gs, GIMPLE_BIND);
2796 gs->gimple_bind.body = seq;
2800 /* Append a statement to the end of a GIMPLE_BIND's body. */
2802 static inline void
2803 gimple_bind_add_stmt (gimple gs, gimple stmt)
2805 GIMPLE_CHECK (gs, GIMPLE_BIND);
2806 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2810 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2812 static inline void
2813 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2815 GIMPLE_CHECK (gs, GIMPLE_BIND);
2816 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2820 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2821 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2823 static inline tree
2824 gimple_bind_block (const_gimple gs)
2826 GIMPLE_CHECK (gs, GIMPLE_BIND);
2827 return gs->gimple_bind.block;
2831 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2832 statement GS. */
2834 static inline void
2835 gimple_bind_set_block (gimple gs, tree block)
2837 GIMPLE_CHECK (gs, GIMPLE_BIND);
2838 gcc_gimple_checking_assert (block == NULL_TREE
2839 || TREE_CODE (block) == BLOCK);
2840 gs->gimple_bind.block = block;
2844 /* Return the number of input operands for GIMPLE_ASM GS. */
2846 static inline unsigned
2847 gimple_asm_ninputs (const_gimple gs)
2849 GIMPLE_CHECK (gs, GIMPLE_ASM);
2850 return gs->gimple_asm.ni;
2854 /* Return the number of output operands for GIMPLE_ASM GS. */
2856 static inline unsigned
2857 gimple_asm_noutputs (const_gimple gs)
2859 GIMPLE_CHECK (gs, GIMPLE_ASM);
2860 return gs->gimple_asm.no;
2864 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2866 static inline unsigned
2867 gimple_asm_nclobbers (const_gimple gs)
2869 GIMPLE_CHECK (gs, GIMPLE_ASM);
2870 return gs->gimple_asm.nc;
2873 /* Return the number of label operands for GIMPLE_ASM GS. */
2875 static inline unsigned
2876 gimple_asm_nlabels (const_gimple gs)
2878 GIMPLE_CHECK (gs, GIMPLE_ASM);
2879 return gs->gimple_asm.nl;
2882 /* Return input operand INDEX of GIMPLE_ASM GS. */
2884 static inline tree
2885 gimple_asm_input_op (const_gimple gs, unsigned index)
2887 GIMPLE_CHECK (gs, GIMPLE_ASM);
2888 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2889 return gimple_op (gs, index);
2892 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2894 static inline tree *
2895 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2897 GIMPLE_CHECK (gs, GIMPLE_ASM);
2898 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2899 return gimple_op_ptr (gs, index);
2903 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2905 static inline void
2906 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2908 GIMPLE_CHECK (gs, GIMPLE_ASM);
2909 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
2910 && TREE_CODE (in_op) == TREE_LIST);
2911 gimple_set_op (gs, index, in_op);
2915 /* Return output operand INDEX of GIMPLE_ASM GS. */
2917 static inline tree
2918 gimple_asm_output_op (const_gimple gs, unsigned index)
2920 GIMPLE_CHECK (gs, GIMPLE_ASM);
2921 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2922 return gimple_op (gs, index + gs->gimple_asm.ni);
2925 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2927 static inline tree *
2928 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2930 GIMPLE_CHECK (gs, GIMPLE_ASM);
2931 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2932 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2936 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2938 static inline void
2939 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2941 GIMPLE_CHECK (gs, GIMPLE_ASM);
2942 gcc_gimple_checking_assert (index <= gs->gimple_asm.no
2943 && TREE_CODE (out_op) == TREE_LIST);
2944 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2948 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2950 static inline tree
2951 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2953 GIMPLE_CHECK (gs, GIMPLE_ASM);
2954 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
2955 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2959 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2961 static inline void
2962 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2964 GIMPLE_CHECK (gs, GIMPLE_ASM);
2965 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
2966 && TREE_CODE (clobber_op) == TREE_LIST);
2967 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2970 /* Return label operand INDEX of GIMPLE_ASM GS. */
2972 static inline tree
2973 gimple_asm_label_op (const_gimple gs, unsigned index)
2975 GIMPLE_CHECK (gs, GIMPLE_ASM);
2976 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
2977 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
2980 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
2982 static inline void
2983 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
2985 GIMPLE_CHECK (gs, GIMPLE_ASM);
2986 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
2987 && TREE_CODE (label_op) == TREE_LIST);
2988 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
2991 /* Return the string representing the assembly instruction in
2992 GIMPLE_ASM GS. */
2994 static inline const char *
2995 gimple_asm_string (const_gimple gs)
2997 GIMPLE_CHECK (gs, GIMPLE_ASM);
2998 return gs->gimple_asm.string;
3002 /* Return true if GS is an asm statement marked volatile. */
3004 static inline bool
3005 gimple_asm_volatile_p (const_gimple gs)
3007 GIMPLE_CHECK (gs, GIMPLE_ASM);
3008 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3012 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3014 static inline void
3015 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3017 GIMPLE_CHECK (gs, GIMPLE_ASM);
3018 if (volatile_p)
3019 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3020 else
3021 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3025 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3027 static inline void
3028 gimple_asm_set_input (gimple gs, bool input_p)
3030 GIMPLE_CHECK (gs, GIMPLE_ASM);
3031 if (input_p)
3032 gs->gsbase.subcode |= GF_ASM_INPUT;
3033 else
3034 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3038 /* Return true if asm GS is an ASM_INPUT. */
3040 static inline bool
3041 gimple_asm_input_p (const_gimple gs)
3043 GIMPLE_CHECK (gs, GIMPLE_ASM);
3044 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3048 /* Return the types handled by GIMPLE_CATCH statement GS. */
3050 static inline tree
3051 gimple_catch_types (const_gimple gs)
3053 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3054 return gs->gimple_catch.types;
3058 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3060 static inline tree *
3061 gimple_catch_types_ptr (gimple gs)
3063 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3064 return &gs->gimple_catch.types;
3068 /* Return the GIMPLE sequence representing the body of the handler of
3069 GIMPLE_CATCH statement GS. */
3071 static inline gimple_seq
3072 gimple_catch_handler (gimple gs)
3074 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3075 return gs->gimple_catch.handler;
3079 /* Return a pointer to the GIMPLE sequence representing the body of
3080 the handler of GIMPLE_CATCH statement GS. */
3082 static inline gimple_seq *
3083 gimple_catch_handler_ptr (gimple gs)
3085 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3086 return &gs->gimple_catch.handler;
3090 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3092 static inline void
3093 gimple_catch_set_types (gimple gs, tree t)
3095 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3096 gs->gimple_catch.types = t;
3100 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3102 static inline void
3103 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3105 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3106 gs->gimple_catch.handler = handler;
3110 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3112 static inline tree
3113 gimple_eh_filter_types (const_gimple gs)
3115 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3116 return gs->gimple_eh_filter.types;
3120 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3121 GS. */
3123 static inline tree *
3124 gimple_eh_filter_types_ptr (gimple gs)
3126 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3127 return &gs->gimple_eh_filter.types;
3131 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3132 statement fails. */
3134 static inline gimple_seq
3135 gimple_eh_filter_failure (gimple gs)
3137 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3138 return gs->gimple_eh_filter.failure;
3142 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3144 static inline void
3145 gimple_eh_filter_set_types (gimple gs, tree types)
3147 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3148 gs->gimple_eh_filter.types = types;
3152 /* Set FAILURE to be the sequence of statements to execute on failure
3153 for GIMPLE_EH_FILTER GS. */
3155 static inline void
3156 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3158 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3159 gs->gimple_eh_filter.failure = failure;
3162 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3164 static inline tree
3165 gimple_eh_must_not_throw_fndecl (gimple gs)
3167 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3168 return gs->gimple_eh_mnt.fndecl;
3171 /* Set the function decl to be called by GS to DECL. */
3173 static inline void
3174 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3176 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3177 gs->gimple_eh_mnt.fndecl = decl;
3181 /* GIMPLE_TRY accessors. */
3183 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3184 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3186 static inline enum gimple_try_flags
3187 gimple_try_kind (const_gimple gs)
3189 GIMPLE_CHECK (gs, GIMPLE_TRY);
3190 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3194 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3196 static inline void
3197 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3199 GIMPLE_CHECK (gs, GIMPLE_TRY);
3200 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3201 || kind == GIMPLE_TRY_FINALLY);
3202 if (gimple_try_kind (gs) != kind)
3203 gs->gsbase.subcode = (unsigned int) kind;
3207 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3209 static inline bool
3210 gimple_try_catch_is_cleanup (const_gimple gs)
3212 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3213 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3217 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3219 static inline gimple_seq
3220 gimple_try_eval (gimple gs)
3222 GIMPLE_CHECK (gs, GIMPLE_TRY);
3223 return gs->gimple_try.eval;
3227 /* Return the sequence of statements used as the cleanup body for
3228 GIMPLE_TRY GS. */
3230 static inline gimple_seq
3231 gimple_try_cleanup (gimple gs)
3233 GIMPLE_CHECK (gs, GIMPLE_TRY);
3234 return gs->gimple_try.cleanup;
3238 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3240 static inline void
3241 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3243 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3244 if (catch_is_cleanup)
3245 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3246 else
3247 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3251 /* Set EVAL to be the sequence of statements to use as the body for
3252 GIMPLE_TRY GS. */
3254 static inline void
3255 gimple_try_set_eval (gimple gs, gimple_seq eval)
3257 GIMPLE_CHECK (gs, GIMPLE_TRY);
3258 gs->gimple_try.eval = eval;
3262 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3263 body for GIMPLE_TRY GS. */
3265 static inline void
3266 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3268 GIMPLE_CHECK (gs, GIMPLE_TRY);
3269 gs->gimple_try.cleanup = cleanup;
3273 /* Return the cleanup sequence for cleanup statement GS. */
3275 static inline gimple_seq
3276 gimple_wce_cleanup (gimple gs)
3278 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3279 return gs->gimple_wce.cleanup;
3283 /* Set CLEANUP to be the cleanup sequence for GS. */
3285 static inline void
3286 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3288 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3289 gs->gimple_wce.cleanup = cleanup;
3293 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3295 static inline bool
3296 gimple_wce_cleanup_eh_only (const_gimple gs)
3298 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3299 return gs->gsbase.subcode != 0;
3303 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3305 static inline void
3306 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3308 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3309 gs->gsbase.subcode = (unsigned int) eh_only_p;
3313 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3315 static inline unsigned
3316 gimple_phi_capacity (const_gimple gs)
3318 GIMPLE_CHECK (gs, GIMPLE_PHI);
3319 return gs->gimple_phi.capacity;
3323 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3324 be exactly the number of incoming edges for the basic block holding
3325 GS. */
3327 static inline unsigned
3328 gimple_phi_num_args (const_gimple gs)
3330 GIMPLE_CHECK (gs, GIMPLE_PHI);
3331 return gs->gimple_phi.nargs;
3335 /* Return the SSA name created by GIMPLE_PHI GS. */
3337 static inline tree
3338 gimple_phi_result (const_gimple gs)
3340 GIMPLE_CHECK (gs, GIMPLE_PHI);
3341 return gs->gimple_phi.result;
3344 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3346 static inline tree *
3347 gimple_phi_result_ptr (gimple gs)
3349 GIMPLE_CHECK (gs, GIMPLE_PHI);
3350 return &gs->gimple_phi.result;
3353 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3355 static inline void
3356 gimple_phi_set_result (gimple gs, tree result)
3358 GIMPLE_CHECK (gs, GIMPLE_PHI);
3359 gs->gimple_phi.result = result;
3363 /* Return the PHI argument corresponding to incoming edge INDEX for
3364 GIMPLE_PHI GS. */
3366 static inline struct phi_arg_d *
3367 gimple_phi_arg (gimple gs, unsigned index)
3369 GIMPLE_CHECK (gs, GIMPLE_PHI);
3370 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3371 return &(gs->gimple_phi.args[index]);
3374 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3375 for GIMPLE_PHI GS. */
3377 static inline void
3378 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3380 GIMPLE_CHECK (gs, GIMPLE_PHI);
3381 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3382 gs->gimple_phi.args[index] = *phiarg;
3385 /* Return the region number for GIMPLE_RESX GS. */
3387 static inline int
3388 gimple_resx_region (const_gimple gs)
3390 GIMPLE_CHECK (gs, GIMPLE_RESX);
3391 return gs->gimple_eh_ctrl.region;
3394 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3396 static inline void
3397 gimple_resx_set_region (gimple gs, int region)
3399 GIMPLE_CHECK (gs, GIMPLE_RESX);
3400 gs->gimple_eh_ctrl.region = region;
3403 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3405 static inline int
3406 gimple_eh_dispatch_region (const_gimple gs)
3408 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3409 return gs->gimple_eh_ctrl.region;
3412 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3414 static inline void
3415 gimple_eh_dispatch_set_region (gimple gs, int region)
3417 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3418 gs->gimple_eh_ctrl.region = region;
3421 /* Return the number of labels associated with the switch statement GS. */
3423 static inline unsigned
3424 gimple_switch_num_labels (const_gimple gs)
3426 unsigned num_ops;
3427 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3428 num_ops = gimple_num_ops (gs);
3429 gcc_gimple_checking_assert (num_ops > 1);
3430 return num_ops - 1;
3434 /* Set NLABELS to be the number of labels for the switch statement GS. */
3436 static inline void
3437 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3439 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3440 gimple_set_num_ops (g, nlabels + 1);
3444 /* Return the index variable used by the switch statement GS. */
3446 static inline tree
3447 gimple_switch_index (const_gimple gs)
3449 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3450 return gimple_op (gs, 0);
3454 /* Return a pointer to the index variable for the switch statement GS. */
3456 static inline tree *
3457 gimple_switch_index_ptr (const_gimple gs)
3459 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3460 return gimple_op_ptr (gs, 0);
3464 /* Set INDEX to be the index variable for switch statement GS. */
3466 static inline void
3467 gimple_switch_set_index (gimple gs, tree index)
3469 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3470 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3471 gimple_set_op (gs, 0, index);
3475 /* Return the label numbered INDEX. The default label is 0, followed by any
3476 labels in a switch statement. */
3478 static inline tree
3479 gimple_switch_label (const_gimple gs, unsigned index)
3481 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3482 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3483 return gimple_op (gs, index + 1);
3486 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3488 static inline void
3489 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3491 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3492 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3493 && (label == NULL_TREE
3494 || TREE_CODE (label) == CASE_LABEL_EXPR));
3495 gimple_set_op (gs, index + 1, label);
3498 /* Return the default label for a switch statement. */
3500 static inline tree
3501 gimple_switch_default_label (const_gimple gs)
3503 return gimple_switch_label (gs, 0);
3506 /* Set the default label for a switch statement. */
3508 static inline void
3509 gimple_switch_set_default_label (gimple gs, tree label)
3511 gimple_switch_set_label (gs, 0, label);
3514 /* Return true if GS is a GIMPLE_DEBUG statement. */
3516 static inline bool
3517 is_gimple_debug (const_gimple gs)
3519 return gimple_code (gs) == GIMPLE_DEBUG;
3522 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3524 static inline bool
3525 gimple_debug_bind_p (const_gimple s)
3527 if (is_gimple_debug (s))
3528 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3530 return false;
3533 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3535 static inline tree
3536 gimple_debug_bind_get_var (gimple dbg)
3538 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3539 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3540 return gimple_op (dbg, 0);
3543 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3544 statement. */
3546 static inline tree
3547 gimple_debug_bind_get_value (gimple dbg)
3549 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3550 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3551 return gimple_op (dbg, 1);
3554 /* Return a pointer to the value bound to the variable in a
3555 GIMPLE_DEBUG bind statement. */
3557 static inline tree *
3558 gimple_debug_bind_get_value_ptr (gimple dbg)
3560 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3561 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3562 return gimple_op_ptr (dbg, 1);
3565 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3567 static inline void
3568 gimple_debug_bind_set_var (gimple dbg, tree var)
3570 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3571 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3572 gimple_set_op (dbg, 0, var);
3575 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3576 statement. */
3578 static inline void
3579 gimple_debug_bind_set_value (gimple dbg, tree value)
3581 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3582 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3583 gimple_set_op (dbg, 1, value);
3586 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3587 optimized away. */
3588 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3590 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3591 statement. */
3593 static inline void
3594 gimple_debug_bind_reset_value (gimple dbg)
3596 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3597 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3598 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3601 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3602 value. */
3604 static inline bool
3605 gimple_debug_bind_has_value_p (gimple dbg)
3607 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3608 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3609 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3612 #undef GIMPLE_DEBUG_BIND_NOVALUE
3614 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3616 static inline bool
3617 gimple_debug_source_bind_p (const_gimple s)
3619 if (is_gimple_debug (s))
3620 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3622 return false;
3625 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3627 static inline tree
3628 gimple_debug_source_bind_get_var (gimple dbg)
3630 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3631 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3632 return gimple_op (dbg, 0);
3635 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3636 statement. */
3638 static inline tree
3639 gimple_debug_source_bind_get_value (gimple dbg)
3641 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3642 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3643 return gimple_op (dbg, 1);
3646 /* Return a pointer to the value bound to the variable in a
3647 GIMPLE_DEBUG source bind statement. */
3649 static inline tree *
3650 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3652 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3653 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3654 return gimple_op_ptr (dbg, 1);
3657 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3659 static inline void
3660 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3662 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3663 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3664 gimple_set_op (dbg, 0, var);
3667 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3668 statement. */
3670 static inline void
3671 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3673 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3674 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3675 gimple_set_op (dbg, 1, value);
3678 /* Return the body for the OMP statement GS. */
3680 static inline gimple_seq
3681 gimple_omp_body (gimple gs)
3683 return gs->omp.body;
3686 /* Set BODY to be the body for the OMP statement GS. */
3688 static inline void
3689 gimple_omp_set_body (gimple gs, gimple_seq body)
3691 gs->omp.body = body;
3695 /* Return the name associated with OMP_CRITICAL statement GS. */
3697 static inline tree
3698 gimple_omp_critical_name (const_gimple gs)
3700 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3701 return gs->gimple_omp_critical.name;
3705 /* Return a pointer to the name associated with OMP critical statement GS. */
3707 static inline tree *
3708 gimple_omp_critical_name_ptr (gimple gs)
3710 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3711 return &gs->gimple_omp_critical.name;
3715 /* Set NAME to be the name associated with OMP critical statement GS. */
3717 static inline void
3718 gimple_omp_critical_set_name (gimple gs, tree name)
3720 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3721 gs->gimple_omp_critical.name = name;
3725 /* Return the clauses associated with OMP_FOR GS. */
3727 static inline tree
3728 gimple_omp_for_clauses (const_gimple gs)
3730 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3731 return gs->gimple_omp_for.clauses;
3735 /* Return a pointer to the OMP_FOR GS. */
3737 static inline tree *
3738 gimple_omp_for_clauses_ptr (gimple gs)
3740 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3741 return &gs->gimple_omp_for.clauses;
3745 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3747 static inline void
3748 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3750 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3751 gs->gimple_omp_for.clauses = clauses;
3755 /* Get the collapse count of OMP_FOR GS. */
3757 static inline size_t
3758 gimple_omp_for_collapse (gimple gs)
3760 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3761 return gs->gimple_omp_for.collapse;
3765 /* Return the index variable for OMP_FOR GS. */
3767 static inline tree
3768 gimple_omp_for_index (const_gimple gs, size_t i)
3770 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3771 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3772 return gs->gimple_omp_for.iter[i].index;
3776 /* Return a pointer to the index variable for OMP_FOR GS. */
3778 static inline tree *
3779 gimple_omp_for_index_ptr (gimple gs, size_t i)
3781 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3782 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3783 return &gs->gimple_omp_for.iter[i].index;
3787 /* Set INDEX to be the index variable for OMP_FOR GS. */
3789 static inline void
3790 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3792 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3793 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3794 gs->gimple_omp_for.iter[i].index = index;
3798 /* Return the initial value for OMP_FOR GS. */
3800 static inline tree
3801 gimple_omp_for_initial (const_gimple gs, size_t i)
3803 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3804 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3805 return gs->gimple_omp_for.iter[i].initial;
3809 /* Return a pointer to the initial value for OMP_FOR GS. */
3811 static inline tree *
3812 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3814 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3815 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3816 return &gs->gimple_omp_for.iter[i].initial;
3820 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3822 static inline void
3823 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3825 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3826 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3827 gs->gimple_omp_for.iter[i].initial = initial;
3831 /* Return the final value for OMP_FOR GS. */
3833 static inline tree
3834 gimple_omp_for_final (const_gimple gs, size_t i)
3836 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3837 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3838 return gs->gimple_omp_for.iter[i].final;
3842 /* Return a pointer to the final value for OMP_FOR GS. */
3844 static inline tree *
3845 gimple_omp_for_final_ptr (gimple gs, size_t i)
3847 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3848 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3849 return &gs->gimple_omp_for.iter[i].final;
3853 /* Set FINAL to be the final value for OMP_FOR GS. */
3855 static inline void
3856 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3858 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3859 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3860 gs->gimple_omp_for.iter[i].final = final;
3864 /* Return the increment value for OMP_FOR GS. */
3866 static inline tree
3867 gimple_omp_for_incr (const_gimple gs, size_t i)
3869 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3870 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3871 return gs->gimple_omp_for.iter[i].incr;
3875 /* Return a pointer to the increment value for OMP_FOR GS. */
3877 static inline tree *
3878 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3880 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3881 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3882 return &gs->gimple_omp_for.iter[i].incr;
3886 /* Set INCR to be the increment value for OMP_FOR GS. */
3888 static inline void
3889 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3891 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3892 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3893 gs->gimple_omp_for.iter[i].incr = incr;
3897 /* Return the sequence of statements to execute before the OMP_FOR
3898 statement GS starts. */
3900 static inline gimple_seq
3901 gimple_omp_for_pre_body (gimple gs)
3903 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3904 return gs->gimple_omp_for.pre_body;
3908 /* Set PRE_BODY to be the sequence of statements to execute before the
3909 OMP_FOR statement GS starts. */
3911 static inline void
3912 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3914 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3915 gs->gimple_omp_for.pre_body = pre_body;
3919 /* Return the clauses associated with OMP_PARALLEL GS. */
3921 static inline tree
3922 gimple_omp_parallel_clauses (const_gimple gs)
3924 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3925 return gs->gimple_omp_parallel.clauses;
3929 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3931 static inline tree *
3932 gimple_omp_parallel_clauses_ptr (gimple gs)
3934 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3935 return &gs->gimple_omp_parallel.clauses;
3939 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
3940 GS. */
3942 static inline void
3943 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
3945 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3946 gs->gimple_omp_parallel.clauses = clauses;
3950 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
3952 static inline tree
3953 gimple_omp_parallel_child_fn (const_gimple gs)
3955 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3956 return gs->gimple_omp_parallel.child_fn;
3959 /* Return a pointer to the child function used to hold the body of
3960 OMP_PARALLEL GS. */
3962 static inline tree *
3963 gimple_omp_parallel_child_fn_ptr (gimple gs)
3965 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3966 return &gs->gimple_omp_parallel.child_fn;
3970 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
3972 static inline void
3973 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
3975 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3976 gs->gimple_omp_parallel.child_fn = child_fn;
3980 /* Return the artificial argument used to send variables and values
3981 from the parent to the children threads in OMP_PARALLEL GS. */
3983 static inline tree
3984 gimple_omp_parallel_data_arg (const_gimple gs)
3986 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3987 return gs->gimple_omp_parallel.data_arg;
3991 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
3993 static inline tree *
3994 gimple_omp_parallel_data_arg_ptr (gimple gs)
3996 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3997 return &gs->gimple_omp_parallel.data_arg;
4001 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4003 static inline void
4004 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4006 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4007 gs->gimple_omp_parallel.data_arg = data_arg;
4011 /* Return the clauses associated with OMP_TASK GS. */
4013 static inline tree
4014 gimple_omp_task_clauses (const_gimple gs)
4016 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4017 return gs->gimple_omp_parallel.clauses;
4021 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4023 static inline tree *
4024 gimple_omp_task_clauses_ptr (gimple gs)
4026 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4027 return &gs->gimple_omp_parallel.clauses;
4031 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4032 GS. */
4034 static inline void
4035 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4037 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4038 gs->gimple_omp_parallel.clauses = clauses;
4042 /* Return the child function used to hold the body of OMP_TASK GS. */
4044 static inline tree
4045 gimple_omp_task_child_fn (const_gimple gs)
4047 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4048 return gs->gimple_omp_parallel.child_fn;
4051 /* Return a pointer to the child function used to hold the body of
4052 OMP_TASK GS. */
4054 static inline tree *
4055 gimple_omp_task_child_fn_ptr (gimple gs)
4057 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4058 return &gs->gimple_omp_parallel.child_fn;
4062 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4064 static inline void
4065 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4067 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4068 gs->gimple_omp_parallel.child_fn = child_fn;
4072 /* Return the artificial argument used to send variables and values
4073 from the parent to the children threads in OMP_TASK GS. */
4075 static inline tree
4076 gimple_omp_task_data_arg (const_gimple gs)
4078 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4079 return gs->gimple_omp_parallel.data_arg;
4083 /* Return a pointer to the data argument for OMP_TASK GS. */
4085 static inline tree *
4086 gimple_omp_task_data_arg_ptr (gimple gs)
4088 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4089 return &gs->gimple_omp_parallel.data_arg;
4093 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4095 static inline void
4096 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4098 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4099 gs->gimple_omp_parallel.data_arg = data_arg;
4103 /* Return the clauses associated with OMP_TASK GS. */
4105 static inline tree
4106 gimple_omp_taskreg_clauses (const_gimple gs)
4108 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4109 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4110 return gs->gimple_omp_parallel.clauses;
4114 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4116 static inline tree *
4117 gimple_omp_taskreg_clauses_ptr (gimple gs)
4119 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4120 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4121 return &gs->gimple_omp_parallel.clauses;
4125 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4126 GS. */
4128 static inline void
4129 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4131 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4132 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4133 gs->gimple_omp_parallel.clauses = clauses;
4137 /* Return the child function used to hold the body of OMP_TASK GS. */
4139 static inline tree
4140 gimple_omp_taskreg_child_fn (const_gimple gs)
4142 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4143 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4144 return gs->gimple_omp_parallel.child_fn;
4147 /* Return a pointer to the child function used to hold the body of
4148 OMP_TASK GS. */
4150 static inline tree *
4151 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4153 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4154 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4155 return &gs->gimple_omp_parallel.child_fn;
4159 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4161 static inline void
4162 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4164 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4165 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4166 gs->gimple_omp_parallel.child_fn = child_fn;
4170 /* Return the artificial argument used to send variables and values
4171 from the parent to the children threads in OMP_TASK GS. */
4173 static inline tree
4174 gimple_omp_taskreg_data_arg (const_gimple gs)
4176 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4177 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4178 return gs->gimple_omp_parallel.data_arg;
4182 /* Return a pointer to the data argument for OMP_TASK GS. */
4184 static inline tree *
4185 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4187 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4188 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4189 return &gs->gimple_omp_parallel.data_arg;
4193 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4195 static inline void
4196 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4198 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4199 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4200 gs->gimple_omp_parallel.data_arg = data_arg;
4204 /* Return the copy function used to hold the body of OMP_TASK GS. */
4206 static inline tree
4207 gimple_omp_task_copy_fn (const_gimple gs)
4209 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4210 return gs->gimple_omp_task.copy_fn;
4213 /* Return a pointer to the copy function used to hold the body of
4214 OMP_TASK GS. */
4216 static inline tree *
4217 gimple_omp_task_copy_fn_ptr (gimple gs)
4219 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4220 return &gs->gimple_omp_task.copy_fn;
4224 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4226 static inline void
4227 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4229 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4230 gs->gimple_omp_task.copy_fn = copy_fn;
4234 /* Return size of the data block in bytes in OMP_TASK GS. */
4236 static inline tree
4237 gimple_omp_task_arg_size (const_gimple gs)
4239 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4240 return gs->gimple_omp_task.arg_size;
4244 /* Return a pointer to the data block size for OMP_TASK GS. */
4246 static inline tree *
4247 gimple_omp_task_arg_size_ptr (gimple gs)
4249 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4250 return &gs->gimple_omp_task.arg_size;
4254 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4256 static inline void
4257 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4259 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4260 gs->gimple_omp_task.arg_size = arg_size;
4264 /* Return align of the data block in bytes in OMP_TASK GS. */
4266 static inline tree
4267 gimple_omp_task_arg_align (const_gimple gs)
4269 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4270 return gs->gimple_omp_task.arg_align;
4274 /* Return a pointer to the data block align for OMP_TASK GS. */
4276 static inline tree *
4277 gimple_omp_task_arg_align_ptr (gimple gs)
4279 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4280 return &gs->gimple_omp_task.arg_align;
4284 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4286 static inline void
4287 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4289 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4290 gs->gimple_omp_task.arg_align = arg_align;
4294 /* Return the clauses associated with OMP_SINGLE GS. */
4296 static inline tree
4297 gimple_omp_single_clauses (const_gimple gs)
4299 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4300 return gs->gimple_omp_single.clauses;
4304 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4306 static inline tree *
4307 gimple_omp_single_clauses_ptr (gimple gs)
4309 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4310 return &gs->gimple_omp_single.clauses;
4314 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4316 static inline void
4317 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4319 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4320 gs->gimple_omp_single.clauses = clauses;
4324 /* Return the clauses associated with OMP_SECTIONS GS. */
4326 static inline tree
4327 gimple_omp_sections_clauses (const_gimple gs)
4329 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4330 return gs->gimple_omp_sections.clauses;
4334 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4336 static inline tree *
4337 gimple_omp_sections_clauses_ptr (gimple gs)
4339 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4340 return &gs->gimple_omp_sections.clauses;
4344 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4345 GS. */
4347 static inline void
4348 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4350 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4351 gs->gimple_omp_sections.clauses = clauses;
4355 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4356 in GS. */
4358 static inline tree
4359 gimple_omp_sections_control (const_gimple gs)
4361 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4362 return gs->gimple_omp_sections.control;
4366 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4367 GS. */
4369 static inline tree *
4370 gimple_omp_sections_control_ptr (gimple gs)
4372 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4373 return &gs->gimple_omp_sections.control;
4377 /* Set CONTROL to be the set of clauses associated with the
4378 GIMPLE_OMP_SECTIONS in GS. */
4380 static inline void
4381 gimple_omp_sections_set_control (gimple gs, tree control)
4383 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4384 gs->gimple_omp_sections.control = control;
4388 /* Set COND to be the condition code for OMP_FOR GS. */
4390 static inline void
4391 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4393 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4394 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4395 && i < gs->gimple_omp_for.collapse);
4396 gs->gimple_omp_for.iter[i].cond = cond;
4400 /* Return the condition code associated with OMP_FOR GS. */
4402 static inline enum tree_code
4403 gimple_omp_for_cond (const_gimple gs, size_t i)
4405 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4406 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4407 return gs->gimple_omp_for.iter[i].cond;
4411 /* Set the value being stored in an atomic store. */
4413 static inline void
4414 gimple_omp_atomic_store_set_val (gimple g, tree val)
4416 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4417 g->gimple_omp_atomic_store.val = val;
4421 /* Return the value being stored in an atomic store. */
4423 static inline tree
4424 gimple_omp_atomic_store_val (const_gimple g)
4426 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4427 return g->gimple_omp_atomic_store.val;
4431 /* Return a pointer to the value being stored in an atomic store. */
4433 static inline tree *
4434 gimple_omp_atomic_store_val_ptr (gimple g)
4436 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4437 return &g->gimple_omp_atomic_store.val;
4441 /* Set the LHS of an atomic load. */
4443 static inline void
4444 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4446 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4447 g->gimple_omp_atomic_load.lhs = lhs;
4451 /* Get the LHS of an atomic load. */
4453 static inline tree
4454 gimple_omp_atomic_load_lhs (const_gimple g)
4456 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4457 return g->gimple_omp_atomic_load.lhs;
4461 /* Return a pointer to the LHS of an atomic load. */
4463 static inline tree *
4464 gimple_omp_atomic_load_lhs_ptr (gimple g)
4466 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4467 return &g->gimple_omp_atomic_load.lhs;
4471 /* Set the RHS of an atomic load. */
4473 static inline void
4474 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4476 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4477 g->gimple_omp_atomic_load.rhs = rhs;
4481 /* Get the RHS of an atomic load. */
4483 static inline tree
4484 gimple_omp_atomic_load_rhs (const_gimple g)
4486 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4487 return g->gimple_omp_atomic_load.rhs;
4491 /* Return a pointer to the RHS of an atomic load. */
4493 static inline tree *
4494 gimple_omp_atomic_load_rhs_ptr (gimple g)
4496 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4497 return &g->gimple_omp_atomic_load.rhs;
4501 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4503 static inline tree
4504 gimple_omp_continue_control_def (const_gimple g)
4506 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4507 return g->gimple_omp_continue.control_def;
4510 /* The same as above, but return the address. */
4512 static inline tree *
4513 gimple_omp_continue_control_def_ptr (gimple g)
4515 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4516 return &g->gimple_omp_continue.control_def;
4519 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4521 static inline void
4522 gimple_omp_continue_set_control_def (gimple g, tree def)
4524 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4525 g->gimple_omp_continue.control_def = def;
4529 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4531 static inline tree
4532 gimple_omp_continue_control_use (const_gimple g)
4534 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4535 return g->gimple_omp_continue.control_use;
4539 /* The same as above, but return the address. */
4541 static inline tree *
4542 gimple_omp_continue_control_use_ptr (gimple g)
4544 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4545 return &g->gimple_omp_continue.control_use;
4549 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4551 static inline void
4552 gimple_omp_continue_set_control_use (gimple g, tree use)
4554 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4555 g->gimple_omp_continue.control_use = use;
4559 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4561 static inline tree *
4562 gimple_return_retval_ptr (const_gimple gs)
4564 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4565 return gimple_op_ptr (gs, 0);
4568 /* Return the return value for GIMPLE_RETURN GS. */
4570 static inline tree
4571 gimple_return_retval (const_gimple gs)
4573 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4574 return gimple_op (gs, 0);
4578 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4580 static inline void
4581 gimple_return_set_retval (gimple gs, tree retval)
4583 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4584 gimple_set_op (gs, 0, retval);
4588 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4590 #define CASE_GIMPLE_OMP \
4591 case GIMPLE_OMP_PARALLEL: \
4592 case GIMPLE_OMP_TASK: \
4593 case GIMPLE_OMP_FOR: \
4594 case GIMPLE_OMP_SECTIONS: \
4595 case GIMPLE_OMP_SECTIONS_SWITCH: \
4596 case GIMPLE_OMP_SINGLE: \
4597 case GIMPLE_OMP_SECTION: \
4598 case GIMPLE_OMP_MASTER: \
4599 case GIMPLE_OMP_ORDERED: \
4600 case GIMPLE_OMP_CRITICAL: \
4601 case GIMPLE_OMP_RETURN: \
4602 case GIMPLE_OMP_ATOMIC_LOAD: \
4603 case GIMPLE_OMP_ATOMIC_STORE: \
4604 case GIMPLE_OMP_CONTINUE
4606 static inline bool
4607 is_gimple_omp (const_gimple stmt)
4609 switch (gimple_code (stmt))
4611 CASE_GIMPLE_OMP:
4612 return true;
4613 default:
4614 return false;
4619 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4621 static inline bool
4622 gimple_nop_p (const_gimple g)
4624 return gimple_code (g) == GIMPLE_NOP;
4628 /* Return true if GS is a GIMPLE_RESX. */
4630 static inline bool
4631 is_gimple_resx (const_gimple gs)
4633 return gimple_code (gs) == GIMPLE_RESX;
4636 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4638 static inline enum br_predictor
4639 gimple_predict_predictor (gimple gs)
4641 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4642 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4646 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4648 static inline void
4649 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4651 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4652 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4653 | (unsigned) predictor;
4657 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4659 static inline enum prediction
4660 gimple_predict_outcome (gimple gs)
4662 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4663 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4667 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4669 static inline void
4670 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4672 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4673 if (outcome == TAKEN)
4674 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4675 else
4676 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4680 /* Return the type of the main expression computed by STMT. Return
4681 void_type_node if the statement computes nothing. */
4683 static inline tree
4684 gimple_expr_type (const_gimple stmt)
4686 enum gimple_code code = gimple_code (stmt);
4688 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4690 tree type;
4691 /* In general we want to pass out a type that can be substituted
4692 for both the RHS and the LHS types if there is a possibly
4693 useless conversion involved. That means returning the
4694 original RHS type as far as we can reconstruct it. */
4695 if (code == GIMPLE_CALL)
4696 type = gimple_call_return_type (stmt);
4697 else
4698 switch (gimple_assign_rhs_code (stmt))
4700 case POINTER_PLUS_EXPR:
4701 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4702 break;
4704 default:
4705 /* As fallback use the type of the LHS. */
4706 type = TREE_TYPE (gimple_get_lhs (stmt));
4707 break;
4709 return type;
4711 else if (code == GIMPLE_COND)
4712 return boolean_type_node;
4713 else
4714 return void_type_node;
4718 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4720 static inline gimple_stmt_iterator
4721 gsi_start (gimple_seq seq)
4723 gimple_stmt_iterator i;
4725 i.ptr = gimple_seq_first (seq);
4726 i.seq = seq;
4727 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4729 return i;
4733 /* Return a new iterator pointing to the first statement in basic block BB. */
4735 static inline gimple_stmt_iterator
4736 gsi_start_bb (basic_block bb)
4738 gimple_stmt_iterator i;
4739 gimple_seq seq;
4741 seq = bb_seq (bb);
4742 i.ptr = gimple_seq_first (seq);
4743 i.seq = seq;
4744 i.bb = bb;
4746 return i;
4750 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4752 static inline gimple_stmt_iterator
4753 gsi_last (gimple_seq seq)
4755 gimple_stmt_iterator i;
4757 i.ptr = gimple_seq_last (seq);
4758 i.seq = seq;
4759 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4761 return i;
4765 /* Return a new iterator pointing to the last statement in basic block BB. */
4767 static inline gimple_stmt_iterator
4768 gsi_last_bb (basic_block bb)
4770 gimple_stmt_iterator i;
4771 gimple_seq seq;
4773 seq = bb_seq (bb);
4774 i.ptr = gimple_seq_last (seq);
4775 i.seq = seq;
4776 i.bb = bb;
4778 return i;
4782 /* Return true if I is at the end of its sequence. */
4784 static inline bool
4785 gsi_end_p (gimple_stmt_iterator i)
4787 return i.ptr == NULL;
4791 /* Return true if I is one statement before the end of its sequence. */
4793 static inline bool
4794 gsi_one_before_end_p (gimple_stmt_iterator i)
4796 return i.ptr != NULL && i.ptr->next == NULL;
4800 /* Advance the iterator to the next gimple statement. */
4802 static inline void
4803 gsi_next (gimple_stmt_iterator *i)
4805 i->ptr = i->ptr->next;
4808 /* Advance the iterator to the previous gimple statement. */
4810 static inline void
4811 gsi_prev (gimple_stmt_iterator *i)
4813 i->ptr = i->ptr->prev;
4816 /* Return the current stmt. */
4818 static inline gimple
4819 gsi_stmt (gimple_stmt_iterator i)
4821 return i.ptr->stmt;
4824 /* Return a block statement iterator that points to the first non-label
4825 statement in block BB. */
4827 static inline gimple_stmt_iterator
4828 gsi_after_labels (basic_block bb)
4830 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4832 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4833 gsi_next (&gsi);
4835 return gsi;
4838 /* Advance the iterator to the next non-debug gimple statement. */
4840 static inline void
4841 gsi_next_nondebug (gimple_stmt_iterator *i)
4845 gsi_next (i);
4847 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4850 /* Advance the iterator to the next non-debug gimple statement. */
4852 static inline void
4853 gsi_prev_nondebug (gimple_stmt_iterator *i)
4857 gsi_prev (i);
4859 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4862 /* Return a new iterator pointing to the first non-debug statement in
4863 basic block BB. */
4865 static inline gimple_stmt_iterator
4866 gsi_start_nondebug_bb (basic_block bb)
4868 gimple_stmt_iterator i = gsi_start_bb (bb);
4870 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4871 gsi_next_nondebug (&i);
4873 return i;
4876 /* Return a new iterator pointing to the last non-debug statement in
4877 basic block BB. */
4879 static inline gimple_stmt_iterator
4880 gsi_last_nondebug_bb (basic_block bb)
4882 gimple_stmt_iterator i = gsi_last_bb (bb);
4884 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4885 gsi_prev_nondebug (&i);
4887 return i;
4890 /* Return a pointer to the current stmt.
4892 NOTE: You may want to use gsi_replace on the iterator itself,
4893 as this performs additional bookkeeping that will not be done
4894 if you simply assign through a pointer returned by gsi_stmt_ptr. */
4896 static inline gimple *
4897 gsi_stmt_ptr (gimple_stmt_iterator *i)
4899 return &i->ptr->stmt;
4903 /* Return the basic block associated with this iterator. */
4905 static inline basic_block
4906 gsi_bb (gimple_stmt_iterator i)
4908 return i.bb;
4912 /* Return the sequence associated with this iterator. */
4914 static inline gimple_seq
4915 gsi_seq (gimple_stmt_iterator i)
4917 return i.seq;
4921 enum gsi_iterator_update
4923 GSI_NEW_STMT, /* Only valid when single statement is added, move
4924 iterator to it. */
4925 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
4926 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
4927 for linking other statements in the same
4928 direction. */
4931 /* In gimple-iterator.c */
4932 gimple_stmt_iterator gsi_start_phis (basic_block);
4933 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
4934 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
4935 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
4936 void gsi_insert_before (gimple_stmt_iterator *, gimple,
4937 enum gsi_iterator_update);
4938 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
4939 enum gsi_iterator_update);
4940 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
4941 enum gsi_iterator_update);
4942 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
4943 enum gsi_iterator_update);
4944 void gsi_insert_after (gimple_stmt_iterator *, gimple,
4945 enum gsi_iterator_update);
4946 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
4947 enum gsi_iterator_update);
4948 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
4949 enum gsi_iterator_update);
4950 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
4951 enum gsi_iterator_update);
4952 void gsi_remove (gimple_stmt_iterator *, bool);
4953 gimple_stmt_iterator gsi_for_stmt (gimple);
4954 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
4955 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
4956 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
4957 void gsi_insert_on_edge (edge, gimple);
4958 void gsi_insert_seq_on_edge (edge, gimple_seq);
4959 basic_block gsi_insert_on_edge_immediate (edge, gimple);
4960 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
4961 void gsi_commit_one_edge_insert (edge, basic_block *);
4962 void gsi_commit_edge_inserts (void);
4963 gimple gimple_call_copy_skip_args (gimple, bitmap);
4966 /* Convenience routines to walk all statements of a gimple function.
4967 Note that this is useful exclusively before the code is converted
4968 into SSA form. Once the program is in SSA form, the standard
4969 operand interface should be used to analyze/modify statements. */
4970 struct walk_stmt_info
4972 /* Points to the current statement being walked. */
4973 gimple_stmt_iterator gsi;
4975 /* Additional data that the callback functions may want to carry
4976 through the recursion. */
4977 void *info;
4979 /* Pointer map used to mark visited tree nodes when calling
4980 walk_tree on each operand. If set to NULL, duplicate tree nodes
4981 will be visited more than once. */
4982 struct pointer_set_t *pset;
4984 /* Indicates whether the operand being examined may be replaced
4985 with something that matches is_gimple_val (if true) or something
4986 slightly more complicated (if false). "Something" technically
4987 means the common subset of is_gimple_lvalue and is_gimple_rhs,
4988 but we never try to form anything more complicated than that, so
4989 we don't bother checking.
4991 Also note that CALLBACK should update this flag while walking the
4992 sub-expressions of a statement. For instance, when walking the
4993 statement 'foo (&var)', the flag VAL_ONLY will initially be set
4994 to true, however, when walking &var, the operand of that
4995 ADDR_EXPR does not need to be a GIMPLE value. */
4996 bool val_only;
4998 /* True if we are currently walking the LHS of an assignment. */
4999 bool is_lhs;
5001 /* Optional. Set to true by the callback functions if they made any
5002 changes. */
5003 bool changed;
5005 /* True if we're interested in location information. */
5006 bool want_locations;
5008 /* Operand returned by the callbacks. This is set when calling
5009 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5010 returns non-NULL, this field will contain the tree returned by
5011 the last callback. */
5012 tree callback_result;
5015 /* Callback for walk_gimple_stmt. Called for every statement found
5016 during traversal. The first argument points to the statement to
5017 walk. The second argument is a flag that the callback sets to
5018 'true' if it the callback handled all the operands and
5019 sub-statements of the statement (the default value of this flag is
5020 'false'). The third argument is an anonymous pointer to data
5021 to be used by the callback. */
5022 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5023 struct walk_stmt_info *);
5025 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5026 struct walk_stmt_info *);
5027 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5028 struct walk_stmt_info *);
5029 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5031 #ifdef GATHER_STATISTICS
5032 /* Enum and arrays used for allocation stats. Keep in sync with
5033 gimple.c:gimple_alloc_kind_names. */
5034 enum gimple_alloc_kind
5036 gimple_alloc_kind_assign, /* Assignments. */
5037 gimple_alloc_kind_phi, /* PHI nodes. */
5038 gimple_alloc_kind_cond, /* Conditionals. */
5039 gimple_alloc_kind_seq, /* Sequences. */
5040 gimple_alloc_kind_rest, /* Everything else. */
5041 gimple_alloc_kind_all
5044 extern int gimple_alloc_counts[];
5045 extern int gimple_alloc_sizes[];
5047 /* Return the allocation kind for a given stmt CODE. */
5048 static inline enum gimple_alloc_kind
5049 gimple_alloc_kind (enum gimple_code code)
5051 switch (code)
5053 case GIMPLE_ASSIGN:
5054 return gimple_alloc_kind_assign;
5055 case GIMPLE_PHI:
5056 return gimple_alloc_kind_phi;
5057 case GIMPLE_COND:
5058 return gimple_alloc_kind_cond;
5059 default:
5060 return gimple_alloc_kind_rest;
5063 #endif /* GATHER_STATISTICS */
5065 extern void dump_gimple_statistics (void);
5067 /* In gimple-fold.c. */
5068 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5069 tree gimple_fold_builtin (gimple);
5070 bool fold_stmt (gimple_stmt_iterator *);
5071 bool fold_stmt_inplace (gimple);
5072 tree maybe_fold_offset_to_address (location_t, tree, tree, tree);
5073 tree maybe_fold_offset_to_reference (location_t, tree, tree, tree);
5074 tree maybe_fold_stmt_addition (location_t, tree, tree, tree);
5075 tree get_symbol_constant_value (tree);
5076 tree canonicalize_constructor_val (tree);
5077 bool may_propagate_address_into_dereference (tree, tree);
5078 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5079 enum tree_code, tree, tree);
5080 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5081 enum tree_code, tree, tree);
5083 bool gimple_val_nonnegative_real_p (tree);
5084 #endif /* GCC_GIMPLE_H */