2011-10-08 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / gimple.h
blob75e19a72b87dbc6c26ce7f07b152035ae3c30cc5
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_valist (tree, unsigned, va_list);
835 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
836 gimple gimple_build_call_internal_vec (enum internal_fn, VEC(tree, heap) *);
837 gimple gimple_build_call_from_tree (tree);
838 gimple gimplify_assign (tree, tree, gimple_seq *);
839 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
840 gimple gimple_build_label (tree label);
841 gimple gimple_build_goto (tree dest);
842 gimple gimple_build_nop (void);
843 gimple gimple_build_bind (tree, gimple_seq, tree);
844 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
845 VEC(tree,gc) *, VEC(tree,gc) *);
846 gimple gimple_build_catch (tree, gimple_seq);
847 gimple gimple_build_eh_filter (tree, gimple_seq);
848 gimple gimple_build_eh_must_not_throw (tree);
849 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
850 gimple gimple_build_wce (gimple_seq);
851 gimple gimple_build_resx (int);
852 gimple gimple_build_eh_dispatch (int);
853 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
854 gimple gimple_build_switch (unsigned, tree, tree, ...);
855 gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
856 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
857 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
858 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
859 gimple gimple_build_omp_critical (gimple_seq, tree);
860 gimple gimple_build_omp_section (gimple_seq);
861 gimple gimple_build_omp_continue (tree, tree);
862 gimple gimple_build_omp_master (gimple_seq);
863 gimple gimple_build_omp_return (bool);
864 gimple gimple_build_omp_ordered (gimple_seq);
865 gimple gimple_build_omp_sections (gimple_seq, tree);
866 gimple gimple_build_omp_sections_switch (void);
867 gimple gimple_build_omp_single (gimple_seq, tree);
868 gimple gimple_build_cdt (tree, tree);
869 gimple gimple_build_omp_atomic_load (tree, tree);
870 gimple gimple_build_omp_atomic_store (tree);
871 gimple gimple_build_predict (enum br_predictor, enum prediction);
872 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
873 void sort_case_labels (VEC(tree,heap) *);
874 void gimple_set_body (tree, gimple_seq);
875 gimple_seq gimple_body (tree);
876 bool gimple_has_body_p (tree);
877 gimple_seq gimple_seq_alloc (void);
878 void gimple_seq_free (gimple_seq);
879 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
880 gimple_seq gimple_seq_copy (gimple_seq);
881 bool gimple_call_same_target_p (const_gimple, const_gimple);
882 int gimple_call_flags (const_gimple);
883 int gimple_call_return_flags (const_gimple);
884 int gimple_call_arg_flags (const_gimple, unsigned);
885 void gimple_call_reset_alias_info (gimple);
886 bool gimple_assign_copy_p (gimple);
887 bool gimple_assign_ssa_name_copy_p (gimple);
888 bool gimple_assign_unary_nop_p (gimple);
889 void gimple_set_bb (gimple, struct basic_block_def *);
890 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
891 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
892 tree, tree, tree);
893 tree gimple_get_lhs (const_gimple);
894 void gimple_set_lhs (gimple, tree);
895 void gimple_replace_lhs (gimple, tree);
896 gimple gimple_copy (gimple);
897 void gimple_set_modified (gimple, bool);
898 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
899 gimple gimple_build_cond_from_tree (tree, tree, tree);
900 void gimple_cond_set_condition_from_tree (gimple, tree);
901 bool gimple_has_side_effects (const_gimple);
902 bool gimple_rhs_has_side_effects (const_gimple);
903 bool gimple_could_trap_p (gimple);
904 bool gimple_could_trap_p_1 (gimple, bool, bool);
905 bool gimple_assign_rhs_could_trap_p (gimple);
906 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
907 bool empty_body_p (gimple_seq);
908 unsigned get_gimple_rhs_num_ops (enum tree_code);
909 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
910 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
911 const char *gimple_decl_printable_name (tree, int);
912 bool gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace);
913 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
914 void gimple_adjust_this_by_delta (gimple_stmt_iterator *, tree);
915 tree gimple_extract_devirt_binfo_from_cst (tree);
916 /* Returns true iff T is a valid GIMPLE statement. */
917 extern bool is_gimple_stmt (tree);
919 /* Returns true iff TYPE is a valid type for a scalar register variable. */
920 extern bool is_gimple_reg_type (tree);
921 /* Returns true iff T is a scalar register variable. */
922 extern bool is_gimple_reg (tree);
923 /* Returns true iff T is any sort of variable. */
924 extern bool is_gimple_variable (tree);
925 /* Returns true iff T is any sort of symbol. */
926 extern bool is_gimple_id (tree);
927 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
928 extern bool is_gimple_min_lval (tree);
929 /* Returns true iff T is something whose address can be taken. */
930 extern bool is_gimple_addressable (tree);
931 /* Returns true iff T is any valid GIMPLE lvalue. */
932 extern bool is_gimple_lvalue (tree);
934 /* Returns true iff T is a GIMPLE address. */
935 bool is_gimple_address (const_tree);
936 /* Returns true iff T is a GIMPLE invariant address. */
937 bool is_gimple_invariant_address (const_tree);
938 /* Returns true iff T is a GIMPLE invariant address at interprocedural
939 level. */
940 bool is_gimple_ip_invariant_address (const_tree);
941 /* Returns true iff T is a valid GIMPLE constant. */
942 bool is_gimple_constant (const_tree);
943 /* Returns true iff T is a GIMPLE restricted function invariant. */
944 extern bool is_gimple_min_invariant (const_tree);
945 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
946 extern bool is_gimple_ip_invariant (const_tree);
947 /* Returns true iff T is a GIMPLE rvalue. */
948 extern bool is_gimple_val (tree);
949 /* Returns true iff T is a GIMPLE asm statement input. */
950 extern bool is_gimple_asm_val (tree);
951 /* Returns true iff T is a valid address operand of a MEM_REF. */
952 bool is_gimple_mem_ref_addr (tree);
953 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
954 GIMPLE temporary, a renamed user variable, or something else,
955 respectively. */
956 extern bool is_gimple_reg_rhs (tree);
957 extern bool is_gimple_mem_rhs (tree);
959 /* Returns true iff T is a valid if-statement condition. */
960 extern bool is_gimple_condexpr (tree);
962 /* Returns true iff T is a variable that does not need to live in memory. */
963 extern bool is_gimple_non_addressable (tree t);
965 /* Returns true iff T is a valid call address expression. */
966 extern bool is_gimple_call_addr (tree);
967 /* If T makes a function call, returns the CALL_EXPR operand. */
968 extern tree get_call_expr_in (tree t);
970 extern void recalculate_side_effects (tree);
971 extern bool gimple_compare_field_offset (tree, tree);
972 extern tree gimple_register_type (tree);
973 extern tree gimple_register_canonical_type (tree);
974 extern void print_gimple_types_stats (void);
975 extern void free_gimple_type_tables (void);
976 extern tree gimple_unsigned_type (tree);
977 extern tree gimple_signed_type (tree);
978 extern alias_set_type gimple_get_alias_set (tree);
979 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
980 unsigned *);
981 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
982 bool (*)(gimple, tree, void *),
983 bool (*)(gimple, tree, void *),
984 bool (*)(gimple, tree, void *));
985 extern bool walk_stmt_load_store_ops (gimple, void *,
986 bool (*)(gimple, tree, void *),
987 bool (*)(gimple, tree, void *));
988 extern bool gimple_ior_addresses_taken (bitmap, gimple);
989 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
990 extern bool gimple_asm_clobbers_memory_p (const_gimple);
992 /* In gimplify.c */
993 extern tree create_tmp_var_raw (tree, const char *);
994 extern tree create_tmp_var_name (const char *);
995 extern tree create_tmp_var (tree, const char *);
996 extern tree create_tmp_reg (tree, const char *);
997 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
998 extern tree get_formal_tmp_var (tree, gimple_seq *);
999 extern void declare_vars (tree, gimple, bool);
1000 extern void annotate_all_with_location (gimple_seq, location_t);
1002 /* Validation of GIMPLE expressions. Note that these predicates only check
1003 the basic form of the expression, they don't recurse to make sure that
1004 underlying nodes are also of the right form. */
1005 typedef bool (*gimple_predicate)(tree);
1008 /* FIXME we should deduce this from the predicate. */
1009 enum fallback {
1010 fb_none = 0, /* Do not generate a temporary. */
1012 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
1013 gimplified expression. */
1015 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
1016 gimplified expression. */
1018 fb_mayfail = 4, /* Gimplification may fail. Error issued
1019 afterwards. */
1020 fb_either= fb_rvalue | fb_lvalue
1023 typedef int fallback_t;
1025 enum gimplify_status {
1026 GS_ERROR = -2, /* Something Bad Seen. */
1027 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
1028 GS_OK = 0, /* We did something, maybe more to do. */
1029 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1032 struct gimplify_ctx
1034 struct gimplify_ctx *prev_context;
1036 VEC(gimple,heap) *bind_expr_stack;
1037 tree temps;
1038 gimple_seq conditional_cleanups;
1039 tree exit_label;
1040 tree return_temp;
1042 VEC(tree,heap) *case_labels;
1043 /* The formal temporary table. Should this be persistent? */
1044 htab_t temp_htab;
1046 int conditions;
1047 bool save_stack;
1048 bool into_ssa;
1049 bool allow_rhs_cond_expr;
1052 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1053 bool (*) (tree), fallback_t);
1054 extern void gimplify_type_sizes (tree, gimple_seq *);
1055 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1056 extern bool gimplify_stmt (tree *, gimple_seq *);
1057 extern gimple gimplify_body (tree *, tree, bool);
1058 extern void push_gimplify_context (struct gimplify_ctx *);
1059 extern void pop_gimplify_context (gimple);
1060 extern void gimplify_and_add (tree, gimple_seq *);
1062 /* Miscellaneous helpers. */
1063 extern void gimple_add_tmp_var (tree);
1064 extern gimple gimple_current_bind_expr (void);
1065 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1066 extern tree voidify_wrapper_expr (tree, tree);
1067 extern tree build_and_jump (tree *);
1068 extern tree force_labels_r (tree *, int *, void *);
1069 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1070 gimple_seq *);
1071 struct gimplify_omp_ctx;
1072 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1073 extern tree gimple_boolify (tree);
1074 extern gimple_predicate rhs_predicate_for (tree);
1075 extern tree canonicalize_cond_expr_cond (tree);
1077 /* In omp-low.c. */
1078 extern tree omp_reduction_init (tree, tree);
1080 /* In tree-nested.c. */
1081 extern void lower_nested_functions (tree);
1082 extern void insert_field_into_struct (tree, tree);
1084 /* In gimplify.c. */
1085 extern void gimplify_function_tree (tree);
1087 /* In cfgexpand.c. */
1088 extern tree gimple_assign_rhs_to_tree (gimple);
1090 /* In builtins.c */
1091 extern bool validate_gimple_arglist (const_gimple, ...);
1093 /* In tree-ssa.c */
1094 extern bool tree_ssa_useless_type_conversion (tree);
1095 extern tree tree_ssa_strip_useless_type_conversions (tree);
1096 extern bool useless_type_conversion_p (tree, tree);
1097 extern bool types_compatible_p (tree, tree);
1099 /* Return the code for GIMPLE statement G. */
1101 static inline enum gimple_code
1102 gimple_code (const_gimple g)
1104 return g->gsbase.code;
1108 /* Return the GSS code used by a GIMPLE code. */
1110 static inline enum gimple_statement_structure_enum
1111 gss_for_code (enum gimple_code code)
1113 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1114 return gss_for_code_[code];
1118 /* Return which GSS code is used by GS. */
1120 static inline enum gimple_statement_structure_enum
1121 gimple_statement_structure (gimple gs)
1123 return gss_for_code (gimple_code (gs));
1127 /* Return true if statement G has sub-statements. This is only true for
1128 High GIMPLE statements. */
1130 static inline bool
1131 gimple_has_substatements (gimple g)
1133 switch (gimple_code (g))
1135 case GIMPLE_BIND:
1136 case GIMPLE_CATCH:
1137 case GIMPLE_EH_FILTER:
1138 case GIMPLE_TRY:
1139 case GIMPLE_OMP_FOR:
1140 case GIMPLE_OMP_MASTER:
1141 case GIMPLE_OMP_ORDERED:
1142 case GIMPLE_OMP_SECTION:
1143 case GIMPLE_OMP_PARALLEL:
1144 case GIMPLE_OMP_TASK:
1145 case GIMPLE_OMP_SECTIONS:
1146 case GIMPLE_OMP_SINGLE:
1147 case GIMPLE_OMP_CRITICAL:
1148 case GIMPLE_WITH_CLEANUP_EXPR:
1149 return true;
1151 default:
1152 return false;
1157 /* Return the basic block holding statement G. */
1159 static inline struct basic_block_def *
1160 gimple_bb (const_gimple g)
1162 return g->gsbase.bb;
1166 /* Return the lexical scope block holding statement G. */
1168 static inline tree
1169 gimple_block (const_gimple g)
1171 return g->gsbase.block;
1175 /* Set BLOCK to be the lexical scope block holding statement G. */
1177 static inline void
1178 gimple_set_block (gimple g, tree block)
1180 g->gsbase.block = block;
1184 /* Return location information for statement G. */
1186 static inline location_t
1187 gimple_location (const_gimple g)
1189 return g->gsbase.location;
1192 /* Return pointer to location information for statement G. */
1194 static inline const location_t *
1195 gimple_location_ptr (const_gimple g)
1197 return &g->gsbase.location;
1201 /* Set location information for statement G. */
1203 static inline void
1204 gimple_set_location (gimple g, location_t location)
1206 g->gsbase.location = location;
1210 /* Return true if G contains location information. */
1212 static inline bool
1213 gimple_has_location (const_gimple g)
1215 return gimple_location (g) != UNKNOWN_LOCATION;
1219 /* Return the file name of the location of STMT. */
1221 static inline const char *
1222 gimple_filename (const_gimple stmt)
1224 return LOCATION_FILE (gimple_location (stmt));
1228 /* Return the line number of the location of STMT. */
1230 static inline int
1231 gimple_lineno (const_gimple stmt)
1233 return LOCATION_LINE (gimple_location (stmt));
1237 /* Determine whether SEQ is a singleton. */
1239 static inline bool
1240 gimple_seq_singleton_p (gimple_seq seq)
1242 return ((gimple_seq_first (seq) != NULL)
1243 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1246 /* Return true if no warnings should be emitted for statement STMT. */
1248 static inline bool
1249 gimple_no_warning_p (const_gimple stmt)
1251 return stmt->gsbase.no_warning;
1254 /* Set the no_warning flag of STMT to NO_WARNING. */
1256 static inline void
1257 gimple_set_no_warning (gimple stmt, bool no_warning)
1259 stmt->gsbase.no_warning = (unsigned) no_warning;
1262 /* Set the visited status on statement STMT to VISITED_P. */
1264 static inline void
1265 gimple_set_visited (gimple stmt, bool visited_p)
1267 stmt->gsbase.visited = (unsigned) visited_p;
1271 /* Return the visited status for statement STMT. */
1273 static inline bool
1274 gimple_visited_p (gimple stmt)
1276 return stmt->gsbase.visited;
1280 /* Set pass local flag PLF on statement STMT to VAL_P. */
1282 static inline void
1283 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1285 if (val_p)
1286 stmt->gsbase.plf |= (unsigned int) plf;
1287 else
1288 stmt->gsbase.plf &= ~((unsigned int) plf);
1292 /* Return the value of pass local flag PLF on statement STMT. */
1294 static inline unsigned int
1295 gimple_plf (gimple stmt, enum plf_mask plf)
1297 return stmt->gsbase.plf & ((unsigned int) plf);
1301 /* Set the UID of statement. */
1303 static inline void
1304 gimple_set_uid (gimple g, unsigned uid)
1306 g->gsbase.uid = uid;
1310 /* Return the UID of statement. */
1312 static inline unsigned
1313 gimple_uid (const_gimple g)
1315 return g->gsbase.uid;
1319 /* Return true if GIMPLE statement G has register or memory operands. */
1321 static inline bool
1322 gimple_has_ops (const_gimple g)
1324 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1328 /* Return true if GIMPLE statement G has memory operands. */
1330 static inline bool
1331 gimple_has_mem_ops (const_gimple g)
1333 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1337 /* Return the set of DEF operands for statement G. */
1339 static inline struct def_optype_d *
1340 gimple_def_ops (const_gimple g)
1342 if (!gimple_has_ops (g))
1343 return NULL;
1344 return g->gsops.opbase.def_ops;
1348 /* Set DEF to be the set of DEF operands for statement G. */
1350 static inline void
1351 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1353 gcc_gimple_checking_assert (gimple_has_ops (g));
1354 g->gsops.opbase.def_ops = def;
1358 /* Return the set of USE operands for statement G. */
1360 static inline struct use_optype_d *
1361 gimple_use_ops (const_gimple g)
1363 if (!gimple_has_ops (g))
1364 return NULL;
1365 return g->gsops.opbase.use_ops;
1369 /* Set USE to be the set of USE operands for statement G. */
1371 static inline void
1372 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1374 gcc_gimple_checking_assert (gimple_has_ops (g));
1375 g->gsops.opbase.use_ops = use;
1379 /* Return the set of VUSE operand for statement G. */
1381 static inline use_operand_p
1382 gimple_vuse_op (const_gimple g)
1384 struct use_optype_d *ops;
1385 if (!gimple_has_mem_ops (g))
1386 return NULL_USE_OPERAND_P;
1387 ops = g->gsops.opbase.use_ops;
1388 if (ops
1389 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1390 return USE_OP_PTR (ops);
1391 return NULL_USE_OPERAND_P;
1394 /* Return the set of VDEF operand for statement G. */
1396 static inline def_operand_p
1397 gimple_vdef_op (const_gimple g)
1399 struct def_optype_d *ops;
1400 if (!gimple_has_mem_ops (g))
1401 return NULL_DEF_OPERAND_P;
1402 ops = g->gsops.opbase.def_ops;
1403 if (ops
1404 && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1405 return DEF_OP_PTR (ops);
1406 return NULL_DEF_OPERAND_P;
1410 /* Return the single VUSE operand of the statement G. */
1412 static inline tree
1413 gimple_vuse (const_gimple g)
1415 if (!gimple_has_mem_ops (g))
1416 return NULL_TREE;
1417 return g->gsmembase.vuse;
1420 /* Return the single VDEF operand of the statement G. */
1422 static inline tree
1423 gimple_vdef (const_gimple g)
1425 if (!gimple_has_mem_ops (g))
1426 return NULL_TREE;
1427 return g->gsmembase.vdef;
1430 /* Return the single VUSE operand of the statement G. */
1432 static inline tree *
1433 gimple_vuse_ptr (gimple g)
1435 if (!gimple_has_mem_ops (g))
1436 return NULL;
1437 return &g->gsmembase.vuse;
1440 /* Return the single VDEF operand of the statement G. */
1442 static inline tree *
1443 gimple_vdef_ptr (gimple g)
1445 if (!gimple_has_mem_ops (g))
1446 return NULL;
1447 return &g->gsmembase.vdef;
1450 /* Set the single VUSE operand of the statement G. */
1452 static inline void
1453 gimple_set_vuse (gimple g, tree vuse)
1455 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1456 g->gsmembase.vuse = vuse;
1459 /* Set the single VDEF operand of the statement G. */
1461 static inline void
1462 gimple_set_vdef (gimple g, tree vdef)
1464 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1465 g->gsmembase.vdef = vdef;
1469 /* Return true if statement G has operands and the modified field has
1470 been set. */
1472 static inline bool
1473 gimple_modified_p (const_gimple g)
1475 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1479 /* Return the tree code for the expression computed by STMT. This is
1480 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1481 GIMPLE_CALL, return CALL_EXPR as the expression code for
1482 consistency. This is useful when the caller needs to deal with the
1483 three kinds of computation that GIMPLE supports. */
1485 static inline enum tree_code
1486 gimple_expr_code (const_gimple stmt)
1488 enum gimple_code code = gimple_code (stmt);
1489 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1490 return (enum tree_code) stmt->gsbase.subcode;
1491 else
1493 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1494 return CALL_EXPR;
1499 /* Mark statement S as modified, and update it. */
1501 static inline void
1502 update_stmt (gimple s)
1504 if (gimple_has_ops (s))
1506 gimple_set_modified (s, true);
1507 update_stmt_operands (s);
1511 /* Update statement S if it has been optimized. */
1513 static inline void
1514 update_stmt_if_modified (gimple s)
1516 if (gimple_modified_p (s))
1517 update_stmt_operands (s);
1520 /* Return true if statement STMT contains volatile operands. */
1522 static inline bool
1523 gimple_has_volatile_ops (const_gimple stmt)
1525 if (gimple_has_mem_ops (stmt))
1526 return stmt->gsbase.has_volatile_ops;
1527 else
1528 return false;
1532 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1534 static inline void
1535 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1537 if (gimple_has_mem_ops (stmt))
1538 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1542 /* Return true if statement STMT may access memory. */
1544 static inline bool
1545 gimple_references_memory_p (gimple stmt)
1547 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1551 /* Return the subcode for OMP statement S. */
1553 static inline unsigned
1554 gimple_omp_subcode (const_gimple s)
1556 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1557 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1558 return s->gsbase.subcode;
1561 /* Set the subcode for OMP statement S to SUBCODE. */
1563 static inline void
1564 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1566 /* We only have 16 bits for the subcode. Assert that we are not
1567 overflowing it. */
1568 gcc_gimple_checking_assert (subcode < (1 << 16));
1569 s->gsbase.subcode = subcode;
1572 /* Set the nowait flag on OMP_RETURN statement S. */
1574 static inline void
1575 gimple_omp_return_set_nowait (gimple s)
1577 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1578 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1582 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1583 flag set. */
1585 static inline bool
1586 gimple_omp_return_nowait_p (const_gimple g)
1588 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1589 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1593 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1594 flag set. */
1596 static inline bool
1597 gimple_omp_section_last_p (const_gimple g)
1599 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1600 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1604 /* Set the GF_OMP_SECTION_LAST flag on G. */
1606 static inline void
1607 gimple_omp_section_set_last (gimple g)
1609 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1610 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1614 /* Return true if OMP parallel statement G has the
1615 GF_OMP_PARALLEL_COMBINED flag set. */
1617 static inline bool
1618 gimple_omp_parallel_combined_p (const_gimple g)
1620 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1621 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1625 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1626 value of COMBINED_P. */
1628 static inline void
1629 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1631 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1632 if (combined_p)
1633 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1634 else
1635 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1639 /* Return true if OMP atomic load/store statement G has the
1640 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1642 static inline bool
1643 gimple_omp_atomic_need_value_p (const_gimple g)
1645 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1646 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1647 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1651 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1653 static inline void
1654 gimple_omp_atomic_set_need_value (gimple g)
1656 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1657 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1658 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1662 /* Return the number of operands for statement GS. */
1664 static inline unsigned
1665 gimple_num_ops (const_gimple gs)
1667 return gs->gsbase.num_ops;
1671 /* Set the number of operands for statement GS. */
1673 static inline void
1674 gimple_set_num_ops (gimple gs, unsigned num_ops)
1676 gs->gsbase.num_ops = num_ops;
1680 /* Return the array of operands for statement GS. */
1682 static inline tree *
1683 gimple_ops (gimple gs)
1685 size_t off;
1687 /* All the tuples have their operand vector at the very bottom
1688 of the structure. Note that those structures that do not
1689 have an operand vector have a zero offset. */
1690 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1691 gcc_gimple_checking_assert (off != 0);
1693 return (tree *) ((char *) gs + off);
1697 /* Return operand I for statement GS. */
1699 static inline tree
1700 gimple_op (const_gimple gs, unsigned i)
1702 if (gimple_has_ops (gs))
1704 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1705 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1707 else
1708 return NULL_TREE;
1711 /* Return a pointer to operand I for statement GS. */
1713 static inline tree *
1714 gimple_op_ptr (const_gimple gs, unsigned i)
1716 if (gimple_has_ops (gs))
1718 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1719 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1721 else
1722 return NULL;
1725 /* Set operand I of statement GS to OP. */
1727 static inline void
1728 gimple_set_op (gimple gs, unsigned i, tree op)
1730 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1732 /* Note. It may be tempting to assert that OP matches
1733 is_gimple_operand, but that would be wrong. Different tuples
1734 accept slightly different sets of tree operands. Each caller
1735 should perform its own validation. */
1736 gimple_ops (gs)[i] = op;
1739 /* Return true if GS is a GIMPLE_ASSIGN. */
1741 static inline bool
1742 is_gimple_assign (const_gimple gs)
1744 return gimple_code (gs) == GIMPLE_ASSIGN;
1747 /* Determine if expression CODE is one of the valid expressions that can
1748 be used on the RHS of GIMPLE assignments. */
1750 static inline enum gimple_rhs_class
1751 get_gimple_rhs_class (enum tree_code code)
1753 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1756 /* Return the LHS of assignment statement GS. */
1758 static inline tree
1759 gimple_assign_lhs (const_gimple gs)
1761 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1762 return gimple_op (gs, 0);
1766 /* Return a pointer to the LHS of assignment statement GS. */
1768 static inline tree *
1769 gimple_assign_lhs_ptr (const_gimple gs)
1771 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1772 return gimple_op_ptr (gs, 0);
1776 /* Set LHS to be the LHS operand of assignment statement GS. */
1778 static inline void
1779 gimple_assign_set_lhs (gimple gs, tree lhs)
1781 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1782 gimple_set_op (gs, 0, lhs);
1784 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1785 SSA_NAME_DEF_STMT (lhs) = gs;
1789 /* Return the first operand on the RHS of assignment statement GS. */
1791 static inline tree
1792 gimple_assign_rhs1 (const_gimple gs)
1794 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1795 return gimple_op (gs, 1);
1799 /* Return a pointer to the first operand on the RHS of assignment
1800 statement GS. */
1802 static inline tree *
1803 gimple_assign_rhs1_ptr (const_gimple gs)
1805 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1806 return gimple_op_ptr (gs, 1);
1809 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1811 static inline void
1812 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1814 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1816 gimple_set_op (gs, 1, rhs);
1820 /* Return the second operand on the RHS of assignment statement GS.
1821 If GS does not have two operands, NULL is returned instead. */
1823 static inline tree
1824 gimple_assign_rhs2 (const_gimple gs)
1826 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1828 if (gimple_num_ops (gs) >= 3)
1829 return gimple_op (gs, 2);
1830 else
1831 return NULL_TREE;
1835 /* Return a pointer to the second operand on the RHS of assignment
1836 statement GS. */
1838 static inline tree *
1839 gimple_assign_rhs2_ptr (const_gimple gs)
1841 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1842 return gimple_op_ptr (gs, 2);
1846 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1848 static inline void
1849 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1851 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1853 gimple_set_op (gs, 2, rhs);
1856 /* Return the third operand on the RHS of assignment statement GS.
1857 If GS does not have two operands, NULL is returned instead. */
1859 static inline tree
1860 gimple_assign_rhs3 (const_gimple gs)
1862 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1864 if (gimple_num_ops (gs) >= 4)
1865 return gimple_op (gs, 3);
1866 else
1867 return NULL_TREE;
1870 /* Return a pointer to the third operand on the RHS of assignment
1871 statement GS. */
1873 static inline tree *
1874 gimple_assign_rhs3_ptr (const_gimple gs)
1876 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1877 return gimple_op_ptr (gs, 3);
1881 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1883 static inline void
1884 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1886 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1888 gimple_set_op (gs, 3, rhs);
1891 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1892 to see only a maximum of two operands. */
1894 static inline void
1895 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1896 tree op1, tree op2)
1898 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1901 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1902 to see only a maximum of two operands. */
1904 static inline void
1905 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1906 tree *op1)
1908 tree op2;
1909 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1910 gcc_assert (op2 == NULL_TREE);
1913 /* Returns true if GS is a nontemporal move. */
1915 static inline bool
1916 gimple_assign_nontemporal_move_p (const_gimple gs)
1918 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1919 return gs->gsbase.nontemporal_move;
1922 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1924 static inline void
1925 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1927 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1928 gs->gsbase.nontemporal_move = nontemporal;
1932 /* Return the code of the expression computed on the rhs of assignment
1933 statement GS. In case that the RHS is a single object, returns the
1934 tree code of the object. */
1936 static inline enum tree_code
1937 gimple_assign_rhs_code (const_gimple gs)
1939 enum tree_code code;
1940 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1942 code = (enum tree_code) gs->gsbase.subcode;
1943 /* While we initially set subcode to the TREE_CODE of the rhs for
1944 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
1945 in sync when we rewrite stmts into SSA form or do SSA propagations. */
1946 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1947 code = TREE_CODE (gimple_assign_rhs1 (gs));
1949 return code;
1953 /* Set CODE to be the code for the expression computed on the RHS of
1954 assignment S. */
1956 static inline void
1957 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
1959 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
1960 s->gsbase.subcode = code;
1964 /* Return the gimple rhs class of the code of the expression computed on
1965 the rhs of assignment statement GS.
1966 This will never return GIMPLE_INVALID_RHS. */
1968 static inline enum gimple_rhs_class
1969 gimple_assign_rhs_class (const_gimple gs)
1971 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
1974 /* Return true if GS is an assignment with a singleton RHS, i.e.,
1975 there is no operator associated with the assignment itself.
1976 Unlike gimple_assign_copy_p, this predicate returns true for
1977 any RHS operand, including those that perform an operation
1978 and do not have the semantics of a copy, such as COND_EXPR. */
1980 static inline bool
1981 gimple_assign_single_p (gimple gs)
1983 return (is_gimple_assign (gs)
1984 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
1988 /* Return true if S is a type-cast assignment. */
1990 static inline bool
1991 gimple_assign_cast_p (gimple s)
1993 if (is_gimple_assign (s))
1995 enum tree_code sc = gimple_assign_rhs_code (s);
1996 return CONVERT_EXPR_CODE_P (sc)
1997 || sc == VIEW_CONVERT_EXPR
1998 || sc == FIX_TRUNC_EXPR;
2001 return false;
2005 /* Return true if GS is a GIMPLE_CALL. */
2007 static inline bool
2008 is_gimple_call (const_gimple gs)
2010 return gimple_code (gs) == GIMPLE_CALL;
2013 /* Return the LHS of call statement GS. */
2015 static inline tree
2016 gimple_call_lhs (const_gimple gs)
2018 GIMPLE_CHECK (gs, GIMPLE_CALL);
2019 return gimple_op (gs, 0);
2023 /* Return a pointer to the LHS of call statement GS. */
2025 static inline tree *
2026 gimple_call_lhs_ptr (const_gimple gs)
2028 GIMPLE_CHECK (gs, GIMPLE_CALL);
2029 return gimple_op_ptr (gs, 0);
2033 /* Set LHS to be the LHS operand of call statement GS. */
2035 static inline void
2036 gimple_call_set_lhs (gimple gs, tree lhs)
2038 GIMPLE_CHECK (gs, GIMPLE_CALL);
2039 gimple_set_op (gs, 0, lhs);
2040 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2041 SSA_NAME_DEF_STMT (lhs) = gs;
2045 /* Return true if call GS calls an internal-only function, as enumerated
2046 by internal_fn. */
2048 static inline bool
2049 gimple_call_internal_p (const_gimple gs)
2051 GIMPLE_CHECK (gs, GIMPLE_CALL);
2052 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2056 /* Return the target of internal call GS. */
2058 static inline enum internal_fn
2059 gimple_call_internal_fn (const_gimple gs)
2061 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2062 return gs->gimple_call.u.internal_fn;
2066 /* Return the function type of the function called by GS. */
2068 static inline tree
2069 gimple_call_fntype (const_gimple gs)
2071 GIMPLE_CHECK (gs, GIMPLE_CALL);
2072 if (gimple_call_internal_p (gs))
2073 return NULL_TREE;
2074 return gs->gimple_call.u.fntype;
2077 /* Set the type of the function called by GS to FNTYPE. */
2079 static inline void
2080 gimple_call_set_fntype (gimple gs, tree fntype)
2082 GIMPLE_CHECK (gs, GIMPLE_CALL);
2083 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2084 gs->gimple_call.u.fntype = fntype;
2088 /* Return the tree node representing the function called by call
2089 statement GS. */
2091 static inline tree
2092 gimple_call_fn (const_gimple gs)
2094 GIMPLE_CHECK (gs, GIMPLE_CALL);
2095 return gimple_op (gs, 1);
2098 /* Return a pointer to the tree node representing the function called by call
2099 statement GS. */
2101 static inline tree *
2102 gimple_call_fn_ptr (const_gimple gs)
2104 GIMPLE_CHECK (gs, GIMPLE_CALL);
2105 return gimple_op_ptr (gs, 1);
2109 /* Set FN to be the function called by call statement GS. */
2111 static inline void
2112 gimple_call_set_fn (gimple gs, tree fn)
2114 GIMPLE_CHECK (gs, GIMPLE_CALL);
2115 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2116 gimple_set_op (gs, 1, fn);
2120 /* Set FNDECL to be the function called by call statement GS. */
2122 static inline void
2123 gimple_call_set_fndecl (gimple gs, tree decl)
2125 GIMPLE_CHECK (gs, GIMPLE_CALL);
2126 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2127 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2131 /* Set internal function FN to be the function called by call statement GS. */
2133 static inline void
2134 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2136 GIMPLE_CHECK (gs, GIMPLE_CALL);
2137 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2138 gs->gimple_call.u.internal_fn = fn;
2142 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2143 associated with the callee if known. Otherwise return NULL_TREE. */
2145 static inline tree
2146 gimple_call_addr_fndecl (const_tree fn)
2148 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2150 tree fndecl = TREE_OPERAND (fn, 0);
2151 if (TREE_CODE (fndecl) == MEM_REF
2152 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2153 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2154 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2155 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2156 return fndecl;
2158 return NULL_TREE;
2161 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2162 Otherwise return NULL. This function is analogous to
2163 get_callee_fndecl in tree land. */
2165 static inline tree
2166 gimple_call_fndecl (const_gimple gs)
2168 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2172 /* Return the type returned by call statement GS. */
2174 static inline tree
2175 gimple_call_return_type (const_gimple gs)
2177 tree type = gimple_call_fntype (gs);
2179 if (type == NULL_TREE)
2180 return TREE_TYPE (gimple_call_lhs (gs));
2182 /* The type returned by a function is the type of its
2183 function type. */
2184 return TREE_TYPE (type);
2188 /* Return the static chain for call statement GS. */
2190 static inline tree
2191 gimple_call_chain (const_gimple gs)
2193 GIMPLE_CHECK (gs, GIMPLE_CALL);
2194 return gimple_op (gs, 2);
2198 /* Return a pointer to the static chain for call statement GS. */
2200 static inline tree *
2201 gimple_call_chain_ptr (const_gimple gs)
2203 GIMPLE_CHECK (gs, GIMPLE_CALL);
2204 return gimple_op_ptr (gs, 2);
2207 /* Set CHAIN to be the static chain for call statement GS. */
2209 static inline void
2210 gimple_call_set_chain (gimple gs, tree chain)
2212 GIMPLE_CHECK (gs, GIMPLE_CALL);
2214 gimple_set_op (gs, 2, chain);
2218 /* Return the number of arguments used by call statement GS. */
2220 static inline unsigned
2221 gimple_call_num_args (const_gimple gs)
2223 unsigned num_ops;
2224 GIMPLE_CHECK (gs, GIMPLE_CALL);
2225 num_ops = gimple_num_ops (gs);
2226 return num_ops - 3;
2230 /* Return the argument at position INDEX for call statement GS. */
2232 static inline tree
2233 gimple_call_arg (const_gimple gs, unsigned index)
2235 GIMPLE_CHECK (gs, GIMPLE_CALL);
2236 return gimple_op (gs, index + 3);
2240 /* Return a pointer to the argument at position INDEX for call
2241 statement GS. */
2243 static inline tree *
2244 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2246 GIMPLE_CHECK (gs, GIMPLE_CALL);
2247 return gimple_op_ptr (gs, index + 3);
2251 /* Set ARG to be the argument at position INDEX for call statement GS. */
2253 static inline void
2254 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2256 GIMPLE_CHECK (gs, GIMPLE_CALL);
2257 gimple_set_op (gs, index + 3, arg);
2261 /* If TAIL_P is true, mark call statement S as being a tail call
2262 (i.e., a call just before the exit of a function). These calls are
2263 candidate for tail call optimization. */
2265 static inline void
2266 gimple_call_set_tail (gimple s, bool tail_p)
2268 GIMPLE_CHECK (s, GIMPLE_CALL);
2269 if (tail_p)
2270 s->gsbase.subcode |= GF_CALL_TAILCALL;
2271 else
2272 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2276 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2278 static inline bool
2279 gimple_call_tail_p (gimple s)
2281 GIMPLE_CHECK (s, GIMPLE_CALL);
2282 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2286 /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
2288 static inline void
2289 gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
2291 GIMPLE_CHECK (s, GIMPLE_CALL);
2292 if (inlinable_p)
2293 s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
2294 else
2295 s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
2299 /* Return true if GIMPLE_CALL S cannot be inlined. */
2301 static inline bool
2302 gimple_call_cannot_inline_p (gimple s)
2304 GIMPLE_CHECK (s, GIMPLE_CALL);
2305 return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0;
2309 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2310 slot optimization. This transformation uses the target of the call
2311 expansion as the return slot for calls that return in memory. */
2313 static inline void
2314 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2316 GIMPLE_CHECK (s, GIMPLE_CALL);
2317 if (return_slot_opt_p)
2318 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2319 else
2320 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2324 /* Return true if S is marked for return slot optimization. */
2326 static inline bool
2327 gimple_call_return_slot_opt_p (gimple s)
2329 GIMPLE_CHECK (s, GIMPLE_CALL);
2330 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2334 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2335 thunk to the thunked-to function. */
2337 static inline void
2338 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2340 GIMPLE_CHECK (s, GIMPLE_CALL);
2341 if (from_thunk_p)
2342 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2343 else
2344 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2348 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2350 static inline bool
2351 gimple_call_from_thunk_p (gimple s)
2353 GIMPLE_CHECK (s, GIMPLE_CALL);
2354 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2358 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2359 argument pack in its argument list. */
2361 static inline void
2362 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2364 GIMPLE_CHECK (s, GIMPLE_CALL);
2365 if (pass_arg_pack_p)
2366 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2367 else
2368 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2372 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2373 argument pack in its argument list. */
2375 static inline bool
2376 gimple_call_va_arg_pack_p (gimple s)
2378 GIMPLE_CHECK (s, GIMPLE_CALL);
2379 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2383 /* Return true if S is a noreturn call. */
2385 static inline bool
2386 gimple_call_noreturn_p (gimple s)
2388 GIMPLE_CHECK (s, GIMPLE_CALL);
2389 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2393 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2394 even if the called function can throw in other cases. */
2396 static inline void
2397 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2399 GIMPLE_CHECK (s, GIMPLE_CALL);
2400 if (nothrow_p)
2401 s->gsbase.subcode |= GF_CALL_NOTHROW;
2402 else
2403 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2406 /* Return true if S is a nothrow call. */
2408 static inline bool
2409 gimple_call_nothrow_p (gimple s)
2411 GIMPLE_CHECK (s, GIMPLE_CALL);
2412 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2415 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2416 is known to be emitted for VLA objects. Those are wrapped by
2417 stack_save/stack_restore calls and hence can't lead to unbounded
2418 stack growth even when they occur in loops. */
2420 static inline void
2421 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2423 GIMPLE_CHECK (s, GIMPLE_CALL);
2424 if (for_var)
2425 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2426 else
2427 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2430 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2432 static inline bool
2433 gimple_call_alloca_for_var_p (gimple s)
2435 GIMPLE_CHECK (s, GIMPLE_CALL);
2436 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2439 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2441 static inline void
2442 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2444 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2445 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2446 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2450 /* Return a pointer to the points-to solution for the set of call-used
2451 variables of the call CALL. */
2453 static inline struct pt_solution *
2454 gimple_call_use_set (gimple call)
2456 GIMPLE_CHECK (call, GIMPLE_CALL);
2457 return &call->gimple_call.call_used;
2461 /* Return a pointer to the points-to solution for the set of call-used
2462 variables of the call CALL. */
2464 static inline struct pt_solution *
2465 gimple_call_clobber_set (gimple call)
2467 GIMPLE_CHECK (call, GIMPLE_CALL);
2468 return &call->gimple_call.call_clobbered;
2472 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2473 non-NULL lhs. */
2475 static inline bool
2476 gimple_has_lhs (gimple stmt)
2478 return (is_gimple_assign (stmt)
2479 || (is_gimple_call (stmt)
2480 && gimple_call_lhs (stmt) != NULL_TREE));
2484 /* Return the code of the predicate computed by conditional statement GS. */
2486 static inline enum tree_code
2487 gimple_cond_code (const_gimple gs)
2489 GIMPLE_CHECK (gs, GIMPLE_COND);
2490 return (enum tree_code) gs->gsbase.subcode;
2494 /* Set CODE to be the predicate code for the conditional statement GS. */
2496 static inline void
2497 gimple_cond_set_code (gimple gs, enum tree_code code)
2499 GIMPLE_CHECK (gs, GIMPLE_COND);
2500 gs->gsbase.subcode = code;
2504 /* Return the LHS of the predicate computed by conditional statement GS. */
2506 static inline tree
2507 gimple_cond_lhs (const_gimple gs)
2509 GIMPLE_CHECK (gs, GIMPLE_COND);
2510 return gimple_op (gs, 0);
2513 /* Return the pointer to the LHS of the predicate computed by conditional
2514 statement GS. */
2516 static inline tree *
2517 gimple_cond_lhs_ptr (const_gimple gs)
2519 GIMPLE_CHECK (gs, GIMPLE_COND);
2520 return gimple_op_ptr (gs, 0);
2523 /* Set LHS to be the LHS operand of the predicate computed by
2524 conditional statement GS. */
2526 static inline void
2527 gimple_cond_set_lhs (gimple gs, tree lhs)
2529 GIMPLE_CHECK (gs, GIMPLE_COND);
2530 gimple_set_op (gs, 0, lhs);
2534 /* Return the RHS operand of the predicate computed by conditional GS. */
2536 static inline tree
2537 gimple_cond_rhs (const_gimple gs)
2539 GIMPLE_CHECK (gs, GIMPLE_COND);
2540 return gimple_op (gs, 1);
2543 /* Return the pointer to the RHS operand of the predicate computed by
2544 conditional GS. */
2546 static inline tree *
2547 gimple_cond_rhs_ptr (const_gimple gs)
2549 GIMPLE_CHECK (gs, GIMPLE_COND);
2550 return gimple_op_ptr (gs, 1);
2554 /* Set RHS to be the RHS operand of the predicate computed by
2555 conditional statement GS. */
2557 static inline void
2558 gimple_cond_set_rhs (gimple gs, tree rhs)
2560 GIMPLE_CHECK (gs, GIMPLE_COND);
2561 gimple_set_op (gs, 1, rhs);
2565 /* Return the label used by conditional statement GS when its
2566 predicate evaluates to true. */
2568 static inline tree
2569 gimple_cond_true_label (const_gimple gs)
2571 GIMPLE_CHECK (gs, GIMPLE_COND);
2572 return gimple_op (gs, 2);
2576 /* Set LABEL to be the label used by conditional statement GS when its
2577 predicate evaluates to true. */
2579 static inline void
2580 gimple_cond_set_true_label (gimple gs, tree label)
2582 GIMPLE_CHECK (gs, GIMPLE_COND);
2583 gimple_set_op (gs, 2, label);
2587 /* Set LABEL to be the label used by conditional statement GS when its
2588 predicate evaluates to false. */
2590 static inline void
2591 gimple_cond_set_false_label (gimple gs, tree label)
2593 GIMPLE_CHECK (gs, GIMPLE_COND);
2594 gimple_set_op (gs, 3, label);
2598 /* Return the label used by conditional statement GS when its
2599 predicate evaluates to false. */
2601 static inline tree
2602 gimple_cond_false_label (const_gimple gs)
2604 GIMPLE_CHECK (gs, GIMPLE_COND);
2605 return gimple_op (gs, 3);
2609 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2611 static inline void
2612 gimple_cond_make_false (gimple gs)
2614 gimple_cond_set_lhs (gs, boolean_true_node);
2615 gimple_cond_set_rhs (gs, boolean_false_node);
2616 gs->gsbase.subcode = EQ_EXPR;
2620 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2622 static inline void
2623 gimple_cond_make_true (gimple gs)
2625 gimple_cond_set_lhs (gs, boolean_true_node);
2626 gimple_cond_set_rhs (gs, boolean_true_node);
2627 gs->gsbase.subcode = EQ_EXPR;
2630 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2631 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2633 static inline bool
2634 gimple_cond_true_p (const_gimple gs)
2636 tree lhs = gimple_cond_lhs (gs);
2637 tree rhs = gimple_cond_rhs (gs);
2638 enum tree_code code = gimple_cond_code (gs);
2640 if (lhs != boolean_true_node && lhs != boolean_false_node)
2641 return false;
2643 if (rhs != boolean_true_node && rhs != boolean_false_node)
2644 return false;
2646 if (code == NE_EXPR && lhs != rhs)
2647 return true;
2649 if (code == EQ_EXPR && lhs == rhs)
2650 return true;
2652 return false;
2655 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2656 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2658 static inline bool
2659 gimple_cond_false_p (const_gimple gs)
2661 tree lhs = gimple_cond_lhs (gs);
2662 tree rhs = gimple_cond_rhs (gs);
2663 enum tree_code code = gimple_cond_code (gs);
2665 if (lhs != boolean_true_node && lhs != boolean_false_node)
2666 return false;
2668 if (rhs != boolean_true_node && rhs != boolean_false_node)
2669 return false;
2671 if (code == NE_EXPR && lhs == rhs)
2672 return true;
2674 if (code == EQ_EXPR && lhs != rhs)
2675 return true;
2677 return false;
2680 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2681 'if (var == 1)' */
2683 static inline bool
2684 gimple_cond_single_var_p (gimple gs)
2686 if (gimple_cond_code (gs) == NE_EXPR
2687 && gimple_cond_rhs (gs) == boolean_false_node)
2688 return true;
2690 if (gimple_cond_code (gs) == EQ_EXPR
2691 && gimple_cond_rhs (gs) == boolean_true_node)
2692 return true;
2694 return false;
2697 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2699 static inline void
2700 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2702 gimple_cond_set_code (stmt, code);
2703 gimple_cond_set_lhs (stmt, lhs);
2704 gimple_cond_set_rhs (stmt, rhs);
2707 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2709 static inline tree
2710 gimple_label_label (const_gimple gs)
2712 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2713 return gimple_op (gs, 0);
2717 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2718 GS. */
2720 static inline void
2721 gimple_label_set_label (gimple gs, tree label)
2723 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2724 gimple_set_op (gs, 0, label);
2728 /* Return the destination of the unconditional jump GS. */
2730 static inline tree
2731 gimple_goto_dest (const_gimple gs)
2733 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2734 return gimple_op (gs, 0);
2738 /* Set DEST to be the destination of the unconditonal jump GS. */
2740 static inline void
2741 gimple_goto_set_dest (gimple gs, tree dest)
2743 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2744 gimple_set_op (gs, 0, dest);
2748 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2750 static inline tree
2751 gimple_bind_vars (const_gimple gs)
2753 GIMPLE_CHECK (gs, GIMPLE_BIND);
2754 return gs->gimple_bind.vars;
2758 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2759 statement GS. */
2761 static inline void
2762 gimple_bind_set_vars (gimple gs, tree vars)
2764 GIMPLE_CHECK (gs, GIMPLE_BIND);
2765 gs->gimple_bind.vars = vars;
2769 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2770 statement GS. */
2772 static inline void
2773 gimple_bind_append_vars (gimple gs, tree vars)
2775 GIMPLE_CHECK (gs, GIMPLE_BIND);
2776 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2780 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2782 static inline gimple_seq
2783 gimple_bind_body (gimple gs)
2785 GIMPLE_CHECK (gs, GIMPLE_BIND);
2786 return gs->gimple_bind.body;
2790 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2791 statement GS. */
2793 static inline void
2794 gimple_bind_set_body (gimple gs, gimple_seq seq)
2796 GIMPLE_CHECK (gs, GIMPLE_BIND);
2797 gs->gimple_bind.body = seq;
2801 /* Append a statement to the end of a GIMPLE_BIND's body. */
2803 static inline void
2804 gimple_bind_add_stmt (gimple gs, gimple stmt)
2806 GIMPLE_CHECK (gs, GIMPLE_BIND);
2807 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2811 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2813 static inline void
2814 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2816 GIMPLE_CHECK (gs, GIMPLE_BIND);
2817 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2821 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2822 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2824 static inline tree
2825 gimple_bind_block (const_gimple gs)
2827 GIMPLE_CHECK (gs, GIMPLE_BIND);
2828 return gs->gimple_bind.block;
2832 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2833 statement GS. */
2835 static inline void
2836 gimple_bind_set_block (gimple gs, tree block)
2838 GIMPLE_CHECK (gs, GIMPLE_BIND);
2839 gcc_gimple_checking_assert (block == NULL_TREE
2840 || TREE_CODE (block) == BLOCK);
2841 gs->gimple_bind.block = block;
2845 /* Return the number of input operands for GIMPLE_ASM GS. */
2847 static inline unsigned
2848 gimple_asm_ninputs (const_gimple gs)
2850 GIMPLE_CHECK (gs, GIMPLE_ASM);
2851 return gs->gimple_asm.ni;
2855 /* Return the number of output operands for GIMPLE_ASM GS. */
2857 static inline unsigned
2858 gimple_asm_noutputs (const_gimple gs)
2860 GIMPLE_CHECK (gs, GIMPLE_ASM);
2861 return gs->gimple_asm.no;
2865 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2867 static inline unsigned
2868 gimple_asm_nclobbers (const_gimple gs)
2870 GIMPLE_CHECK (gs, GIMPLE_ASM);
2871 return gs->gimple_asm.nc;
2874 /* Return the number of label operands for GIMPLE_ASM GS. */
2876 static inline unsigned
2877 gimple_asm_nlabels (const_gimple gs)
2879 GIMPLE_CHECK (gs, GIMPLE_ASM);
2880 return gs->gimple_asm.nl;
2883 /* Return input operand INDEX of GIMPLE_ASM GS. */
2885 static inline tree
2886 gimple_asm_input_op (const_gimple gs, unsigned index)
2888 GIMPLE_CHECK (gs, GIMPLE_ASM);
2889 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2890 return gimple_op (gs, index);
2893 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2895 static inline tree *
2896 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2898 GIMPLE_CHECK (gs, GIMPLE_ASM);
2899 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2900 return gimple_op_ptr (gs, index);
2904 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2906 static inline void
2907 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2909 GIMPLE_CHECK (gs, GIMPLE_ASM);
2910 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
2911 && TREE_CODE (in_op) == TREE_LIST);
2912 gimple_set_op (gs, index, in_op);
2916 /* Return output operand INDEX of GIMPLE_ASM GS. */
2918 static inline tree
2919 gimple_asm_output_op (const_gimple gs, unsigned index)
2921 GIMPLE_CHECK (gs, GIMPLE_ASM);
2922 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2923 return gimple_op (gs, index + gs->gimple_asm.ni);
2926 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2928 static inline tree *
2929 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2931 GIMPLE_CHECK (gs, GIMPLE_ASM);
2932 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2933 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2937 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2939 static inline void
2940 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2942 GIMPLE_CHECK (gs, GIMPLE_ASM);
2943 gcc_gimple_checking_assert (index <= gs->gimple_asm.no
2944 && TREE_CODE (out_op) == TREE_LIST);
2945 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2949 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2951 static inline tree
2952 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2954 GIMPLE_CHECK (gs, GIMPLE_ASM);
2955 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
2956 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2960 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2962 static inline void
2963 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2965 GIMPLE_CHECK (gs, GIMPLE_ASM);
2966 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
2967 && TREE_CODE (clobber_op) == TREE_LIST);
2968 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2971 /* Return label operand INDEX of GIMPLE_ASM GS. */
2973 static inline tree
2974 gimple_asm_label_op (const_gimple gs, unsigned index)
2976 GIMPLE_CHECK (gs, GIMPLE_ASM);
2977 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
2978 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
2981 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
2983 static inline void
2984 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
2986 GIMPLE_CHECK (gs, GIMPLE_ASM);
2987 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
2988 && TREE_CODE (label_op) == TREE_LIST);
2989 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
2992 /* Return the string representing the assembly instruction in
2993 GIMPLE_ASM GS. */
2995 static inline const char *
2996 gimple_asm_string (const_gimple gs)
2998 GIMPLE_CHECK (gs, GIMPLE_ASM);
2999 return gs->gimple_asm.string;
3003 /* Return true if GS is an asm statement marked volatile. */
3005 static inline bool
3006 gimple_asm_volatile_p (const_gimple gs)
3008 GIMPLE_CHECK (gs, GIMPLE_ASM);
3009 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3013 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3015 static inline void
3016 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3018 GIMPLE_CHECK (gs, GIMPLE_ASM);
3019 if (volatile_p)
3020 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3021 else
3022 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3026 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3028 static inline void
3029 gimple_asm_set_input (gimple gs, bool input_p)
3031 GIMPLE_CHECK (gs, GIMPLE_ASM);
3032 if (input_p)
3033 gs->gsbase.subcode |= GF_ASM_INPUT;
3034 else
3035 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3039 /* Return true if asm GS is an ASM_INPUT. */
3041 static inline bool
3042 gimple_asm_input_p (const_gimple gs)
3044 GIMPLE_CHECK (gs, GIMPLE_ASM);
3045 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3049 /* Return the types handled by GIMPLE_CATCH statement GS. */
3051 static inline tree
3052 gimple_catch_types (const_gimple gs)
3054 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3055 return gs->gimple_catch.types;
3059 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3061 static inline tree *
3062 gimple_catch_types_ptr (gimple gs)
3064 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3065 return &gs->gimple_catch.types;
3069 /* Return the GIMPLE sequence representing the body of the handler of
3070 GIMPLE_CATCH statement GS. */
3072 static inline gimple_seq
3073 gimple_catch_handler (gimple gs)
3075 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3076 return gs->gimple_catch.handler;
3080 /* Return a pointer to the GIMPLE sequence representing the body of
3081 the handler of GIMPLE_CATCH statement GS. */
3083 static inline gimple_seq *
3084 gimple_catch_handler_ptr (gimple gs)
3086 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3087 return &gs->gimple_catch.handler;
3091 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3093 static inline void
3094 gimple_catch_set_types (gimple gs, tree t)
3096 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3097 gs->gimple_catch.types = t;
3101 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3103 static inline void
3104 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3106 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3107 gs->gimple_catch.handler = handler;
3111 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3113 static inline tree
3114 gimple_eh_filter_types (const_gimple gs)
3116 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3117 return gs->gimple_eh_filter.types;
3121 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3122 GS. */
3124 static inline tree *
3125 gimple_eh_filter_types_ptr (gimple gs)
3127 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3128 return &gs->gimple_eh_filter.types;
3132 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3133 statement fails. */
3135 static inline gimple_seq
3136 gimple_eh_filter_failure (gimple gs)
3138 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3139 return gs->gimple_eh_filter.failure;
3143 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3145 static inline void
3146 gimple_eh_filter_set_types (gimple gs, tree types)
3148 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3149 gs->gimple_eh_filter.types = types;
3153 /* Set FAILURE to be the sequence of statements to execute on failure
3154 for GIMPLE_EH_FILTER GS. */
3156 static inline void
3157 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3159 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3160 gs->gimple_eh_filter.failure = failure;
3163 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3165 static inline tree
3166 gimple_eh_must_not_throw_fndecl (gimple gs)
3168 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3169 return gs->gimple_eh_mnt.fndecl;
3172 /* Set the function decl to be called by GS to DECL. */
3174 static inline void
3175 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3177 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3178 gs->gimple_eh_mnt.fndecl = decl;
3182 /* GIMPLE_TRY accessors. */
3184 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3185 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3187 static inline enum gimple_try_flags
3188 gimple_try_kind (const_gimple gs)
3190 GIMPLE_CHECK (gs, GIMPLE_TRY);
3191 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3195 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3197 static inline void
3198 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3200 GIMPLE_CHECK (gs, GIMPLE_TRY);
3201 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3202 || kind == GIMPLE_TRY_FINALLY);
3203 if (gimple_try_kind (gs) != kind)
3204 gs->gsbase.subcode = (unsigned int) kind;
3208 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3210 static inline bool
3211 gimple_try_catch_is_cleanup (const_gimple gs)
3213 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3214 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3218 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3220 static inline gimple_seq
3221 gimple_try_eval (gimple gs)
3223 GIMPLE_CHECK (gs, GIMPLE_TRY);
3224 return gs->gimple_try.eval;
3228 /* Return the sequence of statements used as the cleanup body for
3229 GIMPLE_TRY GS. */
3231 static inline gimple_seq
3232 gimple_try_cleanup (gimple gs)
3234 GIMPLE_CHECK (gs, GIMPLE_TRY);
3235 return gs->gimple_try.cleanup;
3239 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3241 static inline void
3242 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3244 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3245 if (catch_is_cleanup)
3246 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3247 else
3248 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3252 /* Set EVAL to be the sequence of statements to use as the body for
3253 GIMPLE_TRY GS. */
3255 static inline void
3256 gimple_try_set_eval (gimple gs, gimple_seq eval)
3258 GIMPLE_CHECK (gs, GIMPLE_TRY);
3259 gs->gimple_try.eval = eval;
3263 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3264 body for GIMPLE_TRY GS. */
3266 static inline void
3267 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3269 GIMPLE_CHECK (gs, GIMPLE_TRY);
3270 gs->gimple_try.cleanup = cleanup;
3274 /* Return the cleanup sequence for cleanup statement GS. */
3276 static inline gimple_seq
3277 gimple_wce_cleanup (gimple gs)
3279 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3280 return gs->gimple_wce.cleanup;
3284 /* Set CLEANUP to be the cleanup sequence for GS. */
3286 static inline void
3287 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3289 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3290 gs->gimple_wce.cleanup = cleanup;
3294 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3296 static inline bool
3297 gimple_wce_cleanup_eh_only (const_gimple gs)
3299 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3300 return gs->gsbase.subcode != 0;
3304 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3306 static inline void
3307 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3309 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3310 gs->gsbase.subcode = (unsigned int) eh_only_p;
3314 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3316 static inline unsigned
3317 gimple_phi_capacity (const_gimple gs)
3319 GIMPLE_CHECK (gs, GIMPLE_PHI);
3320 return gs->gimple_phi.capacity;
3324 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3325 be exactly the number of incoming edges for the basic block holding
3326 GS. */
3328 static inline unsigned
3329 gimple_phi_num_args (const_gimple gs)
3331 GIMPLE_CHECK (gs, GIMPLE_PHI);
3332 return gs->gimple_phi.nargs;
3336 /* Return the SSA name created by GIMPLE_PHI GS. */
3338 static inline tree
3339 gimple_phi_result (const_gimple gs)
3341 GIMPLE_CHECK (gs, GIMPLE_PHI);
3342 return gs->gimple_phi.result;
3345 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3347 static inline tree *
3348 gimple_phi_result_ptr (gimple gs)
3350 GIMPLE_CHECK (gs, GIMPLE_PHI);
3351 return &gs->gimple_phi.result;
3354 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3356 static inline void
3357 gimple_phi_set_result (gimple gs, tree result)
3359 GIMPLE_CHECK (gs, GIMPLE_PHI);
3360 gs->gimple_phi.result = result;
3364 /* Return the PHI argument corresponding to incoming edge INDEX for
3365 GIMPLE_PHI GS. */
3367 static inline struct phi_arg_d *
3368 gimple_phi_arg (gimple gs, unsigned index)
3370 GIMPLE_CHECK (gs, GIMPLE_PHI);
3371 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3372 return &(gs->gimple_phi.args[index]);
3375 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3376 for GIMPLE_PHI GS. */
3378 static inline void
3379 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3381 GIMPLE_CHECK (gs, GIMPLE_PHI);
3382 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3383 gs->gimple_phi.args[index] = *phiarg;
3386 /* Return the region number for GIMPLE_RESX GS. */
3388 static inline int
3389 gimple_resx_region (const_gimple gs)
3391 GIMPLE_CHECK (gs, GIMPLE_RESX);
3392 return gs->gimple_eh_ctrl.region;
3395 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3397 static inline void
3398 gimple_resx_set_region (gimple gs, int region)
3400 GIMPLE_CHECK (gs, GIMPLE_RESX);
3401 gs->gimple_eh_ctrl.region = region;
3404 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3406 static inline int
3407 gimple_eh_dispatch_region (const_gimple gs)
3409 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3410 return gs->gimple_eh_ctrl.region;
3413 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3415 static inline void
3416 gimple_eh_dispatch_set_region (gimple gs, int region)
3418 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3419 gs->gimple_eh_ctrl.region = region;
3422 /* Return the number of labels associated with the switch statement GS. */
3424 static inline unsigned
3425 gimple_switch_num_labels (const_gimple gs)
3427 unsigned num_ops;
3428 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3429 num_ops = gimple_num_ops (gs);
3430 gcc_gimple_checking_assert (num_ops > 1);
3431 return num_ops - 1;
3435 /* Set NLABELS to be the number of labels for the switch statement GS. */
3437 static inline void
3438 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3440 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3441 gimple_set_num_ops (g, nlabels + 1);
3445 /* Return the index variable used by the switch statement GS. */
3447 static inline tree
3448 gimple_switch_index (const_gimple gs)
3450 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3451 return gimple_op (gs, 0);
3455 /* Return a pointer to the index variable for the switch statement GS. */
3457 static inline tree *
3458 gimple_switch_index_ptr (const_gimple gs)
3460 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3461 return gimple_op_ptr (gs, 0);
3465 /* Set INDEX to be the index variable for switch statement GS. */
3467 static inline void
3468 gimple_switch_set_index (gimple gs, tree index)
3470 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3471 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3472 gimple_set_op (gs, 0, index);
3476 /* Return the label numbered INDEX. The default label is 0, followed by any
3477 labels in a switch statement. */
3479 static inline tree
3480 gimple_switch_label (const_gimple gs, unsigned index)
3482 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3483 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3484 return gimple_op (gs, index + 1);
3487 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3489 static inline void
3490 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3492 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3493 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3494 && (label == NULL_TREE
3495 || TREE_CODE (label) == CASE_LABEL_EXPR));
3496 gimple_set_op (gs, index + 1, label);
3499 /* Return the default label for a switch statement. */
3501 static inline tree
3502 gimple_switch_default_label (const_gimple gs)
3504 return gimple_switch_label (gs, 0);
3507 /* Set the default label for a switch statement. */
3509 static inline void
3510 gimple_switch_set_default_label (gimple gs, tree label)
3512 gimple_switch_set_label (gs, 0, label);
3515 /* Return true if GS is a GIMPLE_DEBUG statement. */
3517 static inline bool
3518 is_gimple_debug (const_gimple gs)
3520 return gimple_code (gs) == GIMPLE_DEBUG;
3523 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3525 static inline bool
3526 gimple_debug_bind_p (const_gimple s)
3528 if (is_gimple_debug (s))
3529 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3531 return false;
3534 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3536 static inline tree
3537 gimple_debug_bind_get_var (gimple dbg)
3539 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3540 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3541 return gimple_op (dbg, 0);
3544 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3545 statement. */
3547 static inline tree
3548 gimple_debug_bind_get_value (gimple dbg)
3550 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3551 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3552 return gimple_op (dbg, 1);
3555 /* Return a pointer to the value bound to the variable in a
3556 GIMPLE_DEBUG bind statement. */
3558 static inline tree *
3559 gimple_debug_bind_get_value_ptr (gimple dbg)
3561 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3562 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3563 return gimple_op_ptr (dbg, 1);
3566 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3568 static inline void
3569 gimple_debug_bind_set_var (gimple dbg, tree var)
3571 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3572 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3573 gimple_set_op (dbg, 0, var);
3576 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3577 statement. */
3579 static inline void
3580 gimple_debug_bind_set_value (gimple dbg, tree value)
3582 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3583 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3584 gimple_set_op (dbg, 1, value);
3587 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3588 optimized away. */
3589 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3591 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3592 statement. */
3594 static inline void
3595 gimple_debug_bind_reset_value (gimple dbg)
3597 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3598 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3599 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3602 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3603 value. */
3605 static inline bool
3606 gimple_debug_bind_has_value_p (gimple dbg)
3608 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3609 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3610 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3613 #undef GIMPLE_DEBUG_BIND_NOVALUE
3615 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3617 static inline bool
3618 gimple_debug_source_bind_p (const_gimple s)
3620 if (is_gimple_debug (s))
3621 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3623 return false;
3626 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3628 static inline tree
3629 gimple_debug_source_bind_get_var (gimple dbg)
3631 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3632 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3633 return gimple_op (dbg, 0);
3636 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3637 statement. */
3639 static inline tree
3640 gimple_debug_source_bind_get_value (gimple dbg)
3642 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3643 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3644 return gimple_op (dbg, 1);
3647 /* Return a pointer to the value bound to the variable in a
3648 GIMPLE_DEBUG source bind statement. */
3650 static inline tree *
3651 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3653 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3654 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3655 return gimple_op_ptr (dbg, 1);
3658 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3660 static inline void
3661 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3663 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3664 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3665 gimple_set_op (dbg, 0, var);
3668 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3669 statement. */
3671 static inline void
3672 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3674 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3675 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3676 gimple_set_op (dbg, 1, value);
3679 /* Return the body for the OMP statement GS. */
3681 static inline gimple_seq
3682 gimple_omp_body (gimple gs)
3684 return gs->omp.body;
3687 /* Set BODY to be the body for the OMP statement GS. */
3689 static inline void
3690 gimple_omp_set_body (gimple gs, gimple_seq body)
3692 gs->omp.body = body;
3696 /* Return the name associated with OMP_CRITICAL statement GS. */
3698 static inline tree
3699 gimple_omp_critical_name (const_gimple gs)
3701 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3702 return gs->gimple_omp_critical.name;
3706 /* Return a pointer to the name associated with OMP critical statement GS. */
3708 static inline tree *
3709 gimple_omp_critical_name_ptr (gimple gs)
3711 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3712 return &gs->gimple_omp_critical.name;
3716 /* Set NAME to be the name associated with OMP critical statement GS. */
3718 static inline void
3719 gimple_omp_critical_set_name (gimple gs, tree name)
3721 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3722 gs->gimple_omp_critical.name = name;
3726 /* Return the clauses associated with OMP_FOR GS. */
3728 static inline tree
3729 gimple_omp_for_clauses (const_gimple gs)
3731 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3732 return gs->gimple_omp_for.clauses;
3736 /* Return a pointer to the OMP_FOR GS. */
3738 static inline tree *
3739 gimple_omp_for_clauses_ptr (gimple gs)
3741 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3742 return &gs->gimple_omp_for.clauses;
3746 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3748 static inline void
3749 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3751 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3752 gs->gimple_omp_for.clauses = clauses;
3756 /* Get the collapse count of OMP_FOR GS. */
3758 static inline size_t
3759 gimple_omp_for_collapse (gimple gs)
3761 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3762 return gs->gimple_omp_for.collapse;
3766 /* Return the index variable for OMP_FOR GS. */
3768 static inline tree
3769 gimple_omp_for_index (const_gimple gs, size_t i)
3771 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3772 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3773 return gs->gimple_omp_for.iter[i].index;
3777 /* Return a pointer to the index variable for OMP_FOR GS. */
3779 static inline tree *
3780 gimple_omp_for_index_ptr (gimple gs, size_t i)
3782 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3783 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3784 return &gs->gimple_omp_for.iter[i].index;
3788 /* Set INDEX to be the index variable for OMP_FOR GS. */
3790 static inline void
3791 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3793 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3794 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3795 gs->gimple_omp_for.iter[i].index = index;
3799 /* Return the initial value for OMP_FOR GS. */
3801 static inline tree
3802 gimple_omp_for_initial (const_gimple gs, size_t i)
3804 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3805 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3806 return gs->gimple_omp_for.iter[i].initial;
3810 /* Return a pointer to the initial value for OMP_FOR GS. */
3812 static inline tree *
3813 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3815 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3816 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3817 return &gs->gimple_omp_for.iter[i].initial;
3821 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3823 static inline void
3824 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3826 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3827 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3828 gs->gimple_omp_for.iter[i].initial = initial;
3832 /* Return the final value for OMP_FOR GS. */
3834 static inline tree
3835 gimple_omp_for_final (const_gimple gs, size_t i)
3837 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3838 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3839 return gs->gimple_omp_for.iter[i].final;
3843 /* Return a pointer to the final value for OMP_FOR GS. */
3845 static inline tree *
3846 gimple_omp_for_final_ptr (gimple gs, size_t i)
3848 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3849 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3850 return &gs->gimple_omp_for.iter[i].final;
3854 /* Set FINAL to be the final value for OMP_FOR GS. */
3856 static inline void
3857 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3859 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3860 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3861 gs->gimple_omp_for.iter[i].final = final;
3865 /* Return the increment value for OMP_FOR GS. */
3867 static inline tree
3868 gimple_omp_for_incr (const_gimple gs, size_t i)
3870 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3871 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3872 return gs->gimple_omp_for.iter[i].incr;
3876 /* Return a pointer to the increment value for OMP_FOR GS. */
3878 static inline tree *
3879 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3881 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3882 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3883 return &gs->gimple_omp_for.iter[i].incr;
3887 /* Set INCR to be the increment value for OMP_FOR GS. */
3889 static inline void
3890 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3892 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3893 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3894 gs->gimple_omp_for.iter[i].incr = incr;
3898 /* Return the sequence of statements to execute before the OMP_FOR
3899 statement GS starts. */
3901 static inline gimple_seq
3902 gimple_omp_for_pre_body (gimple gs)
3904 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3905 return gs->gimple_omp_for.pre_body;
3909 /* Set PRE_BODY to be the sequence of statements to execute before the
3910 OMP_FOR statement GS starts. */
3912 static inline void
3913 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3915 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3916 gs->gimple_omp_for.pre_body = pre_body;
3920 /* Return the clauses associated with OMP_PARALLEL GS. */
3922 static inline tree
3923 gimple_omp_parallel_clauses (const_gimple gs)
3925 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3926 return gs->gimple_omp_parallel.clauses;
3930 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3932 static inline tree *
3933 gimple_omp_parallel_clauses_ptr (gimple gs)
3935 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3936 return &gs->gimple_omp_parallel.clauses;
3940 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
3941 GS. */
3943 static inline void
3944 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
3946 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3947 gs->gimple_omp_parallel.clauses = clauses;
3951 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
3953 static inline tree
3954 gimple_omp_parallel_child_fn (const_gimple gs)
3956 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3957 return gs->gimple_omp_parallel.child_fn;
3960 /* Return a pointer to the child function used to hold the body of
3961 OMP_PARALLEL GS. */
3963 static inline tree *
3964 gimple_omp_parallel_child_fn_ptr (gimple gs)
3966 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3967 return &gs->gimple_omp_parallel.child_fn;
3971 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
3973 static inline void
3974 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
3976 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3977 gs->gimple_omp_parallel.child_fn = child_fn;
3981 /* Return the artificial argument used to send variables and values
3982 from the parent to the children threads in OMP_PARALLEL GS. */
3984 static inline tree
3985 gimple_omp_parallel_data_arg (const_gimple gs)
3987 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3988 return gs->gimple_omp_parallel.data_arg;
3992 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
3994 static inline tree *
3995 gimple_omp_parallel_data_arg_ptr (gimple gs)
3997 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3998 return &gs->gimple_omp_parallel.data_arg;
4002 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4004 static inline void
4005 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4007 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4008 gs->gimple_omp_parallel.data_arg = data_arg;
4012 /* Return the clauses associated with OMP_TASK GS. */
4014 static inline tree
4015 gimple_omp_task_clauses (const_gimple gs)
4017 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4018 return gs->gimple_omp_parallel.clauses;
4022 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4024 static inline tree *
4025 gimple_omp_task_clauses_ptr (gimple gs)
4027 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4028 return &gs->gimple_omp_parallel.clauses;
4032 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4033 GS. */
4035 static inline void
4036 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4038 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4039 gs->gimple_omp_parallel.clauses = clauses;
4043 /* Return the child function used to hold the body of OMP_TASK GS. */
4045 static inline tree
4046 gimple_omp_task_child_fn (const_gimple gs)
4048 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4049 return gs->gimple_omp_parallel.child_fn;
4052 /* Return a pointer to the child function used to hold the body of
4053 OMP_TASK GS. */
4055 static inline tree *
4056 gimple_omp_task_child_fn_ptr (gimple gs)
4058 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4059 return &gs->gimple_omp_parallel.child_fn;
4063 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4065 static inline void
4066 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4068 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4069 gs->gimple_omp_parallel.child_fn = child_fn;
4073 /* Return the artificial argument used to send variables and values
4074 from the parent to the children threads in OMP_TASK GS. */
4076 static inline tree
4077 gimple_omp_task_data_arg (const_gimple gs)
4079 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4080 return gs->gimple_omp_parallel.data_arg;
4084 /* Return a pointer to the data argument for OMP_TASK GS. */
4086 static inline tree *
4087 gimple_omp_task_data_arg_ptr (gimple gs)
4089 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4090 return &gs->gimple_omp_parallel.data_arg;
4094 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4096 static inline void
4097 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4099 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4100 gs->gimple_omp_parallel.data_arg = data_arg;
4104 /* Return the clauses associated with OMP_TASK GS. */
4106 static inline tree
4107 gimple_omp_taskreg_clauses (const_gimple gs)
4109 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4110 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4111 return gs->gimple_omp_parallel.clauses;
4115 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4117 static inline tree *
4118 gimple_omp_taskreg_clauses_ptr (gimple gs)
4120 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4121 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4122 return &gs->gimple_omp_parallel.clauses;
4126 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4127 GS. */
4129 static inline void
4130 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4132 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4133 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4134 gs->gimple_omp_parallel.clauses = clauses;
4138 /* Return the child function used to hold the body of OMP_TASK GS. */
4140 static inline tree
4141 gimple_omp_taskreg_child_fn (const_gimple gs)
4143 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4144 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4145 return gs->gimple_omp_parallel.child_fn;
4148 /* Return a pointer to the child function used to hold the body of
4149 OMP_TASK GS. */
4151 static inline tree *
4152 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4154 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4155 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4156 return &gs->gimple_omp_parallel.child_fn;
4160 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4162 static inline void
4163 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4165 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4166 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4167 gs->gimple_omp_parallel.child_fn = child_fn;
4171 /* Return the artificial argument used to send variables and values
4172 from the parent to the children threads in OMP_TASK GS. */
4174 static inline tree
4175 gimple_omp_taskreg_data_arg (const_gimple gs)
4177 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4178 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4179 return gs->gimple_omp_parallel.data_arg;
4183 /* Return a pointer to the data argument for OMP_TASK GS. */
4185 static inline tree *
4186 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4188 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4189 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4190 return &gs->gimple_omp_parallel.data_arg;
4194 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4196 static inline void
4197 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4199 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4200 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4201 gs->gimple_omp_parallel.data_arg = data_arg;
4205 /* Return the copy function used to hold the body of OMP_TASK GS. */
4207 static inline tree
4208 gimple_omp_task_copy_fn (const_gimple gs)
4210 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4211 return gs->gimple_omp_task.copy_fn;
4214 /* Return a pointer to the copy function used to hold the body of
4215 OMP_TASK GS. */
4217 static inline tree *
4218 gimple_omp_task_copy_fn_ptr (gimple gs)
4220 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4221 return &gs->gimple_omp_task.copy_fn;
4225 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4227 static inline void
4228 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4230 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4231 gs->gimple_omp_task.copy_fn = copy_fn;
4235 /* Return size of the data block in bytes in OMP_TASK GS. */
4237 static inline tree
4238 gimple_omp_task_arg_size (const_gimple gs)
4240 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4241 return gs->gimple_omp_task.arg_size;
4245 /* Return a pointer to the data block size for OMP_TASK GS. */
4247 static inline tree *
4248 gimple_omp_task_arg_size_ptr (gimple gs)
4250 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4251 return &gs->gimple_omp_task.arg_size;
4255 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4257 static inline void
4258 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4260 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4261 gs->gimple_omp_task.arg_size = arg_size;
4265 /* Return align of the data block in bytes in OMP_TASK GS. */
4267 static inline tree
4268 gimple_omp_task_arg_align (const_gimple gs)
4270 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4271 return gs->gimple_omp_task.arg_align;
4275 /* Return a pointer to the data block align for OMP_TASK GS. */
4277 static inline tree *
4278 gimple_omp_task_arg_align_ptr (gimple gs)
4280 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4281 return &gs->gimple_omp_task.arg_align;
4285 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4287 static inline void
4288 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4290 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4291 gs->gimple_omp_task.arg_align = arg_align;
4295 /* Return the clauses associated with OMP_SINGLE GS. */
4297 static inline tree
4298 gimple_omp_single_clauses (const_gimple gs)
4300 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4301 return gs->gimple_omp_single.clauses;
4305 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4307 static inline tree *
4308 gimple_omp_single_clauses_ptr (gimple gs)
4310 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4311 return &gs->gimple_omp_single.clauses;
4315 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4317 static inline void
4318 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4320 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4321 gs->gimple_omp_single.clauses = clauses;
4325 /* Return the clauses associated with OMP_SECTIONS GS. */
4327 static inline tree
4328 gimple_omp_sections_clauses (const_gimple gs)
4330 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4331 return gs->gimple_omp_sections.clauses;
4335 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4337 static inline tree *
4338 gimple_omp_sections_clauses_ptr (gimple gs)
4340 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4341 return &gs->gimple_omp_sections.clauses;
4345 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4346 GS. */
4348 static inline void
4349 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4351 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4352 gs->gimple_omp_sections.clauses = clauses;
4356 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4357 in GS. */
4359 static inline tree
4360 gimple_omp_sections_control (const_gimple gs)
4362 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4363 return gs->gimple_omp_sections.control;
4367 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4368 GS. */
4370 static inline tree *
4371 gimple_omp_sections_control_ptr (gimple gs)
4373 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4374 return &gs->gimple_omp_sections.control;
4378 /* Set CONTROL to be the set of clauses associated with the
4379 GIMPLE_OMP_SECTIONS in GS. */
4381 static inline void
4382 gimple_omp_sections_set_control (gimple gs, tree control)
4384 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4385 gs->gimple_omp_sections.control = control;
4389 /* Set COND to be the condition code for OMP_FOR GS. */
4391 static inline void
4392 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4394 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4395 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4396 && i < gs->gimple_omp_for.collapse);
4397 gs->gimple_omp_for.iter[i].cond = cond;
4401 /* Return the condition code associated with OMP_FOR GS. */
4403 static inline enum tree_code
4404 gimple_omp_for_cond (const_gimple gs, size_t i)
4406 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4407 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4408 return gs->gimple_omp_for.iter[i].cond;
4412 /* Set the value being stored in an atomic store. */
4414 static inline void
4415 gimple_omp_atomic_store_set_val (gimple g, tree val)
4417 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4418 g->gimple_omp_atomic_store.val = val;
4422 /* Return the value being stored in an atomic store. */
4424 static inline tree
4425 gimple_omp_atomic_store_val (const_gimple g)
4427 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4428 return g->gimple_omp_atomic_store.val;
4432 /* Return a pointer to the value being stored in an atomic store. */
4434 static inline tree *
4435 gimple_omp_atomic_store_val_ptr (gimple g)
4437 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4438 return &g->gimple_omp_atomic_store.val;
4442 /* Set the LHS of an atomic load. */
4444 static inline void
4445 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4447 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4448 g->gimple_omp_atomic_load.lhs = lhs;
4452 /* Get the LHS of an atomic load. */
4454 static inline tree
4455 gimple_omp_atomic_load_lhs (const_gimple g)
4457 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4458 return g->gimple_omp_atomic_load.lhs;
4462 /* Return a pointer to the LHS of an atomic load. */
4464 static inline tree *
4465 gimple_omp_atomic_load_lhs_ptr (gimple g)
4467 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4468 return &g->gimple_omp_atomic_load.lhs;
4472 /* Set the RHS of an atomic load. */
4474 static inline void
4475 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4477 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4478 g->gimple_omp_atomic_load.rhs = rhs;
4482 /* Get the RHS of an atomic load. */
4484 static inline tree
4485 gimple_omp_atomic_load_rhs (const_gimple g)
4487 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4488 return g->gimple_omp_atomic_load.rhs;
4492 /* Return a pointer to the RHS of an atomic load. */
4494 static inline tree *
4495 gimple_omp_atomic_load_rhs_ptr (gimple g)
4497 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4498 return &g->gimple_omp_atomic_load.rhs;
4502 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4504 static inline tree
4505 gimple_omp_continue_control_def (const_gimple g)
4507 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4508 return g->gimple_omp_continue.control_def;
4511 /* The same as above, but return the address. */
4513 static inline tree *
4514 gimple_omp_continue_control_def_ptr (gimple g)
4516 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4517 return &g->gimple_omp_continue.control_def;
4520 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4522 static inline void
4523 gimple_omp_continue_set_control_def (gimple g, tree def)
4525 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4526 g->gimple_omp_continue.control_def = def;
4530 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4532 static inline tree
4533 gimple_omp_continue_control_use (const_gimple g)
4535 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4536 return g->gimple_omp_continue.control_use;
4540 /* The same as above, but return the address. */
4542 static inline tree *
4543 gimple_omp_continue_control_use_ptr (gimple g)
4545 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4546 return &g->gimple_omp_continue.control_use;
4550 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4552 static inline void
4553 gimple_omp_continue_set_control_use (gimple g, tree use)
4555 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4556 g->gimple_omp_continue.control_use = use;
4560 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4562 static inline tree *
4563 gimple_return_retval_ptr (const_gimple gs)
4565 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4566 return gimple_op_ptr (gs, 0);
4569 /* Return the return value for GIMPLE_RETURN GS. */
4571 static inline tree
4572 gimple_return_retval (const_gimple gs)
4574 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4575 return gimple_op (gs, 0);
4579 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4581 static inline void
4582 gimple_return_set_retval (gimple gs, tree retval)
4584 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4585 gimple_set_op (gs, 0, retval);
4589 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4591 #define CASE_GIMPLE_OMP \
4592 case GIMPLE_OMP_PARALLEL: \
4593 case GIMPLE_OMP_TASK: \
4594 case GIMPLE_OMP_FOR: \
4595 case GIMPLE_OMP_SECTIONS: \
4596 case GIMPLE_OMP_SECTIONS_SWITCH: \
4597 case GIMPLE_OMP_SINGLE: \
4598 case GIMPLE_OMP_SECTION: \
4599 case GIMPLE_OMP_MASTER: \
4600 case GIMPLE_OMP_ORDERED: \
4601 case GIMPLE_OMP_CRITICAL: \
4602 case GIMPLE_OMP_RETURN: \
4603 case GIMPLE_OMP_ATOMIC_LOAD: \
4604 case GIMPLE_OMP_ATOMIC_STORE: \
4605 case GIMPLE_OMP_CONTINUE
4607 static inline bool
4608 is_gimple_omp (const_gimple stmt)
4610 switch (gimple_code (stmt))
4612 CASE_GIMPLE_OMP:
4613 return true;
4614 default:
4615 return false;
4620 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4622 static inline bool
4623 gimple_nop_p (const_gimple g)
4625 return gimple_code (g) == GIMPLE_NOP;
4629 /* Return true if GS is a GIMPLE_RESX. */
4631 static inline bool
4632 is_gimple_resx (const_gimple gs)
4634 return gimple_code (gs) == GIMPLE_RESX;
4637 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4639 static inline enum br_predictor
4640 gimple_predict_predictor (gimple gs)
4642 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4643 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4647 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4649 static inline void
4650 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4652 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4653 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4654 | (unsigned) predictor;
4658 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4660 static inline enum prediction
4661 gimple_predict_outcome (gimple gs)
4663 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4664 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4668 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4670 static inline void
4671 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4673 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4674 if (outcome == TAKEN)
4675 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4676 else
4677 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4681 /* Return the type of the main expression computed by STMT. Return
4682 void_type_node if the statement computes nothing. */
4684 static inline tree
4685 gimple_expr_type (const_gimple stmt)
4687 enum gimple_code code = gimple_code (stmt);
4689 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4691 tree type;
4692 /* In general we want to pass out a type that can be substituted
4693 for both the RHS and the LHS types if there is a possibly
4694 useless conversion involved. That means returning the
4695 original RHS type as far as we can reconstruct it. */
4696 if (code == GIMPLE_CALL)
4697 type = gimple_call_return_type (stmt);
4698 else
4699 switch (gimple_assign_rhs_code (stmt))
4701 case POINTER_PLUS_EXPR:
4702 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4703 break;
4705 default:
4706 /* As fallback use the type of the LHS. */
4707 type = TREE_TYPE (gimple_get_lhs (stmt));
4708 break;
4710 return type;
4712 else if (code == GIMPLE_COND)
4713 return boolean_type_node;
4714 else
4715 return void_type_node;
4719 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4721 static inline gimple_stmt_iterator
4722 gsi_start (gimple_seq seq)
4724 gimple_stmt_iterator i;
4726 i.ptr = gimple_seq_first (seq);
4727 i.seq = seq;
4728 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4730 return i;
4734 /* Return a new iterator pointing to the first statement in basic block BB. */
4736 static inline gimple_stmt_iterator
4737 gsi_start_bb (basic_block bb)
4739 gimple_stmt_iterator i;
4740 gimple_seq seq;
4742 seq = bb_seq (bb);
4743 i.ptr = gimple_seq_first (seq);
4744 i.seq = seq;
4745 i.bb = bb;
4747 return i;
4751 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4753 static inline gimple_stmt_iterator
4754 gsi_last (gimple_seq seq)
4756 gimple_stmt_iterator i;
4758 i.ptr = gimple_seq_last (seq);
4759 i.seq = seq;
4760 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4762 return i;
4766 /* Return a new iterator pointing to the last statement in basic block BB. */
4768 static inline gimple_stmt_iterator
4769 gsi_last_bb (basic_block bb)
4771 gimple_stmt_iterator i;
4772 gimple_seq seq;
4774 seq = bb_seq (bb);
4775 i.ptr = gimple_seq_last (seq);
4776 i.seq = seq;
4777 i.bb = bb;
4779 return i;
4783 /* Return true if I is at the end of its sequence. */
4785 static inline bool
4786 gsi_end_p (gimple_stmt_iterator i)
4788 return i.ptr == NULL;
4792 /* Return true if I is one statement before the end of its sequence. */
4794 static inline bool
4795 gsi_one_before_end_p (gimple_stmt_iterator i)
4797 return i.ptr != NULL && i.ptr->next == NULL;
4801 /* Advance the iterator to the next gimple statement. */
4803 static inline void
4804 gsi_next (gimple_stmt_iterator *i)
4806 i->ptr = i->ptr->next;
4809 /* Advance the iterator to the previous gimple statement. */
4811 static inline void
4812 gsi_prev (gimple_stmt_iterator *i)
4814 i->ptr = i->ptr->prev;
4817 /* Return the current stmt. */
4819 static inline gimple
4820 gsi_stmt (gimple_stmt_iterator i)
4822 return i.ptr->stmt;
4825 /* Return a block statement iterator that points to the first non-label
4826 statement in block BB. */
4828 static inline gimple_stmt_iterator
4829 gsi_after_labels (basic_block bb)
4831 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4833 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4834 gsi_next (&gsi);
4836 return gsi;
4839 /* Advance the iterator to the next non-debug gimple statement. */
4841 static inline void
4842 gsi_next_nondebug (gimple_stmt_iterator *i)
4846 gsi_next (i);
4848 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4851 /* Advance the iterator to the next non-debug gimple statement. */
4853 static inline void
4854 gsi_prev_nondebug (gimple_stmt_iterator *i)
4858 gsi_prev (i);
4860 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4863 /* Return a new iterator pointing to the first non-debug statement in
4864 basic block BB. */
4866 static inline gimple_stmt_iterator
4867 gsi_start_nondebug_bb (basic_block bb)
4869 gimple_stmt_iterator i = gsi_start_bb (bb);
4871 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4872 gsi_next_nondebug (&i);
4874 return i;
4877 /* Return a new iterator pointing to the last non-debug statement in
4878 basic block BB. */
4880 static inline gimple_stmt_iterator
4881 gsi_last_nondebug_bb (basic_block bb)
4883 gimple_stmt_iterator i = gsi_last_bb (bb);
4885 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4886 gsi_prev_nondebug (&i);
4888 return i;
4891 /* Return a pointer to the current stmt.
4893 NOTE: You may want to use gsi_replace on the iterator itself,
4894 as this performs additional bookkeeping that will not be done
4895 if you simply assign through a pointer returned by gsi_stmt_ptr. */
4897 static inline gimple *
4898 gsi_stmt_ptr (gimple_stmt_iterator *i)
4900 return &i->ptr->stmt;
4904 /* Return the basic block associated with this iterator. */
4906 static inline basic_block
4907 gsi_bb (gimple_stmt_iterator i)
4909 return i.bb;
4913 /* Return the sequence associated with this iterator. */
4915 static inline gimple_seq
4916 gsi_seq (gimple_stmt_iterator i)
4918 return i.seq;
4922 enum gsi_iterator_update
4924 GSI_NEW_STMT, /* Only valid when single statement is added, move
4925 iterator to it. */
4926 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
4927 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
4928 for linking other statements in the same
4929 direction. */
4932 /* In gimple-iterator.c */
4933 gimple_stmt_iterator gsi_start_phis (basic_block);
4934 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
4935 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
4936 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
4937 void gsi_insert_before (gimple_stmt_iterator *, gimple,
4938 enum gsi_iterator_update);
4939 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
4940 enum gsi_iterator_update);
4941 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
4942 enum gsi_iterator_update);
4943 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
4944 enum gsi_iterator_update);
4945 void gsi_insert_after (gimple_stmt_iterator *, gimple,
4946 enum gsi_iterator_update);
4947 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
4948 enum gsi_iterator_update);
4949 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
4950 enum gsi_iterator_update);
4951 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
4952 enum gsi_iterator_update);
4953 void gsi_remove (gimple_stmt_iterator *, bool);
4954 gimple_stmt_iterator gsi_for_stmt (gimple);
4955 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
4956 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
4957 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
4958 void gsi_insert_on_edge (edge, gimple);
4959 void gsi_insert_seq_on_edge (edge, gimple_seq);
4960 basic_block gsi_insert_on_edge_immediate (edge, gimple);
4961 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
4962 void gsi_commit_one_edge_insert (edge, basic_block *);
4963 void gsi_commit_edge_inserts (void);
4964 gimple gimple_call_copy_skip_args (gimple, bitmap);
4967 /* Convenience routines to walk all statements of a gimple function.
4968 Note that this is useful exclusively before the code is converted
4969 into SSA form. Once the program is in SSA form, the standard
4970 operand interface should be used to analyze/modify statements. */
4971 struct walk_stmt_info
4973 /* Points to the current statement being walked. */
4974 gimple_stmt_iterator gsi;
4976 /* Additional data that the callback functions may want to carry
4977 through the recursion. */
4978 void *info;
4980 /* Pointer map used to mark visited tree nodes when calling
4981 walk_tree on each operand. If set to NULL, duplicate tree nodes
4982 will be visited more than once. */
4983 struct pointer_set_t *pset;
4985 /* Indicates whether the operand being examined may be replaced
4986 with something that matches is_gimple_val (if true) or something
4987 slightly more complicated (if false). "Something" technically
4988 means the common subset of is_gimple_lvalue and is_gimple_rhs,
4989 but we never try to form anything more complicated than that, so
4990 we don't bother checking.
4992 Also note that CALLBACK should update this flag while walking the
4993 sub-expressions of a statement. For instance, when walking the
4994 statement 'foo (&var)', the flag VAL_ONLY will initially be set
4995 to true, however, when walking &var, the operand of that
4996 ADDR_EXPR does not need to be a GIMPLE value. */
4997 bool val_only;
4999 /* True if we are currently walking the LHS of an assignment. */
5000 bool is_lhs;
5002 /* Optional. Set to true by the callback functions if they made any
5003 changes. */
5004 bool changed;
5006 /* True if we're interested in location information. */
5007 bool want_locations;
5009 /* Operand returned by the callbacks. This is set when calling
5010 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5011 returns non-NULL, this field will contain the tree returned by
5012 the last callback. */
5013 tree callback_result;
5016 /* Callback for walk_gimple_stmt. Called for every statement found
5017 during traversal. The first argument points to the statement to
5018 walk. The second argument is a flag that the callback sets to
5019 'true' if it the callback handled all the operands and
5020 sub-statements of the statement (the default value of this flag is
5021 'false'). The third argument is an anonymous pointer to data
5022 to be used by the callback. */
5023 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5024 struct walk_stmt_info *);
5026 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5027 struct walk_stmt_info *);
5028 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5029 struct walk_stmt_info *);
5030 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5032 #ifdef GATHER_STATISTICS
5033 /* Enum and arrays used for allocation stats. Keep in sync with
5034 gimple.c:gimple_alloc_kind_names. */
5035 enum gimple_alloc_kind
5037 gimple_alloc_kind_assign, /* Assignments. */
5038 gimple_alloc_kind_phi, /* PHI nodes. */
5039 gimple_alloc_kind_cond, /* Conditionals. */
5040 gimple_alloc_kind_seq, /* Sequences. */
5041 gimple_alloc_kind_rest, /* Everything else. */
5042 gimple_alloc_kind_all
5045 extern int gimple_alloc_counts[];
5046 extern int gimple_alloc_sizes[];
5048 /* Return the allocation kind for a given stmt CODE. */
5049 static inline enum gimple_alloc_kind
5050 gimple_alloc_kind (enum gimple_code code)
5052 switch (code)
5054 case GIMPLE_ASSIGN:
5055 return gimple_alloc_kind_assign;
5056 case GIMPLE_PHI:
5057 return gimple_alloc_kind_phi;
5058 case GIMPLE_COND:
5059 return gimple_alloc_kind_cond;
5060 default:
5061 return gimple_alloc_kind_rest;
5064 #endif /* GATHER_STATISTICS */
5066 extern void dump_gimple_statistics (void);
5068 /* In gimple-fold.c. */
5069 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5070 tree gimple_fold_builtin (gimple);
5071 bool fold_stmt (gimple_stmt_iterator *);
5072 bool fold_stmt_inplace (gimple_stmt_iterator *);
5073 tree get_symbol_constant_value (tree);
5074 tree canonicalize_constructor_val (tree);
5075 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5076 enum tree_code, tree, tree);
5077 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5078 enum tree_code, tree, tree);
5080 bool gimple_val_nonnegative_real_p (tree);
5081 #endif /* GCC_GIMPLE_H */