ChangeLog/
[official-gcc.git] / gcc / gimple.h
blobb34016aaac139bac5064ffbddf63ab1960a2fe3c
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;
216 /* Base structure for tuples with operands. */
218 struct GTY(()) gimple_statement_with_ops_base
220 /* [ WORD 1-6 ] */
221 struct gimple_statement_base gsbase;
223 /* [ WORD 7 ]
224 SSA operand vectors. NOTE: It should be possible to
225 amalgamate these vectors with the operand vector OP. However,
226 the SSA operand vectors are organized differently and contain
227 more information (like immediate use chaining). */
228 struct use_optype_d GTY((skip (""))) *use_ops;
232 /* Statements that take register operands. */
234 struct GTY(()) gimple_statement_with_ops
236 /* [ WORD 1-7 ] */
237 struct gimple_statement_with_ops_base opbase;
239 /* [ WORD 8 ]
240 Operand vector. NOTE! This must always be the last field
241 of this structure. In particular, this means that this
242 structure cannot be embedded inside another one. */
243 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
247 /* Base for statements that take both memory and register operands. */
249 struct GTY(()) gimple_statement_with_memory_ops_base
251 /* [ WORD 1-7 ] */
252 struct gimple_statement_with_ops_base opbase;
254 /* [ WORD 8-9 ]
255 Virtual operands for this statement. The GC will pick them
256 up via the ssa_names array. */
257 tree GTY((skip (""))) vdef;
258 tree GTY((skip (""))) vuse;
262 /* Statements that take both memory and register operands. */
264 struct GTY(()) gimple_statement_with_memory_ops
266 /* [ WORD 1-9 ] */
267 struct gimple_statement_with_memory_ops_base membase;
269 /* [ WORD 10 ]
270 Operand vector. NOTE! This must always be the last field
271 of this structure. In particular, this means that this
272 structure cannot be embedded inside another one. */
273 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
277 /* Call statements that take both memory and register operands. */
279 struct GTY(()) gimple_statement_call
281 /* [ WORD 1-9 ] */
282 struct gimple_statement_with_memory_ops_base membase;
284 /* [ WORD 10-13 ] */
285 struct pt_solution call_used;
286 struct pt_solution call_clobbered;
288 /* [ WORD 14 ] */
289 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
290 tree GTY ((tag ("0"))) fntype;
291 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
292 } u;
294 /* [ WORD 15 ]
295 Operand vector. NOTE! This must always be the last field
296 of this structure. In particular, this means that this
297 structure cannot be embedded inside another one. */
298 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
302 /* OpenMP statements (#pragma omp). */
304 struct GTY(()) gimple_statement_omp {
305 /* [ WORD 1-6 ] */
306 struct gimple_statement_base gsbase;
308 /* [ WORD 7 ] */
309 gimple_seq body;
313 /* GIMPLE_BIND */
315 struct GTY(()) gimple_statement_bind {
316 /* [ WORD 1-6 ] */
317 struct gimple_statement_base gsbase;
319 /* [ WORD 7 ]
320 Variables declared in this scope. */
321 tree vars;
323 /* [ WORD 8 ]
324 This is different than the BLOCK field in gimple_statement_base,
325 which is analogous to TREE_BLOCK (i.e., the lexical block holding
326 this statement). This field is the equivalent of BIND_EXPR_BLOCK
327 in tree land (i.e., the lexical scope defined by this bind). See
328 gimple-low.c. */
329 tree block;
331 /* [ WORD 9 ] */
332 gimple_seq body;
336 /* GIMPLE_CATCH */
338 struct GTY(()) gimple_statement_catch {
339 /* [ WORD 1-6 ] */
340 struct gimple_statement_base gsbase;
342 /* [ WORD 7 ] */
343 tree types;
345 /* [ WORD 8 ] */
346 gimple_seq handler;
350 /* GIMPLE_EH_FILTER */
352 struct GTY(()) gimple_statement_eh_filter {
353 /* [ WORD 1-6 ] */
354 struct gimple_statement_base gsbase;
356 /* [ WORD 7 ]
357 Filter types. */
358 tree types;
360 /* [ WORD 8 ]
361 Failure actions. */
362 gimple_seq failure;
365 /* GIMPLE_EH_ELSE */
367 struct GTY(()) gimple_statement_eh_else {
368 /* [ WORD 1-6 ] */
369 struct gimple_statement_base gsbase;
371 /* [ WORD 7,8 ] */
372 gimple_seq n_body, e_body;
375 /* GIMPLE_EH_MUST_NOT_THROW */
377 struct GTY(()) gimple_statement_eh_mnt {
378 /* [ WORD 1-6 ] */
379 struct gimple_statement_base gsbase;
381 /* [ WORD 7 ] Abort function decl. */
382 tree fndecl;
385 /* GIMPLE_PHI */
387 struct GTY(()) gimple_statement_phi {
388 /* [ WORD 1-6 ] */
389 struct gimple_statement_base gsbase;
391 /* [ WORD 7 ] */
392 unsigned capacity;
393 unsigned nargs;
395 /* [ WORD 8 ] */
396 tree result;
398 /* [ WORD 9 ] */
399 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
403 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
405 struct GTY(()) gimple_statement_eh_ctrl
407 /* [ WORD 1-6 ] */
408 struct gimple_statement_base gsbase;
410 /* [ WORD 7 ]
411 Exception region number. */
412 int region;
416 /* GIMPLE_TRY */
418 struct GTY(()) gimple_statement_try {
419 /* [ WORD 1-6 ] */
420 struct gimple_statement_base gsbase;
422 /* [ WORD 7 ]
423 Expression to evaluate. */
424 gimple_seq eval;
426 /* [ WORD 8 ]
427 Cleanup expression. */
428 gimple_seq cleanup;
431 /* Kind of GIMPLE_TRY statements. */
432 enum gimple_try_flags
434 /* A try/catch. */
435 GIMPLE_TRY_CATCH = 1 << 0,
437 /* A try/finally. */
438 GIMPLE_TRY_FINALLY = 1 << 1,
439 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
441 /* Analogous to TRY_CATCH_IS_CLEANUP. */
442 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
445 /* GIMPLE_WITH_CLEANUP_EXPR */
447 struct GTY(()) gimple_statement_wce {
448 /* [ WORD 1-6 ] */
449 struct gimple_statement_base gsbase;
451 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
452 executed if an exception is thrown, not on normal exit of its
453 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
454 in TARGET_EXPRs. */
456 /* [ WORD 7 ]
457 Cleanup expression. */
458 gimple_seq cleanup;
462 /* GIMPLE_ASM */
464 struct GTY(()) gimple_statement_asm
466 /* [ WORD 1-9 ] */
467 struct gimple_statement_with_memory_ops_base membase;
469 /* [ WORD 10 ]
470 __asm__ statement. */
471 const char *string;
473 /* [ WORD 11 ]
474 Number of inputs, outputs, clobbers, labels. */
475 unsigned char ni;
476 unsigned char no;
477 unsigned char nc;
478 unsigned char nl;
480 /* [ WORD 12 ]
481 Operand vector. NOTE! This must always be the last field
482 of this structure. In particular, this means that this
483 structure cannot be embedded inside another one. */
484 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
487 /* GIMPLE_OMP_CRITICAL */
489 struct GTY(()) gimple_statement_omp_critical {
490 /* [ WORD 1-7 ] */
491 struct gimple_statement_omp omp;
493 /* [ WORD 8 ]
494 Critical section name. */
495 tree name;
499 struct GTY(()) gimple_omp_for_iter {
500 /* Condition code. */
501 enum tree_code cond;
503 /* Index variable. */
504 tree index;
506 /* Initial value. */
507 tree initial;
509 /* Final value. */
510 tree final;
512 /* Increment. */
513 tree incr;
516 /* GIMPLE_OMP_FOR */
518 struct GTY(()) gimple_statement_omp_for {
519 /* [ WORD 1-7 ] */
520 struct gimple_statement_omp omp;
522 /* [ WORD 8 ] */
523 tree clauses;
525 /* [ WORD 9 ]
526 Number of elements in iter array. */
527 size_t collapse;
529 /* [ WORD 10 ] */
530 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
532 /* [ WORD 11 ]
533 Pre-body evaluated before the loop body begins. */
534 gimple_seq pre_body;
538 /* GIMPLE_OMP_PARALLEL */
540 struct GTY(()) gimple_statement_omp_parallel {
541 /* [ WORD 1-7 ] */
542 struct gimple_statement_omp omp;
544 /* [ WORD 8 ]
545 Clauses. */
546 tree clauses;
548 /* [ WORD 9 ]
549 Child function holding the body of the parallel region. */
550 tree child_fn;
552 /* [ WORD 10 ]
553 Shared data argument. */
554 tree data_arg;
558 /* GIMPLE_OMP_TASK */
560 struct GTY(()) gimple_statement_omp_task {
561 /* [ WORD 1-10 ] */
562 struct gimple_statement_omp_parallel par;
564 /* [ WORD 11 ]
565 Child function holding firstprivate initialization if needed. */
566 tree copy_fn;
568 /* [ WORD 12-13 ]
569 Size and alignment in bytes of the argument data block. */
570 tree arg_size;
571 tree arg_align;
575 /* GIMPLE_OMP_SECTION */
576 /* Uses struct gimple_statement_omp. */
579 /* GIMPLE_OMP_SECTIONS */
581 struct GTY(()) gimple_statement_omp_sections {
582 /* [ WORD 1-7 ] */
583 struct gimple_statement_omp omp;
585 /* [ WORD 8 ] */
586 tree clauses;
588 /* [ WORD 9 ]
589 The control variable used for deciding which of the sections to
590 execute. */
591 tree control;
594 /* GIMPLE_OMP_CONTINUE.
596 Note: This does not inherit from gimple_statement_omp, because we
597 do not need the body field. */
599 struct GTY(()) gimple_statement_omp_continue {
600 /* [ WORD 1-6 ] */
601 struct gimple_statement_base gsbase;
603 /* [ WORD 7 ] */
604 tree control_def;
606 /* [ WORD 8 ] */
607 tree control_use;
610 /* GIMPLE_OMP_SINGLE */
612 struct GTY(()) gimple_statement_omp_single {
613 /* [ WORD 1-7 ] */
614 struct gimple_statement_omp omp;
616 /* [ WORD 7 ] */
617 tree clauses;
621 /* GIMPLE_OMP_ATOMIC_LOAD.
622 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
623 contains a sequence, which we don't need here. */
625 struct GTY(()) gimple_statement_omp_atomic_load {
626 /* [ WORD 1-6 ] */
627 struct gimple_statement_base gsbase;
629 /* [ WORD 7-8 ] */
630 tree rhs, lhs;
633 /* GIMPLE_OMP_ATOMIC_STORE.
634 See note on GIMPLE_OMP_ATOMIC_LOAD. */
636 struct GTY(()) gimple_statement_omp_atomic_store {
637 /* [ WORD 1-6 ] */
638 struct gimple_statement_base gsbase;
640 /* [ WORD 7 ] */
641 tree val;
644 /* GIMPLE_TRANSACTION. */
646 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
648 /* The __transaction_atomic was declared [[outer]] or it is
649 __transaction_relaxed. */
650 #define GTMA_IS_OUTER (1u << 0)
651 #define GTMA_IS_RELAXED (1u << 1)
652 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
654 /* The transaction is seen to not have an abort. */
655 #define GTMA_HAVE_ABORT (1u << 2)
656 /* The transaction is seen to have loads or stores. */
657 #define GTMA_HAVE_LOAD (1u << 3)
658 #define GTMA_HAVE_STORE (1u << 4)
659 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
660 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
661 /* The transaction WILL enter serial irrevocable mode.
662 An irrevocable block post-dominates the entire transaction, such
663 that all invocations of the transaction will go serial-irrevocable.
664 In such case, we don't bother instrumenting the transaction, and
665 tell the runtime that it should begin the transaction in
666 serial-irrevocable mode. */
667 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
669 struct GTY(()) gimple_statement_transaction
671 /* [ WORD 1-9 ] */
672 struct gimple_statement_with_memory_ops_base gsbase;
674 /* [ WORD 10 ] */
675 gimple_seq body;
677 /* [ WORD 11 ] */
678 tree label;
681 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
682 enum gimple_statement_structure_enum {
683 #include "gsstruct.def"
684 LAST_GSS_ENUM
686 #undef DEFGSSTRUCT
689 /* Define the overall contents of a gimple tuple. It may be any of the
690 structures declared above for various types of tuples. */
692 union GTY ((desc ("gimple_statement_structure (&%h)"),
693 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
694 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
695 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
696 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
697 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
698 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
699 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
700 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
701 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
702 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
703 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
704 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
705 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
706 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
707 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
708 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
709 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
710 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
711 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
712 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
713 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
714 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
715 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
716 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
717 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
718 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
719 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
722 /* In gimple.c. */
724 /* Offset in bytes to the location of the operand vector.
725 Zero if there is no operand vector for this tuple structure. */
726 extern size_t const gimple_ops_offset_[];
728 /* Map GIMPLE codes to GSS codes. */
729 extern enum gimple_statement_structure_enum const gss_for_code_[];
731 /* This variable holds the currently expanded gimple statement for purposes
732 of comminucating the profile info to the builtin expanders. */
733 extern gimple currently_expanding_gimple_stmt;
735 gimple gimple_build_return (tree);
737 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
738 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
740 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
742 gimple
743 gimple_build_assign_with_ops (enum tree_code, tree,
744 tree, tree CXX_MEM_STAT_INFO);
745 gimple
746 gimple_build_assign_with_ops (enum tree_code, tree,
747 tree, tree, tree CXX_MEM_STAT_INFO);
749 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
750 #define gimple_build_debug_bind(var,val,stmt) \
751 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
752 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
753 #define gimple_build_debug_source_bind(var,val,stmt) \
754 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
756 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
757 gimple gimple_build_call (tree, unsigned, ...);
758 gimple gimple_build_call_valist (tree, unsigned, va_list);
759 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
760 gimple gimple_build_call_internal_vec (enum internal_fn, VEC(tree, heap) *);
761 gimple gimple_build_call_from_tree (tree);
762 gimple gimplify_assign (tree, tree, gimple_seq *);
763 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
764 gimple gimple_build_label (tree label);
765 gimple gimple_build_goto (tree dest);
766 gimple gimple_build_nop (void);
767 gimple gimple_build_bind (tree, gimple_seq, tree);
768 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
769 VEC(tree,gc) *, VEC(tree,gc) *);
770 gimple gimple_build_catch (tree, gimple_seq);
771 gimple gimple_build_eh_filter (tree, gimple_seq);
772 gimple gimple_build_eh_must_not_throw (tree);
773 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
774 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
775 gimple gimple_build_wce (gimple_seq);
776 gimple gimple_build_resx (int);
777 gimple gimple_build_eh_dispatch (int);
778 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
779 gimple gimple_build_switch (tree, tree, VEC(tree,heap) *);
780 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
781 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
782 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
783 gimple gimple_build_omp_critical (gimple_seq, tree);
784 gimple gimple_build_omp_section (gimple_seq);
785 gimple gimple_build_omp_continue (tree, tree);
786 gimple gimple_build_omp_master (gimple_seq);
787 gimple gimple_build_omp_return (bool);
788 gimple gimple_build_omp_ordered (gimple_seq);
789 gimple gimple_build_omp_sections (gimple_seq, tree);
790 gimple gimple_build_omp_sections_switch (void);
791 gimple gimple_build_omp_single (gimple_seq, tree);
792 gimple gimple_build_cdt (tree, tree);
793 gimple gimple_build_omp_atomic_load (tree, tree);
794 gimple gimple_build_omp_atomic_store (tree);
795 gimple gimple_build_transaction (gimple_seq, tree);
796 gimple gimple_build_predict (enum br_predictor, enum prediction);
797 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
798 void sort_case_labels (VEC(tree,heap) *);
799 void preprocess_case_label_vec_for_gimple (VEC(tree,heap) *, tree, tree *);
800 void gimple_set_body (tree, gimple_seq);
801 gimple_seq gimple_body (tree);
802 bool gimple_has_body_p (tree);
803 gimple_seq gimple_seq_alloc (void);
804 void gimple_seq_free (gimple_seq);
805 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
806 gimple_seq gimple_seq_copy (gimple_seq);
807 bool gimple_call_same_target_p (const_gimple, const_gimple);
808 int gimple_call_flags (const_gimple);
809 int gimple_call_return_flags (const_gimple);
810 int gimple_call_arg_flags (const_gimple, unsigned);
811 void gimple_call_reset_alias_info (gimple);
812 bool gimple_assign_copy_p (gimple);
813 bool gimple_assign_ssa_name_copy_p (gimple);
814 bool gimple_assign_unary_nop_p (gimple);
815 void gimple_set_bb (gimple, basic_block);
816 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
817 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
818 tree, tree, tree);
819 tree gimple_get_lhs (const_gimple);
820 void gimple_set_lhs (gimple, tree);
821 void gimple_replace_lhs (gimple, tree);
822 gimple gimple_copy (gimple);
823 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
824 gimple gimple_build_cond_from_tree (tree, tree, tree);
825 void gimple_cond_set_condition_from_tree (gimple, tree);
826 bool gimple_has_side_effects (const_gimple);
827 bool gimple_could_trap_p (gimple);
828 bool gimple_could_trap_p_1 (gimple, bool, bool);
829 bool gimple_assign_rhs_could_trap_p (gimple);
830 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
831 bool empty_body_p (gimple_seq);
832 unsigned get_gimple_rhs_num_ops (enum tree_code);
833 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
834 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
835 const char *gimple_decl_printable_name (tree, int);
836 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
837 tree gimple_extract_devirt_binfo_from_cst (tree);
839 /* Returns true iff T is a scalar register variable. */
840 extern bool is_gimple_reg (tree);
841 /* Returns true iff T is any sort of variable. */
842 extern bool is_gimple_variable (tree);
843 /* Returns true iff T is any sort of symbol. */
844 extern bool is_gimple_id (tree);
845 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
846 extern bool is_gimple_min_lval (tree);
847 /* Returns true iff T is something whose address can be taken. */
848 extern bool is_gimple_addressable (tree);
849 /* Returns true iff T is any valid GIMPLE lvalue. */
850 extern bool is_gimple_lvalue (tree);
852 /* Returns true iff T is a GIMPLE address. */
853 bool is_gimple_address (const_tree);
854 /* Returns true iff T is a GIMPLE invariant address. */
855 bool is_gimple_invariant_address (const_tree);
856 /* Returns true iff T is a GIMPLE invariant address at interprocedural
857 level. */
858 bool is_gimple_ip_invariant_address (const_tree);
859 /* Returns true iff T is a valid GIMPLE constant. */
860 bool is_gimple_constant (const_tree);
861 /* Returns true iff T is a GIMPLE restricted function invariant. */
862 extern bool is_gimple_min_invariant (const_tree);
863 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
864 extern bool is_gimple_ip_invariant (const_tree);
865 /* Returns true iff T is a GIMPLE rvalue. */
866 extern bool is_gimple_val (tree);
867 /* Returns true iff T is a GIMPLE asm statement input. */
868 extern bool is_gimple_asm_val (tree);
869 /* Returns true iff T is a valid address operand of a MEM_REF. */
870 bool is_gimple_mem_ref_addr (tree);
872 /* Returns true iff T is a valid if-statement condition. */
873 extern bool is_gimple_condexpr (tree);
875 /* Returns true iff T is a valid call address expression. */
876 extern bool is_gimple_call_addr (tree);
878 extern void recalculate_side_effects (tree);
879 extern bool gimple_compare_field_offset (tree, tree);
880 extern tree gimple_register_canonical_type (tree);
881 extern void print_gimple_types_stats (const char *);
882 extern void free_gimple_type_tables (void);
883 extern tree gimple_unsigned_type (tree);
884 extern tree gimple_signed_type (tree);
885 extern alias_set_type gimple_get_alias_set (tree);
886 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
887 unsigned *);
888 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
889 bool (*)(gimple, tree, void *),
890 bool (*)(gimple, tree, void *),
891 bool (*)(gimple, tree, void *));
892 extern bool walk_stmt_load_store_ops (gimple, void *,
893 bool (*)(gimple, tree, void *),
894 bool (*)(gimple, tree, void *));
895 extern bool gimple_ior_addresses_taken (bitmap, gimple);
896 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
897 extern bool gimple_asm_clobbers_memory_p (const_gimple);
899 /* In gimplify.c */
900 extern tree create_tmp_var_raw (tree, const char *);
901 extern tree create_tmp_var_name (const char *);
902 extern tree create_tmp_var (tree, const char *);
903 extern tree create_tmp_reg (tree, const char *);
904 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
905 extern tree get_formal_tmp_var (tree, gimple_seq *);
906 extern void declare_vars (tree, gimple, bool);
907 extern void annotate_all_with_location (gimple_seq, location_t);
909 /* Validation of GIMPLE expressions. Note that these predicates only check
910 the basic form of the expression, they don't recurse to make sure that
911 underlying nodes are also of the right form. */
912 typedef bool (*gimple_predicate)(tree);
915 /* FIXME we should deduce this from the predicate. */
916 enum fallback {
917 fb_none = 0, /* Do not generate a temporary. */
919 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
920 gimplified expression. */
922 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
923 gimplified expression. */
925 fb_mayfail = 4, /* Gimplification may fail. Error issued
926 afterwards. */
927 fb_either= fb_rvalue | fb_lvalue
930 typedef int fallback_t;
932 enum gimplify_status {
933 GS_ERROR = -2, /* Something Bad Seen. */
934 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
935 GS_OK = 0, /* We did something, maybe more to do. */
936 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
939 struct gimplify_ctx
941 struct gimplify_ctx *prev_context;
943 VEC(gimple,heap) *bind_expr_stack;
944 tree temps;
945 gimple_seq conditional_cleanups;
946 tree exit_label;
947 tree return_temp;
949 VEC(tree,heap) *case_labels;
950 /* The formal temporary table. Should this be persistent? */
951 htab_t temp_htab;
953 int conditions;
954 bool save_stack;
955 bool into_ssa;
956 bool allow_rhs_cond_expr;
957 bool in_cleanup_point_expr;
960 /* Return true if gimplify_one_sizepos doesn't need to gimplify
961 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
962 fields). */
963 static inline bool
964 is_gimple_sizepos (tree expr)
966 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
967 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
968 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
969 function, the gimplifier will want to replace it with a new variable,
970 but that will cause problems if this type is from outside the function.
971 It's OK to have that here. */
972 return (expr == NULL_TREE
973 || TREE_CONSTANT (expr)
974 || TREE_CODE (expr) == VAR_DECL
975 || CONTAINS_PLACEHOLDER_P (expr));
978 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
979 bool (*) (tree), fallback_t);
980 extern void gimplify_type_sizes (tree, gimple_seq *);
981 extern void gimplify_one_sizepos (tree *, gimple_seq *);
982 extern bool gimplify_stmt (tree *, gimple_seq *);
983 extern gimple gimplify_body (tree, bool);
984 extern void push_gimplify_context (struct gimplify_ctx *);
985 extern void pop_gimplify_context (gimple);
986 extern void gimplify_and_add (tree, gimple_seq *);
988 /* Miscellaneous helpers. */
989 extern void gimple_add_tmp_var (tree);
990 extern gimple gimple_current_bind_expr (void);
991 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
992 extern tree voidify_wrapper_expr (tree, tree);
993 extern tree build_and_jump (tree *);
994 extern tree force_labels_r (tree *, int *, void *);
995 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
996 gimple_seq *);
997 struct gimplify_omp_ctx;
998 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
999 extern tree gimple_boolify (tree);
1000 extern gimple_predicate rhs_predicate_for (tree);
1001 extern tree canonicalize_cond_expr_cond (tree);
1003 /* In omp-low.c. */
1004 extern tree omp_reduction_init (tree, tree);
1006 /* In trans-mem.c. */
1007 extern void diagnose_tm_safe_errors (tree);
1008 extern void compute_transaction_bits (void);
1010 /* In tree-nested.c. */
1011 extern void lower_nested_functions (tree);
1012 extern void insert_field_into_struct (tree, tree);
1014 /* In gimplify.c. */
1015 extern void gimplify_function_tree (tree);
1017 /* In cfgexpand.c. */
1018 extern tree gimple_assign_rhs_to_tree (gimple);
1020 /* In builtins.c */
1021 extern bool validate_gimple_arglist (const_gimple, ...);
1023 /* In tree-ssa.c */
1024 extern bool tree_ssa_useless_type_conversion (tree);
1025 extern tree tree_ssa_strip_useless_type_conversions (tree);
1026 extern bool useless_type_conversion_p (tree, tree);
1027 extern bool types_compatible_p (tree, tree);
1029 /* Return the first node in GIMPLE sequence S. */
1031 static inline gimple_seq_node
1032 gimple_seq_first (gimple_seq s)
1034 return s;
1038 /* Return the first statement in GIMPLE sequence S. */
1040 static inline gimple
1041 gimple_seq_first_stmt (gimple_seq s)
1043 gimple_seq_node n = gimple_seq_first (s);
1044 return n;
1048 /* Return the last node in GIMPLE sequence S. */
1050 static inline gimple_seq_node
1051 gimple_seq_last (gimple_seq s)
1053 return s ? s->gsbase.prev : NULL;
1057 /* Return the last statement in GIMPLE sequence S. */
1059 static inline gimple
1060 gimple_seq_last_stmt (gimple_seq s)
1062 gimple_seq_node n = gimple_seq_last (s);
1063 return n;
1067 /* Set the last node in GIMPLE sequence *PS to LAST. */
1069 static inline void
1070 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1072 (*ps)->gsbase.prev = last;
1076 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1078 static inline void
1079 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1081 *ps = first;
1085 /* Return true if GIMPLE sequence S is empty. */
1087 static inline bool
1088 gimple_seq_empty_p (gimple_seq s)
1090 return s == NULL;
1094 void gimple_seq_add_stmt (gimple_seq *, gimple);
1096 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1097 *SEQ_P is NULL, a new sequence is allocated. This function is
1098 similar to gimple_seq_add_stmt, but does not scan the operands.
1099 During gimplification, we need to manipulate statement sequences
1100 before the def/use vectors have been constructed. */
1101 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1103 /* Allocate a new sequence and initialize its first element with STMT. */
1105 static inline gimple_seq
1106 gimple_seq_alloc_with_stmt (gimple stmt)
1108 gimple_seq seq = NULL;
1109 gimple_seq_add_stmt (&seq, stmt);
1110 return seq;
1114 /* Returns the sequence of statements in BB. */
1116 static inline gimple_seq
1117 bb_seq (const_basic_block bb)
1119 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1122 static inline gimple_seq *
1123 bb_seq_addr (basic_block bb)
1125 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1128 /* Sets the sequence of statements in BB to SEQ. */
1130 static inline void
1131 set_bb_seq (basic_block bb, gimple_seq seq)
1133 gcc_checking_assert (!(bb->flags & BB_RTL));
1134 bb->il.gimple.seq = seq;
1138 /* Return the code for GIMPLE statement G. */
1140 static inline enum gimple_code
1141 gimple_code (const_gimple g)
1143 return g->gsbase.code;
1147 /* Return the GSS code used by a GIMPLE code. */
1149 static inline enum gimple_statement_structure_enum
1150 gss_for_code (enum gimple_code code)
1152 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1153 return gss_for_code_[code];
1157 /* Return which GSS code is used by GS. */
1159 static inline enum gimple_statement_structure_enum
1160 gimple_statement_structure (gimple gs)
1162 return gss_for_code (gimple_code (gs));
1166 /* Return true if statement G has sub-statements. This is only true for
1167 High GIMPLE statements. */
1169 static inline bool
1170 gimple_has_substatements (gimple g)
1172 switch (gimple_code (g))
1174 case GIMPLE_BIND:
1175 case GIMPLE_CATCH:
1176 case GIMPLE_EH_FILTER:
1177 case GIMPLE_EH_ELSE:
1178 case GIMPLE_TRY:
1179 case GIMPLE_OMP_FOR:
1180 case GIMPLE_OMP_MASTER:
1181 case GIMPLE_OMP_ORDERED:
1182 case GIMPLE_OMP_SECTION:
1183 case GIMPLE_OMP_PARALLEL:
1184 case GIMPLE_OMP_TASK:
1185 case GIMPLE_OMP_SECTIONS:
1186 case GIMPLE_OMP_SINGLE:
1187 case GIMPLE_OMP_CRITICAL:
1188 case GIMPLE_WITH_CLEANUP_EXPR:
1189 case GIMPLE_TRANSACTION:
1190 return true;
1192 default:
1193 return false;
1198 /* Return the basic block holding statement G. */
1200 static inline basic_block
1201 gimple_bb (const_gimple g)
1203 return g->gsbase.bb;
1207 /* Return the lexical scope block holding statement G. */
1209 static inline tree
1210 gimple_block (const_gimple g)
1212 return LOCATION_BLOCK (g->gsbase.location);
1216 /* Set BLOCK to be the lexical scope block holding statement G. */
1218 static inline void
1219 gimple_set_block (gimple g, tree block)
1221 if (block)
1222 g->gsbase.location =
1223 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1224 else
1225 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1229 /* Return location information for statement G. */
1231 static inline location_t
1232 gimple_location (const_gimple g)
1234 return g->gsbase.location;
1237 /* Return pointer to location information for statement G. */
1239 static inline const location_t *
1240 gimple_location_ptr (const_gimple g)
1242 return &g->gsbase.location;
1246 /* Set location information for statement G. */
1248 static inline void
1249 gimple_set_location (gimple g, location_t location)
1251 g->gsbase.location = location;
1255 /* Return true if G contains location information. */
1257 static inline bool
1258 gimple_has_location (const_gimple g)
1260 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1264 /* Return the file name of the location of STMT. */
1266 static inline const char *
1267 gimple_filename (const_gimple stmt)
1269 return LOCATION_FILE (gimple_location (stmt));
1273 /* Return the line number of the location of STMT. */
1275 static inline int
1276 gimple_lineno (const_gimple stmt)
1278 return LOCATION_LINE (gimple_location (stmt));
1282 /* Determine whether SEQ is a singleton. */
1284 static inline bool
1285 gimple_seq_singleton_p (gimple_seq seq)
1287 return ((gimple_seq_first (seq) != NULL)
1288 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1291 /* Return true if no warnings should be emitted for statement STMT. */
1293 static inline bool
1294 gimple_no_warning_p (const_gimple stmt)
1296 return stmt->gsbase.no_warning;
1299 /* Set the no_warning flag of STMT to NO_WARNING. */
1301 static inline void
1302 gimple_set_no_warning (gimple stmt, bool no_warning)
1304 stmt->gsbase.no_warning = (unsigned) no_warning;
1307 /* Set the visited status on statement STMT to VISITED_P. */
1309 static inline void
1310 gimple_set_visited (gimple stmt, bool visited_p)
1312 stmt->gsbase.visited = (unsigned) visited_p;
1316 /* Return the visited status for statement STMT. */
1318 static inline bool
1319 gimple_visited_p (gimple stmt)
1321 return stmt->gsbase.visited;
1325 /* Set pass local flag PLF on statement STMT to VAL_P. */
1327 static inline void
1328 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1330 if (val_p)
1331 stmt->gsbase.plf |= (unsigned int) plf;
1332 else
1333 stmt->gsbase.plf &= ~((unsigned int) plf);
1337 /* Return the value of pass local flag PLF on statement STMT. */
1339 static inline unsigned int
1340 gimple_plf (gimple stmt, enum plf_mask plf)
1342 return stmt->gsbase.plf & ((unsigned int) plf);
1346 /* Set the UID of statement. */
1348 static inline void
1349 gimple_set_uid (gimple g, unsigned uid)
1351 g->gsbase.uid = uid;
1355 /* Return the UID of statement. */
1357 static inline unsigned
1358 gimple_uid (const_gimple g)
1360 return g->gsbase.uid;
1364 /* Make statement G a singleton sequence. */
1366 static inline void
1367 gimple_init_singleton (gimple g)
1369 g->gsbase.next = NULL;
1370 g->gsbase.prev = g;
1374 /* Return true if GIMPLE statement G has register or memory operands. */
1376 static inline bool
1377 gimple_has_ops (const_gimple g)
1379 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1383 /* Return true if GIMPLE statement G has memory operands. */
1385 static inline bool
1386 gimple_has_mem_ops (const_gimple g)
1388 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1392 /* Return the set of USE operands for statement G. */
1394 static inline struct use_optype_d *
1395 gimple_use_ops (const_gimple g)
1397 if (!gimple_has_ops (g))
1398 return NULL;
1399 return g->gsops.opbase.use_ops;
1403 /* Set USE to be the set of USE operands for statement G. */
1405 static inline void
1406 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1408 gcc_gimple_checking_assert (gimple_has_ops (g));
1409 g->gsops.opbase.use_ops = use;
1413 /* Return the set of VUSE operand for statement G. */
1415 static inline use_operand_p
1416 gimple_vuse_op (const_gimple g)
1418 struct use_optype_d *ops;
1419 if (!gimple_has_mem_ops (g))
1420 return NULL_USE_OPERAND_P;
1421 ops = g->gsops.opbase.use_ops;
1422 if (ops
1423 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1424 return USE_OP_PTR (ops);
1425 return NULL_USE_OPERAND_P;
1428 /* Return the set of VDEF operand for statement G. */
1430 static inline def_operand_p
1431 gimple_vdef_op (gimple g)
1433 if (!gimple_has_mem_ops (g))
1434 return NULL_DEF_OPERAND_P;
1435 if (g->gsmembase.vdef)
1436 return &g->gsmembase.vdef;
1437 return NULL_DEF_OPERAND_P;
1441 /* Return the single VUSE operand of the statement G. */
1443 static inline tree
1444 gimple_vuse (const_gimple g)
1446 if (!gimple_has_mem_ops (g))
1447 return NULL_TREE;
1448 return g->gsmembase.vuse;
1451 /* Return the single VDEF operand of the statement G. */
1453 static inline tree
1454 gimple_vdef (const_gimple g)
1456 if (!gimple_has_mem_ops (g))
1457 return NULL_TREE;
1458 return g->gsmembase.vdef;
1461 /* Return the single VUSE operand of the statement G. */
1463 static inline tree *
1464 gimple_vuse_ptr (gimple g)
1466 if (!gimple_has_mem_ops (g))
1467 return NULL;
1468 return &g->gsmembase.vuse;
1471 /* Return the single VDEF operand of the statement G. */
1473 static inline tree *
1474 gimple_vdef_ptr (gimple g)
1476 if (!gimple_has_mem_ops (g))
1477 return NULL;
1478 return &g->gsmembase.vdef;
1481 /* Set the single VUSE operand of the statement G. */
1483 static inline void
1484 gimple_set_vuse (gimple g, tree vuse)
1486 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1487 g->gsmembase.vuse = vuse;
1490 /* Set the single VDEF operand of the statement G. */
1492 static inline void
1493 gimple_set_vdef (gimple g, tree vdef)
1495 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1496 g->gsmembase.vdef = vdef;
1500 /* Return true if statement G has operands and the modified field has
1501 been set. */
1503 static inline bool
1504 gimple_modified_p (const_gimple g)
1506 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1510 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1511 a MODIFIED field. */
1513 static inline void
1514 gimple_set_modified (gimple s, bool modifiedp)
1516 if (gimple_has_ops (s))
1517 s->gsbase.modified = (unsigned) modifiedp;
1521 /* Return the tree code for the expression computed by STMT. This is
1522 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1523 GIMPLE_CALL, return CALL_EXPR as the expression code for
1524 consistency. This is useful when the caller needs to deal with the
1525 three kinds of computation that GIMPLE supports. */
1527 static inline enum tree_code
1528 gimple_expr_code (const_gimple stmt)
1530 enum gimple_code code = gimple_code (stmt);
1531 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1532 return (enum tree_code) stmt->gsbase.subcode;
1533 else
1535 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1536 return CALL_EXPR;
1541 /* Mark statement S as modified, and update it. */
1543 static inline void
1544 update_stmt (gimple s)
1546 if (gimple_has_ops (s))
1548 gimple_set_modified (s, true);
1549 update_stmt_operands (s);
1553 /* Update statement S if it has been optimized. */
1555 static inline void
1556 update_stmt_if_modified (gimple s)
1558 if (gimple_modified_p (s))
1559 update_stmt_operands (s);
1562 /* Return true if statement STMT contains volatile operands. */
1564 static inline bool
1565 gimple_has_volatile_ops (const_gimple stmt)
1567 if (gimple_has_mem_ops (stmt))
1568 return stmt->gsbase.has_volatile_ops;
1569 else
1570 return false;
1574 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1576 static inline void
1577 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1579 if (gimple_has_mem_ops (stmt))
1580 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1583 /* Return true if BB is in a transaction. */
1585 static inline bool
1586 block_in_transaction (basic_block bb)
1588 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1591 /* Return true if STMT is in a transaction. */
1593 static inline bool
1594 gimple_in_transaction (gimple stmt)
1596 return block_in_transaction (gimple_bb (stmt));
1599 /* Return true if statement STMT may access memory. */
1601 static inline bool
1602 gimple_references_memory_p (gimple stmt)
1604 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1608 /* Return the subcode for OMP statement S. */
1610 static inline unsigned
1611 gimple_omp_subcode (const_gimple s)
1613 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1614 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1615 return s->gsbase.subcode;
1618 /* Set the subcode for OMP statement S to SUBCODE. */
1620 static inline void
1621 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1623 /* We only have 16 bits for the subcode. Assert that we are not
1624 overflowing it. */
1625 gcc_gimple_checking_assert (subcode < (1 << 16));
1626 s->gsbase.subcode = subcode;
1629 /* Set the nowait flag on OMP_RETURN statement S. */
1631 static inline void
1632 gimple_omp_return_set_nowait (gimple s)
1634 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1635 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1639 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1640 flag set. */
1642 static inline bool
1643 gimple_omp_return_nowait_p (const_gimple g)
1645 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1646 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1650 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1651 flag set. */
1653 static inline bool
1654 gimple_omp_section_last_p (const_gimple g)
1656 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1657 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1661 /* Set the GF_OMP_SECTION_LAST flag on G. */
1663 static inline void
1664 gimple_omp_section_set_last (gimple g)
1666 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1667 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1671 /* Return true if OMP parallel statement G has the
1672 GF_OMP_PARALLEL_COMBINED flag set. */
1674 static inline bool
1675 gimple_omp_parallel_combined_p (const_gimple g)
1677 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1678 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1682 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1683 value of COMBINED_P. */
1685 static inline void
1686 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1688 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1689 if (combined_p)
1690 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1691 else
1692 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1696 /* Return true if OMP atomic load/store statement G has the
1697 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1699 static inline bool
1700 gimple_omp_atomic_need_value_p (const_gimple g)
1702 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1703 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1704 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1708 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1710 static inline void
1711 gimple_omp_atomic_set_need_value (gimple g)
1713 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1714 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1715 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1719 /* Return the number of operands for statement GS. */
1721 static inline unsigned
1722 gimple_num_ops (const_gimple gs)
1724 return gs->gsbase.num_ops;
1728 /* Set the number of operands for statement GS. */
1730 static inline void
1731 gimple_set_num_ops (gimple gs, unsigned num_ops)
1733 gs->gsbase.num_ops = num_ops;
1737 /* Return the array of operands for statement GS. */
1739 static inline tree *
1740 gimple_ops (gimple gs)
1742 size_t off;
1744 /* All the tuples have their operand vector at the very bottom
1745 of the structure. Note that those structures that do not
1746 have an operand vector have a zero offset. */
1747 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1748 gcc_gimple_checking_assert (off != 0);
1750 return (tree *) ((char *) gs + off);
1754 /* Return operand I for statement GS. */
1756 static inline tree
1757 gimple_op (const_gimple gs, unsigned i)
1759 if (gimple_has_ops (gs))
1761 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1762 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1764 else
1765 return NULL_TREE;
1768 /* Return a pointer to operand I for statement GS. */
1770 static inline tree *
1771 gimple_op_ptr (const_gimple gs, unsigned i)
1773 if (gimple_has_ops (gs))
1775 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1776 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1778 else
1779 return NULL;
1782 /* Set operand I of statement GS to OP. */
1784 static inline void
1785 gimple_set_op (gimple gs, unsigned i, tree op)
1787 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1789 /* Note. It may be tempting to assert that OP matches
1790 is_gimple_operand, but that would be wrong. Different tuples
1791 accept slightly different sets of tree operands. Each caller
1792 should perform its own validation. */
1793 gimple_ops (gs)[i] = op;
1796 /* Return true if GS is a GIMPLE_ASSIGN. */
1798 static inline bool
1799 is_gimple_assign (const_gimple gs)
1801 return gimple_code (gs) == GIMPLE_ASSIGN;
1804 /* Determine if expression CODE is one of the valid expressions that can
1805 be used on the RHS of GIMPLE assignments. */
1807 static inline enum gimple_rhs_class
1808 get_gimple_rhs_class (enum tree_code code)
1810 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1813 /* Return the LHS of assignment statement GS. */
1815 static inline tree
1816 gimple_assign_lhs (const_gimple gs)
1818 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1819 return gimple_op (gs, 0);
1823 /* Return a pointer to the LHS of assignment statement GS. */
1825 static inline tree *
1826 gimple_assign_lhs_ptr (const_gimple gs)
1828 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1829 return gimple_op_ptr (gs, 0);
1833 /* Set LHS to be the LHS operand of assignment statement GS. */
1835 static inline void
1836 gimple_assign_set_lhs (gimple gs, tree lhs)
1838 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1839 gimple_set_op (gs, 0, lhs);
1841 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1842 SSA_NAME_DEF_STMT (lhs) = gs;
1846 /* Return the first operand on the RHS of assignment statement GS. */
1848 static inline tree
1849 gimple_assign_rhs1 (const_gimple gs)
1851 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1852 return gimple_op (gs, 1);
1856 /* Return a pointer to the first operand on the RHS of assignment
1857 statement GS. */
1859 static inline tree *
1860 gimple_assign_rhs1_ptr (const_gimple gs)
1862 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1863 return gimple_op_ptr (gs, 1);
1866 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1868 static inline void
1869 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1871 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1873 gimple_set_op (gs, 1, rhs);
1877 /* Return the second operand on the RHS of assignment statement GS.
1878 If GS does not have two operands, NULL is returned instead. */
1880 static inline tree
1881 gimple_assign_rhs2 (const_gimple gs)
1883 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1885 if (gimple_num_ops (gs) >= 3)
1886 return gimple_op (gs, 2);
1887 else
1888 return NULL_TREE;
1892 /* Return a pointer to the second operand on the RHS of assignment
1893 statement GS. */
1895 static inline tree *
1896 gimple_assign_rhs2_ptr (const_gimple gs)
1898 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1899 return gimple_op_ptr (gs, 2);
1903 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1905 static inline void
1906 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1908 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1910 gimple_set_op (gs, 2, rhs);
1913 /* Return the third operand on the RHS of assignment statement GS.
1914 If GS does not have two operands, NULL is returned instead. */
1916 static inline tree
1917 gimple_assign_rhs3 (const_gimple gs)
1919 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1921 if (gimple_num_ops (gs) >= 4)
1922 return gimple_op (gs, 3);
1923 else
1924 return NULL_TREE;
1927 /* Return a pointer to the third operand on the RHS of assignment
1928 statement GS. */
1930 static inline tree *
1931 gimple_assign_rhs3_ptr (const_gimple gs)
1933 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1934 return gimple_op_ptr (gs, 3);
1938 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1940 static inline void
1941 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1943 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1945 gimple_set_op (gs, 3, rhs);
1948 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1949 to see only a maximum of two operands. */
1951 static inline void
1952 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1953 tree op1, tree op2)
1955 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1958 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1959 to see only a maximum of two operands. */
1961 static inline void
1962 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1963 tree *op1)
1965 tree op2;
1966 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1967 gcc_assert (op2 == NULL_TREE);
1970 /* Returns true if GS is a nontemporal move. */
1972 static inline bool
1973 gimple_assign_nontemporal_move_p (const_gimple gs)
1975 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1976 return gs->gsbase.nontemporal_move;
1979 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1981 static inline void
1982 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1984 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1985 gs->gsbase.nontemporal_move = nontemporal;
1989 /* Return the code of the expression computed on the rhs of assignment
1990 statement GS. In case that the RHS is a single object, returns the
1991 tree code of the object. */
1993 static inline enum tree_code
1994 gimple_assign_rhs_code (const_gimple gs)
1996 enum tree_code code;
1997 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1999 code = (enum tree_code) gs->gsbase.subcode;
2000 /* While we initially set subcode to the TREE_CODE of the rhs for
2001 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2002 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2003 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2004 code = TREE_CODE (gimple_assign_rhs1 (gs));
2006 return code;
2010 /* Set CODE to be the code for the expression computed on the RHS of
2011 assignment S. */
2013 static inline void
2014 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2016 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2017 s->gsbase.subcode = code;
2021 /* Return the gimple rhs class of the code of the expression computed on
2022 the rhs of assignment statement GS.
2023 This will never return GIMPLE_INVALID_RHS. */
2025 static inline enum gimple_rhs_class
2026 gimple_assign_rhs_class (const_gimple gs)
2028 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2031 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2032 there is no operator associated with the assignment itself.
2033 Unlike gimple_assign_copy_p, this predicate returns true for
2034 any RHS operand, including those that perform an operation
2035 and do not have the semantics of a copy, such as COND_EXPR. */
2037 static inline bool
2038 gimple_assign_single_p (gimple gs)
2040 return (is_gimple_assign (gs)
2041 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2045 /* Return true if S is a type-cast assignment. */
2047 static inline bool
2048 gimple_assign_cast_p (gimple s)
2050 if (is_gimple_assign (s))
2052 enum tree_code sc = gimple_assign_rhs_code (s);
2053 return CONVERT_EXPR_CODE_P (sc)
2054 || sc == VIEW_CONVERT_EXPR
2055 || sc == FIX_TRUNC_EXPR;
2058 return false;
2061 /* Return true if S is a clobber statement. */
2063 static inline bool
2064 gimple_clobber_p (gimple s)
2066 return gimple_assign_single_p (s)
2067 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2070 /* Return true if GS is a GIMPLE_CALL. */
2072 static inline bool
2073 is_gimple_call (const_gimple gs)
2075 return gimple_code (gs) == GIMPLE_CALL;
2078 /* Return the LHS of call statement GS. */
2080 static inline tree
2081 gimple_call_lhs (const_gimple gs)
2083 GIMPLE_CHECK (gs, GIMPLE_CALL);
2084 return gimple_op (gs, 0);
2088 /* Return a pointer to the LHS of call statement GS. */
2090 static inline tree *
2091 gimple_call_lhs_ptr (const_gimple gs)
2093 GIMPLE_CHECK (gs, GIMPLE_CALL);
2094 return gimple_op_ptr (gs, 0);
2098 /* Set LHS to be the LHS operand of call statement GS. */
2100 static inline void
2101 gimple_call_set_lhs (gimple gs, tree lhs)
2103 GIMPLE_CHECK (gs, GIMPLE_CALL);
2104 gimple_set_op (gs, 0, lhs);
2105 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2106 SSA_NAME_DEF_STMT (lhs) = gs;
2110 /* Return true if call GS calls an internal-only function, as enumerated
2111 by internal_fn. */
2113 static inline bool
2114 gimple_call_internal_p (const_gimple gs)
2116 GIMPLE_CHECK (gs, GIMPLE_CALL);
2117 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2121 /* Return the target of internal call GS. */
2123 static inline enum internal_fn
2124 gimple_call_internal_fn (const_gimple gs)
2126 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2127 return gs->gimple_call.u.internal_fn;
2131 /* Return the function type of the function called by GS. */
2133 static inline tree
2134 gimple_call_fntype (const_gimple gs)
2136 GIMPLE_CHECK (gs, GIMPLE_CALL);
2137 if (gimple_call_internal_p (gs))
2138 return NULL_TREE;
2139 return gs->gimple_call.u.fntype;
2142 /* Set the type of the function called by GS to FNTYPE. */
2144 static inline void
2145 gimple_call_set_fntype (gimple gs, tree fntype)
2147 GIMPLE_CHECK (gs, GIMPLE_CALL);
2148 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2149 gs->gimple_call.u.fntype = fntype;
2153 /* Return the tree node representing the function called by call
2154 statement GS. */
2156 static inline tree
2157 gimple_call_fn (const_gimple gs)
2159 GIMPLE_CHECK (gs, GIMPLE_CALL);
2160 return gimple_op (gs, 1);
2163 /* Return a pointer to the tree node representing the function called by call
2164 statement GS. */
2166 static inline tree *
2167 gimple_call_fn_ptr (const_gimple gs)
2169 GIMPLE_CHECK (gs, GIMPLE_CALL);
2170 return gimple_op_ptr (gs, 1);
2174 /* Set FN to be the function called by call statement GS. */
2176 static inline void
2177 gimple_call_set_fn (gimple gs, tree fn)
2179 GIMPLE_CHECK (gs, GIMPLE_CALL);
2180 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2181 gimple_set_op (gs, 1, fn);
2185 /* Set FNDECL to be the function called by call statement GS. */
2187 static inline void
2188 gimple_call_set_fndecl (gimple gs, tree decl)
2190 GIMPLE_CHECK (gs, GIMPLE_CALL);
2191 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2192 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2196 /* Set internal function FN to be the function called by call statement GS. */
2198 static inline void
2199 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2201 GIMPLE_CHECK (gs, GIMPLE_CALL);
2202 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2203 gs->gimple_call.u.internal_fn = fn;
2207 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2208 associated with the callee if known. Otherwise return NULL_TREE. */
2210 static inline tree
2211 gimple_call_addr_fndecl (const_tree fn)
2213 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2215 tree fndecl = TREE_OPERAND (fn, 0);
2216 if (TREE_CODE (fndecl) == MEM_REF
2217 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2218 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2219 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2220 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2221 return fndecl;
2223 return NULL_TREE;
2226 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2227 Otherwise return NULL. This function is analogous to
2228 get_callee_fndecl in tree land. */
2230 static inline tree
2231 gimple_call_fndecl (const_gimple gs)
2233 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2237 /* Return the type returned by call statement GS. */
2239 static inline tree
2240 gimple_call_return_type (const_gimple gs)
2242 tree type = gimple_call_fntype (gs);
2244 if (type == NULL_TREE)
2245 return TREE_TYPE (gimple_call_lhs (gs));
2247 /* The type returned by a function is the type of its
2248 function type. */
2249 return TREE_TYPE (type);
2253 /* Return the static chain for call statement GS. */
2255 static inline tree
2256 gimple_call_chain (const_gimple gs)
2258 GIMPLE_CHECK (gs, GIMPLE_CALL);
2259 return gimple_op (gs, 2);
2263 /* Return a pointer to the static chain for call statement GS. */
2265 static inline tree *
2266 gimple_call_chain_ptr (const_gimple gs)
2268 GIMPLE_CHECK (gs, GIMPLE_CALL);
2269 return gimple_op_ptr (gs, 2);
2272 /* Set CHAIN to be the static chain for call statement GS. */
2274 static inline void
2275 gimple_call_set_chain (gimple gs, tree chain)
2277 GIMPLE_CHECK (gs, GIMPLE_CALL);
2279 gimple_set_op (gs, 2, chain);
2283 /* Return the number of arguments used by call statement GS. */
2285 static inline unsigned
2286 gimple_call_num_args (const_gimple gs)
2288 unsigned num_ops;
2289 GIMPLE_CHECK (gs, GIMPLE_CALL);
2290 num_ops = gimple_num_ops (gs);
2291 return num_ops - 3;
2295 /* Return the argument at position INDEX for call statement GS. */
2297 static inline tree
2298 gimple_call_arg (const_gimple gs, unsigned index)
2300 GIMPLE_CHECK (gs, GIMPLE_CALL);
2301 return gimple_op (gs, index + 3);
2305 /* Return a pointer to the argument at position INDEX for call
2306 statement GS. */
2308 static inline tree *
2309 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2311 GIMPLE_CHECK (gs, GIMPLE_CALL);
2312 return gimple_op_ptr (gs, index + 3);
2316 /* Set ARG to be the argument at position INDEX for call statement GS. */
2318 static inline void
2319 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2321 GIMPLE_CHECK (gs, GIMPLE_CALL);
2322 gimple_set_op (gs, index + 3, arg);
2326 /* If TAIL_P is true, mark call statement S as being a tail call
2327 (i.e., a call just before the exit of a function). These calls are
2328 candidate for tail call optimization. */
2330 static inline void
2331 gimple_call_set_tail (gimple s, bool tail_p)
2333 GIMPLE_CHECK (s, GIMPLE_CALL);
2334 if (tail_p)
2335 s->gsbase.subcode |= GF_CALL_TAILCALL;
2336 else
2337 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2341 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2343 static inline bool
2344 gimple_call_tail_p (gimple s)
2346 GIMPLE_CHECK (s, GIMPLE_CALL);
2347 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2351 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2352 slot optimization. This transformation uses the target of the call
2353 expansion as the return slot for calls that return in memory. */
2355 static inline void
2356 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2358 GIMPLE_CHECK (s, GIMPLE_CALL);
2359 if (return_slot_opt_p)
2360 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2361 else
2362 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2366 /* Return true if S is marked for return slot optimization. */
2368 static inline bool
2369 gimple_call_return_slot_opt_p (gimple s)
2371 GIMPLE_CHECK (s, GIMPLE_CALL);
2372 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2376 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2377 thunk to the thunked-to function. */
2379 static inline void
2380 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2382 GIMPLE_CHECK (s, GIMPLE_CALL);
2383 if (from_thunk_p)
2384 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2385 else
2386 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2390 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2392 static inline bool
2393 gimple_call_from_thunk_p (gimple s)
2395 GIMPLE_CHECK (s, GIMPLE_CALL);
2396 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2400 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2401 argument pack in its argument list. */
2403 static inline void
2404 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2406 GIMPLE_CHECK (s, GIMPLE_CALL);
2407 if (pass_arg_pack_p)
2408 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2409 else
2410 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2414 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2415 argument pack in its argument list. */
2417 static inline bool
2418 gimple_call_va_arg_pack_p (gimple s)
2420 GIMPLE_CHECK (s, GIMPLE_CALL);
2421 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2425 /* Return true if S is a noreturn call. */
2427 static inline bool
2428 gimple_call_noreturn_p (gimple s)
2430 GIMPLE_CHECK (s, GIMPLE_CALL);
2431 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2435 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2436 even if the called function can throw in other cases. */
2438 static inline void
2439 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2441 GIMPLE_CHECK (s, GIMPLE_CALL);
2442 if (nothrow_p)
2443 s->gsbase.subcode |= GF_CALL_NOTHROW;
2444 else
2445 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2448 /* Return true if S is a nothrow call. */
2450 static inline bool
2451 gimple_call_nothrow_p (gimple s)
2453 GIMPLE_CHECK (s, GIMPLE_CALL);
2454 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2457 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2458 is known to be emitted for VLA objects. Those are wrapped by
2459 stack_save/stack_restore calls and hence can't lead to unbounded
2460 stack growth even when they occur in loops. */
2462 static inline void
2463 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2465 GIMPLE_CHECK (s, GIMPLE_CALL);
2466 if (for_var)
2467 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2468 else
2469 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2472 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2474 static inline bool
2475 gimple_call_alloca_for_var_p (gimple s)
2477 GIMPLE_CHECK (s, GIMPLE_CALL);
2478 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2481 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2483 static inline void
2484 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2486 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2487 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2488 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2492 /* Return a pointer to the points-to solution for the set of call-used
2493 variables of the call CALL. */
2495 static inline struct pt_solution *
2496 gimple_call_use_set (gimple call)
2498 GIMPLE_CHECK (call, GIMPLE_CALL);
2499 return &call->gimple_call.call_used;
2503 /* Return a pointer to the points-to solution for the set of call-used
2504 variables of the call CALL. */
2506 static inline struct pt_solution *
2507 gimple_call_clobber_set (gimple call)
2509 GIMPLE_CHECK (call, GIMPLE_CALL);
2510 return &call->gimple_call.call_clobbered;
2514 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2515 non-NULL lhs. */
2517 static inline bool
2518 gimple_has_lhs (gimple stmt)
2520 return (is_gimple_assign (stmt)
2521 || (is_gimple_call (stmt)
2522 && gimple_call_lhs (stmt) != NULL_TREE));
2526 /* Return the code of the predicate computed by conditional statement GS. */
2528 static inline enum tree_code
2529 gimple_cond_code (const_gimple gs)
2531 GIMPLE_CHECK (gs, GIMPLE_COND);
2532 return (enum tree_code) gs->gsbase.subcode;
2536 /* Set CODE to be the predicate code for the conditional statement GS. */
2538 static inline void
2539 gimple_cond_set_code (gimple gs, enum tree_code code)
2541 GIMPLE_CHECK (gs, GIMPLE_COND);
2542 gs->gsbase.subcode = code;
2546 /* Return the LHS of the predicate computed by conditional statement GS. */
2548 static inline tree
2549 gimple_cond_lhs (const_gimple gs)
2551 GIMPLE_CHECK (gs, GIMPLE_COND);
2552 return gimple_op (gs, 0);
2555 /* Return the pointer to the LHS of the predicate computed by conditional
2556 statement GS. */
2558 static inline tree *
2559 gimple_cond_lhs_ptr (const_gimple gs)
2561 GIMPLE_CHECK (gs, GIMPLE_COND);
2562 return gimple_op_ptr (gs, 0);
2565 /* Set LHS to be the LHS operand of the predicate computed by
2566 conditional statement GS. */
2568 static inline void
2569 gimple_cond_set_lhs (gimple gs, tree lhs)
2571 GIMPLE_CHECK (gs, GIMPLE_COND);
2572 gimple_set_op (gs, 0, lhs);
2576 /* Return the RHS operand of the predicate computed by conditional GS. */
2578 static inline tree
2579 gimple_cond_rhs (const_gimple gs)
2581 GIMPLE_CHECK (gs, GIMPLE_COND);
2582 return gimple_op (gs, 1);
2585 /* Return the pointer to the RHS operand of the predicate computed by
2586 conditional GS. */
2588 static inline tree *
2589 gimple_cond_rhs_ptr (const_gimple gs)
2591 GIMPLE_CHECK (gs, GIMPLE_COND);
2592 return gimple_op_ptr (gs, 1);
2596 /* Set RHS to be the RHS operand of the predicate computed by
2597 conditional statement GS. */
2599 static inline void
2600 gimple_cond_set_rhs (gimple gs, tree rhs)
2602 GIMPLE_CHECK (gs, GIMPLE_COND);
2603 gimple_set_op (gs, 1, rhs);
2607 /* Return the label used by conditional statement GS when its
2608 predicate evaluates to true. */
2610 static inline tree
2611 gimple_cond_true_label (const_gimple gs)
2613 GIMPLE_CHECK (gs, GIMPLE_COND);
2614 return gimple_op (gs, 2);
2618 /* Set LABEL to be the label used by conditional statement GS when its
2619 predicate evaluates to true. */
2621 static inline void
2622 gimple_cond_set_true_label (gimple gs, tree label)
2624 GIMPLE_CHECK (gs, GIMPLE_COND);
2625 gimple_set_op (gs, 2, label);
2629 /* Set LABEL to be the label used by conditional statement GS when its
2630 predicate evaluates to false. */
2632 static inline void
2633 gimple_cond_set_false_label (gimple gs, tree label)
2635 GIMPLE_CHECK (gs, GIMPLE_COND);
2636 gimple_set_op (gs, 3, label);
2640 /* Return the label used by conditional statement GS when its
2641 predicate evaluates to false. */
2643 static inline tree
2644 gimple_cond_false_label (const_gimple gs)
2646 GIMPLE_CHECK (gs, GIMPLE_COND);
2647 return gimple_op (gs, 3);
2651 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2653 static inline void
2654 gimple_cond_make_false (gimple gs)
2656 gimple_cond_set_lhs (gs, boolean_true_node);
2657 gimple_cond_set_rhs (gs, boolean_false_node);
2658 gs->gsbase.subcode = EQ_EXPR;
2662 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2664 static inline void
2665 gimple_cond_make_true (gimple gs)
2667 gimple_cond_set_lhs (gs, boolean_true_node);
2668 gimple_cond_set_rhs (gs, boolean_true_node);
2669 gs->gsbase.subcode = EQ_EXPR;
2672 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2673 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2675 static inline bool
2676 gimple_cond_true_p (const_gimple gs)
2678 tree lhs = gimple_cond_lhs (gs);
2679 tree rhs = gimple_cond_rhs (gs);
2680 enum tree_code code = gimple_cond_code (gs);
2682 if (lhs != boolean_true_node && lhs != boolean_false_node)
2683 return false;
2685 if (rhs != boolean_true_node && rhs != boolean_false_node)
2686 return false;
2688 if (code == NE_EXPR && lhs != rhs)
2689 return true;
2691 if (code == EQ_EXPR && lhs == rhs)
2692 return true;
2694 return false;
2697 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2698 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2700 static inline bool
2701 gimple_cond_false_p (const_gimple gs)
2703 tree lhs = gimple_cond_lhs (gs);
2704 tree rhs = gimple_cond_rhs (gs);
2705 enum tree_code code = gimple_cond_code (gs);
2707 if (lhs != boolean_true_node && lhs != boolean_false_node)
2708 return false;
2710 if (rhs != boolean_true_node && rhs != boolean_false_node)
2711 return false;
2713 if (code == NE_EXPR && lhs == rhs)
2714 return true;
2716 if (code == EQ_EXPR && lhs != rhs)
2717 return true;
2719 return false;
2722 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2723 'if (var == 1)' */
2725 static inline bool
2726 gimple_cond_single_var_p (gimple gs)
2728 if (gimple_cond_code (gs) == NE_EXPR
2729 && gimple_cond_rhs (gs) == boolean_false_node)
2730 return true;
2732 if (gimple_cond_code (gs) == EQ_EXPR
2733 && gimple_cond_rhs (gs) == boolean_true_node)
2734 return true;
2736 return false;
2739 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2741 static inline void
2742 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2744 gimple_cond_set_code (stmt, code);
2745 gimple_cond_set_lhs (stmt, lhs);
2746 gimple_cond_set_rhs (stmt, rhs);
2749 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2751 static inline tree
2752 gimple_label_label (const_gimple gs)
2754 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2755 return gimple_op (gs, 0);
2759 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2760 GS. */
2762 static inline void
2763 gimple_label_set_label (gimple gs, tree label)
2765 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2766 gimple_set_op (gs, 0, label);
2770 /* Return the destination of the unconditional jump GS. */
2772 static inline tree
2773 gimple_goto_dest (const_gimple gs)
2775 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2776 return gimple_op (gs, 0);
2780 /* Set DEST to be the destination of the unconditonal jump GS. */
2782 static inline void
2783 gimple_goto_set_dest (gimple gs, tree dest)
2785 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2786 gimple_set_op (gs, 0, dest);
2790 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2792 static inline tree
2793 gimple_bind_vars (const_gimple gs)
2795 GIMPLE_CHECK (gs, GIMPLE_BIND);
2796 return gs->gimple_bind.vars;
2800 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2801 statement GS. */
2803 static inline void
2804 gimple_bind_set_vars (gimple gs, tree vars)
2806 GIMPLE_CHECK (gs, GIMPLE_BIND);
2807 gs->gimple_bind.vars = vars;
2811 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2812 statement GS. */
2814 static inline void
2815 gimple_bind_append_vars (gimple gs, tree vars)
2817 GIMPLE_CHECK (gs, GIMPLE_BIND);
2818 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2822 static inline gimple_seq *
2823 gimple_bind_body_ptr (gimple gs)
2825 GIMPLE_CHECK (gs, GIMPLE_BIND);
2826 return &gs->gimple_bind.body;
2829 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2831 static inline gimple_seq
2832 gimple_bind_body (gimple gs)
2834 return *gimple_bind_body_ptr (gs);
2838 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2839 statement GS. */
2841 static inline void
2842 gimple_bind_set_body (gimple gs, gimple_seq seq)
2844 GIMPLE_CHECK (gs, GIMPLE_BIND);
2845 gs->gimple_bind.body = seq;
2849 /* Append a statement to the end of a GIMPLE_BIND's body. */
2851 static inline void
2852 gimple_bind_add_stmt (gimple gs, gimple stmt)
2854 GIMPLE_CHECK (gs, GIMPLE_BIND);
2855 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2859 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2861 static inline void
2862 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2864 GIMPLE_CHECK (gs, GIMPLE_BIND);
2865 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2869 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2870 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2872 static inline tree
2873 gimple_bind_block (const_gimple gs)
2875 GIMPLE_CHECK (gs, GIMPLE_BIND);
2876 return gs->gimple_bind.block;
2880 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2881 statement GS. */
2883 static inline void
2884 gimple_bind_set_block (gimple gs, tree block)
2886 GIMPLE_CHECK (gs, GIMPLE_BIND);
2887 gcc_gimple_checking_assert (block == NULL_TREE
2888 || TREE_CODE (block) == BLOCK);
2889 gs->gimple_bind.block = block;
2893 /* Return the number of input operands for GIMPLE_ASM GS. */
2895 static inline unsigned
2896 gimple_asm_ninputs (const_gimple gs)
2898 GIMPLE_CHECK (gs, GIMPLE_ASM);
2899 return gs->gimple_asm.ni;
2903 /* Return the number of output operands for GIMPLE_ASM GS. */
2905 static inline unsigned
2906 gimple_asm_noutputs (const_gimple gs)
2908 GIMPLE_CHECK (gs, GIMPLE_ASM);
2909 return gs->gimple_asm.no;
2913 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2915 static inline unsigned
2916 gimple_asm_nclobbers (const_gimple gs)
2918 GIMPLE_CHECK (gs, GIMPLE_ASM);
2919 return gs->gimple_asm.nc;
2922 /* Return the number of label operands for GIMPLE_ASM GS. */
2924 static inline unsigned
2925 gimple_asm_nlabels (const_gimple gs)
2927 GIMPLE_CHECK (gs, GIMPLE_ASM);
2928 return gs->gimple_asm.nl;
2931 /* Return input operand INDEX of GIMPLE_ASM GS. */
2933 static inline tree
2934 gimple_asm_input_op (const_gimple gs, unsigned index)
2936 GIMPLE_CHECK (gs, GIMPLE_ASM);
2937 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2938 return gimple_op (gs, index + gs->gimple_asm.no);
2941 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2943 static inline tree *
2944 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2946 GIMPLE_CHECK (gs, GIMPLE_ASM);
2947 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2948 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
2952 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2954 static inline void
2955 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2957 GIMPLE_CHECK (gs, GIMPLE_ASM);
2958 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
2959 && TREE_CODE (in_op) == TREE_LIST);
2960 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
2964 /* Return output operand INDEX of GIMPLE_ASM GS. */
2966 static inline tree
2967 gimple_asm_output_op (const_gimple gs, unsigned index)
2969 GIMPLE_CHECK (gs, GIMPLE_ASM);
2970 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
2971 return gimple_op (gs, index);
2974 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2976 static inline tree *
2977 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2979 GIMPLE_CHECK (gs, GIMPLE_ASM);
2980 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
2981 return gimple_op_ptr (gs, index);
2985 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2987 static inline void
2988 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2990 GIMPLE_CHECK (gs, GIMPLE_ASM);
2991 gcc_gimple_checking_assert (index < gs->gimple_asm.no
2992 && TREE_CODE (out_op) == TREE_LIST);
2993 gimple_set_op (gs, index, out_op);
2997 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2999 static inline tree
3000 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3002 GIMPLE_CHECK (gs, GIMPLE_ASM);
3003 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3004 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3008 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3010 static inline void
3011 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3013 GIMPLE_CHECK (gs, GIMPLE_ASM);
3014 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3015 && TREE_CODE (clobber_op) == TREE_LIST);
3016 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3019 /* Return label operand INDEX of GIMPLE_ASM GS. */
3021 static inline tree
3022 gimple_asm_label_op (const_gimple gs, unsigned index)
3024 GIMPLE_CHECK (gs, GIMPLE_ASM);
3025 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3026 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3029 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3031 static inline void
3032 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3034 GIMPLE_CHECK (gs, GIMPLE_ASM);
3035 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3036 && TREE_CODE (label_op) == TREE_LIST);
3037 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3040 /* Return the string representing the assembly instruction in
3041 GIMPLE_ASM GS. */
3043 static inline const char *
3044 gimple_asm_string (const_gimple gs)
3046 GIMPLE_CHECK (gs, GIMPLE_ASM);
3047 return gs->gimple_asm.string;
3051 /* Return true if GS is an asm statement marked volatile. */
3053 static inline bool
3054 gimple_asm_volatile_p (const_gimple gs)
3056 GIMPLE_CHECK (gs, GIMPLE_ASM);
3057 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3061 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3063 static inline void
3064 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3066 GIMPLE_CHECK (gs, GIMPLE_ASM);
3067 if (volatile_p)
3068 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3069 else
3070 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3074 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3076 static inline void
3077 gimple_asm_set_input (gimple gs, bool input_p)
3079 GIMPLE_CHECK (gs, GIMPLE_ASM);
3080 if (input_p)
3081 gs->gsbase.subcode |= GF_ASM_INPUT;
3082 else
3083 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3087 /* Return true if asm GS is an ASM_INPUT. */
3089 static inline bool
3090 gimple_asm_input_p (const_gimple gs)
3092 GIMPLE_CHECK (gs, GIMPLE_ASM);
3093 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3097 /* Return the types handled by GIMPLE_CATCH statement GS. */
3099 static inline tree
3100 gimple_catch_types (const_gimple gs)
3102 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3103 return gs->gimple_catch.types;
3107 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3109 static inline tree *
3110 gimple_catch_types_ptr (gimple gs)
3112 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3113 return &gs->gimple_catch.types;
3117 /* Return a pointer to the GIMPLE sequence representing the body of
3118 the handler of GIMPLE_CATCH statement GS. */
3120 static inline gimple_seq *
3121 gimple_catch_handler_ptr (gimple gs)
3123 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3124 return &gs->gimple_catch.handler;
3128 /* Return the GIMPLE sequence representing the body of the handler of
3129 GIMPLE_CATCH statement GS. */
3131 static inline gimple_seq
3132 gimple_catch_handler (gimple gs)
3134 return *gimple_catch_handler_ptr (gs);
3138 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3140 static inline void
3141 gimple_catch_set_types (gimple gs, tree t)
3143 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3144 gs->gimple_catch.types = t;
3148 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3150 static inline void
3151 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3153 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3154 gs->gimple_catch.handler = handler;
3158 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3160 static inline tree
3161 gimple_eh_filter_types (const_gimple gs)
3163 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3164 return gs->gimple_eh_filter.types;
3168 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3169 GS. */
3171 static inline tree *
3172 gimple_eh_filter_types_ptr (gimple gs)
3174 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3175 return &gs->gimple_eh_filter.types;
3179 /* Return a pointer to the sequence of statement to execute when
3180 GIMPLE_EH_FILTER statement fails. */
3182 static inline gimple_seq *
3183 gimple_eh_filter_failure_ptr (gimple gs)
3185 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3186 return &gs->gimple_eh_filter.failure;
3190 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3191 statement fails. */
3193 static inline gimple_seq
3194 gimple_eh_filter_failure (gimple gs)
3196 return *gimple_eh_filter_failure_ptr (gs);
3200 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3202 static inline void
3203 gimple_eh_filter_set_types (gimple gs, tree types)
3205 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3206 gs->gimple_eh_filter.types = types;
3210 /* Set FAILURE to be the sequence of statements to execute on failure
3211 for GIMPLE_EH_FILTER GS. */
3213 static inline void
3214 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3216 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3217 gs->gimple_eh_filter.failure = failure;
3220 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3222 static inline tree
3223 gimple_eh_must_not_throw_fndecl (gimple gs)
3225 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3226 return gs->gimple_eh_mnt.fndecl;
3229 /* Set the function decl to be called by GS to DECL. */
3231 static inline void
3232 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3234 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3235 gs->gimple_eh_mnt.fndecl = decl;
3238 /* GIMPLE_EH_ELSE accessors. */
3240 static inline gimple_seq *
3241 gimple_eh_else_n_body_ptr (gimple gs)
3243 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3244 return &gs->gimple_eh_else.n_body;
3247 static inline gimple_seq
3248 gimple_eh_else_n_body (gimple gs)
3250 return *gimple_eh_else_n_body_ptr (gs);
3253 static inline gimple_seq *
3254 gimple_eh_else_e_body_ptr (gimple gs)
3256 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3257 return &gs->gimple_eh_else.e_body;
3260 static inline gimple_seq
3261 gimple_eh_else_e_body (gimple gs)
3263 return *gimple_eh_else_e_body_ptr (gs);
3266 static inline void
3267 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3269 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3270 gs->gimple_eh_else.n_body = seq;
3273 static inline void
3274 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3276 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3277 gs->gimple_eh_else.e_body = seq;
3280 /* GIMPLE_TRY accessors. */
3282 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3283 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3285 static inline enum gimple_try_flags
3286 gimple_try_kind (const_gimple gs)
3288 GIMPLE_CHECK (gs, GIMPLE_TRY);
3289 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3293 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3295 static inline void
3296 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3298 GIMPLE_CHECK (gs, GIMPLE_TRY);
3299 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3300 || kind == GIMPLE_TRY_FINALLY);
3301 if (gimple_try_kind (gs) != kind)
3302 gs->gsbase.subcode = (unsigned int) kind;
3306 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3308 static inline bool
3309 gimple_try_catch_is_cleanup (const_gimple gs)
3311 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3312 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3316 /* Return a pointer to the sequence of statements used as the
3317 body for GIMPLE_TRY GS. */
3319 static inline gimple_seq *
3320 gimple_try_eval_ptr (gimple gs)
3322 GIMPLE_CHECK (gs, GIMPLE_TRY);
3323 return &gs->gimple_try.eval;
3327 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3329 static inline gimple_seq
3330 gimple_try_eval (gimple gs)
3332 return *gimple_try_eval_ptr (gs);
3336 /* Return a pointer to the sequence of statements used as the cleanup body for
3337 GIMPLE_TRY GS. */
3339 static inline gimple_seq *
3340 gimple_try_cleanup_ptr (gimple gs)
3342 GIMPLE_CHECK (gs, GIMPLE_TRY);
3343 return &gs->gimple_try.cleanup;
3347 /* Return the sequence of statements used as the cleanup body for
3348 GIMPLE_TRY GS. */
3350 static inline gimple_seq
3351 gimple_try_cleanup (gimple gs)
3353 return *gimple_try_cleanup_ptr (gs);
3357 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3359 static inline void
3360 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3362 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3363 if (catch_is_cleanup)
3364 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3365 else
3366 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3370 /* Set EVAL to be the sequence of statements to use as the body for
3371 GIMPLE_TRY GS. */
3373 static inline void
3374 gimple_try_set_eval (gimple gs, gimple_seq eval)
3376 GIMPLE_CHECK (gs, GIMPLE_TRY);
3377 gs->gimple_try.eval = eval;
3381 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3382 body for GIMPLE_TRY GS. */
3384 static inline void
3385 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3387 GIMPLE_CHECK (gs, GIMPLE_TRY);
3388 gs->gimple_try.cleanup = cleanup;
3392 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3394 static inline gimple_seq *
3395 gimple_wce_cleanup_ptr (gimple gs)
3397 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3398 return &gs->gimple_wce.cleanup;
3402 /* Return the cleanup sequence for cleanup statement GS. */
3404 static inline gimple_seq
3405 gimple_wce_cleanup (gimple gs)
3407 return *gimple_wce_cleanup_ptr (gs);
3411 /* Set CLEANUP to be the cleanup sequence for GS. */
3413 static inline void
3414 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3416 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3417 gs->gimple_wce.cleanup = cleanup;
3421 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3423 static inline bool
3424 gimple_wce_cleanup_eh_only (const_gimple gs)
3426 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3427 return gs->gsbase.subcode != 0;
3431 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3433 static inline void
3434 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3436 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3437 gs->gsbase.subcode = (unsigned int) eh_only_p;
3441 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3443 static inline unsigned
3444 gimple_phi_capacity (const_gimple gs)
3446 GIMPLE_CHECK (gs, GIMPLE_PHI);
3447 return gs->gimple_phi.capacity;
3451 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3452 be exactly the number of incoming edges for the basic block holding
3453 GS. */
3455 static inline unsigned
3456 gimple_phi_num_args (const_gimple gs)
3458 GIMPLE_CHECK (gs, GIMPLE_PHI);
3459 return gs->gimple_phi.nargs;
3463 /* Return the SSA name created by GIMPLE_PHI GS. */
3465 static inline tree
3466 gimple_phi_result (const_gimple gs)
3468 GIMPLE_CHECK (gs, GIMPLE_PHI);
3469 return gs->gimple_phi.result;
3472 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3474 static inline tree *
3475 gimple_phi_result_ptr (gimple gs)
3477 GIMPLE_CHECK (gs, GIMPLE_PHI);
3478 return &gs->gimple_phi.result;
3481 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3483 static inline void
3484 gimple_phi_set_result (gimple gs, tree result)
3486 GIMPLE_CHECK (gs, GIMPLE_PHI);
3487 gs->gimple_phi.result = result;
3488 if (result && TREE_CODE (result) == SSA_NAME)
3489 SSA_NAME_DEF_STMT (result) = gs;
3493 /* Return the PHI argument corresponding to incoming edge INDEX for
3494 GIMPLE_PHI GS. */
3496 static inline struct phi_arg_d *
3497 gimple_phi_arg (gimple gs, unsigned index)
3499 GIMPLE_CHECK (gs, GIMPLE_PHI);
3500 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3501 return &(gs->gimple_phi.args[index]);
3504 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3505 for GIMPLE_PHI GS. */
3507 static inline void
3508 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3510 GIMPLE_CHECK (gs, GIMPLE_PHI);
3511 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3512 gs->gimple_phi.args[index] = *phiarg;
3515 /* Return the region number for GIMPLE_RESX GS. */
3517 static inline int
3518 gimple_resx_region (const_gimple gs)
3520 GIMPLE_CHECK (gs, GIMPLE_RESX);
3521 return gs->gimple_eh_ctrl.region;
3524 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3526 static inline void
3527 gimple_resx_set_region (gimple gs, int region)
3529 GIMPLE_CHECK (gs, GIMPLE_RESX);
3530 gs->gimple_eh_ctrl.region = region;
3533 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3535 static inline int
3536 gimple_eh_dispatch_region (const_gimple gs)
3538 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3539 return gs->gimple_eh_ctrl.region;
3542 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3544 static inline void
3545 gimple_eh_dispatch_set_region (gimple gs, int region)
3547 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3548 gs->gimple_eh_ctrl.region = region;
3551 /* Return the number of labels associated with the switch statement GS. */
3553 static inline unsigned
3554 gimple_switch_num_labels (const_gimple gs)
3556 unsigned num_ops;
3557 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3558 num_ops = gimple_num_ops (gs);
3559 gcc_gimple_checking_assert (num_ops > 1);
3560 return num_ops - 1;
3564 /* Set NLABELS to be the number of labels for the switch statement GS. */
3566 static inline void
3567 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3569 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3570 gimple_set_num_ops (g, nlabels + 1);
3574 /* Return the index variable used by the switch statement GS. */
3576 static inline tree
3577 gimple_switch_index (const_gimple gs)
3579 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3580 return gimple_op (gs, 0);
3584 /* Return a pointer to the index variable for the switch statement GS. */
3586 static inline tree *
3587 gimple_switch_index_ptr (const_gimple gs)
3589 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3590 return gimple_op_ptr (gs, 0);
3594 /* Set INDEX to be the index variable for switch statement GS. */
3596 static inline void
3597 gimple_switch_set_index (gimple gs, tree index)
3599 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3600 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3601 gimple_set_op (gs, 0, index);
3605 /* Return the label numbered INDEX. The default label is 0, followed by any
3606 labels in a switch statement. */
3608 static inline tree
3609 gimple_switch_label (const_gimple gs, unsigned index)
3611 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3612 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3613 return gimple_op (gs, index + 1);
3616 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3618 static inline void
3619 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3621 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3622 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3623 && (label == NULL_TREE
3624 || TREE_CODE (label) == CASE_LABEL_EXPR));
3625 gimple_set_op (gs, index + 1, label);
3628 /* Return the default label for a switch statement. */
3630 static inline tree
3631 gimple_switch_default_label (const_gimple gs)
3633 tree label = gimple_switch_label (gs, 0);
3634 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3635 return label;
3638 /* Set the default label for a switch statement. */
3640 static inline void
3641 gimple_switch_set_default_label (gimple gs, tree label)
3643 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3644 gimple_switch_set_label (gs, 0, label);
3647 /* Return true if GS is a GIMPLE_DEBUG statement. */
3649 static inline bool
3650 is_gimple_debug (const_gimple gs)
3652 return gimple_code (gs) == GIMPLE_DEBUG;
3655 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3657 static inline bool
3658 gimple_debug_bind_p (const_gimple s)
3660 if (is_gimple_debug (s))
3661 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3663 return false;
3666 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3668 static inline tree
3669 gimple_debug_bind_get_var (gimple dbg)
3671 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3672 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3673 return gimple_op (dbg, 0);
3676 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3677 statement. */
3679 static inline tree
3680 gimple_debug_bind_get_value (gimple dbg)
3682 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3683 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3684 return gimple_op (dbg, 1);
3687 /* Return a pointer to the value bound to the variable in a
3688 GIMPLE_DEBUG bind statement. */
3690 static inline tree *
3691 gimple_debug_bind_get_value_ptr (gimple dbg)
3693 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3694 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3695 return gimple_op_ptr (dbg, 1);
3698 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3700 static inline void
3701 gimple_debug_bind_set_var (gimple dbg, tree var)
3703 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3704 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3705 gimple_set_op (dbg, 0, var);
3708 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3709 statement. */
3711 static inline void
3712 gimple_debug_bind_set_value (gimple dbg, tree value)
3714 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3715 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3716 gimple_set_op (dbg, 1, value);
3719 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3720 optimized away. */
3721 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3723 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3724 statement. */
3726 static inline void
3727 gimple_debug_bind_reset_value (gimple dbg)
3729 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3730 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3731 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3734 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3735 value. */
3737 static inline bool
3738 gimple_debug_bind_has_value_p (gimple dbg)
3740 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3741 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3742 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3745 #undef GIMPLE_DEBUG_BIND_NOVALUE
3747 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3749 static inline bool
3750 gimple_debug_source_bind_p (const_gimple s)
3752 if (is_gimple_debug (s))
3753 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3755 return false;
3758 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3760 static inline tree
3761 gimple_debug_source_bind_get_var (gimple dbg)
3763 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3764 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3765 return gimple_op (dbg, 0);
3768 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3769 statement. */
3771 static inline tree
3772 gimple_debug_source_bind_get_value (gimple dbg)
3774 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3775 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3776 return gimple_op (dbg, 1);
3779 /* Return a pointer to the value bound to the variable in a
3780 GIMPLE_DEBUG source bind statement. */
3782 static inline tree *
3783 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3785 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3786 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3787 return gimple_op_ptr (dbg, 1);
3790 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3792 static inline void
3793 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3795 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3796 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3797 gimple_set_op (dbg, 0, var);
3800 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3801 statement. */
3803 static inline void
3804 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3806 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3807 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3808 gimple_set_op (dbg, 1, value);
3811 /* Return a pointer to the body for the OMP statement GS. */
3813 static inline gimple_seq *
3814 gimple_omp_body_ptr (gimple gs)
3816 return &gs->omp.body;
3819 /* Return the body for the OMP statement GS. */
3821 static inline gimple_seq
3822 gimple_omp_body (gimple gs)
3824 return *gimple_omp_body_ptr (gs);
3827 /* Set BODY to be the body for the OMP statement GS. */
3829 static inline void
3830 gimple_omp_set_body (gimple gs, gimple_seq body)
3832 gs->omp.body = body;
3836 /* Return the name associated with OMP_CRITICAL statement GS. */
3838 static inline tree
3839 gimple_omp_critical_name (const_gimple gs)
3841 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3842 return gs->gimple_omp_critical.name;
3846 /* Return a pointer to the name associated with OMP critical statement GS. */
3848 static inline tree *
3849 gimple_omp_critical_name_ptr (gimple gs)
3851 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3852 return &gs->gimple_omp_critical.name;
3856 /* Set NAME to be the name associated with OMP critical statement GS. */
3858 static inline void
3859 gimple_omp_critical_set_name (gimple gs, tree name)
3861 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3862 gs->gimple_omp_critical.name = name;
3866 /* Return the clauses associated with OMP_FOR GS. */
3868 static inline tree
3869 gimple_omp_for_clauses (const_gimple gs)
3871 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3872 return gs->gimple_omp_for.clauses;
3876 /* Return a pointer to the OMP_FOR GS. */
3878 static inline tree *
3879 gimple_omp_for_clauses_ptr (gimple gs)
3881 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3882 return &gs->gimple_omp_for.clauses;
3886 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3888 static inline void
3889 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3891 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3892 gs->gimple_omp_for.clauses = clauses;
3896 /* Get the collapse count of OMP_FOR GS. */
3898 static inline size_t
3899 gimple_omp_for_collapse (gimple gs)
3901 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3902 return gs->gimple_omp_for.collapse;
3906 /* Return the index variable for OMP_FOR GS. */
3908 static inline tree
3909 gimple_omp_for_index (const_gimple gs, size_t i)
3911 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3912 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3913 return gs->gimple_omp_for.iter[i].index;
3917 /* Return a pointer to the index variable for OMP_FOR GS. */
3919 static inline tree *
3920 gimple_omp_for_index_ptr (gimple gs, size_t i)
3922 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3923 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3924 return &gs->gimple_omp_for.iter[i].index;
3928 /* Set INDEX to be the index variable for OMP_FOR GS. */
3930 static inline void
3931 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3933 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3934 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3935 gs->gimple_omp_for.iter[i].index = index;
3939 /* Return the initial value for OMP_FOR GS. */
3941 static inline tree
3942 gimple_omp_for_initial (const_gimple gs, size_t i)
3944 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3945 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3946 return gs->gimple_omp_for.iter[i].initial;
3950 /* Return a pointer to the initial value for OMP_FOR GS. */
3952 static inline tree *
3953 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3955 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3956 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3957 return &gs->gimple_omp_for.iter[i].initial;
3961 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3963 static inline void
3964 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3966 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3967 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3968 gs->gimple_omp_for.iter[i].initial = initial;
3972 /* Return the final value for OMP_FOR GS. */
3974 static inline tree
3975 gimple_omp_for_final (const_gimple gs, size_t i)
3977 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3978 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3979 return gs->gimple_omp_for.iter[i].final;
3983 /* Return a pointer to the final value for OMP_FOR GS. */
3985 static inline tree *
3986 gimple_omp_for_final_ptr (gimple gs, size_t i)
3988 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3989 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3990 return &gs->gimple_omp_for.iter[i].final;
3994 /* Set FINAL to be the final value for OMP_FOR GS. */
3996 static inline void
3997 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3999 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4000 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4001 gs->gimple_omp_for.iter[i].final = final;
4005 /* Return the increment value for OMP_FOR GS. */
4007 static inline tree
4008 gimple_omp_for_incr (const_gimple gs, size_t i)
4010 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4011 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4012 return gs->gimple_omp_for.iter[i].incr;
4016 /* Return a pointer to the increment value for OMP_FOR GS. */
4018 static inline tree *
4019 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4021 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4022 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4023 return &gs->gimple_omp_for.iter[i].incr;
4027 /* Set INCR to be the increment value for OMP_FOR GS. */
4029 static inline void
4030 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4032 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4033 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4034 gs->gimple_omp_for.iter[i].incr = incr;
4038 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4039 statement GS starts. */
4041 static inline gimple_seq *
4042 gimple_omp_for_pre_body_ptr (gimple gs)
4044 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4045 return &gs->gimple_omp_for.pre_body;
4049 /* Return the sequence of statements to execute before the OMP_FOR
4050 statement GS starts. */
4052 static inline gimple_seq
4053 gimple_omp_for_pre_body (gimple gs)
4055 return *gimple_omp_for_pre_body_ptr (gs);
4059 /* Set PRE_BODY to be the sequence of statements to execute before the
4060 OMP_FOR statement GS starts. */
4062 static inline void
4063 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4065 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4066 gs->gimple_omp_for.pre_body = pre_body;
4070 /* Return the clauses associated with OMP_PARALLEL GS. */
4072 static inline tree
4073 gimple_omp_parallel_clauses (const_gimple gs)
4075 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4076 return gs->gimple_omp_parallel.clauses;
4080 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4082 static inline tree *
4083 gimple_omp_parallel_clauses_ptr (gimple gs)
4085 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4086 return &gs->gimple_omp_parallel.clauses;
4090 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4091 GS. */
4093 static inline void
4094 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4096 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4097 gs->gimple_omp_parallel.clauses = clauses;
4101 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4103 static inline tree
4104 gimple_omp_parallel_child_fn (const_gimple gs)
4106 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4107 return gs->gimple_omp_parallel.child_fn;
4110 /* Return a pointer to the child function used to hold the body of
4111 OMP_PARALLEL GS. */
4113 static inline tree *
4114 gimple_omp_parallel_child_fn_ptr (gimple gs)
4116 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4117 return &gs->gimple_omp_parallel.child_fn;
4121 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4123 static inline void
4124 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4126 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4127 gs->gimple_omp_parallel.child_fn = child_fn;
4131 /* Return the artificial argument used to send variables and values
4132 from the parent to the children threads in OMP_PARALLEL GS. */
4134 static inline tree
4135 gimple_omp_parallel_data_arg (const_gimple gs)
4137 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4138 return gs->gimple_omp_parallel.data_arg;
4142 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4144 static inline tree *
4145 gimple_omp_parallel_data_arg_ptr (gimple gs)
4147 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4148 return &gs->gimple_omp_parallel.data_arg;
4152 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4154 static inline void
4155 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4157 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4158 gs->gimple_omp_parallel.data_arg = data_arg;
4162 /* Return the clauses associated with OMP_TASK GS. */
4164 static inline tree
4165 gimple_omp_task_clauses (const_gimple gs)
4167 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4168 return gs->gimple_omp_parallel.clauses;
4172 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4174 static inline tree *
4175 gimple_omp_task_clauses_ptr (gimple gs)
4177 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4178 return &gs->gimple_omp_parallel.clauses;
4182 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4183 GS. */
4185 static inline void
4186 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4188 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4189 gs->gimple_omp_parallel.clauses = clauses;
4193 /* Return the child function used to hold the body of OMP_TASK GS. */
4195 static inline tree
4196 gimple_omp_task_child_fn (const_gimple gs)
4198 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4199 return gs->gimple_omp_parallel.child_fn;
4202 /* Return a pointer to the child function used to hold the body of
4203 OMP_TASK GS. */
4205 static inline tree *
4206 gimple_omp_task_child_fn_ptr (gimple gs)
4208 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4209 return &gs->gimple_omp_parallel.child_fn;
4213 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4215 static inline void
4216 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4218 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4219 gs->gimple_omp_parallel.child_fn = child_fn;
4223 /* Return the artificial argument used to send variables and values
4224 from the parent to the children threads in OMP_TASK GS. */
4226 static inline tree
4227 gimple_omp_task_data_arg (const_gimple gs)
4229 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4230 return gs->gimple_omp_parallel.data_arg;
4234 /* Return a pointer to the data argument for OMP_TASK GS. */
4236 static inline tree *
4237 gimple_omp_task_data_arg_ptr (gimple gs)
4239 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4240 return &gs->gimple_omp_parallel.data_arg;
4244 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4246 static inline void
4247 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4249 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4250 gs->gimple_omp_parallel.data_arg = data_arg;
4254 /* Return the clauses associated with OMP_TASK GS. */
4256 static inline tree
4257 gimple_omp_taskreg_clauses (const_gimple gs)
4259 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4260 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4261 return gs->gimple_omp_parallel.clauses;
4265 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4267 static inline tree *
4268 gimple_omp_taskreg_clauses_ptr (gimple gs)
4270 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4271 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4272 return &gs->gimple_omp_parallel.clauses;
4276 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4277 GS. */
4279 static inline void
4280 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4282 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4283 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4284 gs->gimple_omp_parallel.clauses = clauses;
4288 /* Return the child function used to hold the body of OMP_TASK GS. */
4290 static inline tree
4291 gimple_omp_taskreg_child_fn (const_gimple gs)
4293 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4294 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4295 return gs->gimple_omp_parallel.child_fn;
4298 /* Return a pointer to the child function used to hold the body of
4299 OMP_TASK GS. */
4301 static inline tree *
4302 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4304 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4305 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4306 return &gs->gimple_omp_parallel.child_fn;
4310 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4312 static inline void
4313 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4315 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4316 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4317 gs->gimple_omp_parallel.child_fn = child_fn;
4321 /* Return the artificial argument used to send variables and values
4322 from the parent to the children threads in OMP_TASK GS. */
4324 static inline tree
4325 gimple_omp_taskreg_data_arg (const_gimple gs)
4327 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4328 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4329 return gs->gimple_omp_parallel.data_arg;
4333 /* Return a pointer to the data argument for OMP_TASK GS. */
4335 static inline tree *
4336 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4338 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4339 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4340 return &gs->gimple_omp_parallel.data_arg;
4344 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4346 static inline void
4347 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4349 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4350 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4351 gs->gimple_omp_parallel.data_arg = data_arg;
4355 /* Return the copy function used to hold the body of OMP_TASK GS. */
4357 static inline tree
4358 gimple_omp_task_copy_fn (const_gimple gs)
4360 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4361 return gs->gimple_omp_task.copy_fn;
4364 /* Return a pointer to the copy function used to hold the body of
4365 OMP_TASK GS. */
4367 static inline tree *
4368 gimple_omp_task_copy_fn_ptr (gimple gs)
4370 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4371 return &gs->gimple_omp_task.copy_fn;
4375 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4377 static inline void
4378 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4380 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4381 gs->gimple_omp_task.copy_fn = copy_fn;
4385 /* Return size of the data block in bytes in OMP_TASK GS. */
4387 static inline tree
4388 gimple_omp_task_arg_size (const_gimple gs)
4390 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4391 return gs->gimple_omp_task.arg_size;
4395 /* Return a pointer to the data block size for OMP_TASK GS. */
4397 static inline tree *
4398 gimple_omp_task_arg_size_ptr (gimple gs)
4400 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4401 return &gs->gimple_omp_task.arg_size;
4405 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4407 static inline void
4408 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4410 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4411 gs->gimple_omp_task.arg_size = arg_size;
4415 /* Return align of the data block in bytes in OMP_TASK GS. */
4417 static inline tree
4418 gimple_omp_task_arg_align (const_gimple gs)
4420 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4421 return gs->gimple_omp_task.arg_align;
4425 /* Return a pointer to the data block align for OMP_TASK GS. */
4427 static inline tree *
4428 gimple_omp_task_arg_align_ptr (gimple gs)
4430 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4431 return &gs->gimple_omp_task.arg_align;
4435 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4437 static inline void
4438 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4440 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4441 gs->gimple_omp_task.arg_align = arg_align;
4445 /* Return the clauses associated with OMP_SINGLE GS. */
4447 static inline tree
4448 gimple_omp_single_clauses (const_gimple gs)
4450 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4451 return gs->gimple_omp_single.clauses;
4455 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4457 static inline tree *
4458 gimple_omp_single_clauses_ptr (gimple gs)
4460 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4461 return &gs->gimple_omp_single.clauses;
4465 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4467 static inline void
4468 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4470 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4471 gs->gimple_omp_single.clauses = clauses;
4475 /* Return the clauses associated with OMP_SECTIONS GS. */
4477 static inline tree
4478 gimple_omp_sections_clauses (const_gimple gs)
4480 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4481 return gs->gimple_omp_sections.clauses;
4485 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4487 static inline tree *
4488 gimple_omp_sections_clauses_ptr (gimple gs)
4490 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4491 return &gs->gimple_omp_sections.clauses;
4495 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4496 GS. */
4498 static inline void
4499 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4501 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4502 gs->gimple_omp_sections.clauses = clauses;
4506 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4507 in GS. */
4509 static inline tree
4510 gimple_omp_sections_control (const_gimple gs)
4512 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4513 return gs->gimple_omp_sections.control;
4517 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4518 GS. */
4520 static inline tree *
4521 gimple_omp_sections_control_ptr (gimple gs)
4523 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4524 return &gs->gimple_omp_sections.control;
4528 /* Set CONTROL to be the set of clauses associated with the
4529 GIMPLE_OMP_SECTIONS in GS. */
4531 static inline void
4532 gimple_omp_sections_set_control (gimple gs, tree control)
4534 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4535 gs->gimple_omp_sections.control = control;
4539 /* Set COND to be the condition code for OMP_FOR GS. */
4541 static inline void
4542 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4544 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4545 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4546 && i < gs->gimple_omp_for.collapse);
4547 gs->gimple_omp_for.iter[i].cond = cond;
4551 /* Return the condition code associated with OMP_FOR GS. */
4553 static inline enum tree_code
4554 gimple_omp_for_cond (const_gimple gs, size_t i)
4556 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4557 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4558 return gs->gimple_omp_for.iter[i].cond;
4562 /* Set the value being stored in an atomic store. */
4564 static inline void
4565 gimple_omp_atomic_store_set_val (gimple g, tree val)
4567 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4568 g->gimple_omp_atomic_store.val = val;
4572 /* Return the value being stored in an atomic store. */
4574 static inline tree
4575 gimple_omp_atomic_store_val (const_gimple g)
4577 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4578 return g->gimple_omp_atomic_store.val;
4582 /* Return a pointer to the value being stored in an atomic store. */
4584 static inline tree *
4585 gimple_omp_atomic_store_val_ptr (gimple g)
4587 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4588 return &g->gimple_omp_atomic_store.val;
4592 /* Set the LHS of an atomic load. */
4594 static inline void
4595 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4597 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4598 g->gimple_omp_atomic_load.lhs = lhs;
4602 /* Get the LHS of an atomic load. */
4604 static inline tree
4605 gimple_omp_atomic_load_lhs (const_gimple g)
4607 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4608 return g->gimple_omp_atomic_load.lhs;
4612 /* Return a pointer to the LHS of an atomic load. */
4614 static inline tree *
4615 gimple_omp_atomic_load_lhs_ptr (gimple g)
4617 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4618 return &g->gimple_omp_atomic_load.lhs;
4622 /* Set the RHS of an atomic load. */
4624 static inline void
4625 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4627 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4628 g->gimple_omp_atomic_load.rhs = rhs;
4632 /* Get the RHS of an atomic load. */
4634 static inline tree
4635 gimple_omp_atomic_load_rhs (const_gimple g)
4637 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4638 return g->gimple_omp_atomic_load.rhs;
4642 /* Return a pointer to the RHS of an atomic load. */
4644 static inline tree *
4645 gimple_omp_atomic_load_rhs_ptr (gimple g)
4647 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4648 return &g->gimple_omp_atomic_load.rhs;
4652 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4654 static inline tree
4655 gimple_omp_continue_control_def (const_gimple g)
4657 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4658 return g->gimple_omp_continue.control_def;
4661 /* The same as above, but return the address. */
4663 static inline tree *
4664 gimple_omp_continue_control_def_ptr (gimple g)
4666 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4667 return &g->gimple_omp_continue.control_def;
4670 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4672 static inline void
4673 gimple_omp_continue_set_control_def (gimple g, tree def)
4675 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4676 g->gimple_omp_continue.control_def = def;
4680 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4682 static inline tree
4683 gimple_omp_continue_control_use (const_gimple g)
4685 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4686 return g->gimple_omp_continue.control_use;
4690 /* The same as above, but return the address. */
4692 static inline tree *
4693 gimple_omp_continue_control_use_ptr (gimple g)
4695 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4696 return &g->gimple_omp_continue.control_use;
4700 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4702 static inline void
4703 gimple_omp_continue_set_control_use (gimple g, tree use)
4705 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4706 g->gimple_omp_continue.control_use = use;
4709 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4711 static inline gimple_seq *
4712 gimple_transaction_body_ptr (gimple gs)
4714 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4715 return &gs->gimple_transaction.body;
4718 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4720 static inline gimple_seq
4721 gimple_transaction_body (gimple gs)
4723 return *gimple_transaction_body_ptr (gs);
4726 /* Return the label associated with a GIMPLE_TRANSACTION. */
4728 static inline tree
4729 gimple_transaction_label (const_gimple gs)
4731 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4732 return gs->gimple_transaction.label;
4735 static inline tree *
4736 gimple_transaction_label_ptr (gimple gs)
4738 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4739 return &gs->gimple_transaction.label;
4742 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4744 static inline unsigned int
4745 gimple_transaction_subcode (const_gimple gs)
4747 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4748 return gs->gsbase.subcode;
4751 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4753 static inline void
4754 gimple_transaction_set_body (gimple gs, gimple_seq body)
4756 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4757 gs->gimple_transaction.body = body;
4760 /* Set the label associated with a GIMPLE_TRANSACTION. */
4762 static inline void
4763 gimple_transaction_set_label (gimple gs, tree label)
4765 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4766 gs->gimple_transaction.label = label;
4769 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4771 static inline void
4772 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4774 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4775 gs->gsbase.subcode = subcode;
4779 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4781 static inline tree *
4782 gimple_return_retval_ptr (const_gimple gs)
4784 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4785 return gimple_op_ptr (gs, 0);
4788 /* Return the return value for GIMPLE_RETURN GS. */
4790 static inline tree
4791 gimple_return_retval (const_gimple gs)
4793 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4794 return gimple_op (gs, 0);
4798 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4800 static inline void
4801 gimple_return_set_retval (gimple gs, tree retval)
4803 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4804 gimple_set_op (gs, 0, retval);
4808 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4810 #define CASE_GIMPLE_OMP \
4811 case GIMPLE_OMP_PARALLEL: \
4812 case GIMPLE_OMP_TASK: \
4813 case GIMPLE_OMP_FOR: \
4814 case GIMPLE_OMP_SECTIONS: \
4815 case GIMPLE_OMP_SECTIONS_SWITCH: \
4816 case GIMPLE_OMP_SINGLE: \
4817 case GIMPLE_OMP_SECTION: \
4818 case GIMPLE_OMP_MASTER: \
4819 case GIMPLE_OMP_ORDERED: \
4820 case GIMPLE_OMP_CRITICAL: \
4821 case GIMPLE_OMP_RETURN: \
4822 case GIMPLE_OMP_ATOMIC_LOAD: \
4823 case GIMPLE_OMP_ATOMIC_STORE: \
4824 case GIMPLE_OMP_CONTINUE
4826 static inline bool
4827 is_gimple_omp (const_gimple stmt)
4829 switch (gimple_code (stmt))
4831 CASE_GIMPLE_OMP:
4832 return true;
4833 default:
4834 return false;
4839 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4841 static inline bool
4842 gimple_nop_p (const_gimple g)
4844 return gimple_code (g) == GIMPLE_NOP;
4848 /* Return true if GS is a GIMPLE_RESX. */
4850 static inline bool
4851 is_gimple_resx (const_gimple gs)
4853 return gimple_code (gs) == GIMPLE_RESX;
4856 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4858 static inline enum br_predictor
4859 gimple_predict_predictor (gimple gs)
4861 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4862 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4866 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4868 static inline void
4869 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4871 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4872 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4873 | (unsigned) predictor;
4877 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4879 static inline enum prediction
4880 gimple_predict_outcome (gimple gs)
4882 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4883 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4887 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4889 static inline void
4890 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4892 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4893 if (outcome == TAKEN)
4894 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4895 else
4896 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4900 /* Return the type of the main expression computed by STMT. Return
4901 void_type_node if the statement computes nothing. */
4903 static inline tree
4904 gimple_expr_type (const_gimple stmt)
4906 enum gimple_code code = gimple_code (stmt);
4908 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4910 tree type;
4911 /* In general we want to pass out a type that can be substituted
4912 for both the RHS and the LHS types if there is a possibly
4913 useless conversion involved. That means returning the
4914 original RHS type as far as we can reconstruct it. */
4915 if (code == GIMPLE_CALL)
4916 type = gimple_call_return_type (stmt);
4917 else
4918 switch (gimple_assign_rhs_code (stmt))
4920 case POINTER_PLUS_EXPR:
4921 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4922 break;
4924 default:
4925 /* As fallback use the type of the LHS. */
4926 type = TREE_TYPE (gimple_get_lhs (stmt));
4927 break;
4929 return type;
4931 else if (code == GIMPLE_COND)
4932 return boolean_type_node;
4933 else
4934 return void_type_node;
4937 /* Return true if TYPE is a suitable type for a scalar register variable. */
4939 static inline bool
4940 is_gimple_reg_type (tree type)
4942 return !AGGREGATE_TYPE_P (type);
4945 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4947 static inline gimple_stmt_iterator
4948 gsi_start_1 (gimple_seq *seq)
4950 gimple_stmt_iterator i;
4952 i.ptr = gimple_seq_first (*seq);
4953 i.seq = seq;
4954 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
4956 return i;
4959 #define gsi_start(x) gsi_start_1(&(x))
4961 static inline gimple_stmt_iterator
4962 gsi_none (void)
4964 gimple_stmt_iterator i;
4965 i.ptr = NULL;
4966 i.seq = NULL;
4967 i.bb = NULL;
4968 return i;
4971 /* Return a new iterator pointing to the first statement in basic block BB. */
4973 static inline gimple_stmt_iterator
4974 gsi_start_bb (basic_block bb)
4976 gimple_stmt_iterator i;
4977 gimple_seq *seq;
4979 seq = bb_seq_addr (bb);
4980 i.ptr = gimple_seq_first (*seq);
4981 i.seq = seq;
4982 i.bb = bb;
4984 return i;
4988 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4990 static inline gimple_stmt_iterator
4991 gsi_last_1 (gimple_seq *seq)
4993 gimple_stmt_iterator i;
4995 i.ptr = gimple_seq_last (*seq);
4996 i.seq = seq;
4997 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
4999 return i;
5002 #define gsi_last(x) gsi_last_1(&(x))
5004 /* Return a new iterator pointing to the last statement in basic block BB. */
5006 static inline gimple_stmt_iterator
5007 gsi_last_bb (basic_block bb)
5009 gimple_stmt_iterator i;
5010 gimple_seq *seq;
5012 seq = bb_seq_addr (bb);
5013 i.ptr = gimple_seq_last (*seq);
5014 i.seq = seq;
5015 i.bb = bb;
5017 return i;
5021 /* Return true if I is at the end of its sequence. */
5023 static inline bool
5024 gsi_end_p (gimple_stmt_iterator i)
5026 return i.ptr == NULL;
5030 /* Return true if I is one statement before the end of its sequence. */
5032 static inline bool
5033 gsi_one_before_end_p (gimple_stmt_iterator i)
5035 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5039 /* Advance the iterator to the next gimple statement. */
5041 static inline void
5042 gsi_next (gimple_stmt_iterator *i)
5044 i->ptr = i->ptr->gsbase.next;
5047 /* Advance the iterator to the previous gimple statement. */
5049 static inline void
5050 gsi_prev (gimple_stmt_iterator *i)
5052 gimple prev = i->ptr->gsbase.prev;
5053 if (prev->gsbase.next)
5054 i->ptr = prev;
5055 else
5056 i->ptr = NULL;
5059 /* Return the current stmt. */
5061 static inline gimple
5062 gsi_stmt (gimple_stmt_iterator i)
5064 return i.ptr;
5067 /* Return a block statement iterator that points to the first non-label
5068 statement in block BB. */
5070 static inline gimple_stmt_iterator
5071 gsi_after_labels (basic_block bb)
5073 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5075 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5076 gsi_next (&gsi);
5078 return gsi;
5081 /* Advance the iterator to the next non-debug gimple statement. */
5083 static inline void
5084 gsi_next_nondebug (gimple_stmt_iterator *i)
5088 gsi_next (i);
5090 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5093 /* Advance the iterator to the next non-debug gimple statement. */
5095 static inline void
5096 gsi_prev_nondebug (gimple_stmt_iterator *i)
5100 gsi_prev (i);
5102 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5105 /* Return a new iterator pointing to the first non-debug statement in
5106 basic block BB. */
5108 static inline gimple_stmt_iterator
5109 gsi_start_nondebug_bb (basic_block bb)
5111 gimple_stmt_iterator i = gsi_start_bb (bb);
5113 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5114 gsi_next_nondebug (&i);
5116 return i;
5119 /* Return a new iterator pointing to the last non-debug statement in
5120 basic block BB. */
5122 static inline gimple_stmt_iterator
5123 gsi_last_nondebug_bb (basic_block bb)
5125 gimple_stmt_iterator i = gsi_last_bb (bb);
5127 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5128 gsi_prev_nondebug (&i);
5130 return i;
5134 /* Return the basic block associated with this iterator. */
5136 static inline basic_block
5137 gsi_bb (gimple_stmt_iterator i)
5139 return i.bb;
5143 /* Return the sequence associated with this iterator. */
5145 static inline gimple_seq
5146 gsi_seq (gimple_stmt_iterator i)
5148 return *i.seq;
5152 enum gsi_iterator_update
5154 GSI_NEW_STMT, /* Only valid when single statement is added, move
5155 iterator to it. */
5156 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5157 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5158 for linking other statements in the same
5159 direction. */
5162 /* In gimple-iterator.c */
5163 gimple_stmt_iterator gsi_start_phis (basic_block);
5164 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5165 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5166 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5167 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5168 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5169 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5170 enum gsi_iterator_update);
5171 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5172 enum gsi_iterator_update);
5173 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5174 enum gsi_iterator_update);
5175 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5176 enum gsi_iterator_update);
5177 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5178 enum gsi_iterator_update);
5179 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5180 enum gsi_iterator_update);
5181 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5182 enum gsi_iterator_update);
5183 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5184 enum gsi_iterator_update);
5185 bool gsi_remove (gimple_stmt_iterator *, bool);
5186 gimple_stmt_iterator gsi_for_stmt (gimple);
5187 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5188 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5189 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5190 void gsi_insert_on_edge (edge, gimple);
5191 void gsi_insert_seq_on_edge (edge, gimple_seq);
5192 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5193 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5194 void gsi_commit_one_edge_insert (edge, basic_block *);
5195 void gsi_commit_edge_inserts (void);
5196 gimple gimple_call_copy_skip_args (gimple, bitmap);
5199 /* Convenience routines to walk all statements of a gimple function.
5200 Note that this is useful exclusively before the code is converted
5201 into SSA form. Once the program is in SSA form, the standard
5202 operand interface should be used to analyze/modify statements. */
5203 struct walk_stmt_info
5205 /* Points to the current statement being walked. */
5206 gimple_stmt_iterator gsi;
5208 /* Additional data that the callback functions may want to carry
5209 through the recursion. */
5210 void *info;
5212 /* Pointer map used to mark visited tree nodes when calling
5213 walk_tree on each operand. If set to NULL, duplicate tree nodes
5214 will be visited more than once. */
5215 struct pointer_set_t *pset;
5217 /* Operand returned by the callbacks. This is set when calling
5218 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5219 returns non-NULL, this field will contain the tree returned by
5220 the last callback. */
5221 tree callback_result;
5223 /* Indicates whether the operand being examined may be replaced
5224 with something that matches is_gimple_val (if true) or something
5225 slightly more complicated (if false). "Something" technically
5226 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5227 but we never try to form anything more complicated than that, so
5228 we don't bother checking.
5230 Also note that CALLBACK should update this flag while walking the
5231 sub-expressions of a statement. For instance, when walking the
5232 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5233 to true, however, when walking &var, the operand of that
5234 ADDR_EXPR does not need to be a GIMPLE value. */
5235 BOOL_BITFIELD val_only : 1;
5237 /* True if we are currently walking the LHS of an assignment. */
5238 BOOL_BITFIELD is_lhs : 1;
5240 /* Optional. Set to true by the callback functions if they made any
5241 changes. */
5242 BOOL_BITFIELD changed : 1;
5244 /* True if we're interested in location information. */
5245 BOOL_BITFIELD want_locations : 1;
5247 /* True if we've removed the statement that was processed. */
5248 BOOL_BITFIELD removed_stmt : 1;
5251 /* Callback for walk_gimple_stmt. Called for every statement found
5252 during traversal. The first argument points to the statement to
5253 walk. The second argument is a flag that the callback sets to
5254 'true' if it the callback handled all the operands and
5255 sub-statements of the statement (the default value of this flag is
5256 'false'). The third argument is an anonymous pointer to data
5257 to be used by the callback. */
5258 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5259 struct walk_stmt_info *);
5261 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5262 struct walk_stmt_info *);
5263 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5264 struct walk_stmt_info *);
5265 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5266 struct walk_stmt_info *);
5267 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5269 /* Enum and arrays used for allocation stats. Keep in sync with
5270 gimple.c:gimple_alloc_kind_names. */
5271 enum gimple_alloc_kind
5273 gimple_alloc_kind_assign, /* Assignments. */
5274 gimple_alloc_kind_phi, /* PHI nodes. */
5275 gimple_alloc_kind_cond, /* Conditionals. */
5276 gimple_alloc_kind_rest, /* Everything else. */
5277 gimple_alloc_kind_all
5280 extern int gimple_alloc_counts[];
5281 extern int gimple_alloc_sizes[];
5283 /* Return the allocation kind for a given stmt CODE. */
5284 static inline enum gimple_alloc_kind
5285 gimple_alloc_kind (enum gimple_code code)
5287 switch (code)
5289 case GIMPLE_ASSIGN:
5290 return gimple_alloc_kind_assign;
5291 case GIMPLE_PHI:
5292 return gimple_alloc_kind_phi;
5293 case GIMPLE_COND:
5294 return gimple_alloc_kind_cond;
5295 default:
5296 return gimple_alloc_kind_rest;
5300 extern void dump_gimple_statistics (void);
5302 /* In gimple-fold.c. */
5303 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5304 tree gimple_fold_builtin (gimple);
5305 bool fold_stmt (gimple_stmt_iterator *);
5306 bool fold_stmt_inplace (gimple_stmt_iterator *);
5307 tree get_symbol_constant_value (tree);
5308 tree canonicalize_constructor_val (tree, tree);
5309 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5310 enum tree_code, tree, tree);
5311 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5312 enum tree_code, tree, tree);
5314 bool gimple_val_nonnegative_real_p (tree);
5315 #endif /* GCC_GIMPLE_H */