2013-01-29 Janus Weil <janus@gcc.gnu.org>
[official-gcc.git] / gcc / gimple.h
blob4bd6b3d71ccf66e095e8a68199fd4641cea1bb94
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2013 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 "ggc.h"
28 #include "basic-block.h"
29 #include "tree.h"
30 #include "tree-ssa-operands.h"
31 #include "tree-ssa-alias.h"
32 #include "internal-fn.h"
34 typedef gimple gimple_seq_node;
36 /* For each block, the PHI nodes that need to be rewritten are stored into
37 these vectors. */
38 typedef vec<gimple> gimple_vec;
40 enum gimple_code {
41 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
42 #include "gimple.def"
43 #undef DEFGSCODE
44 LAST_AND_UNUSED_GIMPLE_CODE
47 extern const char *const gimple_code_name[];
48 extern const unsigned char gimple_rhs_class_table[];
50 /* Error out if a gimple tuple is addressed incorrectly. */
51 #if defined ENABLE_GIMPLE_CHECKING
52 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
53 extern void gimple_check_failed (const_gimple, const char *, int, \
54 const char *, enum gimple_code, \
55 enum tree_code) ATTRIBUTE_NORETURN;
57 #define GIMPLE_CHECK(GS, CODE) \
58 do { \
59 const_gimple __gs = (GS); \
60 if (gimple_code (__gs) != (CODE)) \
61 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
62 (CODE), ERROR_MARK); \
63 } while (0)
64 #else /* not ENABLE_GIMPLE_CHECKING */
65 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
66 #define GIMPLE_CHECK(GS, CODE) (void)0
67 #endif
69 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
70 get_gimple_rhs_class. */
71 enum gimple_rhs_class
73 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
74 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
75 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
76 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
77 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
78 name, a _DECL, a _REF, etc. */
81 /* Specific flags for individual GIMPLE statements. These flags are
82 always stored in gimple_statement_base.subcode and they may only be
83 defined for statement codes that do not use sub-codes.
85 Values for the masks can overlap as long as the overlapping values
86 are never used in the same statement class.
88 The maximum mask value that can be defined is 1 << 15 (i.e., each
89 statement code can hold up to 16 bitflags).
91 Keep this list sorted. */
92 enum gf_mask {
93 GF_ASM_INPUT = 1 << 0,
94 GF_ASM_VOLATILE = 1 << 1,
95 GF_CALL_FROM_THUNK = 1 << 0,
96 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
97 GF_CALL_TAILCALL = 1 << 2,
98 GF_CALL_VA_ARG_PACK = 1 << 3,
99 GF_CALL_NOTHROW = 1 << 4,
100 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
101 GF_CALL_INTERNAL = 1 << 6,
102 GF_OMP_PARALLEL_COMBINED = 1 << 0,
104 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
105 a thread synchronization via some sort of barrier. The exact barrier
106 that would otherwise be emitted is dependent on the OMP statement with
107 which this return is associated. */
108 GF_OMP_RETURN_NOWAIT = 1 << 0,
110 GF_OMP_SECTION_LAST = 1 << 0,
111 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
112 GF_PREDICT_TAKEN = 1 << 15
115 /* Currently, there are only two types of gimple debug stmt. Others are
116 envisioned, for example, to enable the generation of is_stmt notes
117 in line number information, to mark sequence points, etc. This
118 subcode is to be used to tell them apart. */
119 enum gimple_debug_subcode {
120 GIMPLE_DEBUG_BIND = 0,
121 GIMPLE_DEBUG_SOURCE_BIND = 1
124 /* Masks for selecting a pass local flag (PLF) to work on. These
125 masks are used by gimple_set_plf and gimple_plf. */
126 enum plf_mask {
127 GF_PLF_1 = 1 << 0,
128 GF_PLF_2 = 1 << 1
131 /* Iterator object for GIMPLE statement sequences. */
133 typedef struct
135 /* Sequence node holding the current statement. */
136 gimple_seq_node ptr;
138 /* Sequence and basic block holding the statement. These fields
139 are necessary to handle edge cases such as when statement is
140 added to an empty basic block or when the last statement of a
141 block/sequence is removed. */
142 gimple_seq *seq;
143 basic_block bb;
144 } gimple_stmt_iterator;
147 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
148 are for 64 bit hosts. */
150 struct GTY((chain_next ("%h.next"))) gimple_statement_base {
151 /* [ WORD 1 ]
152 Main identifying code for a tuple. */
153 ENUM_BITFIELD(gimple_code) code : 8;
155 /* Nonzero if a warning should not be emitted on this tuple. */
156 unsigned int no_warning : 1;
158 /* Nonzero if this tuple has been visited. Passes are responsible
159 for clearing this bit before using it. */
160 unsigned int visited : 1;
162 /* Nonzero if this tuple represents a non-temporal move. */
163 unsigned int nontemporal_move : 1;
165 /* Pass local flags. These flags are free for any pass to use as
166 they see fit. Passes should not assume that these flags contain
167 any useful value when the pass starts. Any initial state that
168 the pass requires should be set on entry to the pass. See
169 gimple_set_plf and gimple_plf for usage. */
170 unsigned int plf : 2;
172 /* Nonzero if this statement has been modified and needs to have its
173 operands rescanned. */
174 unsigned modified : 1;
176 /* Nonzero if this statement contains volatile operands. */
177 unsigned has_volatile_ops : 1;
179 /* The SUBCODE field can be used for tuple-specific flags for tuples
180 that do not require subcodes. Note that SUBCODE should be at
181 least as wide as tree codes, as several tuples store tree codes
182 in there. */
183 unsigned int subcode : 16;
185 /* UID of this statement. This is used by passes that want to
186 assign IDs to statements. It must be assigned and used by each
187 pass. By default it should be assumed to contain garbage. */
188 unsigned uid;
190 /* [ WORD 2 ]
191 Locus information for debug info. */
192 location_t location;
194 /* Number of operands in this tuple. */
195 unsigned num_ops;
197 /* [ WORD 3 ]
198 Basic block holding this statement. */
199 basic_block bb;
201 /* [ WORD 4-5 ]
202 Linked lists of gimple statements. The next pointers form
203 a NULL terminated list, the prev pointers are a cyclic list.
204 A gimple statement is hence also a double-ended list of
205 statements, with the pointer itself being the first element,
206 and the prev pointer being the last. */
207 gimple next;
208 gimple GTY((skip)) prev;
212 /* Base structure for tuples with operands. */
214 struct GTY(()) gimple_statement_with_ops_base
216 /* [ WORD 1-6 ] */
217 struct gimple_statement_base gsbase;
219 /* [ WORD 7 ]
220 SSA operand vectors. NOTE: It should be possible to
221 amalgamate these vectors with the operand vector OP. However,
222 the SSA operand vectors are organized differently and contain
223 more information (like immediate use chaining). */
224 struct use_optype_d GTY((skip (""))) *use_ops;
228 /* Statements that take register operands. */
230 struct GTY(()) gimple_statement_with_ops
232 /* [ WORD 1-7 ] */
233 struct gimple_statement_with_ops_base opbase;
235 /* [ WORD 8 ]
236 Operand vector. NOTE! This must always be the last field
237 of this structure. In particular, this means that this
238 structure cannot be embedded inside another one. */
239 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
243 /* Base for statements that take both memory and register operands. */
245 struct GTY(()) gimple_statement_with_memory_ops_base
247 /* [ WORD 1-7 ] */
248 struct gimple_statement_with_ops_base opbase;
250 /* [ WORD 8-9 ]
251 Virtual operands for this statement. The GC will pick them
252 up via the ssa_names array. */
253 tree GTY((skip (""))) vdef;
254 tree GTY((skip (""))) vuse;
258 /* Statements that take both memory and register operands. */
260 struct GTY(()) gimple_statement_with_memory_ops
262 /* [ WORD 1-9 ] */
263 struct gimple_statement_with_memory_ops_base membase;
265 /* [ WORD 10 ]
266 Operand vector. NOTE! This must always be the last field
267 of this structure. In particular, this means that this
268 structure cannot be embedded inside another one. */
269 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
273 /* Call statements that take both memory and register operands. */
275 struct GTY(()) gimple_statement_call
277 /* [ WORD 1-9 ] */
278 struct gimple_statement_with_memory_ops_base membase;
280 /* [ WORD 10-13 ] */
281 struct pt_solution call_used;
282 struct pt_solution call_clobbered;
284 /* [ WORD 14 ] */
285 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
286 tree GTY ((tag ("0"))) fntype;
287 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
288 } u;
290 /* [ WORD 15 ]
291 Operand vector. NOTE! This must always be the last field
292 of this structure. In particular, this means that this
293 structure cannot be embedded inside another one. */
294 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
298 /* OpenMP statements (#pragma omp). */
300 struct GTY(()) gimple_statement_omp {
301 /* [ WORD 1-6 ] */
302 struct gimple_statement_base gsbase;
304 /* [ WORD 7 ] */
305 gimple_seq body;
309 /* GIMPLE_BIND */
311 struct GTY(()) gimple_statement_bind {
312 /* [ WORD 1-6 ] */
313 struct gimple_statement_base gsbase;
315 /* [ WORD 7 ]
316 Variables declared in this scope. */
317 tree vars;
319 /* [ WORD 8 ]
320 This is different than the BLOCK field in gimple_statement_base,
321 which is analogous to TREE_BLOCK (i.e., the lexical block holding
322 this statement). This field is the equivalent of BIND_EXPR_BLOCK
323 in tree land (i.e., the lexical scope defined by this bind). See
324 gimple-low.c. */
325 tree block;
327 /* [ WORD 9 ] */
328 gimple_seq body;
332 /* GIMPLE_CATCH */
334 struct GTY(()) gimple_statement_catch {
335 /* [ WORD 1-6 ] */
336 struct gimple_statement_base gsbase;
338 /* [ WORD 7 ] */
339 tree types;
341 /* [ WORD 8 ] */
342 gimple_seq handler;
346 /* GIMPLE_EH_FILTER */
348 struct GTY(()) gimple_statement_eh_filter {
349 /* [ WORD 1-6 ] */
350 struct gimple_statement_base gsbase;
352 /* [ WORD 7 ]
353 Filter types. */
354 tree types;
356 /* [ WORD 8 ]
357 Failure actions. */
358 gimple_seq failure;
361 /* GIMPLE_EH_ELSE */
363 struct GTY(()) gimple_statement_eh_else {
364 /* [ WORD 1-6 ] */
365 struct gimple_statement_base gsbase;
367 /* [ WORD 7,8 ] */
368 gimple_seq n_body, e_body;
371 /* GIMPLE_EH_MUST_NOT_THROW */
373 struct GTY(()) gimple_statement_eh_mnt {
374 /* [ WORD 1-6 ] */
375 struct gimple_statement_base gsbase;
377 /* [ WORD 7 ] Abort function decl. */
378 tree fndecl;
381 /* GIMPLE_PHI */
383 struct GTY(()) gimple_statement_phi {
384 /* [ WORD 1-6 ] */
385 struct gimple_statement_base gsbase;
387 /* [ WORD 7 ] */
388 unsigned capacity;
389 unsigned nargs;
391 /* [ WORD 8 ] */
392 tree result;
394 /* [ WORD 9 ] */
395 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
399 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
401 struct GTY(()) gimple_statement_eh_ctrl
403 /* [ WORD 1-6 ] */
404 struct gimple_statement_base gsbase;
406 /* [ WORD 7 ]
407 Exception region number. */
408 int region;
412 /* GIMPLE_TRY */
414 struct GTY(()) gimple_statement_try {
415 /* [ WORD 1-6 ] */
416 struct gimple_statement_base gsbase;
418 /* [ WORD 7 ]
419 Expression to evaluate. */
420 gimple_seq eval;
422 /* [ WORD 8 ]
423 Cleanup expression. */
424 gimple_seq cleanup;
427 /* Kind of GIMPLE_TRY statements. */
428 enum gimple_try_flags
430 /* A try/catch. */
431 GIMPLE_TRY_CATCH = 1 << 0,
433 /* A try/finally. */
434 GIMPLE_TRY_FINALLY = 1 << 1,
435 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
437 /* Analogous to TRY_CATCH_IS_CLEANUP. */
438 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
441 /* GIMPLE_WITH_CLEANUP_EXPR */
443 struct GTY(()) gimple_statement_wce {
444 /* [ WORD 1-6 ] */
445 struct gimple_statement_base gsbase;
447 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
448 executed if an exception is thrown, not on normal exit of its
449 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
450 in TARGET_EXPRs. */
452 /* [ WORD 7 ]
453 Cleanup expression. */
454 gimple_seq cleanup;
458 /* GIMPLE_ASM */
460 struct GTY(()) gimple_statement_asm
462 /* [ WORD 1-9 ] */
463 struct gimple_statement_with_memory_ops_base membase;
465 /* [ WORD 10 ]
466 __asm__ statement. */
467 const char *string;
469 /* [ WORD 11 ]
470 Number of inputs, outputs, clobbers, labels. */
471 unsigned char ni;
472 unsigned char no;
473 unsigned char nc;
474 unsigned char nl;
476 /* [ WORD 12 ]
477 Operand vector. NOTE! This must always be the last field
478 of this structure. In particular, this means that this
479 structure cannot be embedded inside another one. */
480 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
483 /* GIMPLE_OMP_CRITICAL */
485 struct GTY(()) gimple_statement_omp_critical {
486 /* [ WORD 1-7 ] */
487 struct gimple_statement_omp omp;
489 /* [ WORD 8 ]
490 Critical section name. */
491 tree name;
495 struct GTY(()) gimple_omp_for_iter {
496 /* Condition code. */
497 enum tree_code cond;
499 /* Index variable. */
500 tree index;
502 /* Initial value. */
503 tree initial;
505 /* Final value. */
506 tree final;
508 /* Increment. */
509 tree incr;
512 /* GIMPLE_OMP_FOR */
514 struct GTY(()) gimple_statement_omp_for {
515 /* [ WORD 1-7 ] */
516 struct gimple_statement_omp omp;
518 /* [ WORD 8 ] */
519 tree clauses;
521 /* [ WORD 9 ]
522 Number of elements in iter array. */
523 size_t collapse;
525 /* [ WORD 10 ] */
526 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
528 /* [ WORD 11 ]
529 Pre-body evaluated before the loop body begins. */
530 gimple_seq pre_body;
534 /* GIMPLE_OMP_PARALLEL */
536 struct GTY(()) gimple_statement_omp_parallel {
537 /* [ WORD 1-7 ] */
538 struct gimple_statement_omp omp;
540 /* [ WORD 8 ]
541 Clauses. */
542 tree clauses;
544 /* [ WORD 9 ]
545 Child function holding the body of the parallel region. */
546 tree child_fn;
548 /* [ WORD 10 ]
549 Shared data argument. */
550 tree data_arg;
554 /* GIMPLE_OMP_TASK */
556 struct GTY(()) gimple_statement_omp_task {
557 /* [ WORD 1-10 ] */
558 struct gimple_statement_omp_parallel par;
560 /* [ WORD 11 ]
561 Child function holding firstprivate initialization if needed. */
562 tree copy_fn;
564 /* [ WORD 12-13 ]
565 Size and alignment in bytes of the argument data block. */
566 tree arg_size;
567 tree arg_align;
571 /* GIMPLE_OMP_SECTION */
572 /* Uses struct gimple_statement_omp. */
575 /* GIMPLE_OMP_SECTIONS */
577 struct GTY(()) gimple_statement_omp_sections {
578 /* [ WORD 1-7 ] */
579 struct gimple_statement_omp omp;
581 /* [ WORD 8 ] */
582 tree clauses;
584 /* [ WORD 9 ]
585 The control variable used for deciding which of the sections to
586 execute. */
587 tree control;
590 /* GIMPLE_OMP_CONTINUE.
592 Note: This does not inherit from gimple_statement_omp, because we
593 do not need the body field. */
595 struct GTY(()) gimple_statement_omp_continue {
596 /* [ WORD 1-6 ] */
597 struct gimple_statement_base gsbase;
599 /* [ WORD 7 ] */
600 tree control_def;
602 /* [ WORD 8 ] */
603 tree control_use;
606 /* GIMPLE_OMP_SINGLE */
608 struct GTY(()) gimple_statement_omp_single {
609 /* [ WORD 1-7 ] */
610 struct gimple_statement_omp omp;
612 /* [ WORD 7 ] */
613 tree clauses;
617 /* GIMPLE_OMP_ATOMIC_LOAD.
618 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
619 contains a sequence, which we don't need here. */
621 struct GTY(()) gimple_statement_omp_atomic_load {
622 /* [ WORD 1-6 ] */
623 struct gimple_statement_base gsbase;
625 /* [ WORD 7-8 ] */
626 tree rhs, lhs;
629 /* GIMPLE_OMP_ATOMIC_STORE.
630 See note on GIMPLE_OMP_ATOMIC_LOAD. */
632 struct GTY(()) gimple_statement_omp_atomic_store {
633 /* [ WORD 1-6 ] */
634 struct gimple_statement_base gsbase;
636 /* [ WORD 7 ] */
637 tree val;
640 /* GIMPLE_TRANSACTION. */
642 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
644 /* The __transaction_atomic was declared [[outer]] or it is
645 __transaction_relaxed. */
646 #define GTMA_IS_OUTER (1u << 0)
647 #define GTMA_IS_RELAXED (1u << 1)
648 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
650 /* The transaction is seen to not have an abort. */
651 #define GTMA_HAVE_ABORT (1u << 2)
652 /* The transaction is seen to have loads or stores. */
653 #define GTMA_HAVE_LOAD (1u << 3)
654 #define GTMA_HAVE_STORE (1u << 4)
655 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
656 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
657 /* The transaction WILL enter serial irrevocable mode.
658 An irrevocable block post-dominates the entire transaction, such
659 that all invocations of the transaction will go serial-irrevocable.
660 In such case, we don't bother instrumenting the transaction, and
661 tell the runtime that it should begin the transaction in
662 serial-irrevocable mode. */
663 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
665 struct GTY(()) gimple_statement_transaction
667 /* [ WORD 1-9 ] */
668 struct gimple_statement_with_memory_ops_base gsbase;
670 /* [ WORD 10 ] */
671 gimple_seq body;
673 /* [ WORD 11 ] */
674 tree label;
677 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
678 enum gimple_statement_structure_enum {
679 #include "gsstruct.def"
680 LAST_GSS_ENUM
682 #undef DEFGSSTRUCT
685 /* Define the overall contents of a gimple tuple. It may be any of the
686 structures declared above for various types of tuples. */
688 union GTY ((desc ("gimple_statement_structure (&%h)"),
689 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
690 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
691 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
692 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
693 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
694 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
695 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
696 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
697 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
698 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
699 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
700 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
701 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
702 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
703 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
704 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
705 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
706 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
707 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
708 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
709 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
710 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
711 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
712 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
713 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
714 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
715 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
718 /* In gimple.c. */
720 /* Offset in bytes to the location of the operand vector.
721 Zero if there is no operand vector for this tuple structure. */
722 extern size_t const gimple_ops_offset_[];
724 /* Map GIMPLE codes to GSS codes. */
725 extern enum gimple_statement_structure_enum const gss_for_code_[];
727 /* This variable holds the currently expanded gimple statement for purposes
728 of comminucating the profile info to the builtin expanders. */
729 extern gimple currently_expanding_gimple_stmt;
731 gimple gimple_build_return (tree);
733 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
734 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
736 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
738 gimple
739 gimple_build_assign_with_ops (enum tree_code, tree,
740 tree, tree CXX_MEM_STAT_INFO);
741 gimple
742 gimple_build_assign_with_ops (enum tree_code, tree,
743 tree, tree, tree CXX_MEM_STAT_INFO);
745 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
746 #define gimple_build_debug_bind(var,val,stmt) \
747 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
748 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
749 #define gimple_build_debug_source_bind(var,val,stmt) \
750 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
752 gimple gimple_build_call_vec (tree, vec<tree> );
753 gimple gimple_build_call (tree, unsigned, ...);
754 gimple gimple_build_call_valist (tree, unsigned, va_list);
755 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
756 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
757 gimple gimple_build_call_from_tree (tree);
758 gimple gimplify_assign (tree, tree, gimple_seq *);
759 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
760 gimple gimple_build_label (tree label);
761 gimple gimple_build_goto (tree dest);
762 gimple gimple_build_nop (void);
763 gimple gimple_build_bind (tree, gimple_seq, tree);
764 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
765 vec<tree, va_gc> *, vec<tree, va_gc> *,
766 vec<tree, va_gc> *);
767 gimple gimple_build_catch (tree, gimple_seq);
768 gimple gimple_build_eh_filter (tree, gimple_seq);
769 gimple gimple_build_eh_must_not_throw (tree);
770 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
771 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
772 gimple gimple_build_wce (gimple_seq);
773 gimple gimple_build_resx (int);
774 gimple gimple_build_eh_dispatch (int);
775 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
776 gimple gimple_build_switch (tree, tree, vec<tree> );
777 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
778 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
779 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
780 gimple gimple_build_omp_critical (gimple_seq, tree);
781 gimple gimple_build_omp_section (gimple_seq);
782 gimple gimple_build_omp_continue (tree, tree);
783 gimple gimple_build_omp_master (gimple_seq);
784 gimple gimple_build_omp_return (bool);
785 gimple gimple_build_omp_ordered (gimple_seq);
786 gimple gimple_build_omp_sections (gimple_seq, tree);
787 gimple gimple_build_omp_sections_switch (void);
788 gimple gimple_build_omp_single (gimple_seq, tree);
789 gimple gimple_build_cdt (tree, tree);
790 gimple gimple_build_omp_atomic_load (tree, tree);
791 gimple gimple_build_omp_atomic_store (tree);
792 gimple gimple_build_transaction (gimple_seq, tree);
793 gimple gimple_build_predict (enum br_predictor, enum prediction);
794 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
795 void sort_case_labels (vec<tree> );
796 void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
797 void gimple_set_body (tree, gimple_seq);
798 gimple_seq gimple_body (tree);
799 bool gimple_has_body_p (tree);
800 gimple_seq gimple_seq_alloc (void);
801 void gimple_seq_free (gimple_seq);
802 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
803 gimple_seq gimple_seq_copy (gimple_seq);
804 bool gimple_call_same_target_p (const_gimple, const_gimple);
805 int gimple_call_flags (const_gimple);
806 int gimple_call_return_flags (const_gimple);
807 int gimple_call_arg_flags (const_gimple, unsigned);
808 void gimple_call_reset_alias_info (gimple);
809 bool gimple_assign_copy_p (gimple);
810 bool gimple_assign_ssa_name_copy_p (gimple);
811 bool gimple_assign_unary_nop_p (gimple);
812 void gimple_set_bb (gimple, basic_block);
813 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
814 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
815 tree, tree, tree);
816 tree gimple_get_lhs (const_gimple);
817 void gimple_set_lhs (gimple, tree);
818 void gimple_replace_lhs (gimple, tree);
819 gimple gimple_copy (gimple);
820 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
821 gimple gimple_build_cond_from_tree (tree, tree, tree);
822 void gimple_cond_set_condition_from_tree (gimple, tree);
823 bool gimple_has_side_effects (const_gimple);
824 bool gimple_could_trap_p (gimple);
825 bool gimple_could_trap_p_1 (gimple, bool, bool);
826 bool gimple_assign_rhs_could_trap_p (gimple);
827 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
828 bool empty_body_p (gimple_seq);
829 unsigned get_gimple_rhs_num_ops (enum tree_code);
830 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
831 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
832 const char *gimple_decl_printable_name (tree, int);
833 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
834 tree gimple_extract_devirt_binfo_from_cst (tree);
836 /* Returns true iff T is a scalar register variable. */
837 extern bool is_gimple_reg (tree);
838 /* Returns true iff T is any sort of variable. */
839 extern bool is_gimple_variable (tree);
840 /* Returns true iff T is any sort of symbol. */
841 extern bool is_gimple_id (tree);
842 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
843 extern bool is_gimple_min_lval (tree);
844 /* Returns true iff T is something whose address can be taken. */
845 extern bool is_gimple_addressable (tree);
846 /* Returns true iff T is any valid GIMPLE lvalue. */
847 extern bool is_gimple_lvalue (tree);
849 /* Returns true iff T is a GIMPLE address. */
850 bool is_gimple_address (const_tree);
851 /* Returns true iff T is a GIMPLE invariant address. */
852 bool is_gimple_invariant_address (const_tree);
853 /* Returns true iff T is a GIMPLE invariant address at interprocedural
854 level. */
855 bool is_gimple_ip_invariant_address (const_tree);
856 /* Returns true iff T is a valid GIMPLE constant. */
857 bool is_gimple_constant (const_tree);
858 /* Returns true iff T is a GIMPLE restricted function invariant. */
859 extern bool is_gimple_min_invariant (const_tree);
860 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
861 extern bool is_gimple_ip_invariant (const_tree);
862 /* Returns true iff T is a GIMPLE rvalue. */
863 extern bool is_gimple_val (tree);
864 /* Returns true iff T is a GIMPLE asm statement input. */
865 extern bool is_gimple_asm_val (tree);
866 /* Returns true iff T is a valid address operand of a MEM_REF. */
867 bool is_gimple_mem_ref_addr (tree);
869 /* Returns true iff T is a valid if-statement condition. */
870 extern bool is_gimple_condexpr (tree);
872 /* Returns true iff T is a valid call address expression. */
873 extern bool is_gimple_call_addr (tree);
875 /* Return TRUE iff stmt is a call to a built-in function. */
876 extern bool is_gimple_builtin_call (gimple stmt);
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_class);
897 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
898 extern bool gimple_asm_clobbers_memory_p (const_gimple);
900 /* In gimplify.c */
901 extern tree create_tmp_var_raw (tree, const char *);
902 extern tree create_tmp_var_name (const char *);
903 extern tree create_tmp_var (tree, const char *);
904 extern tree create_tmp_reg (tree, const char *);
905 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
906 extern tree get_formal_tmp_var (tree, gimple_seq *);
907 extern void declare_vars (tree, gimple, bool);
908 extern void annotate_all_with_location (gimple_seq, location_t);
910 /* Validation of GIMPLE expressions. Note that these predicates only check
911 the basic form of the expression, they don't recurse to make sure that
912 underlying nodes are also of the right form. */
913 typedef bool (*gimple_predicate)(tree);
916 /* FIXME we should deduce this from the predicate. */
917 enum fallback {
918 fb_none = 0, /* Do not generate a temporary. */
920 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
921 gimplified expression. */
923 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
924 gimplified expression. */
926 fb_mayfail = 4, /* Gimplification may fail. Error issued
927 afterwards. */
928 fb_either= fb_rvalue | fb_lvalue
931 typedef int fallback_t;
933 enum gimplify_status {
934 GS_ERROR = -2, /* Something Bad Seen. */
935 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
936 GS_OK = 0, /* We did something, maybe more to do. */
937 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
940 struct gimplify_ctx
942 struct gimplify_ctx *prev_context;
944 vec<gimple> bind_expr_stack;
945 tree temps;
946 gimple_seq conditional_cleanups;
947 tree exit_label;
948 tree return_temp;
950 vec<tree> case_labels;
951 /* The formal temporary table. Should this be persistent? */
952 htab_t temp_htab;
954 int conditions;
955 bool save_stack;
956 bool into_ssa;
957 bool allow_rhs_cond_expr;
958 bool in_cleanup_point_expr;
961 /* Return true if gimplify_one_sizepos doesn't need to gimplify
962 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
963 fields). */
964 static inline bool
965 is_gimple_sizepos (tree expr)
967 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
968 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
969 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
970 function, the gimplifier will want to replace it with a new variable,
971 but that will cause problems if this type is from outside the function.
972 It's OK to have that here. */
973 return (expr == NULL_TREE
974 || TREE_CONSTANT (expr)
975 || TREE_CODE (expr) == VAR_DECL
976 || CONTAINS_PLACEHOLDER_P (expr));
979 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
980 bool (*) (tree), fallback_t);
981 extern void gimplify_type_sizes (tree, gimple_seq *);
982 extern void gimplify_one_sizepos (tree *, gimple_seq *);
983 enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *,
984 bool, tree);
985 extern bool gimplify_stmt (tree *, gimple_seq *);
986 extern gimple gimplify_body (tree, bool);
987 extern void push_gimplify_context (struct gimplify_ctx *);
988 extern void pop_gimplify_context (gimple);
989 extern void gimplify_and_add (tree, gimple_seq *);
991 /* Miscellaneous helpers. */
992 extern void gimple_add_tmp_var (tree);
993 extern gimple gimple_current_bind_expr (void);
994 extern vec<gimple> gimple_bind_expr_stack (void);
995 extern tree voidify_wrapper_expr (tree, tree);
996 extern tree build_and_jump (tree *);
997 extern tree force_labels_r (tree *, int *, void *);
998 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
999 gimple_seq *);
1000 struct gimplify_omp_ctx;
1001 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1002 extern tree gimple_boolify (tree);
1003 extern gimple_predicate rhs_predicate_for (tree);
1004 extern tree canonicalize_cond_expr_cond (tree);
1006 /* In omp-low.c. */
1007 extern tree omp_reduction_init (tree, tree);
1009 /* In trans-mem.c. */
1010 extern void diagnose_tm_safe_errors (tree);
1011 extern void compute_transaction_bits (void);
1013 /* In tree-nested.c. */
1014 extern void lower_nested_functions (tree);
1015 extern void insert_field_into_struct (tree, tree);
1017 /* In gimplify.c. */
1018 extern void gimplify_function_tree (tree);
1020 /* In cfgexpand.c. */
1021 extern tree gimple_assign_rhs_to_tree (gimple);
1023 /* In builtins.c */
1024 extern bool validate_gimple_arglist (const_gimple, ...);
1026 /* In tree-ssa.c */
1027 extern bool tree_ssa_useless_type_conversion (tree);
1028 extern tree tree_ssa_strip_useless_type_conversions (tree);
1029 extern bool useless_type_conversion_p (tree, tree);
1030 extern bool types_compatible_p (tree, tree);
1032 /* Return the first node in GIMPLE sequence S. */
1034 static inline gimple_seq_node
1035 gimple_seq_first (gimple_seq s)
1037 return s;
1041 /* Return the first statement in GIMPLE sequence S. */
1043 static inline gimple
1044 gimple_seq_first_stmt (gimple_seq s)
1046 gimple_seq_node n = gimple_seq_first (s);
1047 return n;
1051 /* Return the last node in GIMPLE sequence S. */
1053 static inline gimple_seq_node
1054 gimple_seq_last (gimple_seq s)
1056 return s ? s->gsbase.prev : NULL;
1060 /* Return the last statement in GIMPLE sequence S. */
1062 static inline gimple
1063 gimple_seq_last_stmt (gimple_seq s)
1065 gimple_seq_node n = gimple_seq_last (s);
1066 return n;
1070 /* Set the last node in GIMPLE sequence *PS to LAST. */
1072 static inline void
1073 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1075 (*ps)->gsbase.prev = last;
1079 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1081 static inline void
1082 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1084 *ps = first;
1088 /* Return true if GIMPLE sequence S is empty. */
1090 static inline bool
1091 gimple_seq_empty_p (gimple_seq s)
1093 return s == NULL;
1097 void gimple_seq_add_stmt (gimple_seq *, gimple);
1099 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1100 *SEQ_P is NULL, a new sequence is allocated. This function is
1101 similar to gimple_seq_add_stmt, but does not scan the operands.
1102 During gimplification, we need to manipulate statement sequences
1103 before the def/use vectors have been constructed. */
1104 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1106 /* Allocate a new sequence and initialize its first element with STMT. */
1108 static inline gimple_seq
1109 gimple_seq_alloc_with_stmt (gimple stmt)
1111 gimple_seq seq = NULL;
1112 gimple_seq_add_stmt (&seq, stmt);
1113 return seq;
1117 /* Returns the sequence of statements in BB. */
1119 static inline gimple_seq
1120 bb_seq (const_basic_block bb)
1122 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1125 static inline gimple_seq *
1126 bb_seq_addr (basic_block bb)
1128 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1131 /* Sets the sequence of statements in BB to SEQ. */
1133 static inline void
1134 set_bb_seq (basic_block bb, gimple_seq seq)
1136 gcc_checking_assert (!(bb->flags & BB_RTL));
1137 bb->il.gimple.seq = seq;
1141 /* Return the code for GIMPLE statement G. */
1143 static inline enum gimple_code
1144 gimple_code (const_gimple g)
1146 return g->gsbase.code;
1150 /* Return the GSS code used by a GIMPLE code. */
1152 static inline enum gimple_statement_structure_enum
1153 gss_for_code (enum gimple_code code)
1155 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1156 return gss_for_code_[code];
1160 /* Return which GSS code is used by GS. */
1162 static inline enum gimple_statement_structure_enum
1163 gimple_statement_structure (gimple gs)
1165 return gss_for_code (gimple_code (gs));
1169 /* Return true if statement G has sub-statements. This is only true for
1170 High GIMPLE statements. */
1172 static inline bool
1173 gimple_has_substatements (gimple g)
1175 switch (gimple_code (g))
1177 case GIMPLE_BIND:
1178 case GIMPLE_CATCH:
1179 case GIMPLE_EH_FILTER:
1180 case GIMPLE_EH_ELSE:
1181 case GIMPLE_TRY:
1182 case GIMPLE_OMP_FOR:
1183 case GIMPLE_OMP_MASTER:
1184 case GIMPLE_OMP_ORDERED:
1185 case GIMPLE_OMP_SECTION:
1186 case GIMPLE_OMP_PARALLEL:
1187 case GIMPLE_OMP_TASK:
1188 case GIMPLE_OMP_SECTIONS:
1189 case GIMPLE_OMP_SINGLE:
1190 case GIMPLE_OMP_CRITICAL:
1191 case GIMPLE_WITH_CLEANUP_EXPR:
1192 case GIMPLE_TRANSACTION:
1193 return true;
1195 default:
1196 return false;
1201 /* Return the basic block holding statement G. */
1203 static inline basic_block
1204 gimple_bb (const_gimple g)
1206 return g->gsbase.bb;
1210 /* Return the lexical scope block holding statement G. */
1212 static inline tree
1213 gimple_block (const_gimple g)
1215 return LOCATION_BLOCK (g->gsbase.location);
1219 /* Set BLOCK to be the lexical scope block holding statement G. */
1221 static inline void
1222 gimple_set_block (gimple g, tree block)
1224 if (block)
1225 g->gsbase.location =
1226 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1227 else
1228 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1232 /* Return location information for statement G. */
1234 static inline location_t
1235 gimple_location (const_gimple g)
1237 return g->gsbase.location;
1240 /* Return pointer to location information for statement G. */
1242 static inline const location_t *
1243 gimple_location_ptr (const_gimple g)
1245 return &g->gsbase.location;
1249 /* Set location information for statement G. */
1251 static inline void
1252 gimple_set_location (gimple g, location_t location)
1254 g->gsbase.location = location;
1258 /* Return true if G contains location information. */
1260 static inline bool
1261 gimple_has_location (const_gimple g)
1263 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1267 /* Return the file name of the location of STMT. */
1269 static inline const char *
1270 gimple_filename (const_gimple stmt)
1272 return LOCATION_FILE (gimple_location (stmt));
1276 /* Return the line number of the location of STMT. */
1278 static inline int
1279 gimple_lineno (const_gimple stmt)
1281 return LOCATION_LINE (gimple_location (stmt));
1285 /* Determine whether SEQ is a singleton. */
1287 static inline bool
1288 gimple_seq_singleton_p (gimple_seq seq)
1290 return ((gimple_seq_first (seq) != NULL)
1291 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1294 /* Return true if no warnings should be emitted for statement STMT. */
1296 static inline bool
1297 gimple_no_warning_p (const_gimple stmt)
1299 return stmt->gsbase.no_warning;
1302 /* Set the no_warning flag of STMT to NO_WARNING. */
1304 static inline void
1305 gimple_set_no_warning (gimple stmt, bool no_warning)
1307 stmt->gsbase.no_warning = (unsigned) no_warning;
1310 /* Set the visited status on statement STMT to VISITED_P. */
1312 static inline void
1313 gimple_set_visited (gimple stmt, bool visited_p)
1315 stmt->gsbase.visited = (unsigned) visited_p;
1319 /* Return the visited status for statement STMT. */
1321 static inline bool
1322 gimple_visited_p (gimple stmt)
1324 return stmt->gsbase.visited;
1328 /* Set pass local flag PLF on statement STMT to VAL_P. */
1330 static inline void
1331 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1333 if (val_p)
1334 stmt->gsbase.plf |= (unsigned int) plf;
1335 else
1336 stmt->gsbase.plf &= ~((unsigned int) plf);
1340 /* Return the value of pass local flag PLF on statement STMT. */
1342 static inline unsigned int
1343 gimple_plf (gimple stmt, enum plf_mask plf)
1345 return stmt->gsbase.plf & ((unsigned int) plf);
1349 /* Set the UID of statement. */
1351 static inline void
1352 gimple_set_uid (gimple g, unsigned uid)
1354 g->gsbase.uid = uid;
1358 /* Return the UID of statement. */
1360 static inline unsigned
1361 gimple_uid (const_gimple g)
1363 return g->gsbase.uid;
1367 /* Make statement G a singleton sequence. */
1369 static inline void
1370 gimple_init_singleton (gimple g)
1372 g->gsbase.next = NULL;
1373 g->gsbase.prev = g;
1377 /* Return true if GIMPLE statement G has register or memory operands. */
1379 static inline bool
1380 gimple_has_ops (const_gimple g)
1382 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1386 /* Return true if GIMPLE statement G has memory operands. */
1388 static inline bool
1389 gimple_has_mem_ops (const_gimple g)
1391 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1395 /* Return the set of USE operands for statement G. */
1397 static inline struct use_optype_d *
1398 gimple_use_ops (const_gimple g)
1400 if (!gimple_has_ops (g))
1401 return NULL;
1402 return g->gsops.opbase.use_ops;
1406 /* Set USE to be the set of USE operands for statement G. */
1408 static inline void
1409 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1411 gcc_gimple_checking_assert (gimple_has_ops (g));
1412 g->gsops.opbase.use_ops = use;
1416 /* Return the set of VUSE operand for statement G. */
1418 static inline use_operand_p
1419 gimple_vuse_op (const_gimple g)
1421 struct use_optype_d *ops;
1422 if (!gimple_has_mem_ops (g))
1423 return NULL_USE_OPERAND_P;
1424 ops = g->gsops.opbase.use_ops;
1425 if (ops
1426 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1427 return USE_OP_PTR (ops);
1428 return NULL_USE_OPERAND_P;
1431 /* Return the set of VDEF operand for statement G. */
1433 static inline def_operand_p
1434 gimple_vdef_op (gimple g)
1436 if (!gimple_has_mem_ops (g))
1437 return NULL_DEF_OPERAND_P;
1438 if (g->gsmembase.vdef)
1439 return &g->gsmembase.vdef;
1440 return NULL_DEF_OPERAND_P;
1444 /* Return the single VUSE operand of the statement G. */
1446 static inline tree
1447 gimple_vuse (const_gimple g)
1449 if (!gimple_has_mem_ops (g))
1450 return NULL_TREE;
1451 return g->gsmembase.vuse;
1454 /* Return the single VDEF operand of the statement G. */
1456 static inline tree
1457 gimple_vdef (const_gimple g)
1459 if (!gimple_has_mem_ops (g))
1460 return NULL_TREE;
1461 return g->gsmembase.vdef;
1464 /* Return the single VUSE operand of the statement G. */
1466 static inline tree *
1467 gimple_vuse_ptr (gimple g)
1469 if (!gimple_has_mem_ops (g))
1470 return NULL;
1471 return &g->gsmembase.vuse;
1474 /* Return the single VDEF operand of the statement G. */
1476 static inline tree *
1477 gimple_vdef_ptr (gimple g)
1479 if (!gimple_has_mem_ops (g))
1480 return NULL;
1481 return &g->gsmembase.vdef;
1484 /* Set the single VUSE operand of the statement G. */
1486 static inline void
1487 gimple_set_vuse (gimple g, tree vuse)
1489 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1490 g->gsmembase.vuse = vuse;
1493 /* Set the single VDEF operand of the statement G. */
1495 static inline void
1496 gimple_set_vdef (gimple g, tree vdef)
1498 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1499 g->gsmembase.vdef = vdef;
1503 /* Return true if statement G has operands and the modified field has
1504 been set. */
1506 static inline bool
1507 gimple_modified_p (const_gimple g)
1509 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1513 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1514 a MODIFIED field. */
1516 static inline void
1517 gimple_set_modified (gimple s, bool modifiedp)
1519 if (gimple_has_ops (s))
1520 s->gsbase.modified = (unsigned) modifiedp;
1524 /* Return the tree code for the expression computed by STMT. This is
1525 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1526 GIMPLE_CALL, return CALL_EXPR as the expression code for
1527 consistency. This is useful when the caller needs to deal with the
1528 three kinds of computation that GIMPLE supports. */
1530 static inline enum tree_code
1531 gimple_expr_code (const_gimple stmt)
1533 enum gimple_code code = gimple_code (stmt);
1534 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1535 return (enum tree_code) stmt->gsbase.subcode;
1536 else
1538 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1539 return CALL_EXPR;
1544 /* Mark statement S as modified, and update it. */
1546 static inline void
1547 update_stmt (gimple s)
1549 if (gimple_has_ops (s))
1551 gimple_set_modified (s, true);
1552 update_stmt_operands (s);
1556 /* Update statement S if it has been optimized. */
1558 static inline void
1559 update_stmt_if_modified (gimple s)
1561 if (gimple_modified_p (s))
1562 update_stmt_operands (s);
1565 /* Return true if statement STMT contains volatile operands. */
1567 static inline bool
1568 gimple_has_volatile_ops (const_gimple stmt)
1570 if (gimple_has_mem_ops (stmt))
1571 return stmt->gsbase.has_volatile_ops;
1572 else
1573 return false;
1577 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1579 static inline void
1580 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1582 if (gimple_has_mem_ops (stmt))
1583 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1586 /* Return true if BB is in a transaction. */
1588 static inline bool
1589 block_in_transaction (basic_block bb)
1591 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1594 /* Return true if STMT is in a transaction. */
1596 static inline bool
1597 gimple_in_transaction (gimple stmt)
1599 return block_in_transaction (gimple_bb (stmt));
1602 /* Return true if statement STMT may access memory. */
1604 static inline bool
1605 gimple_references_memory_p (gimple stmt)
1607 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1611 /* Return the subcode for OMP statement S. */
1613 static inline unsigned
1614 gimple_omp_subcode (const_gimple s)
1616 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1617 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1618 return s->gsbase.subcode;
1621 /* Set the subcode for OMP statement S to SUBCODE. */
1623 static inline void
1624 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1626 /* We only have 16 bits for the subcode. Assert that we are not
1627 overflowing it. */
1628 gcc_gimple_checking_assert (subcode < (1 << 16));
1629 s->gsbase.subcode = subcode;
1632 /* Set the nowait flag on OMP_RETURN statement S. */
1634 static inline void
1635 gimple_omp_return_set_nowait (gimple s)
1637 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1638 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1642 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1643 flag set. */
1645 static inline bool
1646 gimple_omp_return_nowait_p (const_gimple g)
1648 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1649 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1653 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1654 flag set. */
1656 static inline bool
1657 gimple_omp_section_last_p (const_gimple g)
1659 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1660 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1664 /* Set the GF_OMP_SECTION_LAST flag on G. */
1666 static inline void
1667 gimple_omp_section_set_last (gimple g)
1669 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1670 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1674 /* Return true if OMP parallel statement G has the
1675 GF_OMP_PARALLEL_COMBINED flag set. */
1677 static inline bool
1678 gimple_omp_parallel_combined_p (const_gimple g)
1680 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1681 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1685 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1686 value of COMBINED_P. */
1688 static inline void
1689 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1691 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1692 if (combined_p)
1693 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1694 else
1695 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1699 /* Return true if OMP atomic load/store statement G has the
1700 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1702 static inline bool
1703 gimple_omp_atomic_need_value_p (const_gimple g)
1705 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1706 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1707 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1711 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1713 static inline void
1714 gimple_omp_atomic_set_need_value (gimple g)
1716 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1717 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1718 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1722 /* Return the number of operands for statement GS. */
1724 static inline unsigned
1725 gimple_num_ops (const_gimple gs)
1727 return gs->gsbase.num_ops;
1731 /* Set the number of operands for statement GS. */
1733 static inline void
1734 gimple_set_num_ops (gimple gs, unsigned num_ops)
1736 gs->gsbase.num_ops = num_ops;
1740 /* Return the array of operands for statement GS. */
1742 static inline tree *
1743 gimple_ops (gimple gs)
1745 size_t off;
1747 /* All the tuples have their operand vector at the very bottom
1748 of the structure. Note that those structures that do not
1749 have an operand vector have a zero offset. */
1750 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1751 gcc_gimple_checking_assert (off != 0);
1753 return (tree *) ((char *) gs + off);
1757 /* Return operand I for statement GS. */
1759 static inline tree
1760 gimple_op (const_gimple gs, unsigned i)
1762 if (gimple_has_ops (gs))
1764 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1765 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1767 else
1768 return NULL_TREE;
1771 /* Return a pointer to operand I for statement GS. */
1773 static inline tree *
1774 gimple_op_ptr (const_gimple gs, unsigned i)
1776 if (gimple_has_ops (gs))
1778 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1779 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1781 else
1782 return NULL;
1785 /* Set operand I of statement GS to OP. */
1787 static inline void
1788 gimple_set_op (gimple gs, unsigned i, tree op)
1790 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1792 /* Note. It may be tempting to assert that OP matches
1793 is_gimple_operand, but that would be wrong. Different tuples
1794 accept slightly different sets of tree operands. Each caller
1795 should perform its own validation. */
1796 gimple_ops (gs)[i] = op;
1799 /* Return true if GS is a GIMPLE_ASSIGN. */
1801 static inline bool
1802 is_gimple_assign (const_gimple gs)
1804 return gimple_code (gs) == GIMPLE_ASSIGN;
1807 /* Determine if expression CODE is one of the valid expressions that can
1808 be used on the RHS of GIMPLE assignments. */
1810 static inline enum gimple_rhs_class
1811 get_gimple_rhs_class (enum tree_code code)
1813 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1816 /* Return the LHS of assignment statement GS. */
1818 static inline tree
1819 gimple_assign_lhs (const_gimple gs)
1821 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1822 return gimple_op (gs, 0);
1826 /* Return a pointer to the LHS of assignment statement GS. */
1828 static inline tree *
1829 gimple_assign_lhs_ptr (const_gimple gs)
1831 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1832 return gimple_op_ptr (gs, 0);
1836 /* Set LHS to be the LHS operand of assignment statement GS. */
1838 static inline void
1839 gimple_assign_set_lhs (gimple gs, tree lhs)
1841 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1842 gimple_set_op (gs, 0, lhs);
1844 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1845 SSA_NAME_DEF_STMT (lhs) = gs;
1849 /* Return the first operand on the RHS of assignment statement GS. */
1851 static inline tree
1852 gimple_assign_rhs1 (const_gimple gs)
1854 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1855 return gimple_op (gs, 1);
1859 /* Return a pointer to the first operand on the RHS of assignment
1860 statement GS. */
1862 static inline tree *
1863 gimple_assign_rhs1_ptr (const_gimple gs)
1865 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1866 return gimple_op_ptr (gs, 1);
1869 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1871 static inline void
1872 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1874 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1876 gimple_set_op (gs, 1, rhs);
1880 /* Return the second operand on the RHS of assignment statement GS.
1881 If GS does not have two operands, NULL is returned instead. */
1883 static inline tree
1884 gimple_assign_rhs2 (const_gimple gs)
1886 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1888 if (gimple_num_ops (gs) >= 3)
1889 return gimple_op (gs, 2);
1890 else
1891 return NULL_TREE;
1895 /* Return a pointer to the second operand on the RHS of assignment
1896 statement GS. */
1898 static inline tree *
1899 gimple_assign_rhs2_ptr (const_gimple gs)
1901 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1902 return gimple_op_ptr (gs, 2);
1906 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1908 static inline void
1909 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1911 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1913 gimple_set_op (gs, 2, rhs);
1916 /* Return the third operand on the RHS of assignment statement GS.
1917 If GS does not have two operands, NULL is returned instead. */
1919 static inline tree
1920 gimple_assign_rhs3 (const_gimple gs)
1922 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1924 if (gimple_num_ops (gs) >= 4)
1925 return gimple_op (gs, 3);
1926 else
1927 return NULL_TREE;
1930 /* Return a pointer to the third operand on the RHS of assignment
1931 statement GS. */
1933 static inline tree *
1934 gimple_assign_rhs3_ptr (const_gimple gs)
1936 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1937 return gimple_op_ptr (gs, 3);
1941 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1943 static inline void
1944 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1946 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1948 gimple_set_op (gs, 3, rhs);
1951 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1952 to see only a maximum of two operands. */
1954 static inline void
1955 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1956 tree op1, tree op2)
1958 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1961 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1962 to see only a maximum of two operands. */
1964 static inline void
1965 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1966 tree *op1)
1968 tree op2;
1969 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1970 gcc_assert (op2 == NULL_TREE);
1973 /* Returns true if GS is a nontemporal move. */
1975 static inline bool
1976 gimple_assign_nontemporal_move_p (const_gimple gs)
1978 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1979 return gs->gsbase.nontemporal_move;
1982 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1984 static inline void
1985 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1987 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1988 gs->gsbase.nontemporal_move = nontemporal;
1992 /* Return the code of the expression computed on the rhs of assignment
1993 statement GS. In case that the RHS is a single object, returns the
1994 tree code of the object. */
1996 static inline enum tree_code
1997 gimple_assign_rhs_code (const_gimple gs)
1999 enum tree_code code;
2000 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2002 code = (enum tree_code) gs->gsbase.subcode;
2003 /* While we initially set subcode to the TREE_CODE of the rhs for
2004 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2005 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2006 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2007 code = TREE_CODE (gimple_assign_rhs1 (gs));
2009 return code;
2013 /* Set CODE to be the code for the expression computed on the RHS of
2014 assignment S. */
2016 static inline void
2017 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2019 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2020 s->gsbase.subcode = code;
2024 /* Return the gimple rhs class of the code of the expression computed on
2025 the rhs of assignment statement GS.
2026 This will never return GIMPLE_INVALID_RHS. */
2028 static inline enum gimple_rhs_class
2029 gimple_assign_rhs_class (const_gimple gs)
2031 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2034 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2035 there is no operator associated with the assignment itself.
2036 Unlike gimple_assign_copy_p, this predicate returns true for
2037 any RHS operand, including those that perform an operation
2038 and do not have the semantics of a copy, such as COND_EXPR. */
2040 static inline bool
2041 gimple_assign_single_p (gimple gs)
2043 return (is_gimple_assign (gs)
2044 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2047 /* Return true if GS performs a store to its lhs. */
2049 static inline bool
2050 gimple_store_p (gimple gs)
2052 tree lhs = gimple_get_lhs (gs);
2053 return lhs && !is_gimple_reg (lhs);
2056 /* Return true if GS is an assignment that loads from its rhs1. */
2058 static inline bool
2059 gimple_assign_load_p (gimple gs)
2061 tree rhs;
2062 if (!gimple_assign_single_p (gs))
2063 return false;
2064 rhs = gimple_assign_rhs1 (gs);
2065 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2066 return true;
2067 rhs = get_base_address (rhs);
2068 return (DECL_P (rhs)
2069 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2073 /* Return true if S is a type-cast assignment. */
2075 static inline bool
2076 gimple_assign_cast_p (gimple s)
2078 if (is_gimple_assign (s))
2080 enum tree_code sc = gimple_assign_rhs_code (s);
2081 return CONVERT_EXPR_CODE_P (sc)
2082 || sc == VIEW_CONVERT_EXPR
2083 || sc == FIX_TRUNC_EXPR;
2086 return false;
2089 /* Return true if S is a clobber statement. */
2091 static inline bool
2092 gimple_clobber_p (gimple s)
2094 return gimple_assign_single_p (s)
2095 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2098 /* Return true if GS is a GIMPLE_CALL. */
2100 static inline bool
2101 is_gimple_call (const_gimple gs)
2103 return gimple_code (gs) == GIMPLE_CALL;
2106 /* Return the LHS of call statement GS. */
2108 static inline tree
2109 gimple_call_lhs (const_gimple gs)
2111 GIMPLE_CHECK (gs, GIMPLE_CALL);
2112 return gimple_op (gs, 0);
2116 /* Return a pointer to the LHS of call statement GS. */
2118 static inline tree *
2119 gimple_call_lhs_ptr (const_gimple gs)
2121 GIMPLE_CHECK (gs, GIMPLE_CALL);
2122 return gimple_op_ptr (gs, 0);
2126 /* Set LHS to be the LHS operand of call statement GS. */
2128 static inline void
2129 gimple_call_set_lhs (gimple gs, tree lhs)
2131 GIMPLE_CHECK (gs, GIMPLE_CALL);
2132 gimple_set_op (gs, 0, lhs);
2133 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2134 SSA_NAME_DEF_STMT (lhs) = gs;
2138 /* Return true if call GS calls an internal-only function, as enumerated
2139 by internal_fn. */
2141 static inline bool
2142 gimple_call_internal_p (const_gimple gs)
2144 GIMPLE_CHECK (gs, GIMPLE_CALL);
2145 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2149 /* Return the target of internal call GS. */
2151 static inline enum internal_fn
2152 gimple_call_internal_fn (const_gimple gs)
2154 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2155 return gs->gimple_call.u.internal_fn;
2159 /* Return the function type of the function called by GS. */
2161 static inline tree
2162 gimple_call_fntype (const_gimple gs)
2164 GIMPLE_CHECK (gs, GIMPLE_CALL);
2165 if (gimple_call_internal_p (gs))
2166 return NULL_TREE;
2167 return gs->gimple_call.u.fntype;
2170 /* Set the type of the function called by GS to FNTYPE. */
2172 static inline void
2173 gimple_call_set_fntype (gimple gs, tree fntype)
2175 GIMPLE_CHECK (gs, GIMPLE_CALL);
2176 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2177 gs->gimple_call.u.fntype = fntype;
2181 /* Return the tree node representing the function called by call
2182 statement GS. */
2184 static inline tree
2185 gimple_call_fn (const_gimple gs)
2187 GIMPLE_CHECK (gs, GIMPLE_CALL);
2188 return gimple_op (gs, 1);
2191 /* Return a pointer to the tree node representing the function called by call
2192 statement GS. */
2194 static inline tree *
2195 gimple_call_fn_ptr (const_gimple gs)
2197 GIMPLE_CHECK (gs, GIMPLE_CALL);
2198 return gimple_op_ptr (gs, 1);
2202 /* Set FN to be the function called by call statement GS. */
2204 static inline void
2205 gimple_call_set_fn (gimple gs, tree fn)
2207 GIMPLE_CHECK (gs, GIMPLE_CALL);
2208 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2209 gimple_set_op (gs, 1, fn);
2213 /* Set FNDECL to be the function called by call statement GS. */
2215 static inline void
2216 gimple_call_set_fndecl (gimple gs, tree decl)
2218 GIMPLE_CHECK (gs, GIMPLE_CALL);
2219 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2220 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2224 /* Set internal function FN to be the function called by call statement GS. */
2226 static inline void
2227 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2229 GIMPLE_CHECK (gs, GIMPLE_CALL);
2230 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2231 gs->gimple_call.u.internal_fn = fn;
2235 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2236 associated with the callee if known. Otherwise return NULL_TREE. */
2238 static inline tree
2239 gimple_call_addr_fndecl (const_tree fn)
2241 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2243 tree fndecl = TREE_OPERAND (fn, 0);
2244 if (TREE_CODE (fndecl) == MEM_REF
2245 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2246 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2247 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2248 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2249 return fndecl;
2251 return NULL_TREE;
2254 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2255 Otherwise return NULL. This function is analogous to
2256 get_callee_fndecl in tree land. */
2258 static inline tree
2259 gimple_call_fndecl (const_gimple gs)
2261 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2265 /* Return the type returned by call statement GS. */
2267 static inline tree
2268 gimple_call_return_type (const_gimple gs)
2270 tree type = gimple_call_fntype (gs);
2272 if (type == NULL_TREE)
2273 return TREE_TYPE (gimple_call_lhs (gs));
2275 /* The type returned by a function is the type of its
2276 function type. */
2277 return TREE_TYPE (type);
2281 /* Return the static chain for call statement GS. */
2283 static inline tree
2284 gimple_call_chain (const_gimple gs)
2286 GIMPLE_CHECK (gs, GIMPLE_CALL);
2287 return gimple_op (gs, 2);
2291 /* Return a pointer to the static chain for call statement GS. */
2293 static inline tree *
2294 gimple_call_chain_ptr (const_gimple gs)
2296 GIMPLE_CHECK (gs, GIMPLE_CALL);
2297 return gimple_op_ptr (gs, 2);
2300 /* Set CHAIN to be the static chain for call statement GS. */
2302 static inline void
2303 gimple_call_set_chain (gimple gs, tree chain)
2305 GIMPLE_CHECK (gs, GIMPLE_CALL);
2307 gimple_set_op (gs, 2, chain);
2311 /* Return the number of arguments used by call statement GS. */
2313 static inline unsigned
2314 gimple_call_num_args (const_gimple gs)
2316 unsigned num_ops;
2317 GIMPLE_CHECK (gs, GIMPLE_CALL);
2318 num_ops = gimple_num_ops (gs);
2319 return num_ops - 3;
2323 /* Return the argument at position INDEX for call statement GS. */
2325 static inline tree
2326 gimple_call_arg (const_gimple gs, unsigned index)
2328 GIMPLE_CHECK (gs, GIMPLE_CALL);
2329 return gimple_op (gs, index + 3);
2333 /* Return a pointer to the argument at position INDEX for call
2334 statement GS. */
2336 static inline tree *
2337 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2339 GIMPLE_CHECK (gs, GIMPLE_CALL);
2340 return gimple_op_ptr (gs, index + 3);
2344 /* Set ARG to be the argument at position INDEX for call statement GS. */
2346 static inline void
2347 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2349 GIMPLE_CHECK (gs, GIMPLE_CALL);
2350 gimple_set_op (gs, index + 3, arg);
2354 /* If TAIL_P is true, mark call statement S as being a tail call
2355 (i.e., a call just before the exit of a function). These calls are
2356 candidate for tail call optimization. */
2358 static inline void
2359 gimple_call_set_tail (gimple s, bool tail_p)
2361 GIMPLE_CHECK (s, GIMPLE_CALL);
2362 if (tail_p)
2363 s->gsbase.subcode |= GF_CALL_TAILCALL;
2364 else
2365 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2369 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2371 static inline bool
2372 gimple_call_tail_p (gimple s)
2374 GIMPLE_CHECK (s, GIMPLE_CALL);
2375 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2379 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2380 slot optimization. This transformation uses the target of the call
2381 expansion as the return slot for calls that return in memory. */
2383 static inline void
2384 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2386 GIMPLE_CHECK (s, GIMPLE_CALL);
2387 if (return_slot_opt_p)
2388 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2389 else
2390 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2394 /* Return true if S is marked for return slot optimization. */
2396 static inline bool
2397 gimple_call_return_slot_opt_p (gimple s)
2399 GIMPLE_CHECK (s, GIMPLE_CALL);
2400 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2404 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2405 thunk to the thunked-to function. */
2407 static inline void
2408 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2410 GIMPLE_CHECK (s, GIMPLE_CALL);
2411 if (from_thunk_p)
2412 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2413 else
2414 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2418 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2420 static inline bool
2421 gimple_call_from_thunk_p (gimple s)
2423 GIMPLE_CHECK (s, GIMPLE_CALL);
2424 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2428 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2429 argument pack in its argument list. */
2431 static inline void
2432 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2434 GIMPLE_CHECK (s, GIMPLE_CALL);
2435 if (pass_arg_pack_p)
2436 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2437 else
2438 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2442 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2443 argument pack in its argument list. */
2445 static inline bool
2446 gimple_call_va_arg_pack_p (gimple s)
2448 GIMPLE_CHECK (s, GIMPLE_CALL);
2449 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2453 /* Return true if S is a noreturn call. */
2455 static inline bool
2456 gimple_call_noreturn_p (gimple s)
2458 GIMPLE_CHECK (s, GIMPLE_CALL);
2459 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2463 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2464 even if the called function can throw in other cases. */
2466 static inline void
2467 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2469 GIMPLE_CHECK (s, GIMPLE_CALL);
2470 if (nothrow_p)
2471 s->gsbase.subcode |= GF_CALL_NOTHROW;
2472 else
2473 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2476 /* Return true if S is a nothrow call. */
2478 static inline bool
2479 gimple_call_nothrow_p (gimple s)
2481 GIMPLE_CHECK (s, GIMPLE_CALL);
2482 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2485 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2486 is known to be emitted for VLA objects. Those are wrapped by
2487 stack_save/stack_restore calls and hence can't lead to unbounded
2488 stack growth even when they occur in loops. */
2490 static inline void
2491 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2493 GIMPLE_CHECK (s, GIMPLE_CALL);
2494 if (for_var)
2495 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2496 else
2497 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2500 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2502 static inline bool
2503 gimple_call_alloca_for_var_p (gimple s)
2505 GIMPLE_CHECK (s, GIMPLE_CALL);
2506 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2509 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2511 static inline void
2512 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2514 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2515 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2516 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2520 /* Return a pointer to the points-to solution for the set of call-used
2521 variables of the call CALL. */
2523 static inline struct pt_solution *
2524 gimple_call_use_set (gimple call)
2526 GIMPLE_CHECK (call, GIMPLE_CALL);
2527 return &call->gimple_call.call_used;
2531 /* Return a pointer to the points-to solution for the set of call-used
2532 variables of the call CALL. */
2534 static inline struct pt_solution *
2535 gimple_call_clobber_set (gimple call)
2537 GIMPLE_CHECK (call, GIMPLE_CALL);
2538 return &call->gimple_call.call_clobbered;
2542 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2543 non-NULL lhs. */
2545 static inline bool
2546 gimple_has_lhs (gimple stmt)
2548 return (is_gimple_assign (stmt)
2549 || (is_gimple_call (stmt)
2550 && gimple_call_lhs (stmt) != NULL_TREE));
2554 /* Return the code of the predicate computed by conditional statement GS. */
2556 static inline enum tree_code
2557 gimple_cond_code (const_gimple gs)
2559 GIMPLE_CHECK (gs, GIMPLE_COND);
2560 return (enum tree_code) gs->gsbase.subcode;
2564 /* Set CODE to be the predicate code for the conditional statement GS. */
2566 static inline void
2567 gimple_cond_set_code (gimple gs, enum tree_code code)
2569 GIMPLE_CHECK (gs, GIMPLE_COND);
2570 gs->gsbase.subcode = code;
2574 /* Return the LHS of the predicate computed by conditional statement GS. */
2576 static inline tree
2577 gimple_cond_lhs (const_gimple gs)
2579 GIMPLE_CHECK (gs, GIMPLE_COND);
2580 return gimple_op (gs, 0);
2583 /* Return the pointer to the LHS of the predicate computed by conditional
2584 statement GS. */
2586 static inline tree *
2587 gimple_cond_lhs_ptr (const_gimple gs)
2589 GIMPLE_CHECK (gs, GIMPLE_COND);
2590 return gimple_op_ptr (gs, 0);
2593 /* Set LHS to be the LHS operand of the predicate computed by
2594 conditional statement GS. */
2596 static inline void
2597 gimple_cond_set_lhs (gimple gs, tree lhs)
2599 GIMPLE_CHECK (gs, GIMPLE_COND);
2600 gimple_set_op (gs, 0, lhs);
2604 /* Return the RHS operand of the predicate computed by conditional GS. */
2606 static inline tree
2607 gimple_cond_rhs (const_gimple gs)
2609 GIMPLE_CHECK (gs, GIMPLE_COND);
2610 return gimple_op (gs, 1);
2613 /* Return the pointer to the RHS operand of the predicate computed by
2614 conditional GS. */
2616 static inline tree *
2617 gimple_cond_rhs_ptr (const_gimple gs)
2619 GIMPLE_CHECK (gs, GIMPLE_COND);
2620 return gimple_op_ptr (gs, 1);
2624 /* Set RHS to be the RHS operand of the predicate computed by
2625 conditional statement GS. */
2627 static inline void
2628 gimple_cond_set_rhs (gimple gs, tree rhs)
2630 GIMPLE_CHECK (gs, GIMPLE_COND);
2631 gimple_set_op (gs, 1, rhs);
2635 /* Return the label used by conditional statement GS when its
2636 predicate evaluates to true. */
2638 static inline tree
2639 gimple_cond_true_label (const_gimple gs)
2641 GIMPLE_CHECK (gs, GIMPLE_COND);
2642 return gimple_op (gs, 2);
2646 /* Set LABEL to be the label used by conditional statement GS when its
2647 predicate evaluates to true. */
2649 static inline void
2650 gimple_cond_set_true_label (gimple gs, tree label)
2652 GIMPLE_CHECK (gs, GIMPLE_COND);
2653 gimple_set_op (gs, 2, label);
2657 /* Set LABEL to be the label used by conditional statement GS when its
2658 predicate evaluates to false. */
2660 static inline void
2661 gimple_cond_set_false_label (gimple gs, tree label)
2663 GIMPLE_CHECK (gs, GIMPLE_COND);
2664 gimple_set_op (gs, 3, label);
2668 /* Return the label used by conditional statement GS when its
2669 predicate evaluates to false. */
2671 static inline tree
2672 gimple_cond_false_label (const_gimple gs)
2674 GIMPLE_CHECK (gs, GIMPLE_COND);
2675 return gimple_op (gs, 3);
2679 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2681 static inline void
2682 gimple_cond_make_false (gimple gs)
2684 gimple_cond_set_lhs (gs, boolean_true_node);
2685 gimple_cond_set_rhs (gs, boolean_false_node);
2686 gs->gsbase.subcode = EQ_EXPR;
2690 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2692 static inline void
2693 gimple_cond_make_true (gimple gs)
2695 gimple_cond_set_lhs (gs, boolean_true_node);
2696 gimple_cond_set_rhs (gs, boolean_true_node);
2697 gs->gsbase.subcode = EQ_EXPR;
2700 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2701 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2703 static inline bool
2704 gimple_cond_true_p (const_gimple gs)
2706 tree lhs = gimple_cond_lhs (gs);
2707 tree rhs = gimple_cond_rhs (gs);
2708 enum tree_code code = gimple_cond_code (gs);
2710 if (lhs != boolean_true_node && lhs != boolean_false_node)
2711 return false;
2713 if (rhs != boolean_true_node && rhs != boolean_false_node)
2714 return false;
2716 if (code == NE_EXPR && lhs != rhs)
2717 return true;
2719 if (code == EQ_EXPR && lhs == rhs)
2720 return true;
2722 return false;
2725 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2726 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2728 static inline bool
2729 gimple_cond_false_p (const_gimple gs)
2731 tree lhs = gimple_cond_lhs (gs);
2732 tree rhs = gimple_cond_rhs (gs);
2733 enum tree_code code = gimple_cond_code (gs);
2735 if (lhs != boolean_true_node && lhs != boolean_false_node)
2736 return false;
2738 if (rhs != boolean_true_node && rhs != boolean_false_node)
2739 return false;
2741 if (code == NE_EXPR && lhs == rhs)
2742 return true;
2744 if (code == EQ_EXPR && lhs != rhs)
2745 return true;
2747 return false;
2750 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2751 'if (var == 1)' */
2753 static inline bool
2754 gimple_cond_single_var_p (gimple gs)
2756 if (gimple_cond_code (gs) == NE_EXPR
2757 && gimple_cond_rhs (gs) == boolean_false_node)
2758 return true;
2760 if (gimple_cond_code (gs) == EQ_EXPR
2761 && gimple_cond_rhs (gs) == boolean_true_node)
2762 return true;
2764 return false;
2767 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2769 static inline void
2770 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2772 gimple_cond_set_code (stmt, code);
2773 gimple_cond_set_lhs (stmt, lhs);
2774 gimple_cond_set_rhs (stmt, rhs);
2777 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2779 static inline tree
2780 gimple_label_label (const_gimple gs)
2782 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2783 return gimple_op (gs, 0);
2787 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2788 GS. */
2790 static inline void
2791 gimple_label_set_label (gimple gs, tree label)
2793 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2794 gimple_set_op (gs, 0, label);
2798 /* Return the destination of the unconditional jump GS. */
2800 static inline tree
2801 gimple_goto_dest (const_gimple gs)
2803 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2804 return gimple_op (gs, 0);
2808 /* Set DEST to be the destination of the unconditonal jump GS. */
2810 static inline void
2811 gimple_goto_set_dest (gimple gs, tree dest)
2813 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2814 gimple_set_op (gs, 0, dest);
2818 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2820 static inline tree
2821 gimple_bind_vars (const_gimple gs)
2823 GIMPLE_CHECK (gs, GIMPLE_BIND);
2824 return gs->gimple_bind.vars;
2828 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2829 statement GS. */
2831 static inline void
2832 gimple_bind_set_vars (gimple gs, tree vars)
2834 GIMPLE_CHECK (gs, GIMPLE_BIND);
2835 gs->gimple_bind.vars = vars;
2839 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2840 statement GS. */
2842 static inline void
2843 gimple_bind_append_vars (gimple gs, tree vars)
2845 GIMPLE_CHECK (gs, GIMPLE_BIND);
2846 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2850 static inline gimple_seq *
2851 gimple_bind_body_ptr (gimple gs)
2853 GIMPLE_CHECK (gs, GIMPLE_BIND);
2854 return &gs->gimple_bind.body;
2857 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2859 static inline gimple_seq
2860 gimple_bind_body (gimple gs)
2862 return *gimple_bind_body_ptr (gs);
2866 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2867 statement GS. */
2869 static inline void
2870 gimple_bind_set_body (gimple gs, gimple_seq seq)
2872 GIMPLE_CHECK (gs, GIMPLE_BIND);
2873 gs->gimple_bind.body = seq;
2877 /* Append a statement to the end of a GIMPLE_BIND's body. */
2879 static inline void
2880 gimple_bind_add_stmt (gimple gs, gimple stmt)
2882 GIMPLE_CHECK (gs, GIMPLE_BIND);
2883 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2887 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2889 static inline void
2890 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2892 GIMPLE_CHECK (gs, GIMPLE_BIND);
2893 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2897 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2898 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2900 static inline tree
2901 gimple_bind_block (const_gimple gs)
2903 GIMPLE_CHECK (gs, GIMPLE_BIND);
2904 return gs->gimple_bind.block;
2908 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2909 statement GS. */
2911 static inline void
2912 gimple_bind_set_block (gimple gs, tree block)
2914 GIMPLE_CHECK (gs, GIMPLE_BIND);
2915 gcc_gimple_checking_assert (block == NULL_TREE
2916 || TREE_CODE (block) == BLOCK);
2917 gs->gimple_bind.block = block;
2921 /* Return the number of input operands for GIMPLE_ASM GS. */
2923 static inline unsigned
2924 gimple_asm_ninputs (const_gimple gs)
2926 GIMPLE_CHECK (gs, GIMPLE_ASM);
2927 return gs->gimple_asm.ni;
2931 /* Return the number of output operands for GIMPLE_ASM GS. */
2933 static inline unsigned
2934 gimple_asm_noutputs (const_gimple gs)
2936 GIMPLE_CHECK (gs, GIMPLE_ASM);
2937 return gs->gimple_asm.no;
2941 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2943 static inline unsigned
2944 gimple_asm_nclobbers (const_gimple gs)
2946 GIMPLE_CHECK (gs, GIMPLE_ASM);
2947 return gs->gimple_asm.nc;
2950 /* Return the number of label operands for GIMPLE_ASM GS. */
2952 static inline unsigned
2953 gimple_asm_nlabels (const_gimple gs)
2955 GIMPLE_CHECK (gs, GIMPLE_ASM);
2956 return gs->gimple_asm.nl;
2959 /* Return input operand INDEX of GIMPLE_ASM GS. */
2961 static inline tree
2962 gimple_asm_input_op (const_gimple gs, unsigned index)
2964 GIMPLE_CHECK (gs, GIMPLE_ASM);
2965 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2966 return gimple_op (gs, index + gs->gimple_asm.no);
2969 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2971 static inline tree *
2972 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2974 GIMPLE_CHECK (gs, GIMPLE_ASM);
2975 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2976 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
2980 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2982 static inline void
2983 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2985 GIMPLE_CHECK (gs, GIMPLE_ASM);
2986 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
2987 && TREE_CODE (in_op) == TREE_LIST);
2988 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
2992 /* Return output operand INDEX of GIMPLE_ASM GS. */
2994 static inline tree
2995 gimple_asm_output_op (const_gimple gs, unsigned index)
2997 GIMPLE_CHECK (gs, GIMPLE_ASM);
2998 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
2999 return gimple_op (gs, index);
3002 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3004 static inline tree *
3005 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3007 GIMPLE_CHECK (gs, GIMPLE_ASM);
3008 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3009 return gimple_op_ptr (gs, index);
3013 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3015 static inline void
3016 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3018 GIMPLE_CHECK (gs, GIMPLE_ASM);
3019 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3020 && TREE_CODE (out_op) == TREE_LIST);
3021 gimple_set_op (gs, index, out_op);
3025 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3027 static inline tree
3028 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3030 GIMPLE_CHECK (gs, GIMPLE_ASM);
3031 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3032 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3036 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3038 static inline void
3039 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3041 GIMPLE_CHECK (gs, GIMPLE_ASM);
3042 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3043 && TREE_CODE (clobber_op) == TREE_LIST);
3044 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3047 /* Return label operand INDEX of GIMPLE_ASM GS. */
3049 static inline tree
3050 gimple_asm_label_op (const_gimple gs, unsigned index)
3052 GIMPLE_CHECK (gs, GIMPLE_ASM);
3053 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3054 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3057 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3059 static inline void
3060 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3062 GIMPLE_CHECK (gs, GIMPLE_ASM);
3063 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3064 && TREE_CODE (label_op) == TREE_LIST);
3065 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3068 /* Return the string representing the assembly instruction in
3069 GIMPLE_ASM GS. */
3071 static inline const char *
3072 gimple_asm_string (const_gimple gs)
3074 GIMPLE_CHECK (gs, GIMPLE_ASM);
3075 return gs->gimple_asm.string;
3079 /* Return true if GS is an asm statement marked volatile. */
3081 static inline bool
3082 gimple_asm_volatile_p (const_gimple gs)
3084 GIMPLE_CHECK (gs, GIMPLE_ASM);
3085 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3089 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3091 static inline void
3092 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3094 GIMPLE_CHECK (gs, GIMPLE_ASM);
3095 if (volatile_p)
3096 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3097 else
3098 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3102 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3104 static inline void
3105 gimple_asm_set_input (gimple gs, bool input_p)
3107 GIMPLE_CHECK (gs, GIMPLE_ASM);
3108 if (input_p)
3109 gs->gsbase.subcode |= GF_ASM_INPUT;
3110 else
3111 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3115 /* Return true if asm GS is an ASM_INPUT. */
3117 static inline bool
3118 gimple_asm_input_p (const_gimple gs)
3120 GIMPLE_CHECK (gs, GIMPLE_ASM);
3121 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3125 /* Return the types handled by GIMPLE_CATCH statement GS. */
3127 static inline tree
3128 gimple_catch_types (const_gimple gs)
3130 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3131 return gs->gimple_catch.types;
3135 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3137 static inline tree *
3138 gimple_catch_types_ptr (gimple gs)
3140 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3141 return &gs->gimple_catch.types;
3145 /* Return a pointer to the GIMPLE sequence representing the body of
3146 the handler of GIMPLE_CATCH statement GS. */
3148 static inline gimple_seq *
3149 gimple_catch_handler_ptr (gimple gs)
3151 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3152 return &gs->gimple_catch.handler;
3156 /* Return the GIMPLE sequence representing the body of the handler of
3157 GIMPLE_CATCH statement GS. */
3159 static inline gimple_seq
3160 gimple_catch_handler (gimple gs)
3162 return *gimple_catch_handler_ptr (gs);
3166 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3168 static inline void
3169 gimple_catch_set_types (gimple gs, tree t)
3171 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3172 gs->gimple_catch.types = t;
3176 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3178 static inline void
3179 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3181 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3182 gs->gimple_catch.handler = handler;
3186 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3188 static inline tree
3189 gimple_eh_filter_types (const_gimple gs)
3191 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3192 return gs->gimple_eh_filter.types;
3196 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3197 GS. */
3199 static inline tree *
3200 gimple_eh_filter_types_ptr (gimple gs)
3202 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3203 return &gs->gimple_eh_filter.types;
3207 /* Return a pointer to the sequence of statement to execute when
3208 GIMPLE_EH_FILTER statement fails. */
3210 static inline gimple_seq *
3211 gimple_eh_filter_failure_ptr (gimple gs)
3213 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3214 return &gs->gimple_eh_filter.failure;
3218 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3219 statement fails. */
3221 static inline gimple_seq
3222 gimple_eh_filter_failure (gimple gs)
3224 return *gimple_eh_filter_failure_ptr (gs);
3228 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3230 static inline void
3231 gimple_eh_filter_set_types (gimple gs, tree types)
3233 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3234 gs->gimple_eh_filter.types = types;
3238 /* Set FAILURE to be the sequence of statements to execute on failure
3239 for GIMPLE_EH_FILTER GS. */
3241 static inline void
3242 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3244 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3245 gs->gimple_eh_filter.failure = failure;
3248 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3250 static inline tree
3251 gimple_eh_must_not_throw_fndecl (gimple gs)
3253 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3254 return gs->gimple_eh_mnt.fndecl;
3257 /* Set the function decl to be called by GS to DECL. */
3259 static inline void
3260 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3262 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3263 gs->gimple_eh_mnt.fndecl = decl;
3266 /* GIMPLE_EH_ELSE accessors. */
3268 static inline gimple_seq *
3269 gimple_eh_else_n_body_ptr (gimple gs)
3271 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3272 return &gs->gimple_eh_else.n_body;
3275 static inline gimple_seq
3276 gimple_eh_else_n_body (gimple gs)
3278 return *gimple_eh_else_n_body_ptr (gs);
3281 static inline gimple_seq *
3282 gimple_eh_else_e_body_ptr (gimple gs)
3284 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3285 return &gs->gimple_eh_else.e_body;
3288 static inline gimple_seq
3289 gimple_eh_else_e_body (gimple gs)
3291 return *gimple_eh_else_e_body_ptr (gs);
3294 static inline void
3295 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3297 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3298 gs->gimple_eh_else.n_body = seq;
3301 static inline void
3302 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3304 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3305 gs->gimple_eh_else.e_body = seq;
3308 /* GIMPLE_TRY accessors. */
3310 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3311 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3313 static inline enum gimple_try_flags
3314 gimple_try_kind (const_gimple gs)
3316 GIMPLE_CHECK (gs, GIMPLE_TRY);
3317 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3321 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3323 static inline void
3324 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3326 GIMPLE_CHECK (gs, GIMPLE_TRY);
3327 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3328 || kind == GIMPLE_TRY_FINALLY);
3329 if (gimple_try_kind (gs) != kind)
3330 gs->gsbase.subcode = (unsigned int) kind;
3334 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3336 static inline bool
3337 gimple_try_catch_is_cleanup (const_gimple gs)
3339 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3340 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3344 /* Return a pointer to the sequence of statements used as the
3345 body for GIMPLE_TRY GS. */
3347 static inline gimple_seq *
3348 gimple_try_eval_ptr (gimple gs)
3350 GIMPLE_CHECK (gs, GIMPLE_TRY);
3351 return &gs->gimple_try.eval;
3355 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3357 static inline gimple_seq
3358 gimple_try_eval (gimple gs)
3360 return *gimple_try_eval_ptr (gs);
3364 /* Return a pointer to the sequence of statements used as the cleanup body for
3365 GIMPLE_TRY GS. */
3367 static inline gimple_seq *
3368 gimple_try_cleanup_ptr (gimple gs)
3370 GIMPLE_CHECK (gs, GIMPLE_TRY);
3371 return &gs->gimple_try.cleanup;
3375 /* Return the sequence of statements used as the cleanup body for
3376 GIMPLE_TRY GS. */
3378 static inline gimple_seq
3379 gimple_try_cleanup (gimple gs)
3381 return *gimple_try_cleanup_ptr (gs);
3385 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3387 static inline void
3388 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3390 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3391 if (catch_is_cleanup)
3392 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3393 else
3394 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3398 /* Set EVAL to be the sequence of statements to use as the body for
3399 GIMPLE_TRY GS. */
3401 static inline void
3402 gimple_try_set_eval (gimple gs, gimple_seq eval)
3404 GIMPLE_CHECK (gs, GIMPLE_TRY);
3405 gs->gimple_try.eval = eval;
3409 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3410 body for GIMPLE_TRY GS. */
3412 static inline void
3413 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3415 GIMPLE_CHECK (gs, GIMPLE_TRY);
3416 gs->gimple_try.cleanup = cleanup;
3420 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3422 static inline gimple_seq *
3423 gimple_wce_cleanup_ptr (gimple gs)
3425 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3426 return &gs->gimple_wce.cleanup;
3430 /* Return the cleanup sequence for cleanup statement GS. */
3432 static inline gimple_seq
3433 gimple_wce_cleanup (gimple gs)
3435 return *gimple_wce_cleanup_ptr (gs);
3439 /* Set CLEANUP to be the cleanup sequence for GS. */
3441 static inline void
3442 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3444 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3445 gs->gimple_wce.cleanup = cleanup;
3449 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3451 static inline bool
3452 gimple_wce_cleanup_eh_only (const_gimple gs)
3454 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3455 return gs->gsbase.subcode != 0;
3459 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3461 static inline void
3462 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3464 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3465 gs->gsbase.subcode = (unsigned int) eh_only_p;
3469 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3471 static inline unsigned
3472 gimple_phi_capacity (const_gimple gs)
3474 GIMPLE_CHECK (gs, GIMPLE_PHI);
3475 return gs->gimple_phi.capacity;
3479 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3480 be exactly the number of incoming edges for the basic block holding
3481 GS. */
3483 static inline unsigned
3484 gimple_phi_num_args (const_gimple gs)
3486 GIMPLE_CHECK (gs, GIMPLE_PHI);
3487 return gs->gimple_phi.nargs;
3491 /* Return the SSA name created by GIMPLE_PHI GS. */
3493 static inline tree
3494 gimple_phi_result (const_gimple gs)
3496 GIMPLE_CHECK (gs, GIMPLE_PHI);
3497 return gs->gimple_phi.result;
3500 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3502 static inline tree *
3503 gimple_phi_result_ptr (gimple gs)
3505 GIMPLE_CHECK (gs, GIMPLE_PHI);
3506 return &gs->gimple_phi.result;
3509 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3511 static inline void
3512 gimple_phi_set_result (gimple gs, tree result)
3514 GIMPLE_CHECK (gs, GIMPLE_PHI);
3515 gs->gimple_phi.result = result;
3516 if (result && TREE_CODE (result) == SSA_NAME)
3517 SSA_NAME_DEF_STMT (result) = gs;
3521 /* Return the PHI argument corresponding to incoming edge INDEX for
3522 GIMPLE_PHI GS. */
3524 static inline struct phi_arg_d *
3525 gimple_phi_arg (gimple gs, unsigned index)
3527 GIMPLE_CHECK (gs, GIMPLE_PHI);
3528 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3529 return &(gs->gimple_phi.args[index]);
3532 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3533 for GIMPLE_PHI GS. */
3535 static inline void
3536 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3538 GIMPLE_CHECK (gs, GIMPLE_PHI);
3539 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3540 gs->gimple_phi.args[index] = *phiarg;
3543 /* Return the region number for GIMPLE_RESX GS. */
3545 static inline int
3546 gimple_resx_region (const_gimple gs)
3548 GIMPLE_CHECK (gs, GIMPLE_RESX);
3549 return gs->gimple_eh_ctrl.region;
3552 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3554 static inline void
3555 gimple_resx_set_region (gimple gs, int region)
3557 GIMPLE_CHECK (gs, GIMPLE_RESX);
3558 gs->gimple_eh_ctrl.region = region;
3561 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3563 static inline int
3564 gimple_eh_dispatch_region (const_gimple gs)
3566 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3567 return gs->gimple_eh_ctrl.region;
3570 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3572 static inline void
3573 gimple_eh_dispatch_set_region (gimple gs, int region)
3575 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3576 gs->gimple_eh_ctrl.region = region;
3579 /* Return the number of labels associated with the switch statement GS. */
3581 static inline unsigned
3582 gimple_switch_num_labels (const_gimple gs)
3584 unsigned num_ops;
3585 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3586 num_ops = gimple_num_ops (gs);
3587 gcc_gimple_checking_assert (num_ops > 1);
3588 return num_ops - 1;
3592 /* Set NLABELS to be the number of labels for the switch statement GS. */
3594 static inline void
3595 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3597 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3598 gimple_set_num_ops (g, nlabels + 1);
3602 /* Return the index variable used by the switch statement GS. */
3604 static inline tree
3605 gimple_switch_index (const_gimple gs)
3607 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3608 return gimple_op (gs, 0);
3612 /* Return a pointer to the index variable for the switch statement GS. */
3614 static inline tree *
3615 gimple_switch_index_ptr (const_gimple gs)
3617 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3618 return gimple_op_ptr (gs, 0);
3622 /* Set INDEX to be the index variable for switch statement GS. */
3624 static inline void
3625 gimple_switch_set_index (gimple gs, tree index)
3627 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3628 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3629 gimple_set_op (gs, 0, index);
3633 /* Return the label numbered INDEX. The default label is 0, followed by any
3634 labels in a switch statement. */
3636 static inline tree
3637 gimple_switch_label (const_gimple gs, unsigned index)
3639 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3640 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3641 return gimple_op (gs, index + 1);
3644 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3646 static inline void
3647 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3649 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3650 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3651 && (label == NULL_TREE
3652 || TREE_CODE (label) == CASE_LABEL_EXPR));
3653 gimple_set_op (gs, index + 1, label);
3656 /* Return the default label for a switch statement. */
3658 static inline tree
3659 gimple_switch_default_label (const_gimple gs)
3661 tree label = gimple_switch_label (gs, 0);
3662 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3663 return label;
3666 /* Set the default label for a switch statement. */
3668 static inline void
3669 gimple_switch_set_default_label (gimple gs, tree label)
3671 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3672 gimple_switch_set_label (gs, 0, label);
3675 /* Return true if GS is a GIMPLE_DEBUG statement. */
3677 static inline bool
3678 is_gimple_debug (const_gimple gs)
3680 return gimple_code (gs) == GIMPLE_DEBUG;
3683 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3685 static inline bool
3686 gimple_debug_bind_p (const_gimple s)
3688 if (is_gimple_debug (s))
3689 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3691 return false;
3694 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3696 static inline tree
3697 gimple_debug_bind_get_var (gimple dbg)
3699 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3700 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3701 return gimple_op (dbg, 0);
3704 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3705 statement. */
3707 static inline tree
3708 gimple_debug_bind_get_value (gimple dbg)
3710 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3711 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3712 return gimple_op (dbg, 1);
3715 /* Return a pointer to the value bound to the variable in a
3716 GIMPLE_DEBUG bind statement. */
3718 static inline tree *
3719 gimple_debug_bind_get_value_ptr (gimple dbg)
3721 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3722 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3723 return gimple_op_ptr (dbg, 1);
3726 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3728 static inline void
3729 gimple_debug_bind_set_var (gimple dbg, tree var)
3731 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3732 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3733 gimple_set_op (dbg, 0, var);
3736 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3737 statement. */
3739 static inline void
3740 gimple_debug_bind_set_value (gimple dbg, tree value)
3742 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3743 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3744 gimple_set_op (dbg, 1, value);
3747 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3748 optimized away. */
3749 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3751 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3752 statement. */
3754 static inline void
3755 gimple_debug_bind_reset_value (gimple dbg)
3757 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3758 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3759 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3762 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3763 value. */
3765 static inline bool
3766 gimple_debug_bind_has_value_p (gimple dbg)
3768 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3769 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3770 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3773 #undef GIMPLE_DEBUG_BIND_NOVALUE
3775 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3777 static inline bool
3778 gimple_debug_source_bind_p (const_gimple s)
3780 if (is_gimple_debug (s))
3781 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3783 return false;
3786 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3788 static inline tree
3789 gimple_debug_source_bind_get_var (gimple dbg)
3791 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3792 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3793 return gimple_op (dbg, 0);
3796 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3797 statement. */
3799 static inline tree
3800 gimple_debug_source_bind_get_value (gimple dbg)
3802 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3803 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3804 return gimple_op (dbg, 1);
3807 /* Return a pointer to the value bound to the variable in a
3808 GIMPLE_DEBUG source bind statement. */
3810 static inline tree *
3811 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3813 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3814 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3815 return gimple_op_ptr (dbg, 1);
3818 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3820 static inline void
3821 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3823 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3824 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3825 gimple_set_op (dbg, 0, var);
3828 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3829 statement. */
3831 static inline void
3832 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3834 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3835 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3836 gimple_set_op (dbg, 1, value);
3839 /* Return a pointer to the body for the OMP statement GS. */
3841 static inline gimple_seq *
3842 gimple_omp_body_ptr (gimple gs)
3844 return &gs->omp.body;
3847 /* Return the body for the OMP statement GS. */
3849 static inline gimple_seq
3850 gimple_omp_body (gimple gs)
3852 return *gimple_omp_body_ptr (gs);
3855 /* Set BODY to be the body for the OMP statement GS. */
3857 static inline void
3858 gimple_omp_set_body (gimple gs, gimple_seq body)
3860 gs->omp.body = body;
3864 /* Return the name associated with OMP_CRITICAL statement GS. */
3866 static inline tree
3867 gimple_omp_critical_name (const_gimple gs)
3869 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3870 return gs->gimple_omp_critical.name;
3874 /* Return a pointer to the name associated with OMP critical statement GS. */
3876 static inline tree *
3877 gimple_omp_critical_name_ptr (gimple gs)
3879 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3880 return &gs->gimple_omp_critical.name;
3884 /* Set NAME to be the name associated with OMP critical statement GS. */
3886 static inline void
3887 gimple_omp_critical_set_name (gimple gs, tree name)
3889 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3890 gs->gimple_omp_critical.name = name;
3894 /* Return the clauses associated with OMP_FOR GS. */
3896 static inline tree
3897 gimple_omp_for_clauses (const_gimple gs)
3899 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3900 return gs->gimple_omp_for.clauses;
3904 /* Return a pointer to the OMP_FOR GS. */
3906 static inline tree *
3907 gimple_omp_for_clauses_ptr (gimple gs)
3909 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3910 return &gs->gimple_omp_for.clauses;
3914 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3916 static inline void
3917 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3919 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3920 gs->gimple_omp_for.clauses = clauses;
3924 /* Get the collapse count of OMP_FOR GS. */
3926 static inline size_t
3927 gimple_omp_for_collapse (gimple gs)
3929 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3930 return gs->gimple_omp_for.collapse;
3934 /* Return the index variable for OMP_FOR GS. */
3936 static inline tree
3937 gimple_omp_for_index (const_gimple gs, size_t i)
3939 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3940 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3941 return gs->gimple_omp_for.iter[i].index;
3945 /* Return a pointer to the index variable for OMP_FOR GS. */
3947 static inline tree *
3948 gimple_omp_for_index_ptr (gimple gs, size_t i)
3950 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3951 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3952 return &gs->gimple_omp_for.iter[i].index;
3956 /* Set INDEX to be the index variable for OMP_FOR GS. */
3958 static inline void
3959 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3961 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3962 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3963 gs->gimple_omp_for.iter[i].index = index;
3967 /* Return the initial value for OMP_FOR GS. */
3969 static inline tree
3970 gimple_omp_for_initial (const_gimple gs, size_t i)
3972 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3973 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3974 return gs->gimple_omp_for.iter[i].initial;
3978 /* Return a pointer to the initial value for OMP_FOR GS. */
3980 static inline tree *
3981 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3983 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3984 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3985 return &gs->gimple_omp_for.iter[i].initial;
3989 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3991 static inline void
3992 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3994 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3995 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3996 gs->gimple_omp_for.iter[i].initial = initial;
4000 /* Return the final value for OMP_FOR GS. */
4002 static inline tree
4003 gimple_omp_for_final (const_gimple gs, size_t i)
4005 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4006 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4007 return gs->gimple_omp_for.iter[i].final;
4011 /* Return a pointer to the final value for OMP_FOR GS. */
4013 static inline tree *
4014 gimple_omp_for_final_ptr (gimple gs, size_t i)
4016 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4017 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4018 return &gs->gimple_omp_for.iter[i].final;
4022 /* Set FINAL to be the final value for OMP_FOR GS. */
4024 static inline void
4025 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4027 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4028 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4029 gs->gimple_omp_for.iter[i].final = final;
4033 /* Return the increment value for OMP_FOR GS. */
4035 static inline tree
4036 gimple_omp_for_incr (const_gimple gs, size_t i)
4038 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4039 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4040 return gs->gimple_omp_for.iter[i].incr;
4044 /* Return a pointer to the increment value for OMP_FOR GS. */
4046 static inline tree *
4047 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4049 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4050 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4051 return &gs->gimple_omp_for.iter[i].incr;
4055 /* Set INCR to be the increment value for OMP_FOR GS. */
4057 static inline void
4058 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4060 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4061 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4062 gs->gimple_omp_for.iter[i].incr = incr;
4066 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4067 statement GS starts. */
4069 static inline gimple_seq *
4070 gimple_omp_for_pre_body_ptr (gimple gs)
4072 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4073 return &gs->gimple_omp_for.pre_body;
4077 /* Return the sequence of statements to execute before the OMP_FOR
4078 statement GS starts. */
4080 static inline gimple_seq
4081 gimple_omp_for_pre_body (gimple gs)
4083 return *gimple_omp_for_pre_body_ptr (gs);
4087 /* Set PRE_BODY to be the sequence of statements to execute before the
4088 OMP_FOR statement GS starts. */
4090 static inline void
4091 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4093 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4094 gs->gimple_omp_for.pre_body = pre_body;
4098 /* Return the clauses associated with OMP_PARALLEL GS. */
4100 static inline tree
4101 gimple_omp_parallel_clauses (const_gimple gs)
4103 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4104 return gs->gimple_omp_parallel.clauses;
4108 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4110 static inline tree *
4111 gimple_omp_parallel_clauses_ptr (gimple gs)
4113 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4114 return &gs->gimple_omp_parallel.clauses;
4118 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4119 GS. */
4121 static inline void
4122 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4124 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4125 gs->gimple_omp_parallel.clauses = clauses;
4129 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4131 static inline tree
4132 gimple_omp_parallel_child_fn (const_gimple gs)
4134 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4135 return gs->gimple_omp_parallel.child_fn;
4138 /* Return a pointer to the child function used to hold the body of
4139 OMP_PARALLEL GS. */
4141 static inline tree *
4142 gimple_omp_parallel_child_fn_ptr (gimple gs)
4144 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4145 return &gs->gimple_omp_parallel.child_fn;
4149 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4151 static inline void
4152 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4154 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4155 gs->gimple_omp_parallel.child_fn = child_fn;
4159 /* Return the artificial argument used to send variables and values
4160 from the parent to the children threads in OMP_PARALLEL GS. */
4162 static inline tree
4163 gimple_omp_parallel_data_arg (const_gimple gs)
4165 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4166 return gs->gimple_omp_parallel.data_arg;
4170 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4172 static inline tree *
4173 gimple_omp_parallel_data_arg_ptr (gimple gs)
4175 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4176 return &gs->gimple_omp_parallel.data_arg;
4180 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4182 static inline void
4183 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4185 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4186 gs->gimple_omp_parallel.data_arg = data_arg;
4190 /* Return the clauses associated with OMP_TASK GS. */
4192 static inline tree
4193 gimple_omp_task_clauses (const_gimple gs)
4195 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4196 return gs->gimple_omp_parallel.clauses;
4200 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4202 static inline tree *
4203 gimple_omp_task_clauses_ptr (gimple gs)
4205 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4206 return &gs->gimple_omp_parallel.clauses;
4210 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4211 GS. */
4213 static inline void
4214 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4216 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4217 gs->gimple_omp_parallel.clauses = clauses;
4221 /* Return the child function used to hold the body of OMP_TASK GS. */
4223 static inline tree
4224 gimple_omp_task_child_fn (const_gimple gs)
4226 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4227 return gs->gimple_omp_parallel.child_fn;
4230 /* Return a pointer to the child function used to hold the body of
4231 OMP_TASK GS. */
4233 static inline tree *
4234 gimple_omp_task_child_fn_ptr (gimple gs)
4236 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4237 return &gs->gimple_omp_parallel.child_fn;
4241 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4243 static inline void
4244 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4246 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4247 gs->gimple_omp_parallel.child_fn = child_fn;
4251 /* Return the artificial argument used to send variables and values
4252 from the parent to the children threads in OMP_TASK GS. */
4254 static inline tree
4255 gimple_omp_task_data_arg (const_gimple gs)
4257 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4258 return gs->gimple_omp_parallel.data_arg;
4262 /* Return a pointer to the data argument for OMP_TASK GS. */
4264 static inline tree *
4265 gimple_omp_task_data_arg_ptr (gimple gs)
4267 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4268 return &gs->gimple_omp_parallel.data_arg;
4272 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4274 static inline void
4275 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4277 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4278 gs->gimple_omp_parallel.data_arg = data_arg;
4282 /* Return the clauses associated with OMP_TASK GS. */
4284 static inline tree
4285 gimple_omp_taskreg_clauses (const_gimple gs)
4287 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4288 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4289 return gs->gimple_omp_parallel.clauses;
4293 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4295 static inline tree *
4296 gimple_omp_taskreg_clauses_ptr (gimple gs)
4298 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4299 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4300 return &gs->gimple_omp_parallel.clauses;
4304 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4305 GS. */
4307 static inline void
4308 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4310 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4311 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4312 gs->gimple_omp_parallel.clauses = clauses;
4316 /* Return the child function used to hold the body of OMP_TASK GS. */
4318 static inline tree
4319 gimple_omp_taskreg_child_fn (const_gimple gs)
4321 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4322 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4323 return gs->gimple_omp_parallel.child_fn;
4326 /* Return a pointer to the child function used to hold the body of
4327 OMP_TASK GS. */
4329 static inline tree *
4330 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4332 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4333 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4334 return &gs->gimple_omp_parallel.child_fn;
4338 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4340 static inline void
4341 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4343 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4344 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4345 gs->gimple_omp_parallel.child_fn = child_fn;
4349 /* Return the artificial argument used to send variables and values
4350 from the parent to the children threads in OMP_TASK GS. */
4352 static inline tree
4353 gimple_omp_taskreg_data_arg (const_gimple gs)
4355 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4356 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4357 return gs->gimple_omp_parallel.data_arg;
4361 /* Return a pointer to the data argument for OMP_TASK GS. */
4363 static inline tree *
4364 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4366 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4367 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4368 return &gs->gimple_omp_parallel.data_arg;
4372 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4374 static inline void
4375 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4377 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4378 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4379 gs->gimple_omp_parallel.data_arg = data_arg;
4383 /* Return the copy function used to hold the body of OMP_TASK GS. */
4385 static inline tree
4386 gimple_omp_task_copy_fn (const_gimple gs)
4388 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4389 return gs->gimple_omp_task.copy_fn;
4392 /* Return a pointer to the copy function used to hold the body of
4393 OMP_TASK GS. */
4395 static inline tree *
4396 gimple_omp_task_copy_fn_ptr (gimple gs)
4398 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4399 return &gs->gimple_omp_task.copy_fn;
4403 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4405 static inline void
4406 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4408 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4409 gs->gimple_omp_task.copy_fn = copy_fn;
4413 /* Return size of the data block in bytes in OMP_TASK GS. */
4415 static inline tree
4416 gimple_omp_task_arg_size (const_gimple gs)
4418 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4419 return gs->gimple_omp_task.arg_size;
4423 /* Return a pointer to the data block size for OMP_TASK GS. */
4425 static inline tree *
4426 gimple_omp_task_arg_size_ptr (gimple gs)
4428 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4429 return &gs->gimple_omp_task.arg_size;
4433 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4435 static inline void
4436 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4438 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4439 gs->gimple_omp_task.arg_size = arg_size;
4443 /* Return align of the data block in bytes in OMP_TASK GS. */
4445 static inline tree
4446 gimple_omp_task_arg_align (const_gimple gs)
4448 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4449 return gs->gimple_omp_task.arg_align;
4453 /* Return a pointer to the data block align for OMP_TASK GS. */
4455 static inline tree *
4456 gimple_omp_task_arg_align_ptr (gimple gs)
4458 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4459 return &gs->gimple_omp_task.arg_align;
4463 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4465 static inline void
4466 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4468 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4469 gs->gimple_omp_task.arg_align = arg_align;
4473 /* Return the clauses associated with OMP_SINGLE GS. */
4475 static inline tree
4476 gimple_omp_single_clauses (const_gimple gs)
4478 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4479 return gs->gimple_omp_single.clauses;
4483 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4485 static inline tree *
4486 gimple_omp_single_clauses_ptr (gimple gs)
4488 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4489 return &gs->gimple_omp_single.clauses;
4493 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4495 static inline void
4496 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4498 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4499 gs->gimple_omp_single.clauses = clauses;
4503 /* Return the clauses associated with OMP_SECTIONS GS. */
4505 static inline tree
4506 gimple_omp_sections_clauses (const_gimple gs)
4508 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4509 return gs->gimple_omp_sections.clauses;
4513 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4515 static inline tree *
4516 gimple_omp_sections_clauses_ptr (gimple gs)
4518 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4519 return &gs->gimple_omp_sections.clauses;
4523 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4524 GS. */
4526 static inline void
4527 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4529 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4530 gs->gimple_omp_sections.clauses = clauses;
4534 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4535 in GS. */
4537 static inline tree
4538 gimple_omp_sections_control (const_gimple gs)
4540 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4541 return gs->gimple_omp_sections.control;
4545 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4546 GS. */
4548 static inline tree *
4549 gimple_omp_sections_control_ptr (gimple gs)
4551 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4552 return &gs->gimple_omp_sections.control;
4556 /* Set CONTROL to be the set of clauses associated with the
4557 GIMPLE_OMP_SECTIONS in GS. */
4559 static inline void
4560 gimple_omp_sections_set_control (gimple gs, tree control)
4562 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4563 gs->gimple_omp_sections.control = control;
4567 /* Set COND to be the condition code for OMP_FOR GS. */
4569 static inline void
4570 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4572 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4573 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4574 && i < gs->gimple_omp_for.collapse);
4575 gs->gimple_omp_for.iter[i].cond = cond;
4579 /* Return the condition code associated with OMP_FOR GS. */
4581 static inline enum tree_code
4582 gimple_omp_for_cond (const_gimple gs, size_t i)
4584 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4585 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4586 return gs->gimple_omp_for.iter[i].cond;
4590 /* Set the value being stored in an atomic store. */
4592 static inline void
4593 gimple_omp_atomic_store_set_val (gimple g, tree val)
4595 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4596 g->gimple_omp_atomic_store.val = val;
4600 /* Return the value being stored in an atomic store. */
4602 static inline tree
4603 gimple_omp_atomic_store_val (const_gimple g)
4605 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4606 return g->gimple_omp_atomic_store.val;
4610 /* Return a pointer to the value being stored in an atomic store. */
4612 static inline tree *
4613 gimple_omp_atomic_store_val_ptr (gimple g)
4615 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4616 return &g->gimple_omp_atomic_store.val;
4620 /* Set the LHS of an atomic load. */
4622 static inline void
4623 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4625 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4626 g->gimple_omp_atomic_load.lhs = lhs;
4630 /* Get the LHS of an atomic load. */
4632 static inline tree
4633 gimple_omp_atomic_load_lhs (const_gimple g)
4635 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4636 return g->gimple_omp_atomic_load.lhs;
4640 /* Return a pointer to the LHS of an atomic load. */
4642 static inline tree *
4643 gimple_omp_atomic_load_lhs_ptr (gimple g)
4645 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4646 return &g->gimple_omp_atomic_load.lhs;
4650 /* Set the RHS of an atomic load. */
4652 static inline void
4653 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4655 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4656 g->gimple_omp_atomic_load.rhs = rhs;
4660 /* Get the RHS of an atomic load. */
4662 static inline tree
4663 gimple_omp_atomic_load_rhs (const_gimple g)
4665 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4666 return g->gimple_omp_atomic_load.rhs;
4670 /* Return a pointer to the RHS of an atomic load. */
4672 static inline tree *
4673 gimple_omp_atomic_load_rhs_ptr (gimple g)
4675 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4676 return &g->gimple_omp_atomic_load.rhs;
4680 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4682 static inline tree
4683 gimple_omp_continue_control_def (const_gimple g)
4685 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4686 return g->gimple_omp_continue.control_def;
4689 /* The same as above, but return the address. */
4691 static inline tree *
4692 gimple_omp_continue_control_def_ptr (gimple g)
4694 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4695 return &g->gimple_omp_continue.control_def;
4698 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4700 static inline void
4701 gimple_omp_continue_set_control_def (gimple g, tree def)
4703 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4704 g->gimple_omp_continue.control_def = def;
4708 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4710 static inline tree
4711 gimple_omp_continue_control_use (const_gimple g)
4713 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4714 return g->gimple_omp_continue.control_use;
4718 /* The same as above, but return the address. */
4720 static inline tree *
4721 gimple_omp_continue_control_use_ptr (gimple g)
4723 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4724 return &g->gimple_omp_continue.control_use;
4728 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4730 static inline void
4731 gimple_omp_continue_set_control_use (gimple g, tree use)
4733 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4734 g->gimple_omp_continue.control_use = use;
4737 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4739 static inline gimple_seq *
4740 gimple_transaction_body_ptr (gimple gs)
4742 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4743 return &gs->gimple_transaction.body;
4746 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4748 static inline gimple_seq
4749 gimple_transaction_body (gimple gs)
4751 return *gimple_transaction_body_ptr (gs);
4754 /* Return the label associated with a GIMPLE_TRANSACTION. */
4756 static inline tree
4757 gimple_transaction_label (const_gimple gs)
4759 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4760 return gs->gimple_transaction.label;
4763 static inline tree *
4764 gimple_transaction_label_ptr (gimple gs)
4766 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4767 return &gs->gimple_transaction.label;
4770 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4772 static inline unsigned int
4773 gimple_transaction_subcode (const_gimple gs)
4775 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4776 return gs->gsbase.subcode;
4779 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4781 static inline void
4782 gimple_transaction_set_body (gimple gs, gimple_seq body)
4784 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4785 gs->gimple_transaction.body = body;
4788 /* Set the label associated with a GIMPLE_TRANSACTION. */
4790 static inline void
4791 gimple_transaction_set_label (gimple gs, tree label)
4793 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4794 gs->gimple_transaction.label = label;
4797 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4799 static inline void
4800 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4802 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4803 gs->gsbase.subcode = subcode;
4807 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4809 static inline tree *
4810 gimple_return_retval_ptr (const_gimple gs)
4812 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4813 return gimple_op_ptr (gs, 0);
4816 /* Return the return value for GIMPLE_RETURN GS. */
4818 static inline tree
4819 gimple_return_retval (const_gimple gs)
4821 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4822 return gimple_op (gs, 0);
4826 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4828 static inline void
4829 gimple_return_set_retval (gimple gs, tree retval)
4831 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4832 gimple_set_op (gs, 0, retval);
4836 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4838 #define CASE_GIMPLE_OMP \
4839 case GIMPLE_OMP_PARALLEL: \
4840 case GIMPLE_OMP_TASK: \
4841 case GIMPLE_OMP_FOR: \
4842 case GIMPLE_OMP_SECTIONS: \
4843 case GIMPLE_OMP_SECTIONS_SWITCH: \
4844 case GIMPLE_OMP_SINGLE: \
4845 case GIMPLE_OMP_SECTION: \
4846 case GIMPLE_OMP_MASTER: \
4847 case GIMPLE_OMP_ORDERED: \
4848 case GIMPLE_OMP_CRITICAL: \
4849 case GIMPLE_OMP_RETURN: \
4850 case GIMPLE_OMP_ATOMIC_LOAD: \
4851 case GIMPLE_OMP_ATOMIC_STORE: \
4852 case GIMPLE_OMP_CONTINUE
4854 static inline bool
4855 is_gimple_omp (const_gimple stmt)
4857 switch (gimple_code (stmt))
4859 CASE_GIMPLE_OMP:
4860 return true;
4861 default:
4862 return false;
4867 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4869 static inline bool
4870 gimple_nop_p (const_gimple g)
4872 return gimple_code (g) == GIMPLE_NOP;
4876 /* Return true if GS is a GIMPLE_RESX. */
4878 static inline bool
4879 is_gimple_resx (const_gimple gs)
4881 return gimple_code (gs) == GIMPLE_RESX;
4884 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4886 static inline enum br_predictor
4887 gimple_predict_predictor (gimple gs)
4889 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4890 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4894 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4896 static inline void
4897 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4899 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4900 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4901 | (unsigned) predictor;
4905 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4907 static inline enum prediction
4908 gimple_predict_outcome (gimple gs)
4910 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4911 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4915 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4917 static inline void
4918 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4920 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4921 if (outcome == TAKEN)
4922 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4923 else
4924 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4928 /* Return the type of the main expression computed by STMT. Return
4929 void_type_node if the statement computes nothing. */
4931 static inline tree
4932 gimple_expr_type (const_gimple stmt)
4934 enum gimple_code code = gimple_code (stmt);
4936 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4938 tree type;
4939 /* In general we want to pass out a type that can be substituted
4940 for both the RHS and the LHS types if there is a possibly
4941 useless conversion involved. That means returning the
4942 original RHS type as far as we can reconstruct it. */
4943 if (code == GIMPLE_CALL)
4944 type = gimple_call_return_type (stmt);
4945 else
4946 switch (gimple_assign_rhs_code (stmt))
4948 case POINTER_PLUS_EXPR:
4949 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4950 break;
4952 default:
4953 /* As fallback use the type of the LHS. */
4954 type = TREE_TYPE (gimple_get_lhs (stmt));
4955 break;
4957 return type;
4959 else if (code == GIMPLE_COND)
4960 return boolean_type_node;
4961 else
4962 return void_type_node;
4965 /* Return true if TYPE is a suitable type for a scalar register variable. */
4967 static inline bool
4968 is_gimple_reg_type (tree type)
4970 return !AGGREGATE_TYPE_P (type);
4973 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4975 static inline gimple_stmt_iterator
4976 gsi_start_1 (gimple_seq *seq)
4978 gimple_stmt_iterator i;
4980 i.ptr = gimple_seq_first (*seq);
4981 i.seq = seq;
4982 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
4984 return i;
4987 #define gsi_start(x) gsi_start_1(&(x))
4989 static inline gimple_stmt_iterator
4990 gsi_none (void)
4992 gimple_stmt_iterator i;
4993 i.ptr = NULL;
4994 i.seq = NULL;
4995 i.bb = NULL;
4996 return i;
4999 /* Return a new iterator pointing to the first statement in basic block BB. */
5001 static inline gimple_stmt_iterator
5002 gsi_start_bb (basic_block bb)
5004 gimple_stmt_iterator i;
5005 gimple_seq *seq;
5007 seq = bb_seq_addr (bb);
5008 i.ptr = gimple_seq_first (*seq);
5009 i.seq = seq;
5010 i.bb = bb;
5012 return i;
5016 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5018 static inline gimple_stmt_iterator
5019 gsi_last_1 (gimple_seq *seq)
5021 gimple_stmt_iterator i;
5023 i.ptr = gimple_seq_last (*seq);
5024 i.seq = seq;
5025 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5027 return i;
5030 #define gsi_last(x) gsi_last_1(&(x))
5032 /* Return a new iterator pointing to the last statement in basic block BB. */
5034 static inline gimple_stmt_iterator
5035 gsi_last_bb (basic_block bb)
5037 gimple_stmt_iterator i;
5038 gimple_seq *seq;
5040 seq = bb_seq_addr (bb);
5041 i.ptr = gimple_seq_last (*seq);
5042 i.seq = seq;
5043 i.bb = bb;
5045 return i;
5049 /* Return true if I is at the end of its sequence. */
5051 static inline bool
5052 gsi_end_p (gimple_stmt_iterator i)
5054 return i.ptr == NULL;
5058 /* Return true if I is one statement before the end of its sequence. */
5060 static inline bool
5061 gsi_one_before_end_p (gimple_stmt_iterator i)
5063 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5067 /* Advance the iterator to the next gimple statement. */
5069 static inline void
5070 gsi_next (gimple_stmt_iterator *i)
5072 i->ptr = i->ptr->gsbase.next;
5075 /* Advance the iterator to the previous gimple statement. */
5077 static inline void
5078 gsi_prev (gimple_stmt_iterator *i)
5080 gimple prev = i->ptr->gsbase.prev;
5081 if (prev->gsbase.next)
5082 i->ptr = prev;
5083 else
5084 i->ptr = NULL;
5087 /* Return the current stmt. */
5089 static inline gimple
5090 gsi_stmt (gimple_stmt_iterator i)
5092 return i.ptr;
5095 /* Return a block statement iterator that points to the first non-label
5096 statement in block BB. */
5098 static inline gimple_stmt_iterator
5099 gsi_after_labels (basic_block bb)
5101 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5103 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5104 gsi_next (&gsi);
5106 return gsi;
5109 /* Advance the iterator to the next non-debug gimple statement. */
5111 static inline void
5112 gsi_next_nondebug (gimple_stmt_iterator *i)
5116 gsi_next (i);
5118 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5121 /* Advance the iterator to the next non-debug gimple statement. */
5123 static inline void
5124 gsi_prev_nondebug (gimple_stmt_iterator *i)
5128 gsi_prev (i);
5130 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5133 /* Return a new iterator pointing to the first non-debug statement in
5134 basic block BB. */
5136 static inline gimple_stmt_iterator
5137 gsi_start_nondebug_bb (basic_block bb)
5139 gimple_stmt_iterator i = gsi_start_bb (bb);
5141 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5142 gsi_next_nondebug (&i);
5144 return i;
5147 /* Return a new iterator pointing to the last non-debug statement in
5148 basic block BB. */
5150 static inline gimple_stmt_iterator
5151 gsi_last_nondebug_bb (basic_block bb)
5153 gimple_stmt_iterator i = gsi_last_bb (bb);
5155 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5156 gsi_prev_nondebug (&i);
5158 return i;
5162 /* Return the basic block associated with this iterator. */
5164 static inline basic_block
5165 gsi_bb (gimple_stmt_iterator i)
5167 return i.bb;
5171 /* Return the sequence associated with this iterator. */
5173 static inline gimple_seq
5174 gsi_seq (gimple_stmt_iterator i)
5176 return *i.seq;
5180 enum gsi_iterator_update
5182 GSI_NEW_STMT, /* Only valid when single statement is added, move
5183 iterator to it. */
5184 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5185 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5186 for linking other statements in the same
5187 direction. */
5190 /* In gimple-iterator.c */
5191 gimple_stmt_iterator gsi_start_phis (basic_block);
5192 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5193 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5194 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5195 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5196 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5197 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5198 enum gsi_iterator_update);
5199 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5200 enum gsi_iterator_update);
5201 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5202 enum gsi_iterator_update);
5203 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5204 enum gsi_iterator_update);
5205 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5206 enum gsi_iterator_update);
5207 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5208 enum gsi_iterator_update);
5209 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5210 enum gsi_iterator_update);
5211 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5212 enum gsi_iterator_update);
5213 bool gsi_remove (gimple_stmt_iterator *, bool);
5214 gimple_stmt_iterator gsi_for_stmt (gimple);
5215 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5216 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5217 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5218 void gsi_insert_on_edge (edge, gimple);
5219 void gsi_insert_seq_on_edge (edge, gimple_seq);
5220 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5221 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5222 void gsi_commit_one_edge_insert (edge, basic_block *);
5223 void gsi_commit_edge_inserts (void);
5224 gimple gimple_call_copy_skip_args (gimple, bitmap);
5227 /* Convenience routines to walk all statements of a gimple function.
5228 Note that this is useful exclusively before the code is converted
5229 into SSA form. Once the program is in SSA form, the standard
5230 operand interface should be used to analyze/modify statements. */
5231 struct walk_stmt_info
5233 /* Points to the current statement being walked. */
5234 gimple_stmt_iterator gsi;
5236 /* Additional data that the callback functions may want to carry
5237 through the recursion. */
5238 void *info;
5240 /* Pointer map used to mark visited tree nodes when calling
5241 walk_tree on each operand. If set to NULL, duplicate tree nodes
5242 will be visited more than once. */
5243 struct pointer_set_t *pset;
5245 /* Operand returned by the callbacks. This is set when calling
5246 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5247 returns non-NULL, this field will contain the tree returned by
5248 the last callback. */
5249 tree callback_result;
5251 /* Indicates whether the operand being examined may be replaced
5252 with something that matches is_gimple_val (if true) or something
5253 slightly more complicated (if false). "Something" technically
5254 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5255 but we never try to form anything more complicated than that, so
5256 we don't bother checking.
5258 Also note that CALLBACK should update this flag while walking the
5259 sub-expressions of a statement. For instance, when walking the
5260 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5261 to true, however, when walking &var, the operand of that
5262 ADDR_EXPR does not need to be a GIMPLE value. */
5263 BOOL_BITFIELD val_only : 1;
5265 /* True if we are currently walking the LHS of an assignment. */
5266 BOOL_BITFIELD is_lhs : 1;
5268 /* Optional. Set to true by the callback functions if they made any
5269 changes. */
5270 BOOL_BITFIELD changed : 1;
5272 /* True if we're interested in location information. */
5273 BOOL_BITFIELD want_locations : 1;
5275 /* True if we've removed the statement that was processed. */
5276 BOOL_BITFIELD removed_stmt : 1;
5279 /* Callback for walk_gimple_stmt. Called for every statement found
5280 during traversal. The first argument points to the statement to
5281 walk. The second argument is a flag that the callback sets to
5282 'true' if it the callback handled all the operands and
5283 sub-statements of the statement (the default value of this flag is
5284 'false'). The third argument is an anonymous pointer to data
5285 to be used by the callback. */
5286 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5287 struct walk_stmt_info *);
5289 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5290 struct walk_stmt_info *);
5291 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5292 struct walk_stmt_info *);
5293 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5294 struct walk_stmt_info *);
5295 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5297 /* Enum and arrays used for allocation stats. Keep in sync with
5298 gimple.c:gimple_alloc_kind_names. */
5299 enum gimple_alloc_kind
5301 gimple_alloc_kind_assign, /* Assignments. */
5302 gimple_alloc_kind_phi, /* PHI nodes. */
5303 gimple_alloc_kind_cond, /* Conditionals. */
5304 gimple_alloc_kind_rest, /* Everything else. */
5305 gimple_alloc_kind_all
5308 extern int gimple_alloc_counts[];
5309 extern int gimple_alloc_sizes[];
5311 /* Return the allocation kind for a given stmt CODE. */
5312 static inline enum gimple_alloc_kind
5313 gimple_alloc_kind (enum gimple_code code)
5315 switch (code)
5317 case GIMPLE_ASSIGN:
5318 return gimple_alloc_kind_assign;
5319 case GIMPLE_PHI:
5320 return gimple_alloc_kind_phi;
5321 case GIMPLE_COND:
5322 return gimple_alloc_kind_cond;
5323 default:
5324 return gimple_alloc_kind_rest;
5328 extern void dump_gimple_statistics (void);
5330 /* In gimple-fold.c. */
5331 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5332 tree gimple_fold_builtin (gimple);
5333 bool fold_stmt (gimple_stmt_iterator *);
5334 bool fold_stmt_inplace (gimple_stmt_iterator *);
5335 tree get_symbol_constant_value (tree);
5336 tree canonicalize_constructor_val (tree, tree);
5337 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5338 enum tree_code, tree, tree);
5339 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5340 enum tree_code, tree, tree);
5342 bool gimple_val_nonnegative_real_p (tree);
5343 #endif /* GCC_GIMPLE_H */