gcc/
[official-gcc.git] / gcc / gimple.h
blob797cd944450848f9b551e13142cbdb02076dcf25
1 /* Gimple IR definitions.
3 Copyright 2007, 2008, 2009, 2010, 2011, 2012 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.h"
32 #include "tree-ssa-operands.h"
33 #include "tree-ssa-alias.h"
34 #include "internal-fn.h"
36 typedef gimple gimple_seq_node;
38 /* For each block, the PHI nodes that need to be rewritten are stored into
39 these vectors. */
40 typedef VEC(gimple, heap) *gimple_vec;
41 DEF_VEC_P (gimple_vec);
42 DEF_VEC_ALLOC_P (gimple_vec, heap);
44 enum gimple_code {
45 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
46 #include "gimple.def"
47 #undef DEFGSCODE
48 LAST_AND_UNUSED_GIMPLE_CODE
51 extern const char *const gimple_code_name[];
52 extern const unsigned char gimple_rhs_class_table[];
54 /* Error out if a gimple tuple is addressed incorrectly. */
55 #if defined ENABLE_GIMPLE_CHECKING
56 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
57 extern void gimple_check_failed (const_gimple, const char *, int, \
58 const char *, enum gimple_code, \
59 enum tree_code) ATTRIBUTE_NORETURN;
61 #define GIMPLE_CHECK(GS, CODE) \
62 do { \
63 const_gimple __gs = (GS); \
64 if (gimple_code (__gs) != (CODE)) \
65 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
66 (CODE), ERROR_MARK); \
67 } while (0)
68 #else /* not ENABLE_GIMPLE_CHECKING */
69 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
70 #define GIMPLE_CHECK(GS, CODE) (void)0
71 #endif
73 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
74 get_gimple_rhs_class. */
75 enum gimple_rhs_class
77 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
78 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
79 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
80 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
81 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
82 name, a _DECL, a _REF, etc. */
85 /* Specific flags for individual GIMPLE statements. These flags are
86 always stored in gimple_statement_base.subcode and they may only be
87 defined for statement codes that do not use sub-codes.
89 Values for the masks can overlap as long as the overlapping values
90 are never used in the same statement class.
92 The maximum mask value that can be defined is 1 << 15 (i.e., each
93 statement code can hold up to 16 bitflags).
95 Keep this list sorted. */
96 enum gf_mask {
97 GF_ASM_INPUT = 1 << 0,
98 GF_ASM_VOLATILE = 1 << 1,
99 GF_CALL_FROM_THUNK = 1 << 0,
100 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
101 GF_CALL_TAILCALL = 1 << 2,
102 GF_CALL_VA_ARG_PACK = 1 << 3,
103 GF_CALL_NOTHROW = 1 << 4,
104 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
105 GF_CALL_INTERNAL = 1 << 6,
106 GF_OMP_PARALLEL_COMBINED = 1 << 0,
108 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
109 a thread synchronization via some sort of barrier. The exact barrier
110 that would otherwise be emitted is dependent on the OMP statement with
111 which this return is associated. */
112 GF_OMP_RETURN_NOWAIT = 1 << 0,
114 GF_OMP_SECTION_LAST = 1 << 0,
115 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
116 GF_PREDICT_TAKEN = 1 << 15
119 /* Currently, there are only two types of gimple debug stmt. Others are
120 envisioned, for example, to enable the generation of is_stmt notes
121 in line number information, to mark sequence points, etc. This
122 subcode is to be used to tell them apart. */
123 enum gimple_debug_subcode {
124 GIMPLE_DEBUG_BIND = 0,
125 GIMPLE_DEBUG_SOURCE_BIND = 1
128 /* Masks for selecting a pass local flag (PLF) to work on. These
129 masks are used by gimple_set_plf and gimple_plf. */
130 enum plf_mask {
131 GF_PLF_1 = 1 << 0,
132 GF_PLF_2 = 1 << 1
135 /* Iterator object for GIMPLE statement sequences. */
137 typedef struct
139 /* Sequence node holding the current statement. */
140 gimple_seq_node ptr;
142 /* Sequence and basic block holding the statement. These fields
143 are necessary to handle edge cases such as when statement is
144 added to an empty basic block or when the last statement of a
145 block/sequence is removed. */
146 gimple_seq *seq;
147 basic_block bb;
148 } gimple_stmt_iterator;
151 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
152 are for 64 bit hosts. */
154 struct GTY((chain_next ("%h.next"))) gimple_statement_base {
155 /* [ WORD 1 ]
156 Main identifying code for a tuple. */
157 ENUM_BITFIELD(gimple_code) code : 8;
159 /* Nonzero if a warning should not be emitted on this tuple. */
160 unsigned int no_warning : 1;
162 /* Nonzero if this tuple has been visited. Passes are responsible
163 for clearing this bit before using it. */
164 unsigned int visited : 1;
166 /* Nonzero if this tuple represents a non-temporal move. */
167 unsigned int nontemporal_move : 1;
169 /* Pass local flags. These flags are free for any pass to use as
170 they see fit. Passes should not assume that these flags contain
171 any useful value when the pass starts. Any initial state that
172 the pass requires should be set on entry to the pass. See
173 gimple_set_plf and gimple_plf for usage. */
174 unsigned int plf : 2;
176 /* Nonzero if this statement has been modified and needs to have its
177 operands rescanned. */
178 unsigned modified : 1;
180 /* Nonzero if this statement contains volatile operands. */
181 unsigned has_volatile_ops : 1;
183 /* The SUBCODE field can be used for tuple-specific flags for tuples
184 that do not require subcodes. Note that SUBCODE should be at
185 least as wide as tree codes, as several tuples store tree codes
186 in there. */
187 unsigned int subcode : 16;
189 /* UID of this statement. This is used by passes that want to
190 assign IDs to statements. It must be assigned and used by each
191 pass. By default it should be assumed to contain garbage. */
192 unsigned uid;
194 /* [ WORD 2 ]
195 Locus information for debug info. */
196 location_t location;
198 /* Number of operands in this tuple. */
199 unsigned num_ops;
201 /* [ WORD 3 ]
202 Basic block holding this statement. */
203 basic_block bb;
205 /* [ WORD 4-5 ]
206 Linked lists of gimple statements. The next pointers form
207 a NULL terminated list, the prev pointers are a cyclic list.
208 A gimple statement is hence also a double-ended list of
209 statements, with the pointer itself being the first element,
210 and the prev pointer being the last. */
211 gimple next;
212 gimple GTY((skip)) prev;
214 /* [ WORD 6 ]
215 Lexical block holding this statement. */
216 tree block;
220 /* Base structure for tuples with operands. */
222 struct GTY(()) gimple_statement_with_ops_base
224 /* [ WORD 1-6 ] */
225 struct gimple_statement_base gsbase;
227 /* [ WORD 7-8 ]
228 SSA operand vectors. NOTE: It should be possible to
229 amalgamate these vectors with the operand vector OP. However,
230 the SSA operand vectors are organized differently and contain
231 more information (like immediate use chaining). */
232 struct def_optype_d GTY((skip (""))) *def_ops;
233 struct use_optype_d GTY((skip (""))) *use_ops;
237 /* Statements that take register operands. */
239 struct GTY(()) gimple_statement_with_ops
241 /* [ WORD 1-8 ] */
242 struct gimple_statement_with_ops_base opbase;
244 /* [ WORD 9 ]
245 Operand vector. NOTE! This must always be the last field
246 of this structure. In particular, this means that this
247 structure cannot be embedded inside another one. */
248 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
252 /* Base for statements that take both memory and register operands. */
254 struct GTY(()) gimple_statement_with_memory_ops_base
256 /* [ WORD 1-8 ] */
257 struct gimple_statement_with_ops_base opbase;
259 /* [ WORD 9-10 ]
260 Virtual operands for this statement. The GC will pick them
261 up via the ssa_names array. */
262 tree GTY((skip (""))) vdef;
263 tree GTY((skip (""))) vuse;
267 /* Statements that take both memory and register operands. */
269 struct GTY(()) gimple_statement_with_memory_ops
271 /* [ WORD 1-10 ] */
272 struct gimple_statement_with_memory_ops_base membase;
274 /* [ WORD 11 ]
275 Operand vector. NOTE! This must always be the last field
276 of this structure. In particular, this means that this
277 structure cannot be embedded inside another one. */
278 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
282 /* Call statements that take both memory and register operands. */
284 struct GTY(()) gimple_statement_call
286 /* [ WORD 1-10 ] */
287 struct gimple_statement_with_memory_ops_base membase;
289 /* [ WORD 11-14 ] */
290 struct pt_solution call_used;
291 struct pt_solution call_clobbered;
293 /* [ WORD 15 ] */
294 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
295 tree GTY ((tag ("0"))) fntype;
296 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
297 } u;
299 /* [ WORD 16 ]
300 Operand vector. NOTE! This must always be the last field
301 of this structure. In particular, this means that this
302 structure cannot be embedded inside another one. */
303 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
307 /* OpenMP statements (#pragma omp). */
309 struct GTY(()) gimple_statement_omp {
310 /* [ WORD 1-6 ] */
311 struct gimple_statement_base gsbase;
313 /* [ WORD 7 ] */
314 gimple_seq body;
318 /* GIMPLE_BIND */
320 struct GTY(()) gimple_statement_bind {
321 /* [ WORD 1-6 ] */
322 struct gimple_statement_base gsbase;
324 /* [ WORD 7 ]
325 Variables declared in this scope. */
326 tree vars;
328 /* [ WORD 8 ]
329 This is different than the BLOCK field in gimple_statement_base,
330 which is analogous to TREE_BLOCK (i.e., the lexical block holding
331 this statement). This field is the equivalent of BIND_EXPR_BLOCK
332 in tree land (i.e., the lexical scope defined by this bind). See
333 gimple-low.c. */
334 tree block;
336 /* [ WORD 9 ] */
337 gimple_seq body;
341 /* GIMPLE_CATCH */
343 struct GTY(()) gimple_statement_catch {
344 /* [ WORD 1-6 ] */
345 struct gimple_statement_base gsbase;
347 /* [ WORD 7 ] */
348 tree types;
350 /* [ WORD 8 ] */
351 gimple_seq handler;
355 /* GIMPLE_EH_FILTER */
357 struct GTY(()) gimple_statement_eh_filter {
358 /* [ WORD 1-6 ] */
359 struct gimple_statement_base gsbase;
361 /* [ WORD 7 ]
362 Filter types. */
363 tree types;
365 /* [ WORD 8 ]
366 Failure actions. */
367 gimple_seq failure;
370 /* GIMPLE_EH_ELSE */
372 struct GTY(()) gimple_statement_eh_else {
373 /* [ WORD 1-6 ] */
374 struct gimple_statement_base gsbase;
376 /* [ WORD 7,8 ] */
377 gimple_seq n_body, e_body;
380 /* GIMPLE_EH_MUST_NOT_THROW */
382 struct GTY(()) gimple_statement_eh_mnt {
383 /* [ WORD 1-6 ] */
384 struct gimple_statement_base gsbase;
386 /* [ WORD 7 ] Abort function decl. */
387 tree fndecl;
390 /* GIMPLE_PHI */
392 struct GTY(()) gimple_statement_phi {
393 /* [ WORD 1-6 ] */
394 struct gimple_statement_base gsbase;
396 /* [ WORD 7 ] */
397 unsigned capacity;
398 unsigned nargs;
400 /* [ WORD 8 ] */
401 tree result;
403 /* [ WORD 9 ] */
404 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
408 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
410 struct GTY(()) gimple_statement_eh_ctrl
412 /* [ WORD 1-6 ] */
413 struct gimple_statement_base gsbase;
415 /* [ WORD 7 ]
416 Exception region number. */
417 int region;
421 /* GIMPLE_TRY */
423 struct GTY(()) gimple_statement_try {
424 /* [ WORD 1-6 ] */
425 struct gimple_statement_base gsbase;
427 /* [ WORD 7 ]
428 Expression to evaluate. */
429 gimple_seq eval;
431 /* [ WORD 8 ]
432 Cleanup expression. */
433 gimple_seq cleanup;
436 /* Kind of GIMPLE_TRY statements. */
437 enum gimple_try_flags
439 /* A try/catch. */
440 GIMPLE_TRY_CATCH = 1 << 0,
442 /* A try/finally. */
443 GIMPLE_TRY_FINALLY = 1 << 1,
444 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
446 /* Analogous to TRY_CATCH_IS_CLEANUP. */
447 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
450 /* GIMPLE_WITH_CLEANUP_EXPR */
452 struct GTY(()) gimple_statement_wce {
453 /* [ WORD 1-6 ] */
454 struct gimple_statement_base gsbase;
456 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
457 executed if an exception is thrown, not on normal exit of its
458 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
459 in TARGET_EXPRs. */
461 /* [ WORD 7 ]
462 Cleanup expression. */
463 gimple_seq cleanup;
467 /* GIMPLE_ASM */
469 struct GTY(()) gimple_statement_asm
471 /* [ WORD 1-10 ] */
472 struct gimple_statement_with_memory_ops_base membase;
474 /* [ WORD 11 ]
475 __asm__ statement. */
476 const char *string;
478 /* [ WORD 12 ]
479 Number of inputs, outputs, clobbers, labels. */
480 unsigned char ni;
481 unsigned char no;
482 unsigned char nc;
483 unsigned char nl;
485 /* [ WORD 13 ]
486 Operand vector. NOTE! This must always be the last field
487 of this structure. In particular, this means that this
488 structure cannot be embedded inside another one. */
489 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
492 /* GIMPLE_OMP_CRITICAL */
494 struct GTY(()) gimple_statement_omp_critical {
495 /* [ WORD 1-7 ] */
496 struct gimple_statement_omp omp;
498 /* [ WORD 8 ]
499 Critical section name. */
500 tree name;
504 struct GTY(()) gimple_omp_for_iter {
505 /* Condition code. */
506 enum tree_code cond;
508 /* Index variable. */
509 tree index;
511 /* Initial value. */
512 tree initial;
514 /* Final value. */
515 tree final;
517 /* Increment. */
518 tree incr;
521 /* GIMPLE_OMP_FOR */
523 struct GTY(()) gimple_statement_omp_for {
524 /* [ WORD 1-7 ] */
525 struct gimple_statement_omp omp;
527 /* [ WORD 8 ] */
528 tree clauses;
530 /* [ WORD 9 ]
531 Number of elements in iter array. */
532 size_t collapse;
534 /* [ WORD 10 ] */
535 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
537 /* [ WORD 11 ]
538 Pre-body evaluated before the loop body begins. */
539 gimple_seq pre_body;
543 /* GIMPLE_OMP_PARALLEL */
545 struct GTY(()) gimple_statement_omp_parallel {
546 /* [ WORD 1-7 ] */
547 struct gimple_statement_omp omp;
549 /* [ WORD 8 ]
550 Clauses. */
551 tree clauses;
553 /* [ WORD 9 ]
554 Child function holding the body of the parallel region. */
555 tree child_fn;
557 /* [ WORD 10 ]
558 Shared data argument. */
559 tree data_arg;
563 /* GIMPLE_OMP_TASK */
565 struct GTY(()) gimple_statement_omp_task {
566 /* [ WORD 1-10 ] */
567 struct gimple_statement_omp_parallel par;
569 /* [ WORD 11 ]
570 Child function holding firstprivate initialization if needed. */
571 tree copy_fn;
573 /* [ WORD 12-13 ]
574 Size and alignment in bytes of the argument data block. */
575 tree arg_size;
576 tree arg_align;
580 /* GIMPLE_OMP_SECTION */
581 /* Uses struct gimple_statement_omp. */
584 /* GIMPLE_OMP_SECTIONS */
586 struct GTY(()) gimple_statement_omp_sections {
587 /* [ WORD 1-7 ] */
588 struct gimple_statement_omp omp;
590 /* [ WORD 8 ] */
591 tree clauses;
593 /* [ WORD 9 ]
594 The control variable used for deciding which of the sections to
595 execute. */
596 tree control;
599 /* GIMPLE_OMP_CONTINUE.
601 Note: This does not inherit from gimple_statement_omp, because we
602 do not need the body field. */
604 struct GTY(()) gimple_statement_omp_continue {
605 /* [ WORD 1-6 ] */
606 struct gimple_statement_base gsbase;
608 /* [ WORD 7 ] */
609 tree control_def;
611 /* [ WORD 8 ] */
612 tree control_use;
615 /* GIMPLE_OMP_SINGLE */
617 struct GTY(()) gimple_statement_omp_single {
618 /* [ WORD 1-7 ] */
619 struct gimple_statement_omp omp;
621 /* [ WORD 7 ] */
622 tree clauses;
626 /* GIMPLE_OMP_ATOMIC_LOAD.
627 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
628 contains a sequence, which we don't need here. */
630 struct GTY(()) gimple_statement_omp_atomic_load {
631 /* [ WORD 1-6 ] */
632 struct gimple_statement_base gsbase;
634 /* [ WORD 7-8 ] */
635 tree rhs, lhs;
638 /* GIMPLE_OMP_ATOMIC_STORE.
639 See note on GIMPLE_OMP_ATOMIC_LOAD. */
641 struct GTY(()) gimple_statement_omp_atomic_store {
642 /* [ WORD 1-6 ] */
643 struct gimple_statement_base gsbase;
645 /* [ WORD 7 ] */
646 tree val;
649 /* GIMPLE_TRANSACTION. */
651 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
653 /* The __transaction_atomic was declared [[outer]] or it is
654 __transaction_relaxed. */
655 #define GTMA_IS_OUTER (1u << 0)
656 #define GTMA_IS_RELAXED (1u << 1)
657 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
659 /* The transaction is seen to not have an abort. */
660 #define GTMA_HAVE_ABORT (1u << 2)
661 /* The transaction is seen to have loads or stores. */
662 #define GTMA_HAVE_LOAD (1u << 3)
663 #define GTMA_HAVE_STORE (1u << 4)
664 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
665 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
666 /* The transaction WILL enter serial irrevocable mode.
667 An irrevocable block post-dominates the entire transaction, such
668 that all invocations of the transaction will go serial-irrevocable.
669 In such case, we don't bother instrumenting the transaction, and
670 tell the runtime that it should begin the transaction in
671 serial-irrevocable mode. */
672 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
674 struct GTY(()) gimple_statement_transaction
676 /* [ WORD 1-10 ] */
677 struct gimple_statement_with_memory_ops_base gsbase;
679 /* [ WORD 11 ] */
680 gimple_seq body;
682 /* [ WORD 12 ] */
683 tree label;
686 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
687 enum gimple_statement_structure_enum {
688 #include "gsstruct.def"
689 LAST_GSS_ENUM
691 #undef DEFGSSTRUCT
694 /* Define the overall contents of a gimple tuple. It may be any of the
695 structures declared above for various types of tuples. */
697 union GTY ((desc ("gimple_statement_structure (&%h)"),
698 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
699 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
700 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
701 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
702 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
703 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
704 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
705 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
706 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
707 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
708 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
709 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
710 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
711 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
712 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
713 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
714 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
715 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
716 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
717 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
718 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
719 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
720 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
721 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
722 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
723 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
724 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
727 /* In gimple.c. */
729 /* Offset in bytes to the location of the operand vector.
730 Zero if there is no operand vector for this tuple structure. */
731 extern size_t const gimple_ops_offset_[];
733 /* Map GIMPLE codes to GSS codes. */
734 extern enum gimple_statement_structure_enum const gss_for_code_[];
736 /* This variable holds the currently expanded gimple statement for purposes
737 of comminucating the profile info to the builtin expanders. */
738 extern gimple currently_expanding_gimple_stmt;
740 gimple gimple_build_return (tree);
742 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
743 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
745 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
747 gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
748 tree, tree MEM_STAT_DECL);
749 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
750 gimple_build_assign_with_ops_stat (c, o1, o2, o3, NULL_TREE MEM_STAT_INFO)
751 #define gimple_build_assign_with_ops3(c,o1,o2,o3,o4) \
752 gimple_build_assign_with_ops_stat (c, o1, o2, o3, o4 MEM_STAT_INFO)
754 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
755 #define gimple_build_debug_bind(var,val,stmt) \
756 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
757 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
758 #define gimple_build_debug_source_bind(var,val,stmt) \
759 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
761 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
762 gimple gimple_build_call (tree, unsigned, ...);
763 gimple gimple_build_call_valist (tree, unsigned, va_list);
764 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
765 gimple gimple_build_call_internal_vec (enum internal_fn, VEC(tree, heap) *);
766 gimple gimple_build_call_from_tree (tree);
767 gimple gimplify_assign (tree, tree, gimple_seq *);
768 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
769 gimple gimple_build_label (tree label);
770 gimple gimple_build_goto (tree dest);
771 gimple gimple_build_nop (void);
772 gimple gimple_build_bind (tree, gimple_seq, tree);
773 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
774 VEC(tree,gc) *, VEC(tree,gc) *);
775 gimple gimple_build_catch (tree, gimple_seq);
776 gimple gimple_build_eh_filter (tree, gimple_seq);
777 gimple gimple_build_eh_must_not_throw (tree);
778 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
779 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
780 gimple gimple_build_wce (gimple_seq);
781 gimple gimple_build_resx (int);
782 gimple gimple_build_eh_dispatch (int);
783 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
784 gimple gimple_build_switch (tree, tree, VEC(tree,heap) *);
785 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
786 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
787 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
788 gimple gimple_build_omp_critical (gimple_seq, tree);
789 gimple gimple_build_omp_section (gimple_seq);
790 gimple gimple_build_omp_continue (tree, tree);
791 gimple gimple_build_omp_master (gimple_seq);
792 gimple gimple_build_omp_return (bool);
793 gimple gimple_build_omp_ordered (gimple_seq);
794 gimple gimple_build_omp_sections (gimple_seq, tree);
795 gimple gimple_build_omp_sections_switch (void);
796 gimple gimple_build_omp_single (gimple_seq, tree);
797 gimple gimple_build_cdt (tree, tree);
798 gimple gimple_build_omp_atomic_load (tree, tree);
799 gimple gimple_build_omp_atomic_store (tree);
800 gimple gimple_build_transaction (gimple_seq, tree);
801 gimple gimple_build_predict (enum br_predictor, enum prediction);
802 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
803 void sort_case_labels (VEC(tree,heap) *);
804 void preprocess_case_label_vec_for_gimple (VEC(tree,heap) *, tree, tree *);
805 void gimple_set_body (tree, gimple_seq);
806 gimple_seq gimple_body (tree);
807 bool gimple_has_body_p (tree);
808 gimple_seq gimple_seq_alloc (void);
809 void gimple_seq_free (gimple_seq);
810 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
811 gimple_seq gimple_seq_copy (gimple_seq);
812 bool gimple_call_same_target_p (const_gimple, const_gimple);
813 int gimple_call_flags (const_gimple);
814 int gimple_call_return_flags (const_gimple);
815 int gimple_call_arg_flags (const_gimple, unsigned);
816 void gimple_call_reset_alias_info (gimple);
817 bool gimple_assign_copy_p (gimple);
818 bool gimple_assign_ssa_name_copy_p (gimple);
819 bool gimple_assign_unary_nop_p (gimple);
820 void gimple_set_bb (gimple, basic_block);
821 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
822 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
823 tree, tree, tree);
824 tree gimple_get_lhs (const_gimple);
825 void gimple_set_lhs (gimple, tree);
826 void gimple_replace_lhs (gimple, tree);
827 gimple gimple_copy (gimple);
828 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
829 gimple gimple_build_cond_from_tree (tree, tree, tree);
830 void gimple_cond_set_condition_from_tree (gimple, tree);
831 bool gimple_has_side_effects (const_gimple);
832 bool gimple_could_trap_p (gimple);
833 bool gimple_could_trap_p_1 (gimple, bool, bool);
834 bool gimple_assign_rhs_could_trap_p (gimple);
835 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
836 bool empty_body_p (gimple_seq);
837 unsigned get_gimple_rhs_num_ops (enum tree_code);
838 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
839 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
840 const char *gimple_decl_printable_name (tree, int);
841 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
842 tree gimple_extract_devirt_binfo_from_cst (tree);
844 /* Returns true iff T is a scalar register variable. */
845 extern bool is_gimple_reg (tree);
846 /* Returns true iff T is any sort of variable. */
847 extern bool is_gimple_variable (tree);
848 /* Returns true iff T is any sort of symbol. */
849 extern bool is_gimple_id (tree);
850 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
851 extern bool is_gimple_min_lval (tree);
852 /* Returns true iff T is something whose address can be taken. */
853 extern bool is_gimple_addressable (tree);
854 /* Returns true iff T is any valid GIMPLE lvalue. */
855 extern bool is_gimple_lvalue (tree);
857 /* Returns true iff T is a GIMPLE address. */
858 bool is_gimple_address (const_tree);
859 /* Returns true iff T is a GIMPLE invariant address. */
860 bool is_gimple_invariant_address (const_tree);
861 /* Returns true iff T is a GIMPLE invariant address at interprocedural
862 level. */
863 bool is_gimple_ip_invariant_address (const_tree);
864 /* Returns true iff T is a valid GIMPLE constant. */
865 bool is_gimple_constant (const_tree);
866 /* Returns true iff T is a GIMPLE restricted function invariant. */
867 extern bool is_gimple_min_invariant (const_tree);
868 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
869 extern bool is_gimple_ip_invariant (const_tree);
870 /* Returns true iff T is a GIMPLE rvalue. */
871 extern bool is_gimple_val (tree);
872 /* Returns true iff T is a GIMPLE asm statement input. */
873 extern bool is_gimple_asm_val (tree);
874 /* Returns true iff T is a valid address operand of a MEM_REF. */
875 bool is_gimple_mem_ref_addr (tree);
877 /* Returns true iff T is a valid if-statement condition. */
878 extern bool is_gimple_condexpr (tree);
880 /* Returns true iff T is a valid call address expression. */
881 extern bool is_gimple_call_addr (tree);
883 extern void recalculate_side_effects (tree);
884 extern bool gimple_compare_field_offset (tree, tree);
885 extern tree gimple_register_canonical_type (tree);
886 extern void print_gimple_types_stats (const char *);
887 extern void free_gimple_type_tables (void);
888 extern tree gimple_unsigned_type (tree);
889 extern tree gimple_signed_type (tree);
890 extern alias_set_type gimple_get_alias_set (tree);
891 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
892 unsigned *);
893 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
894 bool (*)(gimple, tree, void *),
895 bool (*)(gimple, tree, void *),
896 bool (*)(gimple, tree, void *));
897 extern bool walk_stmt_load_store_ops (gimple, void *,
898 bool (*)(gimple, tree, void *),
899 bool (*)(gimple, tree, void *));
900 extern bool gimple_ior_addresses_taken (bitmap, gimple);
901 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
902 extern bool gimple_asm_clobbers_memory_p (const_gimple);
904 /* In gimplify.c */
905 extern tree create_tmp_var_raw (tree, const char *);
906 extern tree create_tmp_var_name (const char *);
907 extern tree create_tmp_var (tree, const char *);
908 extern tree create_tmp_reg (tree, const char *);
909 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
910 extern tree get_formal_tmp_var (tree, gimple_seq *);
911 extern void declare_vars (tree, gimple, bool);
912 extern void annotate_all_with_location (gimple_seq, location_t);
914 /* Validation of GIMPLE expressions. Note that these predicates only check
915 the basic form of the expression, they don't recurse to make sure that
916 underlying nodes are also of the right form. */
917 typedef bool (*gimple_predicate)(tree);
920 /* FIXME we should deduce this from the predicate. */
921 enum fallback {
922 fb_none = 0, /* Do not generate a temporary. */
924 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
925 gimplified expression. */
927 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
928 gimplified expression. */
930 fb_mayfail = 4, /* Gimplification may fail. Error issued
931 afterwards. */
932 fb_either= fb_rvalue | fb_lvalue
935 typedef int fallback_t;
937 enum gimplify_status {
938 GS_ERROR = -2, /* Something Bad Seen. */
939 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
940 GS_OK = 0, /* We did something, maybe more to do. */
941 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
944 struct gimplify_ctx
946 struct gimplify_ctx *prev_context;
948 VEC(gimple,heap) *bind_expr_stack;
949 tree temps;
950 gimple_seq conditional_cleanups;
951 tree exit_label;
952 tree return_temp;
954 VEC(tree,heap) *case_labels;
955 /* The formal temporary table. Should this be persistent? */
956 htab_t temp_htab;
958 int conditions;
959 bool save_stack;
960 bool into_ssa;
961 bool allow_rhs_cond_expr;
962 bool in_cleanup_point_expr;
965 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
966 bool (*) (tree), fallback_t);
967 extern void gimplify_type_sizes (tree, gimple_seq *);
968 extern void gimplify_one_sizepos (tree *, gimple_seq *);
969 extern bool gimplify_stmt (tree *, gimple_seq *);
970 extern gimple gimplify_body (tree, bool);
971 extern void push_gimplify_context (struct gimplify_ctx *);
972 extern void pop_gimplify_context (gimple);
973 extern void gimplify_and_add (tree, gimple_seq *);
975 /* Miscellaneous helpers. */
976 extern void gimple_add_tmp_var (tree);
977 extern gimple gimple_current_bind_expr (void);
978 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
979 extern tree voidify_wrapper_expr (tree, tree);
980 extern tree build_and_jump (tree *);
981 extern tree force_labels_r (tree *, int *, void *);
982 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
983 gimple_seq *);
984 struct gimplify_omp_ctx;
985 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
986 extern tree gimple_boolify (tree);
987 extern gimple_predicate rhs_predicate_for (tree);
988 extern tree canonicalize_cond_expr_cond (tree);
990 /* In omp-low.c. */
991 extern tree omp_reduction_init (tree, tree);
993 /* In trans-mem.c. */
994 extern void diagnose_tm_safe_errors (tree);
995 extern void compute_transaction_bits (void);
997 /* In tree-nested.c. */
998 extern void lower_nested_functions (tree);
999 extern void insert_field_into_struct (tree, tree);
1001 /* In gimplify.c. */
1002 extern void gimplify_function_tree (tree);
1004 /* In cfgexpand.c. */
1005 extern tree gimple_assign_rhs_to_tree (gimple);
1007 /* In builtins.c */
1008 extern bool validate_gimple_arglist (const_gimple, ...);
1010 /* In tree-ssa.c */
1011 extern bool tree_ssa_useless_type_conversion (tree);
1012 extern tree tree_ssa_strip_useless_type_conversions (tree);
1013 extern bool useless_type_conversion_p (tree, tree);
1014 extern bool types_compatible_p (tree, tree);
1016 /* Return the first node in GIMPLE sequence S. */
1018 static inline gimple_seq_node
1019 gimple_seq_first (gimple_seq s)
1021 return s;
1025 /* Return the first statement in GIMPLE sequence S. */
1027 static inline gimple
1028 gimple_seq_first_stmt (gimple_seq s)
1030 gimple_seq_node n = gimple_seq_first (s);
1031 return n;
1035 /* Return the last node in GIMPLE sequence S. */
1037 static inline gimple_seq_node
1038 gimple_seq_last (gimple_seq s)
1040 return s ? s->gsbase.prev : NULL;
1044 /* Return the last statement in GIMPLE sequence S. */
1046 static inline gimple
1047 gimple_seq_last_stmt (gimple_seq s)
1049 gimple_seq_node n = gimple_seq_last (s);
1050 return n;
1054 /* Set the last node in GIMPLE sequence *PS to LAST. */
1056 static inline void
1057 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1059 (*ps)->gsbase.prev = last;
1063 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1065 static inline void
1066 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1068 *ps = first;
1072 /* Return true if GIMPLE sequence S is empty. */
1074 static inline bool
1075 gimple_seq_empty_p (gimple_seq s)
1077 return s == NULL;
1081 void gimple_seq_add_stmt (gimple_seq *, gimple);
1083 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1084 *SEQ_P is NULL, a new sequence is allocated. This function is
1085 similar to gimple_seq_add_stmt, but does not scan the operands.
1086 During gimplification, we need to manipulate statement sequences
1087 before the def/use vectors have been constructed. */
1088 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1090 /* Allocate a new sequence and initialize its first element with STMT. */
1092 static inline gimple_seq
1093 gimple_seq_alloc_with_stmt (gimple stmt)
1095 gimple_seq seq = NULL;
1096 gimple_seq_add_stmt (&seq, stmt);
1097 return seq;
1101 /* Returns the sequence of statements in BB. */
1103 static inline gimple_seq
1104 bb_seq (const_basic_block bb)
1106 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1109 static inline gimple_seq *
1110 bb_seq_addr (basic_block bb)
1112 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1115 /* Sets the sequence of statements in BB to SEQ. */
1117 static inline void
1118 set_bb_seq (basic_block bb, gimple_seq seq)
1120 gcc_checking_assert (!(bb->flags & BB_RTL));
1121 bb->il.gimple.seq = seq;
1125 /* Return the code for GIMPLE statement G. */
1127 static inline enum gimple_code
1128 gimple_code (const_gimple g)
1130 return g->gsbase.code;
1134 /* Return the GSS code used by a GIMPLE code. */
1136 static inline enum gimple_statement_structure_enum
1137 gss_for_code (enum gimple_code code)
1139 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1140 return gss_for_code_[code];
1144 /* Return which GSS code is used by GS. */
1146 static inline enum gimple_statement_structure_enum
1147 gimple_statement_structure (gimple gs)
1149 return gss_for_code (gimple_code (gs));
1153 /* Return true if statement G has sub-statements. This is only true for
1154 High GIMPLE statements. */
1156 static inline bool
1157 gimple_has_substatements (gimple g)
1159 switch (gimple_code (g))
1161 case GIMPLE_BIND:
1162 case GIMPLE_CATCH:
1163 case GIMPLE_EH_FILTER:
1164 case GIMPLE_EH_ELSE:
1165 case GIMPLE_TRY:
1166 case GIMPLE_OMP_FOR:
1167 case GIMPLE_OMP_MASTER:
1168 case GIMPLE_OMP_ORDERED:
1169 case GIMPLE_OMP_SECTION:
1170 case GIMPLE_OMP_PARALLEL:
1171 case GIMPLE_OMP_TASK:
1172 case GIMPLE_OMP_SECTIONS:
1173 case GIMPLE_OMP_SINGLE:
1174 case GIMPLE_OMP_CRITICAL:
1175 case GIMPLE_WITH_CLEANUP_EXPR:
1176 case GIMPLE_TRANSACTION:
1177 return true;
1179 default:
1180 return false;
1185 /* Return the basic block holding statement G. */
1187 static inline basic_block
1188 gimple_bb (const_gimple g)
1190 return g->gsbase.bb;
1194 /* Return the lexical scope block holding statement G. */
1196 static inline tree
1197 gimple_block (const_gimple g)
1199 return g->gsbase.block;
1203 /* Set BLOCK to be the lexical scope block holding statement G. */
1205 static inline void
1206 gimple_set_block (gimple g, tree block)
1208 g->gsbase.block = block;
1212 /* Return location information for statement G. */
1214 static inline location_t
1215 gimple_location (const_gimple g)
1217 return g->gsbase.location;
1220 /* Return pointer to location information for statement G. */
1222 static inline const location_t *
1223 gimple_location_ptr (const_gimple g)
1225 return &g->gsbase.location;
1229 /* Set location information for statement G. */
1231 static inline void
1232 gimple_set_location (gimple g, location_t location)
1234 g->gsbase.location = location;
1238 /* Return true if G contains location information. */
1240 static inline bool
1241 gimple_has_location (const_gimple g)
1243 return gimple_location (g) != UNKNOWN_LOCATION;
1247 /* Return the file name of the location of STMT. */
1249 static inline const char *
1250 gimple_filename (const_gimple stmt)
1252 return LOCATION_FILE (gimple_location (stmt));
1256 /* Return the line number of the location of STMT. */
1258 static inline int
1259 gimple_lineno (const_gimple stmt)
1261 return LOCATION_LINE (gimple_location (stmt));
1265 /* Determine whether SEQ is a singleton. */
1267 static inline bool
1268 gimple_seq_singleton_p (gimple_seq seq)
1270 return ((gimple_seq_first (seq) != NULL)
1271 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1274 /* Return true if no warnings should be emitted for statement STMT. */
1276 static inline bool
1277 gimple_no_warning_p (const_gimple stmt)
1279 return stmt->gsbase.no_warning;
1282 /* Set the no_warning flag of STMT to NO_WARNING. */
1284 static inline void
1285 gimple_set_no_warning (gimple stmt, bool no_warning)
1287 stmt->gsbase.no_warning = (unsigned) no_warning;
1290 /* Set the visited status on statement STMT to VISITED_P. */
1292 static inline void
1293 gimple_set_visited (gimple stmt, bool visited_p)
1295 stmt->gsbase.visited = (unsigned) visited_p;
1299 /* Return the visited status for statement STMT. */
1301 static inline bool
1302 gimple_visited_p (gimple stmt)
1304 return stmt->gsbase.visited;
1308 /* Set pass local flag PLF on statement STMT to VAL_P. */
1310 static inline void
1311 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1313 if (val_p)
1314 stmt->gsbase.plf |= (unsigned int) plf;
1315 else
1316 stmt->gsbase.plf &= ~((unsigned int) plf);
1320 /* Return the value of pass local flag PLF on statement STMT. */
1322 static inline unsigned int
1323 gimple_plf (gimple stmt, enum plf_mask plf)
1325 return stmt->gsbase.plf & ((unsigned int) plf);
1329 /* Set the UID of statement. */
1331 static inline void
1332 gimple_set_uid (gimple g, unsigned uid)
1334 g->gsbase.uid = uid;
1338 /* Return the UID of statement. */
1340 static inline unsigned
1341 gimple_uid (const_gimple g)
1343 return g->gsbase.uid;
1347 /* Make statement G a singleton sequence. */
1349 static inline void
1350 gimple_init_singleton (gimple g)
1352 g->gsbase.next = NULL;
1353 g->gsbase.prev = g;
1357 /* Return true if GIMPLE statement G has register or memory operands. */
1359 static inline bool
1360 gimple_has_ops (const_gimple g)
1362 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1366 /* Return true if GIMPLE statement G has memory operands. */
1368 static inline bool
1369 gimple_has_mem_ops (const_gimple g)
1371 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1375 /* Return the set of DEF operands for statement G. */
1377 static inline struct def_optype_d *
1378 gimple_def_ops (const_gimple g)
1380 if (!gimple_has_ops (g))
1381 return NULL;
1382 return g->gsops.opbase.def_ops;
1386 /* Set DEF to be the set of DEF operands for statement G. */
1388 static inline void
1389 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1391 gcc_gimple_checking_assert (gimple_has_ops (g));
1392 g->gsops.opbase.def_ops = def;
1396 /* Return the set of USE operands for statement G. */
1398 static inline struct use_optype_d *
1399 gimple_use_ops (const_gimple g)
1401 if (!gimple_has_ops (g))
1402 return NULL;
1403 return g->gsops.opbase.use_ops;
1407 /* Set USE to be the set of USE operands for statement G. */
1409 static inline void
1410 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1412 gcc_gimple_checking_assert (gimple_has_ops (g));
1413 g->gsops.opbase.use_ops = use;
1417 /* Return the set of VUSE operand for statement G. */
1419 static inline use_operand_p
1420 gimple_vuse_op (const_gimple g)
1422 struct use_optype_d *ops;
1423 if (!gimple_has_mem_ops (g))
1424 return NULL_USE_OPERAND_P;
1425 ops = g->gsops.opbase.use_ops;
1426 if (ops
1427 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1428 return USE_OP_PTR (ops);
1429 return NULL_USE_OPERAND_P;
1432 /* Return the set of VDEF operand for statement G. */
1434 static inline def_operand_p
1435 gimple_vdef_op (const_gimple g)
1437 struct def_optype_d *ops;
1438 if (!gimple_has_mem_ops (g))
1439 return NULL_DEF_OPERAND_P;
1440 ops = g->gsops.opbase.def_ops;
1441 if (ops
1442 && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1443 return DEF_OP_PTR (ops);
1444 return NULL_DEF_OPERAND_P;
1448 /* Return the single VUSE operand of the statement G. */
1450 static inline tree
1451 gimple_vuse (const_gimple g)
1453 if (!gimple_has_mem_ops (g))
1454 return NULL_TREE;
1455 return g->gsmembase.vuse;
1458 /* Return the single VDEF operand of the statement G. */
1460 static inline tree
1461 gimple_vdef (const_gimple g)
1463 if (!gimple_has_mem_ops (g))
1464 return NULL_TREE;
1465 return g->gsmembase.vdef;
1468 /* Return the single VUSE operand of the statement G. */
1470 static inline tree *
1471 gimple_vuse_ptr (gimple g)
1473 if (!gimple_has_mem_ops (g))
1474 return NULL;
1475 return &g->gsmembase.vuse;
1478 /* Return the single VDEF operand of the statement G. */
1480 static inline tree *
1481 gimple_vdef_ptr (gimple g)
1483 if (!gimple_has_mem_ops (g))
1484 return NULL;
1485 return &g->gsmembase.vdef;
1488 /* Set the single VUSE operand of the statement G. */
1490 static inline void
1491 gimple_set_vuse (gimple g, tree vuse)
1493 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1494 g->gsmembase.vuse = vuse;
1497 /* Set the single VDEF operand of the statement G. */
1499 static inline void
1500 gimple_set_vdef (gimple g, tree vdef)
1502 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1503 g->gsmembase.vdef = vdef;
1507 /* Return true if statement G has operands and the modified field has
1508 been set. */
1510 static inline bool
1511 gimple_modified_p (const_gimple g)
1513 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1517 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1518 a MODIFIED field. */
1520 static inline void
1521 gimple_set_modified (gimple s, bool modifiedp)
1523 if (gimple_has_ops (s))
1524 s->gsbase.modified = (unsigned) modifiedp;
1528 /* Return the tree code for the expression computed by STMT. This is
1529 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1530 GIMPLE_CALL, return CALL_EXPR as the expression code for
1531 consistency. This is useful when the caller needs to deal with the
1532 three kinds of computation that GIMPLE supports. */
1534 static inline enum tree_code
1535 gimple_expr_code (const_gimple stmt)
1537 enum gimple_code code = gimple_code (stmt);
1538 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1539 return (enum tree_code) stmt->gsbase.subcode;
1540 else
1542 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1543 return CALL_EXPR;
1548 /* Mark statement S as modified, and update it. */
1550 static inline void
1551 update_stmt (gimple s)
1553 if (gimple_has_ops (s))
1555 gimple_set_modified (s, true);
1556 update_stmt_operands (s);
1560 /* Update statement S if it has been optimized. */
1562 static inline void
1563 update_stmt_if_modified (gimple s)
1565 if (gimple_modified_p (s))
1566 update_stmt_operands (s);
1569 /* Return true if statement STMT contains volatile operands. */
1571 static inline bool
1572 gimple_has_volatile_ops (const_gimple stmt)
1574 if (gimple_has_mem_ops (stmt))
1575 return stmt->gsbase.has_volatile_ops;
1576 else
1577 return false;
1581 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1583 static inline void
1584 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1586 if (gimple_has_mem_ops (stmt))
1587 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1590 /* Return true if BB is in a transaction. */
1592 static inline bool
1593 block_in_transaction (basic_block bb)
1595 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1598 /* Return true if STMT is in a transaction. */
1600 static inline bool
1601 gimple_in_transaction (gimple stmt)
1603 return block_in_transaction (gimple_bb (stmt));
1606 /* Return true if statement STMT may access memory. */
1608 static inline bool
1609 gimple_references_memory_p (gimple stmt)
1611 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1615 /* Return the subcode for OMP statement S. */
1617 static inline unsigned
1618 gimple_omp_subcode (const_gimple s)
1620 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1621 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1622 return s->gsbase.subcode;
1625 /* Set the subcode for OMP statement S to SUBCODE. */
1627 static inline void
1628 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1630 /* We only have 16 bits for the subcode. Assert that we are not
1631 overflowing it. */
1632 gcc_gimple_checking_assert (subcode < (1 << 16));
1633 s->gsbase.subcode = subcode;
1636 /* Set the nowait flag on OMP_RETURN statement S. */
1638 static inline void
1639 gimple_omp_return_set_nowait (gimple s)
1641 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1642 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1646 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1647 flag set. */
1649 static inline bool
1650 gimple_omp_return_nowait_p (const_gimple g)
1652 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1653 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1657 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1658 flag set. */
1660 static inline bool
1661 gimple_omp_section_last_p (const_gimple g)
1663 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1664 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1668 /* Set the GF_OMP_SECTION_LAST flag on G. */
1670 static inline void
1671 gimple_omp_section_set_last (gimple g)
1673 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1674 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1678 /* Return true if OMP parallel statement G has the
1679 GF_OMP_PARALLEL_COMBINED flag set. */
1681 static inline bool
1682 gimple_omp_parallel_combined_p (const_gimple g)
1684 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1685 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1689 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1690 value of COMBINED_P. */
1692 static inline void
1693 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1695 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1696 if (combined_p)
1697 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1698 else
1699 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1703 /* Return true if OMP atomic load/store statement G has the
1704 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1706 static inline bool
1707 gimple_omp_atomic_need_value_p (const_gimple g)
1709 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1710 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1711 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1715 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1717 static inline void
1718 gimple_omp_atomic_set_need_value (gimple g)
1720 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1721 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1722 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1726 /* Return the number of operands for statement GS. */
1728 static inline unsigned
1729 gimple_num_ops (const_gimple gs)
1731 return gs->gsbase.num_ops;
1735 /* Set the number of operands for statement GS. */
1737 static inline void
1738 gimple_set_num_ops (gimple gs, unsigned num_ops)
1740 gs->gsbase.num_ops = num_ops;
1744 /* Return the array of operands for statement GS. */
1746 static inline tree *
1747 gimple_ops (gimple gs)
1749 size_t off;
1751 /* All the tuples have their operand vector at the very bottom
1752 of the structure. Note that those structures that do not
1753 have an operand vector have a zero offset. */
1754 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1755 gcc_gimple_checking_assert (off != 0);
1757 return (tree *) ((char *) gs + off);
1761 /* Return operand I for statement GS. */
1763 static inline tree
1764 gimple_op (const_gimple gs, unsigned i)
1766 if (gimple_has_ops (gs))
1768 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1769 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1771 else
1772 return NULL_TREE;
1775 /* Return a pointer to operand I for statement GS. */
1777 static inline tree *
1778 gimple_op_ptr (const_gimple gs, unsigned i)
1780 if (gimple_has_ops (gs))
1782 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1783 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1785 else
1786 return NULL;
1789 /* Set operand I of statement GS to OP. */
1791 static inline void
1792 gimple_set_op (gimple gs, unsigned i, tree op)
1794 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1796 /* Note. It may be tempting to assert that OP matches
1797 is_gimple_operand, but that would be wrong. Different tuples
1798 accept slightly different sets of tree operands. Each caller
1799 should perform its own validation. */
1800 gimple_ops (gs)[i] = op;
1803 /* Return true if GS is a GIMPLE_ASSIGN. */
1805 static inline bool
1806 is_gimple_assign (const_gimple gs)
1808 return gimple_code (gs) == GIMPLE_ASSIGN;
1811 /* Determine if expression CODE is one of the valid expressions that can
1812 be used on the RHS of GIMPLE assignments. */
1814 static inline enum gimple_rhs_class
1815 get_gimple_rhs_class (enum tree_code code)
1817 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1820 /* Return the LHS of assignment statement GS. */
1822 static inline tree
1823 gimple_assign_lhs (const_gimple gs)
1825 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1826 return gimple_op (gs, 0);
1830 /* Return a pointer to the LHS of assignment statement GS. */
1832 static inline tree *
1833 gimple_assign_lhs_ptr (const_gimple gs)
1835 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1836 return gimple_op_ptr (gs, 0);
1840 /* Set LHS to be the LHS operand of assignment statement GS. */
1842 static inline void
1843 gimple_assign_set_lhs (gimple gs, tree lhs)
1845 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1846 gimple_set_op (gs, 0, lhs);
1848 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1849 SSA_NAME_DEF_STMT (lhs) = gs;
1853 /* Return the first operand on the RHS of assignment statement GS. */
1855 static inline tree
1856 gimple_assign_rhs1 (const_gimple gs)
1858 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1859 return gimple_op (gs, 1);
1863 /* Return a pointer to the first operand on the RHS of assignment
1864 statement GS. */
1866 static inline tree *
1867 gimple_assign_rhs1_ptr (const_gimple gs)
1869 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1870 return gimple_op_ptr (gs, 1);
1873 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1875 static inline void
1876 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1878 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1880 gimple_set_op (gs, 1, rhs);
1884 /* Return the second operand on the RHS of assignment statement GS.
1885 If GS does not have two operands, NULL is returned instead. */
1887 static inline tree
1888 gimple_assign_rhs2 (const_gimple gs)
1890 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1892 if (gimple_num_ops (gs) >= 3)
1893 return gimple_op (gs, 2);
1894 else
1895 return NULL_TREE;
1899 /* Return a pointer to the second operand on the RHS of assignment
1900 statement GS. */
1902 static inline tree *
1903 gimple_assign_rhs2_ptr (const_gimple gs)
1905 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1906 return gimple_op_ptr (gs, 2);
1910 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1912 static inline void
1913 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1915 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1917 gimple_set_op (gs, 2, rhs);
1920 /* Return the third operand on the RHS of assignment statement GS.
1921 If GS does not have two operands, NULL is returned instead. */
1923 static inline tree
1924 gimple_assign_rhs3 (const_gimple gs)
1926 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1928 if (gimple_num_ops (gs) >= 4)
1929 return gimple_op (gs, 3);
1930 else
1931 return NULL_TREE;
1934 /* Return a pointer to the third operand on the RHS of assignment
1935 statement GS. */
1937 static inline tree *
1938 gimple_assign_rhs3_ptr (const_gimple gs)
1940 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1941 return gimple_op_ptr (gs, 3);
1945 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1947 static inline void
1948 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1950 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1952 gimple_set_op (gs, 3, rhs);
1955 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1956 to see only a maximum of two operands. */
1958 static inline void
1959 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1960 tree op1, tree op2)
1962 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1965 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1966 to see only a maximum of two operands. */
1968 static inline void
1969 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1970 tree *op1)
1972 tree op2;
1973 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1974 gcc_assert (op2 == NULL_TREE);
1977 /* Returns true if GS is a nontemporal move. */
1979 static inline bool
1980 gimple_assign_nontemporal_move_p (const_gimple gs)
1982 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1983 return gs->gsbase.nontemporal_move;
1986 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1988 static inline void
1989 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1991 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1992 gs->gsbase.nontemporal_move = nontemporal;
1996 /* Return the code of the expression computed on the rhs of assignment
1997 statement GS. In case that the RHS is a single object, returns the
1998 tree code of the object. */
2000 static inline enum tree_code
2001 gimple_assign_rhs_code (const_gimple gs)
2003 enum tree_code code;
2004 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2006 code = (enum tree_code) gs->gsbase.subcode;
2007 /* While we initially set subcode to the TREE_CODE of the rhs for
2008 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2009 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2010 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2011 code = TREE_CODE (gimple_assign_rhs1 (gs));
2013 return code;
2017 /* Set CODE to be the code for the expression computed on the RHS of
2018 assignment S. */
2020 static inline void
2021 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2023 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2024 s->gsbase.subcode = code;
2028 /* Return the gimple rhs class of the code of the expression computed on
2029 the rhs of assignment statement GS.
2030 This will never return GIMPLE_INVALID_RHS. */
2032 static inline enum gimple_rhs_class
2033 gimple_assign_rhs_class (const_gimple gs)
2035 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2038 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2039 there is no operator associated with the assignment itself.
2040 Unlike gimple_assign_copy_p, this predicate returns true for
2041 any RHS operand, including those that perform an operation
2042 and do not have the semantics of a copy, such as COND_EXPR. */
2044 static inline bool
2045 gimple_assign_single_p (gimple gs)
2047 return (is_gimple_assign (gs)
2048 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2052 /* Return true if S is a type-cast assignment. */
2054 static inline bool
2055 gimple_assign_cast_p (gimple s)
2057 if (is_gimple_assign (s))
2059 enum tree_code sc = gimple_assign_rhs_code (s);
2060 return CONVERT_EXPR_CODE_P (sc)
2061 || sc == VIEW_CONVERT_EXPR
2062 || sc == FIX_TRUNC_EXPR;
2065 return false;
2068 /* Return true if S is a clobber statement. */
2070 static inline bool
2071 gimple_clobber_p (gimple s)
2073 return gimple_assign_single_p (s)
2074 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2077 /* Return true if GS is a GIMPLE_CALL. */
2079 static inline bool
2080 is_gimple_call (const_gimple gs)
2082 return gimple_code (gs) == GIMPLE_CALL;
2085 /* Return the LHS of call statement GS. */
2087 static inline tree
2088 gimple_call_lhs (const_gimple gs)
2090 GIMPLE_CHECK (gs, GIMPLE_CALL);
2091 return gimple_op (gs, 0);
2095 /* Return a pointer to the LHS of call statement GS. */
2097 static inline tree *
2098 gimple_call_lhs_ptr (const_gimple gs)
2100 GIMPLE_CHECK (gs, GIMPLE_CALL);
2101 return gimple_op_ptr (gs, 0);
2105 /* Set LHS to be the LHS operand of call statement GS. */
2107 static inline void
2108 gimple_call_set_lhs (gimple gs, tree lhs)
2110 GIMPLE_CHECK (gs, GIMPLE_CALL);
2111 gimple_set_op (gs, 0, lhs);
2112 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2113 SSA_NAME_DEF_STMT (lhs) = gs;
2117 /* Return true if call GS calls an internal-only function, as enumerated
2118 by internal_fn. */
2120 static inline bool
2121 gimple_call_internal_p (const_gimple gs)
2123 GIMPLE_CHECK (gs, GIMPLE_CALL);
2124 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2128 /* Return the target of internal call GS. */
2130 static inline enum internal_fn
2131 gimple_call_internal_fn (const_gimple gs)
2133 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2134 return gs->gimple_call.u.internal_fn;
2138 /* Return the function type of the function called by GS. */
2140 static inline tree
2141 gimple_call_fntype (const_gimple gs)
2143 GIMPLE_CHECK (gs, GIMPLE_CALL);
2144 if (gimple_call_internal_p (gs))
2145 return NULL_TREE;
2146 return gs->gimple_call.u.fntype;
2149 /* Set the type of the function called by GS to FNTYPE. */
2151 static inline void
2152 gimple_call_set_fntype (gimple gs, tree fntype)
2154 GIMPLE_CHECK (gs, GIMPLE_CALL);
2155 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2156 gs->gimple_call.u.fntype = fntype;
2160 /* Return the tree node representing the function called by call
2161 statement GS. */
2163 static inline tree
2164 gimple_call_fn (const_gimple gs)
2166 GIMPLE_CHECK (gs, GIMPLE_CALL);
2167 return gimple_op (gs, 1);
2170 /* Return a pointer to the tree node representing the function called by call
2171 statement GS. */
2173 static inline tree *
2174 gimple_call_fn_ptr (const_gimple gs)
2176 GIMPLE_CHECK (gs, GIMPLE_CALL);
2177 return gimple_op_ptr (gs, 1);
2181 /* Set FN to be the function called by call statement GS. */
2183 static inline void
2184 gimple_call_set_fn (gimple gs, tree fn)
2186 GIMPLE_CHECK (gs, GIMPLE_CALL);
2187 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2188 gimple_set_op (gs, 1, fn);
2192 /* Set FNDECL to be the function called by call statement GS. */
2194 static inline void
2195 gimple_call_set_fndecl (gimple gs, tree decl)
2197 GIMPLE_CHECK (gs, GIMPLE_CALL);
2198 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2199 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2203 /* Set internal function FN to be the function called by call statement GS. */
2205 static inline void
2206 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2208 GIMPLE_CHECK (gs, GIMPLE_CALL);
2209 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2210 gs->gimple_call.u.internal_fn = fn;
2214 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2215 associated with the callee if known. Otherwise return NULL_TREE. */
2217 static inline tree
2218 gimple_call_addr_fndecl (const_tree fn)
2220 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2222 tree fndecl = TREE_OPERAND (fn, 0);
2223 if (TREE_CODE (fndecl) == MEM_REF
2224 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2225 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2226 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2227 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2228 return fndecl;
2230 return NULL_TREE;
2233 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2234 Otherwise return NULL. This function is analogous to
2235 get_callee_fndecl in tree land. */
2237 static inline tree
2238 gimple_call_fndecl (const_gimple gs)
2240 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2244 /* Return the type returned by call statement GS. */
2246 static inline tree
2247 gimple_call_return_type (const_gimple gs)
2249 tree type = gimple_call_fntype (gs);
2251 if (type == NULL_TREE)
2252 return TREE_TYPE (gimple_call_lhs (gs));
2254 /* The type returned by a function is the type of its
2255 function type. */
2256 return TREE_TYPE (type);
2260 /* Return the static chain for call statement GS. */
2262 static inline tree
2263 gimple_call_chain (const_gimple gs)
2265 GIMPLE_CHECK (gs, GIMPLE_CALL);
2266 return gimple_op (gs, 2);
2270 /* Return a pointer to the static chain for call statement GS. */
2272 static inline tree *
2273 gimple_call_chain_ptr (const_gimple gs)
2275 GIMPLE_CHECK (gs, GIMPLE_CALL);
2276 return gimple_op_ptr (gs, 2);
2279 /* Set CHAIN to be the static chain for call statement GS. */
2281 static inline void
2282 gimple_call_set_chain (gimple gs, tree chain)
2284 GIMPLE_CHECK (gs, GIMPLE_CALL);
2286 gimple_set_op (gs, 2, chain);
2290 /* Return the number of arguments used by call statement GS. */
2292 static inline unsigned
2293 gimple_call_num_args (const_gimple gs)
2295 unsigned num_ops;
2296 GIMPLE_CHECK (gs, GIMPLE_CALL);
2297 num_ops = gimple_num_ops (gs);
2298 return num_ops - 3;
2302 /* Return the argument at position INDEX for call statement GS. */
2304 static inline tree
2305 gimple_call_arg (const_gimple gs, unsigned index)
2307 GIMPLE_CHECK (gs, GIMPLE_CALL);
2308 return gimple_op (gs, index + 3);
2312 /* Return a pointer to the argument at position INDEX for call
2313 statement GS. */
2315 static inline tree *
2316 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2318 GIMPLE_CHECK (gs, GIMPLE_CALL);
2319 return gimple_op_ptr (gs, index + 3);
2323 /* Set ARG to be the argument at position INDEX for call statement GS. */
2325 static inline void
2326 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2328 GIMPLE_CHECK (gs, GIMPLE_CALL);
2329 gimple_set_op (gs, index + 3, arg);
2333 /* If TAIL_P is true, mark call statement S as being a tail call
2334 (i.e., a call just before the exit of a function). These calls are
2335 candidate for tail call optimization. */
2337 static inline void
2338 gimple_call_set_tail (gimple s, bool tail_p)
2340 GIMPLE_CHECK (s, GIMPLE_CALL);
2341 if (tail_p)
2342 s->gsbase.subcode |= GF_CALL_TAILCALL;
2343 else
2344 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2348 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2350 static inline bool
2351 gimple_call_tail_p (gimple s)
2353 GIMPLE_CHECK (s, GIMPLE_CALL);
2354 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2358 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2359 slot optimization. This transformation uses the target of the call
2360 expansion as the return slot for calls that return in memory. */
2362 static inline void
2363 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2365 GIMPLE_CHECK (s, GIMPLE_CALL);
2366 if (return_slot_opt_p)
2367 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2368 else
2369 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2373 /* Return true if S is marked for return slot optimization. */
2375 static inline bool
2376 gimple_call_return_slot_opt_p (gimple s)
2378 GIMPLE_CHECK (s, GIMPLE_CALL);
2379 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2383 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2384 thunk to the thunked-to function. */
2386 static inline void
2387 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2389 GIMPLE_CHECK (s, GIMPLE_CALL);
2390 if (from_thunk_p)
2391 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2392 else
2393 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2397 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2399 static inline bool
2400 gimple_call_from_thunk_p (gimple s)
2402 GIMPLE_CHECK (s, GIMPLE_CALL);
2403 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2407 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2408 argument pack in its argument list. */
2410 static inline void
2411 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2413 GIMPLE_CHECK (s, GIMPLE_CALL);
2414 if (pass_arg_pack_p)
2415 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2416 else
2417 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2421 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2422 argument pack in its argument list. */
2424 static inline bool
2425 gimple_call_va_arg_pack_p (gimple s)
2427 GIMPLE_CHECK (s, GIMPLE_CALL);
2428 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2432 /* Return true if S is a noreturn call. */
2434 static inline bool
2435 gimple_call_noreturn_p (gimple s)
2437 GIMPLE_CHECK (s, GIMPLE_CALL);
2438 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2442 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2443 even if the called function can throw in other cases. */
2445 static inline void
2446 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2448 GIMPLE_CHECK (s, GIMPLE_CALL);
2449 if (nothrow_p)
2450 s->gsbase.subcode |= GF_CALL_NOTHROW;
2451 else
2452 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2455 /* Return true if S is a nothrow call. */
2457 static inline bool
2458 gimple_call_nothrow_p (gimple s)
2460 GIMPLE_CHECK (s, GIMPLE_CALL);
2461 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2464 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2465 is known to be emitted for VLA objects. Those are wrapped by
2466 stack_save/stack_restore calls and hence can't lead to unbounded
2467 stack growth even when they occur in loops. */
2469 static inline void
2470 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2472 GIMPLE_CHECK (s, GIMPLE_CALL);
2473 if (for_var)
2474 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2475 else
2476 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2479 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2481 static inline bool
2482 gimple_call_alloca_for_var_p (gimple s)
2484 GIMPLE_CHECK (s, GIMPLE_CALL);
2485 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2488 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2490 static inline void
2491 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2493 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2494 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2495 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2499 /* Return a pointer to the points-to solution for the set of call-used
2500 variables of the call CALL. */
2502 static inline struct pt_solution *
2503 gimple_call_use_set (gimple call)
2505 GIMPLE_CHECK (call, GIMPLE_CALL);
2506 return &call->gimple_call.call_used;
2510 /* Return a pointer to the points-to solution for the set of call-used
2511 variables of the call CALL. */
2513 static inline struct pt_solution *
2514 gimple_call_clobber_set (gimple call)
2516 GIMPLE_CHECK (call, GIMPLE_CALL);
2517 return &call->gimple_call.call_clobbered;
2521 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2522 non-NULL lhs. */
2524 static inline bool
2525 gimple_has_lhs (gimple stmt)
2527 return (is_gimple_assign (stmt)
2528 || (is_gimple_call (stmt)
2529 && gimple_call_lhs (stmt) != NULL_TREE));
2533 /* Return the code of the predicate computed by conditional statement GS. */
2535 static inline enum tree_code
2536 gimple_cond_code (const_gimple gs)
2538 GIMPLE_CHECK (gs, GIMPLE_COND);
2539 return (enum tree_code) gs->gsbase.subcode;
2543 /* Set CODE to be the predicate code for the conditional statement GS. */
2545 static inline void
2546 gimple_cond_set_code (gimple gs, enum tree_code code)
2548 GIMPLE_CHECK (gs, GIMPLE_COND);
2549 gs->gsbase.subcode = code;
2553 /* Return the LHS of the predicate computed by conditional statement GS. */
2555 static inline tree
2556 gimple_cond_lhs (const_gimple gs)
2558 GIMPLE_CHECK (gs, GIMPLE_COND);
2559 return gimple_op (gs, 0);
2562 /* Return the pointer to the LHS of the predicate computed by conditional
2563 statement GS. */
2565 static inline tree *
2566 gimple_cond_lhs_ptr (const_gimple gs)
2568 GIMPLE_CHECK (gs, GIMPLE_COND);
2569 return gimple_op_ptr (gs, 0);
2572 /* Set LHS to be the LHS operand of the predicate computed by
2573 conditional statement GS. */
2575 static inline void
2576 gimple_cond_set_lhs (gimple gs, tree lhs)
2578 GIMPLE_CHECK (gs, GIMPLE_COND);
2579 gimple_set_op (gs, 0, lhs);
2583 /* Return the RHS operand of the predicate computed by conditional GS. */
2585 static inline tree
2586 gimple_cond_rhs (const_gimple gs)
2588 GIMPLE_CHECK (gs, GIMPLE_COND);
2589 return gimple_op (gs, 1);
2592 /* Return the pointer to the RHS operand of the predicate computed by
2593 conditional GS. */
2595 static inline tree *
2596 gimple_cond_rhs_ptr (const_gimple gs)
2598 GIMPLE_CHECK (gs, GIMPLE_COND);
2599 return gimple_op_ptr (gs, 1);
2603 /* Set RHS to be the RHS operand of the predicate computed by
2604 conditional statement GS. */
2606 static inline void
2607 gimple_cond_set_rhs (gimple gs, tree rhs)
2609 GIMPLE_CHECK (gs, GIMPLE_COND);
2610 gimple_set_op (gs, 1, rhs);
2614 /* Return the label used by conditional statement GS when its
2615 predicate evaluates to true. */
2617 static inline tree
2618 gimple_cond_true_label (const_gimple gs)
2620 GIMPLE_CHECK (gs, GIMPLE_COND);
2621 return gimple_op (gs, 2);
2625 /* Set LABEL to be the label used by conditional statement GS when its
2626 predicate evaluates to true. */
2628 static inline void
2629 gimple_cond_set_true_label (gimple gs, tree label)
2631 GIMPLE_CHECK (gs, GIMPLE_COND);
2632 gimple_set_op (gs, 2, label);
2636 /* Set LABEL to be the label used by conditional statement GS when its
2637 predicate evaluates to false. */
2639 static inline void
2640 gimple_cond_set_false_label (gimple gs, tree label)
2642 GIMPLE_CHECK (gs, GIMPLE_COND);
2643 gimple_set_op (gs, 3, label);
2647 /* Return the label used by conditional statement GS when its
2648 predicate evaluates to false. */
2650 static inline tree
2651 gimple_cond_false_label (const_gimple gs)
2653 GIMPLE_CHECK (gs, GIMPLE_COND);
2654 return gimple_op (gs, 3);
2658 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2660 static inline void
2661 gimple_cond_make_false (gimple gs)
2663 gimple_cond_set_lhs (gs, boolean_true_node);
2664 gimple_cond_set_rhs (gs, boolean_false_node);
2665 gs->gsbase.subcode = EQ_EXPR;
2669 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2671 static inline void
2672 gimple_cond_make_true (gimple gs)
2674 gimple_cond_set_lhs (gs, boolean_true_node);
2675 gimple_cond_set_rhs (gs, boolean_true_node);
2676 gs->gsbase.subcode = EQ_EXPR;
2679 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2680 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2682 static inline bool
2683 gimple_cond_true_p (const_gimple gs)
2685 tree lhs = gimple_cond_lhs (gs);
2686 tree rhs = gimple_cond_rhs (gs);
2687 enum tree_code code = gimple_cond_code (gs);
2689 if (lhs != boolean_true_node && lhs != boolean_false_node)
2690 return false;
2692 if (rhs != boolean_true_node && rhs != boolean_false_node)
2693 return false;
2695 if (code == NE_EXPR && lhs != rhs)
2696 return true;
2698 if (code == EQ_EXPR && lhs == rhs)
2699 return true;
2701 return false;
2704 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2705 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2707 static inline bool
2708 gimple_cond_false_p (const_gimple gs)
2710 tree lhs = gimple_cond_lhs (gs);
2711 tree rhs = gimple_cond_rhs (gs);
2712 enum tree_code code = gimple_cond_code (gs);
2714 if (lhs != boolean_true_node && lhs != boolean_false_node)
2715 return false;
2717 if (rhs != boolean_true_node && rhs != boolean_false_node)
2718 return false;
2720 if (code == NE_EXPR && lhs == rhs)
2721 return true;
2723 if (code == EQ_EXPR && lhs != rhs)
2724 return true;
2726 return false;
2729 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2730 'if (var == 1)' */
2732 static inline bool
2733 gimple_cond_single_var_p (gimple gs)
2735 if (gimple_cond_code (gs) == NE_EXPR
2736 && gimple_cond_rhs (gs) == boolean_false_node)
2737 return true;
2739 if (gimple_cond_code (gs) == EQ_EXPR
2740 && gimple_cond_rhs (gs) == boolean_true_node)
2741 return true;
2743 return false;
2746 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2748 static inline void
2749 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2751 gimple_cond_set_code (stmt, code);
2752 gimple_cond_set_lhs (stmt, lhs);
2753 gimple_cond_set_rhs (stmt, rhs);
2756 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2758 static inline tree
2759 gimple_label_label (const_gimple gs)
2761 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2762 return gimple_op (gs, 0);
2766 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2767 GS. */
2769 static inline void
2770 gimple_label_set_label (gimple gs, tree label)
2772 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2773 gimple_set_op (gs, 0, label);
2777 /* Return the destination of the unconditional jump GS. */
2779 static inline tree
2780 gimple_goto_dest (const_gimple gs)
2782 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2783 return gimple_op (gs, 0);
2787 /* Set DEST to be the destination of the unconditonal jump GS. */
2789 static inline void
2790 gimple_goto_set_dest (gimple gs, tree dest)
2792 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2793 gimple_set_op (gs, 0, dest);
2797 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2799 static inline tree
2800 gimple_bind_vars (const_gimple gs)
2802 GIMPLE_CHECK (gs, GIMPLE_BIND);
2803 return gs->gimple_bind.vars;
2807 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2808 statement GS. */
2810 static inline void
2811 gimple_bind_set_vars (gimple gs, tree vars)
2813 GIMPLE_CHECK (gs, GIMPLE_BIND);
2814 gs->gimple_bind.vars = vars;
2818 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2819 statement GS. */
2821 static inline void
2822 gimple_bind_append_vars (gimple gs, tree vars)
2824 GIMPLE_CHECK (gs, GIMPLE_BIND);
2825 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2829 static inline gimple_seq *
2830 gimple_bind_body_ptr (gimple gs)
2832 GIMPLE_CHECK (gs, GIMPLE_BIND);
2833 return &gs->gimple_bind.body;
2836 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2838 static inline gimple_seq
2839 gimple_bind_body (gimple gs)
2841 return *gimple_bind_body_ptr (gs);
2845 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2846 statement GS. */
2848 static inline void
2849 gimple_bind_set_body (gimple gs, gimple_seq seq)
2851 GIMPLE_CHECK (gs, GIMPLE_BIND);
2852 gs->gimple_bind.body = seq;
2856 /* Append a statement to the end of a GIMPLE_BIND's body. */
2858 static inline void
2859 gimple_bind_add_stmt (gimple gs, gimple stmt)
2861 GIMPLE_CHECK (gs, GIMPLE_BIND);
2862 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2866 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2868 static inline void
2869 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2871 GIMPLE_CHECK (gs, GIMPLE_BIND);
2872 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2876 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2877 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2879 static inline tree
2880 gimple_bind_block (const_gimple gs)
2882 GIMPLE_CHECK (gs, GIMPLE_BIND);
2883 return gs->gimple_bind.block;
2887 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2888 statement GS. */
2890 static inline void
2891 gimple_bind_set_block (gimple gs, tree block)
2893 GIMPLE_CHECK (gs, GIMPLE_BIND);
2894 gcc_gimple_checking_assert (block == NULL_TREE
2895 || TREE_CODE (block) == BLOCK);
2896 gs->gimple_bind.block = block;
2900 /* Return the number of input operands for GIMPLE_ASM GS. */
2902 static inline unsigned
2903 gimple_asm_ninputs (const_gimple gs)
2905 GIMPLE_CHECK (gs, GIMPLE_ASM);
2906 return gs->gimple_asm.ni;
2910 /* Return the number of output operands for GIMPLE_ASM GS. */
2912 static inline unsigned
2913 gimple_asm_noutputs (const_gimple gs)
2915 GIMPLE_CHECK (gs, GIMPLE_ASM);
2916 return gs->gimple_asm.no;
2920 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2922 static inline unsigned
2923 gimple_asm_nclobbers (const_gimple gs)
2925 GIMPLE_CHECK (gs, GIMPLE_ASM);
2926 return gs->gimple_asm.nc;
2929 /* Return the number of label operands for GIMPLE_ASM GS. */
2931 static inline unsigned
2932 gimple_asm_nlabels (const_gimple gs)
2934 GIMPLE_CHECK (gs, GIMPLE_ASM);
2935 return gs->gimple_asm.nl;
2938 /* Return input operand INDEX of GIMPLE_ASM GS. */
2940 static inline tree
2941 gimple_asm_input_op (const_gimple gs, unsigned index)
2943 GIMPLE_CHECK (gs, GIMPLE_ASM);
2944 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2945 return gimple_op (gs, index);
2948 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2950 static inline tree *
2951 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2953 GIMPLE_CHECK (gs, GIMPLE_ASM);
2954 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2955 return gimple_op_ptr (gs, index);
2959 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2961 static inline void
2962 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2964 GIMPLE_CHECK (gs, GIMPLE_ASM);
2965 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
2966 && TREE_CODE (in_op) == TREE_LIST);
2967 gimple_set_op (gs, index, in_op);
2971 /* Return output operand INDEX of GIMPLE_ASM GS. */
2973 static inline tree
2974 gimple_asm_output_op (const_gimple gs, unsigned index)
2976 GIMPLE_CHECK (gs, GIMPLE_ASM);
2977 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2978 return gimple_op (gs, index + gs->gimple_asm.ni);
2981 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2983 static inline tree *
2984 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2986 GIMPLE_CHECK (gs, GIMPLE_ASM);
2987 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2988 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2992 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2994 static inline void
2995 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2997 GIMPLE_CHECK (gs, GIMPLE_ASM);
2998 gcc_gimple_checking_assert (index <= gs->gimple_asm.no
2999 && TREE_CODE (out_op) == TREE_LIST);
3000 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
3004 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3006 static inline tree
3007 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3009 GIMPLE_CHECK (gs, GIMPLE_ASM);
3010 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
3011 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3015 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3017 static inline void
3018 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3020 GIMPLE_CHECK (gs, GIMPLE_ASM);
3021 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
3022 && TREE_CODE (clobber_op) == TREE_LIST);
3023 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3026 /* Return label operand INDEX of GIMPLE_ASM GS. */
3028 static inline tree
3029 gimple_asm_label_op (const_gimple gs, unsigned index)
3031 GIMPLE_CHECK (gs, GIMPLE_ASM);
3032 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
3033 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3036 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3038 static inline void
3039 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3041 GIMPLE_CHECK (gs, GIMPLE_ASM);
3042 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
3043 && TREE_CODE (label_op) == TREE_LIST);
3044 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3047 /* Return the string representing the assembly instruction in
3048 GIMPLE_ASM GS. */
3050 static inline const char *
3051 gimple_asm_string (const_gimple gs)
3053 GIMPLE_CHECK (gs, GIMPLE_ASM);
3054 return gs->gimple_asm.string;
3058 /* Return true if GS is an asm statement marked volatile. */
3060 static inline bool
3061 gimple_asm_volatile_p (const_gimple gs)
3063 GIMPLE_CHECK (gs, GIMPLE_ASM);
3064 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3068 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3070 static inline void
3071 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3073 GIMPLE_CHECK (gs, GIMPLE_ASM);
3074 if (volatile_p)
3075 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3076 else
3077 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3081 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3083 static inline void
3084 gimple_asm_set_input (gimple gs, bool input_p)
3086 GIMPLE_CHECK (gs, GIMPLE_ASM);
3087 if (input_p)
3088 gs->gsbase.subcode |= GF_ASM_INPUT;
3089 else
3090 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3094 /* Return true if asm GS is an ASM_INPUT. */
3096 static inline bool
3097 gimple_asm_input_p (const_gimple gs)
3099 GIMPLE_CHECK (gs, GIMPLE_ASM);
3100 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3104 /* Return the types handled by GIMPLE_CATCH statement GS. */
3106 static inline tree
3107 gimple_catch_types (const_gimple gs)
3109 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3110 return gs->gimple_catch.types;
3114 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3116 static inline tree *
3117 gimple_catch_types_ptr (gimple gs)
3119 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3120 return &gs->gimple_catch.types;
3124 /* Return a pointer to the GIMPLE sequence representing the body of
3125 the handler of GIMPLE_CATCH statement GS. */
3127 static inline gimple_seq *
3128 gimple_catch_handler_ptr (gimple gs)
3130 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3131 return &gs->gimple_catch.handler;
3135 /* Return the GIMPLE sequence representing the body of the handler of
3136 GIMPLE_CATCH statement GS. */
3138 static inline gimple_seq
3139 gimple_catch_handler (gimple gs)
3141 return *gimple_catch_handler_ptr (gs);
3145 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3147 static inline void
3148 gimple_catch_set_types (gimple gs, tree t)
3150 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3151 gs->gimple_catch.types = t;
3155 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3157 static inline void
3158 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3160 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3161 gs->gimple_catch.handler = handler;
3165 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3167 static inline tree
3168 gimple_eh_filter_types (const_gimple gs)
3170 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3171 return gs->gimple_eh_filter.types;
3175 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3176 GS. */
3178 static inline tree *
3179 gimple_eh_filter_types_ptr (gimple gs)
3181 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3182 return &gs->gimple_eh_filter.types;
3186 /* Return a pointer to the sequence of statement to execute when
3187 GIMPLE_EH_FILTER statement fails. */
3189 static inline gimple_seq *
3190 gimple_eh_filter_failure_ptr (gimple gs)
3192 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3193 return &gs->gimple_eh_filter.failure;
3197 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3198 statement fails. */
3200 static inline gimple_seq
3201 gimple_eh_filter_failure (gimple gs)
3203 return *gimple_eh_filter_failure_ptr (gs);
3207 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3209 static inline void
3210 gimple_eh_filter_set_types (gimple gs, tree types)
3212 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3213 gs->gimple_eh_filter.types = types;
3217 /* Set FAILURE to be the sequence of statements to execute on failure
3218 for GIMPLE_EH_FILTER GS. */
3220 static inline void
3221 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3223 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3224 gs->gimple_eh_filter.failure = failure;
3227 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3229 static inline tree
3230 gimple_eh_must_not_throw_fndecl (gimple gs)
3232 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3233 return gs->gimple_eh_mnt.fndecl;
3236 /* Set the function decl to be called by GS to DECL. */
3238 static inline void
3239 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3241 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3242 gs->gimple_eh_mnt.fndecl = decl;
3245 /* GIMPLE_EH_ELSE accessors. */
3247 static inline gimple_seq *
3248 gimple_eh_else_n_body_ptr (gimple gs)
3250 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3251 return &gs->gimple_eh_else.n_body;
3254 static inline gimple_seq
3255 gimple_eh_else_n_body (gimple gs)
3257 return *gimple_eh_else_n_body_ptr (gs);
3260 static inline gimple_seq *
3261 gimple_eh_else_e_body_ptr (gimple gs)
3263 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3264 return &gs->gimple_eh_else.e_body;
3267 static inline gimple_seq
3268 gimple_eh_else_e_body (gimple gs)
3270 return *gimple_eh_else_e_body_ptr (gs);
3273 static inline void
3274 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3276 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3277 gs->gimple_eh_else.n_body = seq;
3280 static inline void
3281 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3283 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3284 gs->gimple_eh_else.e_body = seq;
3287 /* GIMPLE_TRY accessors. */
3289 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3290 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3292 static inline enum gimple_try_flags
3293 gimple_try_kind (const_gimple gs)
3295 GIMPLE_CHECK (gs, GIMPLE_TRY);
3296 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3300 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3302 static inline void
3303 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3305 GIMPLE_CHECK (gs, GIMPLE_TRY);
3306 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3307 || kind == GIMPLE_TRY_FINALLY);
3308 if (gimple_try_kind (gs) != kind)
3309 gs->gsbase.subcode = (unsigned int) kind;
3313 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3315 static inline bool
3316 gimple_try_catch_is_cleanup (const_gimple gs)
3318 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3319 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3323 /* Return a pointer to the sequence of statements used as the
3324 body for GIMPLE_TRY GS. */
3326 static inline gimple_seq *
3327 gimple_try_eval_ptr (gimple gs)
3329 GIMPLE_CHECK (gs, GIMPLE_TRY);
3330 return &gs->gimple_try.eval;
3334 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3336 static inline gimple_seq
3337 gimple_try_eval (gimple gs)
3339 return *gimple_try_eval_ptr (gs);
3343 /* Return a pointer to the sequence of statements used as the cleanup body for
3344 GIMPLE_TRY GS. */
3346 static inline gimple_seq *
3347 gimple_try_cleanup_ptr (gimple gs)
3349 GIMPLE_CHECK (gs, GIMPLE_TRY);
3350 return &gs->gimple_try.cleanup;
3354 /* Return the sequence of statements used as the cleanup body for
3355 GIMPLE_TRY GS. */
3357 static inline gimple_seq
3358 gimple_try_cleanup (gimple gs)
3360 return *gimple_try_cleanup_ptr (gs);
3364 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3366 static inline void
3367 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3369 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3370 if (catch_is_cleanup)
3371 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3372 else
3373 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3377 /* Set EVAL to be the sequence of statements to use as the body for
3378 GIMPLE_TRY GS. */
3380 static inline void
3381 gimple_try_set_eval (gimple gs, gimple_seq eval)
3383 GIMPLE_CHECK (gs, GIMPLE_TRY);
3384 gs->gimple_try.eval = eval;
3388 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3389 body for GIMPLE_TRY GS. */
3391 static inline void
3392 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3394 GIMPLE_CHECK (gs, GIMPLE_TRY);
3395 gs->gimple_try.cleanup = cleanup;
3399 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3401 static inline gimple_seq *
3402 gimple_wce_cleanup_ptr (gimple gs)
3404 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3405 return &gs->gimple_wce.cleanup;
3409 /* Return the cleanup sequence for cleanup statement GS. */
3411 static inline gimple_seq
3412 gimple_wce_cleanup (gimple gs)
3414 return *gimple_wce_cleanup_ptr (gs);
3418 /* Set CLEANUP to be the cleanup sequence for GS. */
3420 static inline void
3421 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3423 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3424 gs->gimple_wce.cleanup = cleanup;
3428 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3430 static inline bool
3431 gimple_wce_cleanup_eh_only (const_gimple gs)
3433 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3434 return gs->gsbase.subcode != 0;
3438 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3440 static inline void
3441 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3443 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3444 gs->gsbase.subcode = (unsigned int) eh_only_p;
3448 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3450 static inline unsigned
3451 gimple_phi_capacity (const_gimple gs)
3453 GIMPLE_CHECK (gs, GIMPLE_PHI);
3454 return gs->gimple_phi.capacity;
3458 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3459 be exactly the number of incoming edges for the basic block holding
3460 GS. */
3462 static inline unsigned
3463 gimple_phi_num_args (const_gimple gs)
3465 GIMPLE_CHECK (gs, GIMPLE_PHI);
3466 return gs->gimple_phi.nargs;
3470 /* Return the SSA name created by GIMPLE_PHI GS. */
3472 static inline tree
3473 gimple_phi_result (const_gimple gs)
3475 GIMPLE_CHECK (gs, GIMPLE_PHI);
3476 return gs->gimple_phi.result;
3479 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3481 static inline tree *
3482 gimple_phi_result_ptr (gimple gs)
3484 GIMPLE_CHECK (gs, GIMPLE_PHI);
3485 return &gs->gimple_phi.result;
3488 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3490 static inline void
3491 gimple_phi_set_result (gimple gs, tree result)
3493 GIMPLE_CHECK (gs, GIMPLE_PHI);
3494 gs->gimple_phi.result = result;
3495 if (result && TREE_CODE (result) == SSA_NAME)
3496 SSA_NAME_DEF_STMT (result) = gs;
3500 /* Return the PHI argument corresponding to incoming edge INDEX for
3501 GIMPLE_PHI GS. */
3503 static inline struct phi_arg_d *
3504 gimple_phi_arg (gimple gs, unsigned index)
3506 GIMPLE_CHECK (gs, GIMPLE_PHI);
3507 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3508 return &(gs->gimple_phi.args[index]);
3511 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3512 for GIMPLE_PHI GS. */
3514 static inline void
3515 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3517 GIMPLE_CHECK (gs, GIMPLE_PHI);
3518 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3519 gs->gimple_phi.args[index] = *phiarg;
3522 /* Return the region number for GIMPLE_RESX GS. */
3524 static inline int
3525 gimple_resx_region (const_gimple gs)
3527 GIMPLE_CHECK (gs, GIMPLE_RESX);
3528 return gs->gimple_eh_ctrl.region;
3531 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3533 static inline void
3534 gimple_resx_set_region (gimple gs, int region)
3536 GIMPLE_CHECK (gs, GIMPLE_RESX);
3537 gs->gimple_eh_ctrl.region = region;
3540 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3542 static inline int
3543 gimple_eh_dispatch_region (const_gimple gs)
3545 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3546 return gs->gimple_eh_ctrl.region;
3549 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3551 static inline void
3552 gimple_eh_dispatch_set_region (gimple gs, int region)
3554 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3555 gs->gimple_eh_ctrl.region = region;
3558 /* Return the number of labels associated with the switch statement GS. */
3560 static inline unsigned
3561 gimple_switch_num_labels (const_gimple gs)
3563 unsigned num_ops;
3564 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3565 num_ops = gimple_num_ops (gs);
3566 gcc_gimple_checking_assert (num_ops > 1);
3567 return num_ops - 1;
3571 /* Set NLABELS to be the number of labels for the switch statement GS. */
3573 static inline void
3574 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3576 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3577 gimple_set_num_ops (g, nlabels + 1);
3581 /* Return the index variable used by the switch statement GS. */
3583 static inline tree
3584 gimple_switch_index (const_gimple gs)
3586 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3587 return gimple_op (gs, 0);
3591 /* Return a pointer to the index variable for the switch statement GS. */
3593 static inline tree *
3594 gimple_switch_index_ptr (const_gimple gs)
3596 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3597 return gimple_op_ptr (gs, 0);
3601 /* Set INDEX to be the index variable for switch statement GS. */
3603 static inline void
3604 gimple_switch_set_index (gimple gs, tree index)
3606 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3607 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3608 gimple_set_op (gs, 0, index);
3612 /* Return the label numbered INDEX. The default label is 0, followed by any
3613 labels in a switch statement. */
3615 static inline tree
3616 gimple_switch_label (const_gimple gs, unsigned index)
3618 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3619 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3620 return gimple_op (gs, index + 1);
3623 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3625 static inline void
3626 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3628 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3629 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3630 && (label == NULL_TREE
3631 || TREE_CODE (label) == CASE_LABEL_EXPR));
3632 gimple_set_op (gs, index + 1, label);
3635 /* Return the default label for a switch statement. */
3637 static inline tree
3638 gimple_switch_default_label (const_gimple gs)
3640 tree label = gimple_switch_label (gs, 0);
3641 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3642 return label;
3645 /* Set the default label for a switch statement. */
3647 static inline void
3648 gimple_switch_set_default_label (gimple gs, tree label)
3650 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3651 gimple_switch_set_label (gs, 0, label);
3654 /* Return true if GS is a GIMPLE_DEBUG statement. */
3656 static inline bool
3657 is_gimple_debug (const_gimple gs)
3659 return gimple_code (gs) == GIMPLE_DEBUG;
3662 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3664 static inline bool
3665 gimple_debug_bind_p (const_gimple s)
3667 if (is_gimple_debug (s))
3668 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3670 return false;
3673 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3675 static inline tree
3676 gimple_debug_bind_get_var (gimple dbg)
3678 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3679 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3680 return gimple_op (dbg, 0);
3683 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3684 statement. */
3686 static inline tree
3687 gimple_debug_bind_get_value (gimple dbg)
3689 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3690 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3691 return gimple_op (dbg, 1);
3694 /* Return a pointer to the value bound to the variable in a
3695 GIMPLE_DEBUG bind statement. */
3697 static inline tree *
3698 gimple_debug_bind_get_value_ptr (gimple dbg)
3700 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3701 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3702 return gimple_op_ptr (dbg, 1);
3705 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3707 static inline void
3708 gimple_debug_bind_set_var (gimple dbg, tree var)
3710 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3711 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3712 gimple_set_op (dbg, 0, var);
3715 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3716 statement. */
3718 static inline void
3719 gimple_debug_bind_set_value (gimple dbg, tree value)
3721 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3722 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3723 gimple_set_op (dbg, 1, value);
3726 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3727 optimized away. */
3728 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3730 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3731 statement. */
3733 static inline void
3734 gimple_debug_bind_reset_value (gimple dbg)
3736 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3737 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3738 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3741 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3742 value. */
3744 static inline bool
3745 gimple_debug_bind_has_value_p (gimple dbg)
3747 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3748 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3749 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3752 #undef GIMPLE_DEBUG_BIND_NOVALUE
3754 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3756 static inline bool
3757 gimple_debug_source_bind_p (const_gimple s)
3759 if (is_gimple_debug (s))
3760 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3762 return false;
3765 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3767 static inline tree
3768 gimple_debug_source_bind_get_var (gimple dbg)
3770 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3771 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3772 return gimple_op (dbg, 0);
3775 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3776 statement. */
3778 static inline tree
3779 gimple_debug_source_bind_get_value (gimple dbg)
3781 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3782 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3783 return gimple_op (dbg, 1);
3786 /* Return a pointer to the value bound to the variable in a
3787 GIMPLE_DEBUG source bind statement. */
3789 static inline tree *
3790 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3792 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3793 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3794 return gimple_op_ptr (dbg, 1);
3797 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3799 static inline void
3800 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3802 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3803 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3804 gimple_set_op (dbg, 0, var);
3807 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3808 statement. */
3810 static inline void
3811 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3813 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3814 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3815 gimple_set_op (dbg, 1, value);
3818 /* Return a pointer to the body for the OMP statement GS. */
3820 static inline gimple_seq *
3821 gimple_omp_body_ptr (gimple gs)
3823 return &gs->omp.body;
3826 /* Return the body for the OMP statement GS. */
3828 static inline gimple_seq
3829 gimple_omp_body (gimple gs)
3831 return *gimple_omp_body_ptr (gs);
3834 /* Set BODY to be the body for the OMP statement GS. */
3836 static inline void
3837 gimple_omp_set_body (gimple gs, gimple_seq body)
3839 gs->omp.body = body;
3843 /* Return the name associated with OMP_CRITICAL statement GS. */
3845 static inline tree
3846 gimple_omp_critical_name (const_gimple gs)
3848 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3849 return gs->gimple_omp_critical.name;
3853 /* Return a pointer to the name associated with OMP critical statement GS. */
3855 static inline tree *
3856 gimple_omp_critical_name_ptr (gimple gs)
3858 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3859 return &gs->gimple_omp_critical.name;
3863 /* Set NAME to be the name associated with OMP critical statement GS. */
3865 static inline void
3866 gimple_omp_critical_set_name (gimple gs, tree name)
3868 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3869 gs->gimple_omp_critical.name = name;
3873 /* Return the clauses associated with OMP_FOR GS. */
3875 static inline tree
3876 gimple_omp_for_clauses (const_gimple gs)
3878 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3879 return gs->gimple_omp_for.clauses;
3883 /* Return a pointer to the OMP_FOR GS. */
3885 static inline tree *
3886 gimple_omp_for_clauses_ptr (gimple gs)
3888 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3889 return &gs->gimple_omp_for.clauses;
3893 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3895 static inline void
3896 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3898 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3899 gs->gimple_omp_for.clauses = clauses;
3903 /* Get the collapse count of OMP_FOR GS. */
3905 static inline size_t
3906 gimple_omp_for_collapse (gimple gs)
3908 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3909 return gs->gimple_omp_for.collapse;
3913 /* Return the index variable for OMP_FOR GS. */
3915 static inline tree
3916 gimple_omp_for_index (const_gimple gs, size_t i)
3918 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3919 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3920 return gs->gimple_omp_for.iter[i].index;
3924 /* Return a pointer to the index variable for OMP_FOR GS. */
3926 static inline tree *
3927 gimple_omp_for_index_ptr (gimple gs, size_t i)
3929 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3930 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3931 return &gs->gimple_omp_for.iter[i].index;
3935 /* Set INDEX to be the index variable for OMP_FOR GS. */
3937 static inline void
3938 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3940 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3941 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3942 gs->gimple_omp_for.iter[i].index = index;
3946 /* Return the initial value for OMP_FOR GS. */
3948 static inline tree
3949 gimple_omp_for_initial (const_gimple gs, size_t i)
3951 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3952 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3953 return gs->gimple_omp_for.iter[i].initial;
3957 /* Return a pointer to the initial value for OMP_FOR GS. */
3959 static inline tree *
3960 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3962 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3963 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3964 return &gs->gimple_omp_for.iter[i].initial;
3968 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3970 static inline void
3971 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3973 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3974 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3975 gs->gimple_omp_for.iter[i].initial = initial;
3979 /* Return the final value for OMP_FOR GS. */
3981 static inline tree
3982 gimple_omp_for_final (const_gimple gs, size_t i)
3984 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3985 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3986 return gs->gimple_omp_for.iter[i].final;
3990 /* Return a pointer to the final value for OMP_FOR GS. */
3992 static inline tree *
3993 gimple_omp_for_final_ptr (gimple gs, size_t i)
3995 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3996 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3997 return &gs->gimple_omp_for.iter[i].final;
4001 /* Set FINAL to be the final value for OMP_FOR GS. */
4003 static inline void
4004 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4006 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4007 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4008 gs->gimple_omp_for.iter[i].final = final;
4012 /* Return the increment value for OMP_FOR GS. */
4014 static inline tree
4015 gimple_omp_for_incr (const_gimple gs, size_t i)
4017 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4018 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4019 return gs->gimple_omp_for.iter[i].incr;
4023 /* Return a pointer to the increment value for OMP_FOR GS. */
4025 static inline tree *
4026 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4028 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4029 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4030 return &gs->gimple_omp_for.iter[i].incr;
4034 /* Set INCR to be the increment value for OMP_FOR GS. */
4036 static inline void
4037 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4039 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4040 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4041 gs->gimple_omp_for.iter[i].incr = incr;
4045 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4046 statement GS starts. */
4048 static inline gimple_seq *
4049 gimple_omp_for_pre_body_ptr (gimple gs)
4051 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4052 return &gs->gimple_omp_for.pre_body;
4056 /* Return the sequence of statements to execute before the OMP_FOR
4057 statement GS starts. */
4059 static inline gimple_seq
4060 gimple_omp_for_pre_body (gimple gs)
4062 return *gimple_omp_for_pre_body_ptr (gs);
4066 /* Set PRE_BODY to be the sequence of statements to execute before the
4067 OMP_FOR statement GS starts. */
4069 static inline void
4070 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4072 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4073 gs->gimple_omp_for.pre_body = pre_body;
4077 /* Return the clauses associated with OMP_PARALLEL GS. */
4079 static inline tree
4080 gimple_omp_parallel_clauses (const_gimple gs)
4082 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4083 return gs->gimple_omp_parallel.clauses;
4087 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4089 static inline tree *
4090 gimple_omp_parallel_clauses_ptr (gimple gs)
4092 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4093 return &gs->gimple_omp_parallel.clauses;
4097 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4098 GS. */
4100 static inline void
4101 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4103 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4104 gs->gimple_omp_parallel.clauses = clauses;
4108 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4110 static inline tree
4111 gimple_omp_parallel_child_fn (const_gimple gs)
4113 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4114 return gs->gimple_omp_parallel.child_fn;
4117 /* Return a pointer to the child function used to hold the body of
4118 OMP_PARALLEL GS. */
4120 static inline tree *
4121 gimple_omp_parallel_child_fn_ptr (gimple gs)
4123 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4124 return &gs->gimple_omp_parallel.child_fn;
4128 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4130 static inline void
4131 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4133 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4134 gs->gimple_omp_parallel.child_fn = child_fn;
4138 /* Return the artificial argument used to send variables and values
4139 from the parent to the children threads in OMP_PARALLEL GS. */
4141 static inline tree
4142 gimple_omp_parallel_data_arg (const_gimple gs)
4144 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4145 return gs->gimple_omp_parallel.data_arg;
4149 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4151 static inline tree *
4152 gimple_omp_parallel_data_arg_ptr (gimple gs)
4154 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4155 return &gs->gimple_omp_parallel.data_arg;
4159 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4161 static inline void
4162 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4164 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4165 gs->gimple_omp_parallel.data_arg = data_arg;
4169 /* Return the clauses associated with OMP_TASK GS. */
4171 static inline tree
4172 gimple_omp_task_clauses (const_gimple gs)
4174 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4175 return gs->gimple_omp_parallel.clauses;
4179 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4181 static inline tree *
4182 gimple_omp_task_clauses_ptr (gimple gs)
4184 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4185 return &gs->gimple_omp_parallel.clauses;
4189 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4190 GS. */
4192 static inline void
4193 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4195 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4196 gs->gimple_omp_parallel.clauses = clauses;
4200 /* Return the child function used to hold the body of OMP_TASK GS. */
4202 static inline tree
4203 gimple_omp_task_child_fn (const_gimple gs)
4205 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4206 return gs->gimple_omp_parallel.child_fn;
4209 /* Return a pointer to the child function used to hold the body of
4210 OMP_TASK GS. */
4212 static inline tree *
4213 gimple_omp_task_child_fn_ptr (gimple gs)
4215 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4216 return &gs->gimple_omp_parallel.child_fn;
4220 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4222 static inline void
4223 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4225 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4226 gs->gimple_omp_parallel.child_fn = child_fn;
4230 /* Return the artificial argument used to send variables and values
4231 from the parent to the children threads in OMP_TASK GS. */
4233 static inline tree
4234 gimple_omp_task_data_arg (const_gimple gs)
4236 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4237 return gs->gimple_omp_parallel.data_arg;
4241 /* Return a pointer to the data argument for OMP_TASK GS. */
4243 static inline tree *
4244 gimple_omp_task_data_arg_ptr (gimple gs)
4246 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4247 return &gs->gimple_omp_parallel.data_arg;
4251 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4253 static inline void
4254 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4256 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4257 gs->gimple_omp_parallel.data_arg = data_arg;
4261 /* Return the clauses associated with OMP_TASK GS. */
4263 static inline tree
4264 gimple_omp_taskreg_clauses (const_gimple gs)
4266 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4267 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4268 return gs->gimple_omp_parallel.clauses;
4272 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4274 static inline tree *
4275 gimple_omp_taskreg_clauses_ptr (gimple gs)
4277 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4278 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4279 return &gs->gimple_omp_parallel.clauses;
4283 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4284 GS. */
4286 static inline void
4287 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4289 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4290 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4291 gs->gimple_omp_parallel.clauses = clauses;
4295 /* Return the child function used to hold the body of OMP_TASK GS. */
4297 static inline tree
4298 gimple_omp_taskreg_child_fn (const_gimple gs)
4300 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4301 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4302 return gs->gimple_omp_parallel.child_fn;
4305 /* Return a pointer to the child function used to hold the body of
4306 OMP_TASK GS. */
4308 static inline tree *
4309 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4311 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4312 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4313 return &gs->gimple_omp_parallel.child_fn;
4317 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4319 static inline void
4320 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4322 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4323 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4324 gs->gimple_omp_parallel.child_fn = child_fn;
4328 /* Return the artificial argument used to send variables and values
4329 from the parent to the children threads in OMP_TASK GS. */
4331 static inline tree
4332 gimple_omp_taskreg_data_arg (const_gimple gs)
4334 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4335 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4336 return gs->gimple_omp_parallel.data_arg;
4340 /* Return a pointer to the data argument for OMP_TASK GS. */
4342 static inline tree *
4343 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4345 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4346 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4347 return &gs->gimple_omp_parallel.data_arg;
4351 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4353 static inline void
4354 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4356 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4357 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4358 gs->gimple_omp_parallel.data_arg = data_arg;
4362 /* Return the copy function used to hold the body of OMP_TASK GS. */
4364 static inline tree
4365 gimple_omp_task_copy_fn (const_gimple gs)
4367 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4368 return gs->gimple_omp_task.copy_fn;
4371 /* Return a pointer to the copy function used to hold the body of
4372 OMP_TASK GS. */
4374 static inline tree *
4375 gimple_omp_task_copy_fn_ptr (gimple gs)
4377 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4378 return &gs->gimple_omp_task.copy_fn;
4382 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4384 static inline void
4385 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4387 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4388 gs->gimple_omp_task.copy_fn = copy_fn;
4392 /* Return size of the data block in bytes in OMP_TASK GS. */
4394 static inline tree
4395 gimple_omp_task_arg_size (const_gimple gs)
4397 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4398 return gs->gimple_omp_task.arg_size;
4402 /* Return a pointer to the data block size for OMP_TASK GS. */
4404 static inline tree *
4405 gimple_omp_task_arg_size_ptr (gimple gs)
4407 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4408 return &gs->gimple_omp_task.arg_size;
4412 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4414 static inline void
4415 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4417 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4418 gs->gimple_omp_task.arg_size = arg_size;
4422 /* Return align of the data block in bytes in OMP_TASK GS. */
4424 static inline tree
4425 gimple_omp_task_arg_align (const_gimple gs)
4427 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4428 return gs->gimple_omp_task.arg_align;
4432 /* Return a pointer to the data block align for OMP_TASK GS. */
4434 static inline tree *
4435 gimple_omp_task_arg_align_ptr (gimple gs)
4437 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4438 return &gs->gimple_omp_task.arg_align;
4442 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4444 static inline void
4445 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4447 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4448 gs->gimple_omp_task.arg_align = arg_align;
4452 /* Return the clauses associated with OMP_SINGLE GS. */
4454 static inline tree
4455 gimple_omp_single_clauses (const_gimple gs)
4457 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4458 return gs->gimple_omp_single.clauses;
4462 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4464 static inline tree *
4465 gimple_omp_single_clauses_ptr (gimple gs)
4467 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4468 return &gs->gimple_omp_single.clauses;
4472 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4474 static inline void
4475 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4477 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4478 gs->gimple_omp_single.clauses = clauses;
4482 /* Return the clauses associated with OMP_SECTIONS GS. */
4484 static inline tree
4485 gimple_omp_sections_clauses (const_gimple gs)
4487 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4488 return gs->gimple_omp_sections.clauses;
4492 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4494 static inline tree *
4495 gimple_omp_sections_clauses_ptr (gimple gs)
4497 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4498 return &gs->gimple_omp_sections.clauses;
4502 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4503 GS. */
4505 static inline void
4506 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4508 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4509 gs->gimple_omp_sections.clauses = clauses;
4513 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4514 in GS. */
4516 static inline tree
4517 gimple_omp_sections_control (const_gimple gs)
4519 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4520 return gs->gimple_omp_sections.control;
4524 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4525 GS. */
4527 static inline tree *
4528 gimple_omp_sections_control_ptr (gimple gs)
4530 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4531 return &gs->gimple_omp_sections.control;
4535 /* Set CONTROL to be the set of clauses associated with the
4536 GIMPLE_OMP_SECTIONS in GS. */
4538 static inline void
4539 gimple_omp_sections_set_control (gimple gs, tree control)
4541 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4542 gs->gimple_omp_sections.control = control;
4546 /* Set COND to be the condition code for OMP_FOR GS. */
4548 static inline void
4549 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4551 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4552 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4553 && i < gs->gimple_omp_for.collapse);
4554 gs->gimple_omp_for.iter[i].cond = cond;
4558 /* Return the condition code associated with OMP_FOR GS. */
4560 static inline enum tree_code
4561 gimple_omp_for_cond (const_gimple gs, size_t i)
4563 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4564 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4565 return gs->gimple_omp_for.iter[i].cond;
4569 /* Set the value being stored in an atomic store. */
4571 static inline void
4572 gimple_omp_atomic_store_set_val (gimple g, tree val)
4574 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4575 g->gimple_omp_atomic_store.val = val;
4579 /* Return the value being stored in an atomic store. */
4581 static inline tree
4582 gimple_omp_atomic_store_val (const_gimple g)
4584 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4585 return g->gimple_omp_atomic_store.val;
4589 /* Return a pointer to the value being stored in an atomic store. */
4591 static inline tree *
4592 gimple_omp_atomic_store_val_ptr (gimple g)
4594 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4595 return &g->gimple_omp_atomic_store.val;
4599 /* Set the LHS of an atomic load. */
4601 static inline void
4602 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4604 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4605 g->gimple_omp_atomic_load.lhs = lhs;
4609 /* Get the LHS of an atomic load. */
4611 static inline tree
4612 gimple_omp_atomic_load_lhs (const_gimple g)
4614 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4615 return g->gimple_omp_atomic_load.lhs;
4619 /* Return a pointer to the LHS of an atomic load. */
4621 static inline tree *
4622 gimple_omp_atomic_load_lhs_ptr (gimple g)
4624 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4625 return &g->gimple_omp_atomic_load.lhs;
4629 /* Set the RHS of an atomic load. */
4631 static inline void
4632 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4634 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4635 g->gimple_omp_atomic_load.rhs = rhs;
4639 /* Get the RHS of an atomic load. */
4641 static inline tree
4642 gimple_omp_atomic_load_rhs (const_gimple g)
4644 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4645 return g->gimple_omp_atomic_load.rhs;
4649 /* Return a pointer to the RHS of an atomic load. */
4651 static inline tree *
4652 gimple_omp_atomic_load_rhs_ptr (gimple g)
4654 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4655 return &g->gimple_omp_atomic_load.rhs;
4659 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4661 static inline tree
4662 gimple_omp_continue_control_def (const_gimple g)
4664 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4665 return g->gimple_omp_continue.control_def;
4668 /* The same as above, but return the address. */
4670 static inline tree *
4671 gimple_omp_continue_control_def_ptr (gimple g)
4673 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4674 return &g->gimple_omp_continue.control_def;
4677 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4679 static inline void
4680 gimple_omp_continue_set_control_def (gimple g, tree def)
4682 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4683 g->gimple_omp_continue.control_def = def;
4687 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4689 static inline tree
4690 gimple_omp_continue_control_use (const_gimple g)
4692 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4693 return g->gimple_omp_continue.control_use;
4697 /* The same as above, but return the address. */
4699 static inline tree *
4700 gimple_omp_continue_control_use_ptr (gimple g)
4702 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4703 return &g->gimple_omp_continue.control_use;
4707 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4709 static inline void
4710 gimple_omp_continue_set_control_use (gimple g, tree use)
4712 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4713 g->gimple_omp_continue.control_use = use;
4716 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4718 static inline gimple_seq *
4719 gimple_transaction_body_ptr (gimple gs)
4721 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4722 return &gs->gimple_transaction.body;
4725 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4727 static inline gimple_seq
4728 gimple_transaction_body (gimple gs)
4730 return *gimple_transaction_body_ptr (gs);
4733 /* Return the label associated with a GIMPLE_TRANSACTION. */
4735 static inline tree
4736 gimple_transaction_label (const_gimple gs)
4738 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4739 return gs->gimple_transaction.label;
4742 static inline tree *
4743 gimple_transaction_label_ptr (gimple gs)
4745 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4746 return &gs->gimple_transaction.label;
4749 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4751 static inline unsigned int
4752 gimple_transaction_subcode (const_gimple gs)
4754 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4755 return gs->gsbase.subcode;
4758 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4760 static inline void
4761 gimple_transaction_set_body (gimple gs, gimple_seq body)
4763 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4764 gs->gimple_transaction.body = body;
4767 /* Set the label associated with a GIMPLE_TRANSACTION. */
4769 static inline void
4770 gimple_transaction_set_label (gimple gs, tree label)
4772 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4773 gs->gimple_transaction.label = label;
4776 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4778 static inline void
4779 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4781 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4782 gs->gsbase.subcode = subcode;
4786 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4788 static inline tree *
4789 gimple_return_retval_ptr (const_gimple gs)
4791 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4792 return gimple_op_ptr (gs, 0);
4795 /* Return the return value for GIMPLE_RETURN GS. */
4797 static inline tree
4798 gimple_return_retval (const_gimple gs)
4800 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4801 return gimple_op (gs, 0);
4805 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4807 static inline void
4808 gimple_return_set_retval (gimple gs, tree retval)
4810 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4811 gimple_set_op (gs, 0, retval);
4815 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4817 #define CASE_GIMPLE_OMP \
4818 case GIMPLE_OMP_PARALLEL: \
4819 case GIMPLE_OMP_TASK: \
4820 case GIMPLE_OMP_FOR: \
4821 case GIMPLE_OMP_SECTIONS: \
4822 case GIMPLE_OMP_SECTIONS_SWITCH: \
4823 case GIMPLE_OMP_SINGLE: \
4824 case GIMPLE_OMP_SECTION: \
4825 case GIMPLE_OMP_MASTER: \
4826 case GIMPLE_OMP_ORDERED: \
4827 case GIMPLE_OMP_CRITICAL: \
4828 case GIMPLE_OMP_RETURN: \
4829 case GIMPLE_OMP_ATOMIC_LOAD: \
4830 case GIMPLE_OMP_ATOMIC_STORE: \
4831 case GIMPLE_OMP_CONTINUE
4833 static inline bool
4834 is_gimple_omp (const_gimple stmt)
4836 switch (gimple_code (stmt))
4838 CASE_GIMPLE_OMP:
4839 return true;
4840 default:
4841 return false;
4846 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4848 static inline bool
4849 gimple_nop_p (const_gimple g)
4851 return gimple_code (g) == GIMPLE_NOP;
4855 /* Return true if GS is a GIMPLE_RESX. */
4857 static inline bool
4858 is_gimple_resx (const_gimple gs)
4860 return gimple_code (gs) == GIMPLE_RESX;
4863 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4865 static inline enum br_predictor
4866 gimple_predict_predictor (gimple gs)
4868 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4869 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4873 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4875 static inline void
4876 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4878 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4879 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4880 | (unsigned) predictor;
4884 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4886 static inline enum prediction
4887 gimple_predict_outcome (gimple gs)
4889 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4890 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4894 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4896 static inline void
4897 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4899 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4900 if (outcome == TAKEN)
4901 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4902 else
4903 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4907 /* Return the type of the main expression computed by STMT. Return
4908 void_type_node if the statement computes nothing. */
4910 static inline tree
4911 gimple_expr_type (const_gimple stmt)
4913 enum gimple_code code = gimple_code (stmt);
4915 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4917 tree type;
4918 /* In general we want to pass out a type that can be substituted
4919 for both the RHS and the LHS types if there is a possibly
4920 useless conversion involved. That means returning the
4921 original RHS type as far as we can reconstruct it. */
4922 if (code == GIMPLE_CALL)
4923 type = gimple_call_return_type (stmt);
4924 else
4925 switch (gimple_assign_rhs_code (stmt))
4927 case POINTER_PLUS_EXPR:
4928 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4929 break;
4931 default:
4932 /* As fallback use the type of the LHS. */
4933 type = TREE_TYPE (gimple_get_lhs (stmt));
4934 break;
4936 return type;
4938 else if (code == GIMPLE_COND)
4939 return boolean_type_node;
4940 else
4941 return void_type_node;
4944 /* Return true if TYPE is a suitable type for a scalar register variable. */
4946 static inline bool
4947 is_gimple_reg_type (tree type)
4949 return !AGGREGATE_TYPE_P (type);
4952 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4954 static inline gimple_stmt_iterator
4955 gsi_start_1 (gimple_seq *seq)
4957 gimple_stmt_iterator i;
4959 i.ptr = gimple_seq_first (*seq);
4960 i.seq = seq;
4961 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
4963 return i;
4966 #define gsi_start(x) gsi_start_1(&(x))
4968 static inline gimple_stmt_iterator
4969 gsi_none (void)
4971 gimple_stmt_iterator i;
4972 i.ptr = NULL;
4973 i.seq = NULL;
4974 i.bb = NULL;
4975 return i;
4978 /* Return a new iterator pointing to the first statement in basic block BB. */
4980 static inline gimple_stmt_iterator
4981 gsi_start_bb (basic_block bb)
4983 gimple_stmt_iterator i;
4984 gimple_seq *seq;
4986 seq = bb_seq_addr (bb);
4987 i.ptr = gimple_seq_first (*seq);
4988 i.seq = seq;
4989 i.bb = bb;
4991 return i;
4995 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4997 static inline gimple_stmt_iterator
4998 gsi_last_1 (gimple_seq *seq)
5000 gimple_stmt_iterator i;
5002 i.ptr = gimple_seq_last (*seq);
5003 i.seq = seq;
5004 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5006 return i;
5009 #define gsi_last(x) gsi_last_1(&(x))
5011 /* Return a new iterator pointing to the last statement in basic block BB. */
5013 static inline gimple_stmt_iterator
5014 gsi_last_bb (basic_block bb)
5016 gimple_stmt_iterator i;
5017 gimple_seq *seq;
5019 seq = bb_seq_addr (bb);
5020 i.ptr = gimple_seq_last (*seq);
5021 i.seq = seq;
5022 i.bb = bb;
5024 return i;
5028 /* Return true if I is at the end of its sequence. */
5030 static inline bool
5031 gsi_end_p (gimple_stmt_iterator i)
5033 return i.ptr == NULL;
5037 /* Return true if I is one statement before the end of its sequence. */
5039 static inline bool
5040 gsi_one_before_end_p (gimple_stmt_iterator i)
5042 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5046 /* Advance the iterator to the next gimple statement. */
5048 static inline void
5049 gsi_next (gimple_stmt_iterator *i)
5051 i->ptr = i->ptr->gsbase.next;
5054 /* Advance the iterator to the previous gimple statement. */
5056 static inline void
5057 gsi_prev (gimple_stmt_iterator *i)
5059 gimple prev = i->ptr->gsbase.prev;
5060 if (prev->gsbase.next)
5061 i->ptr = prev;
5062 else
5063 i->ptr = NULL;
5066 /* Return the current stmt. */
5068 static inline gimple
5069 gsi_stmt (gimple_stmt_iterator i)
5071 return i.ptr;
5074 /* Return a block statement iterator that points to the first non-label
5075 statement in block BB. */
5077 static inline gimple_stmt_iterator
5078 gsi_after_labels (basic_block bb)
5080 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5082 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5083 gsi_next (&gsi);
5085 return gsi;
5088 /* Advance the iterator to the next non-debug gimple statement. */
5090 static inline void
5091 gsi_next_nondebug (gimple_stmt_iterator *i)
5095 gsi_next (i);
5097 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5100 /* Advance the iterator to the next non-debug gimple statement. */
5102 static inline void
5103 gsi_prev_nondebug (gimple_stmt_iterator *i)
5107 gsi_prev (i);
5109 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5112 /* Return a new iterator pointing to the first non-debug statement in
5113 basic block BB. */
5115 static inline gimple_stmt_iterator
5116 gsi_start_nondebug_bb (basic_block bb)
5118 gimple_stmt_iterator i = gsi_start_bb (bb);
5120 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5121 gsi_next_nondebug (&i);
5123 return i;
5126 /* Return a new iterator pointing to the last non-debug statement in
5127 basic block BB. */
5129 static inline gimple_stmt_iterator
5130 gsi_last_nondebug_bb (basic_block bb)
5132 gimple_stmt_iterator i = gsi_last_bb (bb);
5134 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5135 gsi_prev_nondebug (&i);
5137 return i;
5141 /* Return the basic block associated with this iterator. */
5143 static inline basic_block
5144 gsi_bb (gimple_stmt_iterator i)
5146 return i.bb;
5150 /* Return the sequence associated with this iterator. */
5152 static inline gimple_seq
5153 gsi_seq (gimple_stmt_iterator i)
5155 return *i.seq;
5159 enum gsi_iterator_update
5161 GSI_NEW_STMT, /* Only valid when single statement is added, move
5162 iterator to it. */
5163 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5164 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5165 for linking other statements in the same
5166 direction. */
5169 /* In gimple-iterator.c */
5170 gimple_stmt_iterator gsi_start_phis (basic_block);
5171 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5172 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5173 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5174 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5175 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5176 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5177 enum gsi_iterator_update);
5178 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5179 enum gsi_iterator_update);
5180 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5181 enum gsi_iterator_update);
5182 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5183 enum gsi_iterator_update);
5184 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5185 enum gsi_iterator_update);
5186 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5187 enum gsi_iterator_update);
5188 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5189 enum gsi_iterator_update);
5190 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5191 enum gsi_iterator_update);
5192 bool gsi_remove (gimple_stmt_iterator *, bool);
5193 gimple_stmt_iterator gsi_for_stmt (gimple);
5194 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5195 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5196 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5197 void gsi_insert_on_edge (edge, gimple);
5198 void gsi_insert_seq_on_edge (edge, gimple_seq);
5199 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5200 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5201 void gsi_commit_one_edge_insert (edge, basic_block *);
5202 void gsi_commit_edge_inserts (void);
5203 gimple gimple_call_copy_skip_args (gimple, bitmap);
5206 /* Convenience routines to walk all statements of a gimple function.
5207 Note that this is useful exclusively before the code is converted
5208 into SSA form. Once the program is in SSA form, the standard
5209 operand interface should be used to analyze/modify statements. */
5210 struct walk_stmt_info
5212 /* Points to the current statement being walked. */
5213 gimple_stmt_iterator gsi;
5215 /* Additional data that the callback functions may want to carry
5216 through the recursion. */
5217 void *info;
5219 /* Pointer map used to mark visited tree nodes when calling
5220 walk_tree on each operand. If set to NULL, duplicate tree nodes
5221 will be visited more than once. */
5222 struct pointer_set_t *pset;
5224 /* Operand returned by the callbacks. This is set when calling
5225 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5226 returns non-NULL, this field will contain the tree returned by
5227 the last callback. */
5228 tree callback_result;
5230 /* Indicates whether the operand being examined may be replaced
5231 with something that matches is_gimple_val (if true) or something
5232 slightly more complicated (if false). "Something" technically
5233 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5234 but we never try to form anything more complicated than that, so
5235 we don't bother checking.
5237 Also note that CALLBACK should update this flag while walking the
5238 sub-expressions of a statement. For instance, when walking the
5239 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5240 to true, however, when walking &var, the operand of that
5241 ADDR_EXPR does not need to be a GIMPLE value. */
5242 BOOL_BITFIELD val_only : 1;
5244 /* True if we are currently walking the LHS of an assignment. */
5245 BOOL_BITFIELD is_lhs : 1;
5247 /* Optional. Set to true by the callback functions if they made any
5248 changes. */
5249 BOOL_BITFIELD changed : 1;
5251 /* True if we're interested in location information. */
5252 BOOL_BITFIELD want_locations : 1;
5254 /* True if we've removed the statement that was processed. */
5255 BOOL_BITFIELD removed_stmt : 1;
5258 /* Callback for walk_gimple_stmt. Called for every statement found
5259 during traversal. The first argument points to the statement to
5260 walk. The second argument is a flag that the callback sets to
5261 'true' if it the callback handled all the operands and
5262 sub-statements of the statement (the default value of this flag is
5263 'false'). The third argument is an anonymous pointer to data
5264 to be used by the callback. */
5265 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5266 struct walk_stmt_info *);
5268 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5269 struct walk_stmt_info *);
5270 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5271 struct walk_stmt_info *);
5272 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5273 struct walk_stmt_info *);
5274 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5276 /* Enum and arrays used for allocation stats. Keep in sync with
5277 gimple.c:gimple_alloc_kind_names. */
5278 enum gimple_alloc_kind
5280 gimple_alloc_kind_assign, /* Assignments. */
5281 gimple_alloc_kind_phi, /* PHI nodes. */
5282 gimple_alloc_kind_cond, /* Conditionals. */
5283 gimple_alloc_kind_rest, /* Everything else. */
5284 gimple_alloc_kind_all
5287 extern int gimple_alloc_counts[];
5288 extern int gimple_alloc_sizes[];
5290 /* Return the allocation kind for a given stmt CODE. */
5291 static inline enum gimple_alloc_kind
5292 gimple_alloc_kind (enum gimple_code code)
5294 switch (code)
5296 case GIMPLE_ASSIGN:
5297 return gimple_alloc_kind_assign;
5298 case GIMPLE_PHI:
5299 return gimple_alloc_kind_phi;
5300 case GIMPLE_COND:
5301 return gimple_alloc_kind_cond;
5302 default:
5303 return gimple_alloc_kind_rest;
5307 extern void dump_gimple_statistics (void);
5309 /* In gimple-fold.c. */
5310 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5311 tree gimple_fold_builtin (gimple);
5312 bool fold_stmt (gimple_stmt_iterator *);
5313 bool fold_stmt_inplace (gimple_stmt_iterator *);
5314 tree get_symbol_constant_value (tree);
5315 tree canonicalize_constructor_val (tree, tree);
5316 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5317 enum tree_code, tree, tree);
5318 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5319 enum tree_code, tree, tree);
5321 bool gimple_val_nonnegative_real_p (tree);
5322 #endif /* GCC_GIMPLE_H */