Mark ChangeLog
[official-gcc.git] / gcc / gimple.h
blob4985446cc4c9aba1cd43d8d4b87770a74c2cd044
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 /* Padding to get subcode to 16 bit alignment. */
180 unsigned pad : 1;
182 /* The SUBCODE field can be used for tuple-specific flags for tuples
183 that do not require subcodes. Note that SUBCODE should be at
184 least as wide as tree codes, as several tuples store tree codes
185 in there. */
186 unsigned int subcode : 16;
188 /* UID of this statement. This is used by passes that want to
189 assign IDs to statements. It must be assigned and used by each
190 pass. By default it should be assumed to contain garbage. */
191 unsigned uid;
193 /* [ WORD 2 ]
194 Locus information for debug info. */
195 location_t location;
197 /* Number of operands in this tuple. */
198 unsigned num_ops;
200 /* [ WORD 3 ]
201 Basic block holding this statement. */
202 basic_block bb;
204 /* [ WORD 4-5 ]
205 Linked lists of gimple statements. The next pointers form
206 a NULL terminated list, the prev pointers are a cyclic list.
207 A gimple statement is hence also a double-ended list of
208 statements, with the pointer itself being the first element,
209 and the prev pointer being the last. */
210 gimple next;
211 gimple GTY((skip)) prev;
215 /* Base structure for tuples with operands. */
217 struct GTY(()) gimple_statement_with_ops_base
219 /* [ WORD 1-6 ] */
220 struct gimple_statement_base gsbase;
222 /* [ WORD 7 ]
223 SSA operand vectors. NOTE: It should be possible to
224 amalgamate these vectors with the operand vector OP. However,
225 the SSA operand vectors are organized differently and contain
226 more information (like immediate use chaining). */
227 struct use_optype_d GTY((skip (""))) *use_ops;
231 /* Statements that take register operands. */
233 struct GTY(()) gimple_statement_with_ops
235 /* [ WORD 1-7 ] */
236 struct gimple_statement_with_ops_base opbase;
238 /* [ WORD 8 ]
239 Operand vector. NOTE! This must always be the last field
240 of this structure. In particular, this means that this
241 structure cannot be embedded inside another one. */
242 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
246 /* Base for statements that take both memory and register operands. */
248 struct GTY(()) gimple_statement_with_memory_ops_base
250 /* [ WORD 1-7 ] */
251 struct gimple_statement_with_ops_base opbase;
253 /* [ WORD 8-9 ]
254 Virtual operands for this statement. The GC will pick them
255 up via the ssa_names array. */
256 tree GTY((skip (""))) vdef;
257 tree GTY((skip (""))) vuse;
261 /* Statements that take both memory and register operands. */
263 struct GTY(()) gimple_statement_with_memory_ops
265 /* [ WORD 1-9 ] */
266 struct gimple_statement_with_memory_ops_base membase;
268 /* [ WORD 10 ]
269 Operand vector. NOTE! This must always be the last field
270 of this structure. In particular, this means that this
271 structure cannot be embedded inside another one. */
272 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
276 /* Call statements that take both memory and register operands. */
278 struct GTY(()) gimple_statement_call
280 /* [ WORD 1-9 ] */
281 struct gimple_statement_with_memory_ops_base membase;
283 /* [ WORD 10-13 ] */
284 struct pt_solution call_used;
285 struct pt_solution call_clobbered;
287 /* [ WORD 14 ] */
288 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
289 tree GTY ((tag ("0"))) fntype;
290 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
291 } u;
293 /* [ WORD 15 ]
294 Operand vector. NOTE! This must always be the last field
295 of this structure. In particular, this means that this
296 structure cannot be embedded inside another one. */
297 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
301 /* OpenMP statements (#pragma omp). */
303 struct GTY(()) gimple_statement_omp {
304 /* [ WORD 1-6 ] */
305 struct gimple_statement_base gsbase;
307 /* [ WORD 7 ] */
308 gimple_seq body;
312 /* GIMPLE_BIND */
314 struct GTY(()) gimple_statement_bind {
315 /* [ WORD 1-6 ] */
316 struct gimple_statement_base gsbase;
318 /* [ WORD 7 ]
319 Variables declared in this scope. */
320 tree vars;
322 /* [ WORD 8 ]
323 This is different than the BLOCK field in gimple_statement_base,
324 which is analogous to TREE_BLOCK (i.e., the lexical block holding
325 this statement). This field is the equivalent of BIND_EXPR_BLOCK
326 in tree land (i.e., the lexical scope defined by this bind). See
327 gimple-low.c. */
328 tree block;
330 /* [ WORD 9 ] */
331 gimple_seq body;
335 /* GIMPLE_CATCH */
337 struct GTY(()) gimple_statement_catch {
338 /* [ WORD 1-6 ] */
339 struct gimple_statement_base gsbase;
341 /* [ WORD 7 ] */
342 tree types;
344 /* [ WORD 8 ] */
345 gimple_seq handler;
349 /* GIMPLE_EH_FILTER */
351 struct GTY(()) gimple_statement_eh_filter {
352 /* [ WORD 1-6 ] */
353 struct gimple_statement_base gsbase;
355 /* [ WORD 7 ]
356 Filter types. */
357 tree types;
359 /* [ WORD 8 ]
360 Failure actions. */
361 gimple_seq failure;
364 /* GIMPLE_EH_ELSE */
366 struct GTY(()) gimple_statement_eh_else {
367 /* [ WORD 1-6 ] */
368 struct gimple_statement_base gsbase;
370 /* [ WORD 7,8 ] */
371 gimple_seq n_body, e_body;
374 /* GIMPLE_EH_MUST_NOT_THROW */
376 struct GTY(()) gimple_statement_eh_mnt {
377 /* [ WORD 1-6 ] */
378 struct gimple_statement_base gsbase;
380 /* [ WORD 7 ] Abort function decl. */
381 tree fndecl;
384 /* GIMPLE_PHI */
386 struct GTY(()) gimple_statement_phi {
387 /* [ WORD 1-6 ] */
388 struct gimple_statement_base gsbase;
390 /* [ WORD 7 ] */
391 unsigned capacity;
392 unsigned nargs;
394 /* [ WORD 8 ] */
395 tree result;
397 /* [ WORD 9 ] */
398 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
402 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
404 struct GTY(()) gimple_statement_eh_ctrl
406 /* [ WORD 1-6 ] */
407 struct gimple_statement_base gsbase;
409 /* [ WORD 7 ]
410 Exception region number. */
411 int region;
415 /* GIMPLE_TRY */
417 struct GTY(()) gimple_statement_try {
418 /* [ WORD 1-6 ] */
419 struct gimple_statement_base gsbase;
421 /* [ WORD 7 ]
422 Expression to evaluate. */
423 gimple_seq eval;
425 /* [ WORD 8 ]
426 Cleanup expression. */
427 gimple_seq cleanup;
430 /* Kind of GIMPLE_TRY statements. */
431 enum gimple_try_flags
433 /* A try/catch. */
434 GIMPLE_TRY_CATCH = 1 << 0,
436 /* A try/finally. */
437 GIMPLE_TRY_FINALLY = 1 << 1,
438 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
440 /* Analogous to TRY_CATCH_IS_CLEANUP. */
441 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
444 /* GIMPLE_WITH_CLEANUP_EXPR */
446 struct GTY(()) gimple_statement_wce {
447 /* [ WORD 1-6 ] */
448 struct gimple_statement_base gsbase;
450 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
451 executed if an exception is thrown, not on normal exit of its
452 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
453 in TARGET_EXPRs. */
455 /* [ WORD 7 ]
456 Cleanup expression. */
457 gimple_seq cleanup;
461 /* GIMPLE_ASM */
463 struct GTY(()) gimple_statement_asm
465 /* [ WORD 1-9 ] */
466 struct gimple_statement_with_memory_ops_base membase;
468 /* [ WORD 10 ]
469 __asm__ statement. */
470 const char *string;
472 /* [ WORD 11 ]
473 Number of inputs, outputs, clobbers, labels. */
474 unsigned char ni;
475 unsigned char no;
476 unsigned char nc;
477 unsigned char nl;
479 /* [ WORD 12 ]
480 Operand vector. NOTE! This must always be the last field
481 of this structure. In particular, this means that this
482 structure cannot be embedded inside another one. */
483 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
486 /* GIMPLE_OMP_CRITICAL */
488 struct GTY(()) gimple_statement_omp_critical {
489 /* [ WORD 1-7 ] */
490 struct gimple_statement_omp omp;
492 /* [ WORD 8 ]
493 Critical section name. */
494 tree name;
498 struct GTY(()) gimple_omp_for_iter {
499 /* Condition code. */
500 enum tree_code cond;
502 /* Index variable. */
503 tree index;
505 /* Initial value. */
506 tree initial;
508 /* Final value. */
509 tree final;
511 /* Increment. */
512 tree incr;
515 /* GIMPLE_OMP_FOR */
517 struct GTY(()) gimple_statement_omp_for {
518 /* [ WORD 1-7 ] */
519 struct gimple_statement_omp omp;
521 /* [ WORD 8 ] */
522 tree clauses;
524 /* [ WORD 9 ]
525 Number of elements in iter array. */
526 size_t collapse;
528 /* [ WORD 10 ] */
529 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
531 /* [ WORD 11 ]
532 Pre-body evaluated before the loop body begins. */
533 gimple_seq pre_body;
537 /* GIMPLE_OMP_PARALLEL */
539 struct GTY(()) gimple_statement_omp_parallel {
540 /* [ WORD 1-7 ] */
541 struct gimple_statement_omp omp;
543 /* [ WORD 8 ]
544 Clauses. */
545 tree clauses;
547 /* [ WORD 9 ]
548 Child function holding the body of the parallel region. */
549 tree child_fn;
551 /* [ WORD 10 ]
552 Shared data argument. */
553 tree data_arg;
557 /* GIMPLE_OMP_TASK */
559 struct GTY(()) gimple_statement_omp_task {
560 /* [ WORD 1-10 ] */
561 struct gimple_statement_omp_parallel par;
563 /* [ WORD 11 ]
564 Child function holding firstprivate initialization if needed. */
565 tree copy_fn;
567 /* [ WORD 12-13 ]
568 Size and alignment in bytes of the argument data block. */
569 tree arg_size;
570 tree arg_align;
574 /* GIMPLE_OMP_SECTION */
575 /* Uses struct gimple_statement_omp. */
578 /* GIMPLE_OMP_SECTIONS */
580 struct GTY(()) gimple_statement_omp_sections {
581 /* [ WORD 1-7 ] */
582 struct gimple_statement_omp omp;
584 /* [ WORD 8 ] */
585 tree clauses;
587 /* [ WORD 9 ]
588 The control variable used for deciding which of the sections to
589 execute. */
590 tree control;
593 /* GIMPLE_OMP_CONTINUE.
595 Note: This does not inherit from gimple_statement_omp, because we
596 do not need the body field. */
598 struct GTY(()) gimple_statement_omp_continue {
599 /* [ WORD 1-6 ] */
600 struct gimple_statement_base gsbase;
602 /* [ WORD 7 ] */
603 tree control_def;
605 /* [ WORD 8 ] */
606 tree control_use;
609 /* GIMPLE_OMP_SINGLE */
611 struct GTY(()) gimple_statement_omp_single {
612 /* [ WORD 1-7 ] */
613 struct gimple_statement_omp omp;
615 /* [ WORD 7 ] */
616 tree clauses;
620 /* GIMPLE_OMP_ATOMIC_LOAD.
621 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
622 contains a sequence, which we don't need here. */
624 struct GTY(()) gimple_statement_omp_atomic_load {
625 /* [ WORD 1-6 ] */
626 struct gimple_statement_base gsbase;
628 /* [ WORD 7-8 ] */
629 tree rhs, lhs;
632 /* GIMPLE_OMP_ATOMIC_STORE.
633 See note on GIMPLE_OMP_ATOMIC_LOAD. */
635 struct GTY(()) gimple_statement_omp_atomic_store {
636 /* [ WORD 1-6 ] */
637 struct gimple_statement_base gsbase;
639 /* [ WORD 7 ] */
640 tree val;
643 /* GIMPLE_TRANSACTION. */
645 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
647 /* The __transaction_atomic was declared [[outer]] or it is
648 __transaction_relaxed. */
649 #define GTMA_IS_OUTER (1u << 0)
650 #define GTMA_IS_RELAXED (1u << 1)
651 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
653 /* The transaction is seen to not have an abort. */
654 #define GTMA_HAVE_ABORT (1u << 2)
655 /* The transaction is seen to have loads or stores. */
656 #define GTMA_HAVE_LOAD (1u << 3)
657 #define GTMA_HAVE_STORE (1u << 4)
658 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
659 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
660 /* The transaction WILL enter serial irrevocable mode.
661 An irrevocable block post-dominates the entire transaction, such
662 that all invocations of the transaction will go serial-irrevocable.
663 In such case, we don't bother instrumenting the transaction, and
664 tell the runtime that it should begin the transaction in
665 serial-irrevocable mode. */
666 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
667 /* The transaction contains no instrumentation code whatsover, most
668 likely because it is guaranteed to go irrevocable upon entry. */
669 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
671 struct GTY(()) gimple_statement_transaction
673 /* [ WORD 1-9 ] */
674 struct gimple_statement_with_memory_ops_base gsbase;
676 /* [ WORD 10 ] */
677 gimple_seq body;
679 /* [ WORD 11 ] */
680 tree label;
683 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
684 enum gimple_statement_structure_enum {
685 #include "gsstruct.def"
686 LAST_GSS_ENUM
688 #undef DEFGSSTRUCT
691 /* Define the overall contents of a gimple tuple. It may be any of the
692 structures declared above for various types of tuples. */
694 union GTY ((desc ("gimple_statement_structure (&%h)"),
695 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
696 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
697 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
698 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
699 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
700 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
701 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
702 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
703 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
704 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
705 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
706 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
707 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
708 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
709 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
710 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
711 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
712 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
713 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
714 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
715 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
716 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
717 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
718 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
719 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
720 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
721 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
724 /* In gimple.c. */
726 /* Offset in bytes to the location of the operand vector.
727 Zero if there is no operand vector for this tuple structure. */
728 extern size_t const gimple_ops_offset_[];
730 /* Map GIMPLE codes to GSS codes. */
731 extern enum gimple_statement_structure_enum const gss_for_code_[];
733 /* This variable holds the currently expanded gimple statement for purposes
734 of comminucating the profile info to the builtin expanders. */
735 extern gimple currently_expanding_gimple_stmt;
737 gimple gimple_build_return (tree);
739 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
740 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
742 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
744 gimple
745 gimple_build_assign_with_ops (enum tree_code, tree,
746 tree, tree CXX_MEM_STAT_INFO);
747 gimple
748 gimple_build_assign_with_ops (enum tree_code, tree,
749 tree, tree, tree CXX_MEM_STAT_INFO);
751 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
752 #define gimple_build_debug_bind(var,val,stmt) \
753 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
754 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
755 #define gimple_build_debug_source_bind(var,val,stmt) \
756 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
758 gimple gimple_build_call_vec (tree, vec<tree> );
759 gimple gimple_build_call (tree, unsigned, ...);
760 gimple gimple_build_call_valist (tree, unsigned, va_list);
761 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
762 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
763 gimple gimple_build_call_from_tree (tree);
764 gimple gimplify_assign (tree, tree, gimple_seq *);
765 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
766 gimple gimple_build_label (tree label);
767 gimple gimple_build_goto (tree dest);
768 gimple gimple_build_nop (void);
769 gimple gimple_build_bind (tree, gimple_seq, tree);
770 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
771 vec<tree, va_gc> *, vec<tree, va_gc> *,
772 vec<tree, va_gc> *);
773 gimple gimple_build_catch (tree, gimple_seq);
774 gimple gimple_build_eh_filter (tree, gimple_seq);
775 gimple gimple_build_eh_must_not_throw (tree);
776 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
777 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
778 gimple gimple_build_wce (gimple_seq);
779 gimple gimple_build_resx (int);
780 gimple gimple_build_eh_dispatch (int);
781 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
782 gimple gimple_build_switch (tree, tree, vec<tree> );
783 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
784 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
785 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
786 gimple gimple_build_omp_critical (gimple_seq, tree);
787 gimple gimple_build_omp_section (gimple_seq);
788 gimple gimple_build_omp_continue (tree, tree);
789 gimple gimple_build_omp_master (gimple_seq);
790 gimple gimple_build_omp_return (bool);
791 gimple gimple_build_omp_ordered (gimple_seq);
792 gimple gimple_build_omp_sections (gimple_seq, tree);
793 gimple gimple_build_omp_sections_switch (void);
794 gimple gimple_build_omp_single (gimple_seq, tree);
795 gimple gimple_build_cdt (tree, tree);
796 gimple gimple_build_omp_atomic_load (tree, tree);
797 gimple gimple_build_omp_atomic_store (tree);
798 gimple gimple_build_transaction (gimple_seq, tree);
799 gimple gimple_build_predict (enum br_predictor, enum prediction);
800 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
801 void sort_case_labels (vec<tree> );
802 void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
803 void gimple_set_body (tree, gimple_seq);
804 gimple_seq gimple_body (tree);
805 bool gimple_has_body_p (tree);
806 gimple_seq gimple_seq_alloc (void);
807 void gimple_seq_free (gimple_seq);
808 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
809 gimple_seq gimple_seq_copy (gimple_seq);
810 bool gimple_call_same_target_p (const_gimple, const_gimple);
811 int gimple_call_flags (const_gimple);
812 int gimple_call_return_flags (const_gimple);
813 int gimple_call_arg_flags (const_gimple, unsigned);
814 void gimple_call_reset_alias_info (gimple);
815 bool gimple_assign_copy_p (gimple);
816 bool gimple_assign_ssa_name_copy_p (gimple);
817 bool gimple_assign_unary_nop_p (gimple);
818 void gimple_set_bb (gimple, basic_block);
819 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
820 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
821 tree, tree, tree);
822 tree gimple_get_lhs (const_gimple);
823 void gimple_set_lhs (gimple, tree);
824 void gimple_replace_lhs (gimple, tree);
825 gimple gimple_copy (gimple);
826 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
827 gimple gimple_build_cond_from_tree (tree, tree, tree);
828 void gimple_cond_set_condition_from_tree (gimple, tree);
829 bool gimple_has_side_effects (const_gimple);
830 bool gimple_could_trap_p (gimple);
831 bool gimple_could_trap_p_1 (gimple, bool, bool);
832 bool gimple_assign_rhs_could_trap_p (gimple);
833 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
834 bool empty_body_p (gimple_seq);
835 unsigned get_gimple_rhs_num_ops (enum tree_code);
836 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
837 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
838 const char *gimple_decl_printable_name (tree, int);
839 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
840 tree gimple_extract_devirt_binfo_from_cst (tree);
842 /* Returns true iff T is a scalar register variable. */
843 extern bool is_gimple_reg (tree);
844 /* Returns true iff T is any sort of variable. */
845 extern bool is_gimple_variable (tree);
846 /* Returns true iff T is any sort of symbol. */
847 extern bool is_gimple_id (tree);
848 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
849 extern bool is_gimple_min_lval (tree);
850 /* Returns true iff T is something whose address can be taken. */
851 extern bool is_gimple_addressable (tree);
852 /* Returns true iff T is any valid GIMPLE lvalue. */
853 extern bool is_gimple_lvalue (tree);
855 /* Returns true iff T is a GIMPLE address. */
856 bool is_gimple_address (const_tree);
857 /* Returns true iff T is a GIMPLE invariant address. */
858 bool is_gimple_invariant_address (const_tree);
859 /* Returns true iff T is a GIMPLE invariant address at interprocedural
860 level. */
861 bool is_gimple_ip_invariant_address (const_tree);
862 /* Returns true iff T is a valid GIMPLE constant. */
863 bool is_gimple_constant (const_tree);
864 /* Returns true iff T is a GIMPLE restricted function invariant. */
865 extern bool is_gimple_min_invariant (const_tree);
866 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
867 extern bool is_gimple_ip_invariant (const_tree);
868 /* Returns true iff T is a GIMPLE rvalue. */
869 extern bool is_gimple_val (tree);
870 /* Returns true iff T is a GIMPLE asm statement input. */
871 extern bool is_gimple_asm_val (tree);
872 /* Returns true iff T is a valid address operand of a MEM_REF. */
873 bool is_gimple_mem_ref_addr (tree);
875 /* Returns true iff T is a valid if-statement condition. */
876 extern bool is_gimple_condexpr (tree);
878 /* Returns true iff T is a valid call address expression. */
879 extern bool is_gimple_call_addr (tree);
881 /* Return TRUE iff stmt is a call to a built-in function. */
882 extern bool is_gimple_builtin_call (gimple stmt);
884 extern void recalculate_side_effects (tree);
885 extern bool gimple_compare_field_offset (tree, tree);
886 extern tree gimple_register_canonical_type (tree);
887 extern void print_gimple_types_stats (const char *);
888 extern void free_gimple_type_tables (void);
889 extern tree gimple_unsigned_type (tree);
890 extern tree gimple_signed_type (tree);
891 extern alias_set_type gimple_get_alias_set (tree);
892 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
893 unsigned *);
894 typedef bool (*walk_stmt_load_store_addr_fn) (gimple, tree, tree, void *);
895 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
896 walk_stmt_load_store_addr_fn,
897 walk_stmt_load_store_addr_fn,
898 walk_stmt_load_store_addr_fn);
899 extern bool walk_stmt_load_store_ops (gimple, void *,
900 walk_stmt_load_store_addr_fn,
901 walk_stmt_load_store_addr_fn);
902 extern bool gimple_ior_addresses_taken (bitmap, gimple);
903 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
904 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
905 extern bool gimple_asm_clobbers_memory_p (const_gimple);
907 /* In gimplify.c */
908 extern tree create_tmp_var_raw (tree, const char *);
909 extern tree create_tmp_var_name (const char *);
910 extern tree create_tmp_var (tree, const char *);
911 extern tree create_tmp_reg (tree, const char *);
912 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
913 extern tree get_formal_tmp_var (tree, gimple_seq *);
914 extern void declare_vars (tree, gimple, bool);
915 extern void annotate_all_with_location (gimple_seq, location_t);
917 /* Validation of GIMPLE expressions. Note that these predicates only check
918 the basic form of the expression, they don't recurse to make sure that
919 underlying nodes are also of the right form. */
920 typedef bool (*gimple_predicate)(tree);
923 /* FIXME we should deduce this from the predicate. */
924 enum fallback {
925 fb_none = 0, /* Do not generate a temporary. */
927 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
928 gimplified expression. */
930 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
931 gimplified expression. */
933 fb_mayfail = 4, /* Gimplification may fail. Error issued
934 afterwards. */
935 fb_either= fb_rvalue | fb_lvalue
938 typedef int fallback_t;
940 enum gimplify_status {
941 GS_ERROR = -2, /* Something Bad Seen. */
942 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
943 GS_OK = 0, /* We did something, maybe more to do. */
944 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
947 struct gimplify_ctx
949 struct gimplify_ctx *prev_context;
951 vec<gimple> bind_expr_stack;
952 tree temps;
953 gimple_seq conditional_cleanups;
954 tree exit_label;
955 tree return_temp;
957 vec<tree> case_labels;
958 /* The formal temporary table. Should this be persistent? */
959 htab_t temp_htab;
961 int conditions;
962 bool save_stack;
963 bool into_ssa;
964 bool allow_rhs_cond_expr;
965 bool in_cleanup_point_expr;
968 /* Return true if gimplify_one_sizepos doesn't need to gimplify
969 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
970 fields). */
971 static inline bool
972 is_gimple_sizepos (tree expr)
974 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
975 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
976 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
977 function, the gimplifier will want to replace it with a new variable,
978 but that will cause problems if this type is from outside the function.
979 It's OK to have that here. */
980 return (expr == NULL_TREE
981 || TREE_CONSTANT (expr)
982 || TREE_CODE (expr) == VAR_DECL
983 || CONTAINS_PLACEHOLDER_P (expr));
986 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
987 bool (*) (tree), fallback_t);
988 extern void gimplify_type_sizes (tree, gimple_seq *);
989 extern void gimplify_one_sizepos (tree *, gimple_seq *);
990 enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *,
991 bool, tree);
992 extern bool gimplify_stmt (tree *, gimple_seq *);
993 extern gimple gimplify_body (tree, bool);
994 extern void push_gimplify_context (struct gimplify_ctx *);
995 extern void pop_gimplify_context (gimple);
996 extern void gimplify_and_add (tree, gimple_seq *);
998 /* Miscellaneous helpers. */
999 extern void gimple_add_tmp_var (tree);
1000 extern gimple gimple_current_bind_expr (void);
1001 extern vec<gimple> gimple_bind_expr_stack (void);
1002 extern tree voidify_wrapper_expr (tree, tree);
1003 extern tree build_and_jump (tree *);
1004 extern tree force_labels_r (tree *, int *, void *);
1005 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1006 gimple_seq *);
1007 struct gimplify_omp_ctx;
1008 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1009 extern tree gimple_boolify (tree);
1010 extern gimple_predicate rhs_predicate_for (tree);
1011 extern tree canonicalize_cond_expr_cond (tree);
1013 /* In omp-low.c. */
1014 extern tree omp_reduction_init (tree, tree);
1016 /* In trans-mem.c. */
1017 extern void diagnose_tm_safe_errors (tree);
1018 extern void compute_transaction_bits (void);
1020 /* In tree-nested.c. */
1021 extern void lower_nested_functions (tree);
1022 extern void insert_field_into_struct (tree, tree);
1024 /* In gimplify.c. */
1025 extern void gimplify_function_tree (tree);
1027 /* In cfgexpand.c. */
1028 extern tree gimple_assign_rhs_to_tree (gimple);
1030 /* In builtins.c */
1031 extern bool validate_gimple_arglist (const_gimple, ...);
1033 /* In tree-ssa.c */
1034 extern bool tree_ssa_useless_type_conversion (tree);
1035 extern tree tree_ssa_strip_useless_type_conversions (tree);
1036 extern bool useless_type_conversion_p (tree, tree);
1037 extern bool types_compatible_p (tree, tree);
1039 /* Return the first node in GIMPLE sequence S. */
1041 static inline gimple_seq_node
1042 gimple_seq_first (gimple_seq s)
1044 return s;
1048 /* Return the first statement in GIMPLE sequence S. */
1050 static inline gimple
1051 gimple_seq_first_stmt (gimple_seq s)
1053 gimple_seq_node n = gimple_seq_first (s);
1054 return n;
1058 /* Return the last node in GIMPLE sequence S. */
1060 static inline gimple_seq_node
1061 gimple_seq_last (gimple_seq s)
1063 return s ? s->gsbase.prev : NULL;
1067 /* Return the last statement in GIMPLE sequence S. */
1069 static inline gimple
1070 gimple_seq_last_stmt (gimple_seq s)
1072 gimple_seq_node n = gimple_seq_last (s);
1073 return n;
1077 /* Set the last node in GIMPLE sequence *PS to LAST. */
1079 static inline void
1080 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1082 (*ps)->gsbase.prev = last;
1086 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1088 static inline void
1089 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1091 *ps = first;
1095 /* Return true if GIMPLE sequence S is empty. */
1097 static inline bool
1098 gimple_seq_empty_p (gimple_seq s)
1100 return s == NULL;
1104 void gimple_seq_add_stmt (gimple_seq *, gimple);
1106 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1107 *SEQ_P is NULL, a new sequence is allocated. This function is
1108 similar to gimple_seq_add_stmt, but does not scan the operands.
1109 During gimplification, we need to manipulate statement sequences
1110 before the def/use vectors have been constructed. */
1111 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1113 /* Allocate a new sequence and initialize its first element with STMT. */
1115 static inline gimple_seq
1116 gimple_seq_alloc_with_stmt (gimple stmt)
1118 gimple_seq seq = NULL;
1119 gimple_seq_add_stmt (&seq, stmt);
1120 return seq;
1124 /* Returns the sequence of statements in BB. */
1126 static inline gimple_seq
1127 bb_seq (const_basic_block bb)
1129 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1132 static inline gimple_seq *
1133 bb_seq_addr (basic_block bb)
1135 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1138 /* Sets the sequence of statements in BB to SEQ. */
1140 static inline void
1141 set_bb_seq (basic_block bb, gimple_seq seq)
1143 gcc_checking_assert (!(bb->flags & BB_RTL));
1144 bb->il.gimple.seq = seq;
1148 /* Return the code for GIMPLE statement G. */
1150 static inline enum gimple_code
1151 gimple_code (const_gimple g)
1153 return g->gsbase.code;
1157 /* Return the GSS code used by a GIMPLE code. */
1159 static inline enum gimple_statement_structure_enum
1160 gss_for_code (enum gimple_code code)
1162 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1163 return gss_for_code_[code];
1167 /* Return which GSS code is used by GS. */
1169 static inline enum gimple_statement_structure_enum
1170 gimple_statement_structure (gimple gs)
1172 return gss_for_code (gimple_code (gs));
1176 /* Return true if statement G has sub-statements. This is only true for
1177 High GIMPLE statements. */
1179 static inline bool
1180 gimple_has_substatements (gimple g)
1182 switch (gimple_code (g))
1184 case GIMPLE_BIND:
1185 case GIMPLE_CATCH:
1186 case GIMPLE_EH_FILTER:
1187 case GIMPLE_EH_ELSE:
1188 case GIMPLE_TRY:
1189 case GIMPLE_OMP_FOR:
1190 case GIMPLE_OMP_MASTER:
1191 case GIMPLE_OMP_ORDERED:
1192 case GIMPLE_OMP_SECTION:
1193 case GIMPLE_OMP_PARALLEL:
1194 case GIMPLE_OMP_TASK:
1195 case GIMPLE_OMP_SECTIONS:
1196 case GIMPLE_OMP_SINGLE:
1197 case GIMPLE_OMP_CRITICAL:
1198 case GIMPLE_WITH_CLEANUP_EXPR:
1199 case GIMPLE_TRANSACTION:
1200 return true;
1202 default:
1203 return false;
1208 /* Return the basic block holding statement G. */
1210 static inline basic_block
1211 gimple_bb (const_gimple g)
1213 return g->gsbase.bb;
1217 /* Return the lexical scope block holding statement G. */
1219 static inline tree
1220 gimple_block (const_gimple g)
1222 return LOCATION_BLOCK (g->gsbase.location);
1226 /* Set BLOCK to be the lexical scope block holding statement G. */
1228 static inline void
1229 gimple_set_block (gimple g, tree block)
1231 if (block)
1232 g->gsbase.location =
1233 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1234 else
1235 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1239 /* Return location information for statement G. */
1241 static inline location_t
1242 gimple_location (const_gimple g)
1244 return g->gsbase.location;
1247 /* Return pointer to location information for statement G. */
1249 static inline const location_t *
1250 gimple_location_ptr (const_gimple g)
1252 return &g->gsbase.location;
1256 /* Set location information for statement G. */
1258 static inline void
1259 gimple_set_location (gimple g, location_t location)
1261 g->gsbase.location = location;
1265 /* Return true if G contains location information. */
1267 static inline bool
1268 gimple_has_location (const_gimple g)
1270 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1274 /* Return the file name of the location of STMT. */
1276 static inline const char *
1277 gimple_filename (const_gimple stmt)
1279 return LOCATION_FILE (gimple_location (stmt));
1283 /* Return the line number of the location of STMT. */
1285 static inline int
1286 gimple_lineno (const_gimple stmt)
1288 return LOCATION_LINE (gimple_location (stmt));
1292 /* Determine whether SEQ is a singleton. */
1294 static inline bool
1295 gimple_seq_singleton_p (gimple_seq seq)
1297 return ((gimple_seq_first (seq) != NULL)
1298 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1301 /* Return true if no warnings should be emitted for statement STMT. */
1303 static inline bool
1304 gimple_no_warning_p (const_gimple stmt)
1306 return stmt->gsbase.no_warning;
1309 /* Set the no_warning flag of STMT to NO_WARNING. */
1311 static inline void
1312 gimple_set_no_warning (gimple stmt, bool no_warning)
1314 stmt->gsbase.no_warning = (unsigned) no_warning;
1317 /* Set the visited status on statement STMT to VISITED_P. */
1319 static inline void
1320 gimple_set_visited (gimple stmt, bool visited_p)
1322 stmt->gsbase.visited = (unsigned) visited_p;
1326 /* Return the visited status for statement STMT. */
1328 static inline bool
1329 gimple_visited_p (gimple stmt)
1331 return stmt->gsbase.visited;
1335 /* Set pass local flag PLF on statement STMT to VAL_P. */
1337 static inline void
1338 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1340 if (val_p)
1341 stmt->gsbase.plf |= (unsigned int) plf;
1342 else
1343 stmt->gsbase.plf &= ~((unsigned int) plf);
1347 /* Return the value of pass local flag PLF on statement STMT. */
1349 static inline unsigned int
1350 gimple_plf (gimple stmt, enum plf_mask plf)
1352 return stmt->gsbase.plf & ((unsigned int) plf);
1356 /* Set the UID of statement. */
1358 static inline void
1359 gimple_set_uid (gimple g, unsigned uid)
1361 g->gsbase.uid = uid;
1365 /* Return the UID of statement. */
1367 static inline unsigned
1368 gimple_uid (const_gimple g)
1370 return g->gsbase.uid;
1374 /* Make statement G a singleton sequence. */
1376 static inline void
1377 gimple_init_singleton (gimple g)
1379 g->gsbase.next = NULL;
1380 g->gsbase.prev = g;
1384 /* Return true if GIMPLE statement G has register or memory operands. */
1386 static inline bool
1387 gimple_has_ops (const_gimple g)
1389 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1393 /* Return true if GIMPLE statement G has memory operands. */
1395 static inline bool
1396 gimple_has_mem_ops (const_gimple g)
1398 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1402 /* Return the set of USE operands for statement G. */
1404 static inline struct use_optype_d *
1405 gimple_use_ops (const_gimple g)
1407 if (!gimple_has_ops (g))
1408 return NULL;
1409 return g->gsops.opbase.use_ops;
1413 /* Set USE to be the set of USE operands for statement G. */
1415 static inline void
1416 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1418 gcc_gimple_checking_assert (gimple_has_ops (g));
1419 g->gsops.opbase.use_ops = use;
1423 /* Return the set of VUSE operand for statement G. */
1425 static inline use_operand_p
1426 gimple_vuse_op (const_gimple g)
1428 struct use_optype_d *ops;
1429 if (!gimple_has_mem_ops (g))
1430 return NULL_USE_OPERAND_P;
1431 ops = g->gsops.opbase.use_ops;
1432 if (ops
1433 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1434 return USE_OP_PTR (ops);
1435 return NULL_USE_OPERAND_P;
1438 /* Return the set of VDEF operand for statement G. */
1440 static inline def_operand_p
1441 gimple_vdef_op (gimple g)
1443 if (!gimple_has_mem_ops (g))
1444 return NULL_DEF_OPERAND_P;
1445 if (g->gsmembase.vdef)
1446 return &g->gsmembase.vdef;
1447 return NULL_DEF_OPERAND_P;
1451 /* Return the single VUSE operand of the statement G. */
1453 static inline tree
1454 gimple_vuse (const_gimple g)
1456 if (!gimple_has_mem_ops (g))
1457 return NULL_TREE;
1458 return g->gsmembase.vuse;
1461 /* Return the single VDEF operand of the statement G. */
1463 static inline tree
1464 gimple_vdef (const_gimple g)
1466 if (!gimple_has_mem_ops (g))
1467 return NULL_TREE;
1468 return g->gsmembase.vdef;
1471 /* Return the single VUSE operand of the statement G. */
1473 static inline tree *
1474 gimple_vuse_ptr (gimple g)
1476 if (!gimple_has_mem_ops (g))
1477 return NULL;
1478 return &g->gsmembase.vuse;
1481 /* Return the single VDEF operand of the statement G. */
1483 static inline tree *
1484 gimple_vdef_ptr (gimple g)
1486 if (!gimple_has_mem_ops (g))
1487 return NULL;
1488 return &g->gsmembase.vdef;
1491 /* Set the single VUSE operand of the statement G. */
1493 static inline void
1494 gimple_set_vuse (gimple g, tree vuse)
1496 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1497 g->gsmembase.vuse = vuse;
1500 /* Set the single VDEF operand of the statement G. */
1502 static inline void
1503 gimple_set_vdef (gimple g, tree vdef)
1505 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1506 g->gsmembase.vdef = vdef;
1510 /* Return true if statement G has operands and the modified field has
1511 been set. */
1513 static inline bool
1514 gimple_modified_p (const_gimple g)
1516 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1520 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1521 a MODIFIED field. */
1523 static inline void
1524 gimple_set_modified (gimple s, bool modifiedp)
1526 if (gimple_has_ops (s))
1527 s->gsbase.modified = (unsigned) modifiedp;
1531 /* Return the tree code for the expression computed by STMT. This is
1532 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1533 GIMPLE_CALL, return CALL_EXPR as the expression code for
1534 consistency. This is useful when the caller needs to deal with the
1535 three kinds of computation that GIMPLE supports. */
1537 static inline enum tree_code
1538 gimple_expr_code (const_gimple stmt)
1540 enum gimple_code code = gimple_code (stmt);
1541 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1542 return (enum tree_code) stmt->gsbase.subcode;
1543 else
1545 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1546 return CALL_EXPR;
1551 /* Mark statement S as modified, and update it. */
1553 static inline void
1554 update_stmt (gimple s)
1556 if (gimple_has_ops (s))
1558 gimple_set_modified (s, true);
1559 update_stmt_operands (s);
1563 /* Update statement S if it has been optimized. */
1565 static inline void
1566 update_stmt_if_modified (gimple s)
1568 if (gimple_modified_p (s))
1569 update_stmt_operands (s);
1572 /* Return true if statement STMT contains volatile operands. */
1574 static inline bool
1575 gimple_has_volatile_ops (const_gimple stmt)
1577 if (gimple_has_mem_ops (stmt))
1578 return stmt->gsbase.has_volatile_ops;
1579 else
1580 return false;
1584 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1586 static inline void
1587 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1589 if (gimple_has_mem_ops (stmt))
1590 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1593 /* Return true if BB is in a transaction. */
1595 static inline bool
1596 block_in_transaction (basic_block bb)
1598 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1601 /* Return true if STMT is in a transaction. */
1603 static inline bool
1604 gimple_in_transaction (gimple stmt)
1606 return block_in_transaction (gimple_bb (stmt));
1609 /* Return true if statement STMT may access memory. */
1611 static inline bool
1612 gimple_references_memory_p (gimple stmt)
1614 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1618 /* Return the subcode for OMP statement S. */
1620 static inline unsigned
1621 gimple_omp_subcode (const_gimple s)
1623 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1624 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1625 return s->gsbase.subcode;
1628 /* Set the subcode for OMP statement S to SUBCODE. */
1630 static inline void
1631 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1633 /* We only have 16 bits for the subcode. Assert that we are not
1634 overflowing it. */
1635 gcc_gimple_checking_assert (subcode < (1 << 16));
1636 s->gsbase.subcode = subcode;
1639 /* Set the nowait flag on OMP_RETURN statement S. */
1641 static inline void
1642 gimple_omp_return_set_nowait (gimple s)
1644 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1645 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1649 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1650 flag set. */
1652 static inline bool
1653 gimple_omp_return_nowait_p (const_gimple g)
1655 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1656 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1660 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1661 flag set. */
1663 static inline bool
1664 gimple_omp_section_last_p (const_gimple g)
1666 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1667 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1671 /* Set the GF_OMP_SECTION_LAST flag on G. */
1673 static inline void
1674 gimple_omp_section_set_last (gimple g)
1676 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1677 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1681 /* Return true if OMP parallel statement G has the
1682 GF_OMP_PARALLEL_COMBINED flag set. */
1684 static inline bool
1685 gimple_omp_parallel_combined_p (const_gimple g)
1687 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1688 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1692 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1693 value of COMBINED_P. */
1695 static inline void
1696 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1698 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1699 if (combined_p)
1700 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1701 else
1702 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1706 /* Return true if OMP atomic load/store statement G has the
1707 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1709 static inline bool
1710 gimple_omp_atomic_need_value_p (const_gimple g)
1712 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1713 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1714 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1718 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1720 static inline void
1721 gimple_omp_atomic_set_need_value (gimple g)
1723 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1724 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1725 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1729 /* Return the number of operands for statement GS. */
1731 static inline unsigned
1732 gimple_num_ops (const_gimple gs)
1734 return gs->gsbase.num_ops;
1738 /* Set the number of operands for statement GS. */
1740 static inline void
1741 gimple_set_num_ops (gimple gs, unsigned num_ops)
1743 gs->gsbase.num_ops = num_ops;
1747 /* Return the array of operands for statement GS. */
1749 static inline tree *
1750 gimple_ops (gimple gs)
1752 size_t off;
1754 /* All the tuples have their operand vector at the very bottom
1755 of the structure. Note that those structures that do not
1756 have an operand vector have a zero offset. */
1757 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1758 gcc_gimple_checking_assert (off != 0);
1760 return (tree *) ((char *) gs + off);
1764 /* Return operand I for statement GS. */
1766 static inline tree
1767 gimple_op (const_gimple gs, unsigned i)
1769 if (gimple_has_ops (gs))
1771 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1772 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1774 else
1775 return NULL_TREE;
1778 /* Return a pointer to operand I for statement GS. */
1780 static inline tree *
1781 gimple_op_ptr (const_gimple gs, unsigned i)
1783 if (gimple_has_ops (gs))
1785 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1786 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1788 else
1789 return NULL;
1792 /* Set operand I of statement GS to OP. */
1794 static inline void
1795 gimple_set_op (gimple gs, unsigned i, tree op)
1797 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1799 /* Note. It may be tempting to assert that OP matches
1800 is_gimple_operand, but that would be wrong. Different tuples
1801 accept slightly different sets of tree operands. Each caller
1802 should perform its own validation. */
1803 gimple_ops (gs)[i] = op;
1806 /* Return true if GS is a GIMPLE_ASSIGN. */
1808 static inline bool
1809 is_gimple_assign (const_gimple gs)
1811 return gimple_code (gs) == GIMPLE_ASSIGN;
1814 /* Determine if expression CODE is one of the valid expressions that can
1815 be used on the RHS of GIMPLE assignments. */
1817 static inline enum gimple_rhs_class
1818 get_gimple_rhs_class (enum tree_code code)
1820 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1823 /* Return the LHS of assignment statement GS. */
1825 static inline tree
1826 gimple_assign_lhs (const_gimple gs)
1828 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1829 return gimple_op (gs, 0);
1833 /* Return a pointer to the LHS of assignment statement GS. */
1835 static inline tree *
1836 gimple_assign_lhs_ptr (const_gimple gs)
1838 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1839 return gimple_op_ptr (gs, 0);
1843 /* Set LHS to be the LHS operand of assignment statement GS. */
1845 static inline void
1846 gimple_assign_set_lhs (gimple gs, tree lhs)
1848 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1849 gimple_set_op (gs, 0, lhs);
1851 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1852 SSA_NAME_DEF_STMT (lhs) = gs;
1856 /* Return the first operand on the RHS of assignment statement GS. */
1858 static inline tree
1859 gimple_assign_rhs1 (const_gimple gs)
1861 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1862 return gimple_op (gs, 1);
1866 /* Return a pointer to the first operand on the RHS of assignment
1867 statement GS. */
1869 static inline tree *
1870 gimple_assign_rhs1_ptr (const_gimple gs)
1872 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1873 return gimple_op_ptr (gs, 1);
1876 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1878 static inline void
1879 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1881 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1883 gimple_set_op (gs, 1, rhs);
1887 /* Return the second operand on the RHS of assignment statement GS.
1888 If GS does not have two operands, NULL is returned instead. */
1890 static inline tree
1891 gimple_assign_rhs2 (const_gimple gs)
1893 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1895 if (gimple_num_ops (gs) >= 3)
1896 return gimple_op (gs, 2);
1897 else
1898 return NULL_TREE;
1902 /* Return a pointer to the second operand on the RHS of assignment
1903 statement GS. */
1905 static inline tree *
1906 gimple_assign_rhs2_ptr (const_gimple gs)
1908 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1909 return gimple_op_ptr (gs, 2);
1913 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1915 static inline void
1916 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1918 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1920 gimple_set_op (gs, 2, rhs);
1923 /* Return the third operand on the RHS of assignment statement GS.
1924 If GS does not have two operands, NULL is returned instead. */
1926 static inline tree
1927 gimple_assign_rhs3 (const_gimple gs)
1929 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1931 if (gimple_num_ops (gs) >= 4)
1932 return gimple_op (gs, 3);
1933 else
1934 return NULL_TREE;
1937 /* Return a pointer to the third operand on the RHS of assignment
1938 statement GS. */
1940 static inline tree *
1941 gimple_assign_rhs3_ptr (const_gimple gs)
1943 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1944 return gimple_op_ptr (gs, 3);
1948 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1950 static inline void
1951 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1953 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1955 gimple_set_op (gs, 3, rhs);
1958 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1959 to see only a maximum of two operands. */
1961 static inline void
1962 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1963 tree op1, tree op2)
1965 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1968 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1969 to see only a maximum of two operands. */
1971 static inline void
1972 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1973 tree *op1)
1975 tree op2;
1976 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1977 gcc_assert (op2 == NULL_TREE);
1980 /* Returns true if GS is a nontemporal move. */
1982 static inline bool
1983 gimple_assign_nontemporal_move_p (const_gimple gs)
1985 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1986 return gs->gsbase.nontemporal_move;
1989 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1991 static inline void
1992 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1994 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1995 gs->gsbase.nontemporal_move = nontemporal;
1999 /* Return the code of the expression computed on the rhs of assignment
2000 statement GS. In case that the RHS is a single object, returns the
2001 tree code of the object. */
2003 static inline enum tree_code
2004 gimple_assign_rhs_code (const_gimple gs)
2006 enum tree_code code;
2007 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2009 code = (enum tree_code) gs->gsbase.subcode;
2010 /* While we initially set subcode to the TREE_CODE of the rhs for
2011 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2012 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2013 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2014 code = TREE_CODE (gimple_assign_rhs1 (gs));
2016 return code;
2020 /* Set CODE to be the code for the expression computed on the RHS of
2021 assignment S. */
2023 static inline void
2024 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2026 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2027 s->gsbase.subcode = code;
2031 /* Return the gimple rhs class of the code of the expression computed on
2032 the rhs of assignment statement GS.
2033 This will never return GIMPLE_INVALID_RHS. */
2035 static inline enum gimple_rhs_class
2036 gimple_assign_rhs_class (const_gimple gs)
2038 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2041 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2042 there is no operator associated with the assignment itself.
2043 Unlike gimple_assign_copy_p, this predicate returns true for
2044 any RHS operand, including those that perform an operation
2045 and do not have the semantics of a copy, such as COND_EXPR. */
2047 static inline bool
2048 gimple_assign_single_p (gimple gs)
2050 return (is_gimple_assign (gs)
2051 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2054 /* Return true if GS performs a store to its lhs. */
2056 static inline bool
2057 gimple_store_p (gimple gs)
2059 tree lhs = gimple_get_lhs (gs);
2060 return lhs && !is_gimple_reg (lhs);
2063 /* Return true if GS is an assignment that loads from its rhs1. */
2065 static inline bool
2066 gimple_assign_load_p (gimple gs)
2068 tree rhs;
2069 if (!gimple_assign_single_p (gs))
2070 return false;
2071 rhs = gimple_assign_rhs1 (gs);
2072 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2073 return true;
2074 rhs = get_base_address (rhs);
2075 return (DECL_P (rhs)
2076 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2080 /* Return true if S is a type-cast assignment. */
2082 static inline bool
2083 gimple_assign_cast_p (gimple s)
2085 if (is_gimple_assign (s))
2087 enum tree_code sc = gimple_assign_rhs_code (s);
2088 return CONVERT_EXPR_CODE_P (sc)
2089 || sc == VIEW_CONVERT_EXPR
2090 || sc == FIX_TRUNC_EXPR;
2093 return false;
2096 /* Return true if S is a clobber statement. */
2098 static inline bool
2099 gimple_clobber_p (gimple s)
2101 return gimple_assign_single_p (s)
2102 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2105 /* Return true if GS is a GIMPLE_CALL. */
2107 static inline bool
2108 is_gimple_call (const_gimple gs)
2110 return gimple_code (gs) == GIMPLE_CALL;
2113 /* Return the LHS of call statement GS. */
2115 static inline tree
2116 gimple_call_lhs (const_gimple gs)
2118 GIMPLE_CHECK (gs, GIMPLE_CALL);
2119 return gimple_op (gs, 0);
2123 /* Return a pointer to the LHS of call statement GS. */
2125 static inline tree *
2126 gimple_call_lhs_ptr (const_gimple gs)
2128 GIMPLE_CHECK (gs, GIMPLE_CALL);
2129 return gimple_op_ptr (gs, 0);
2133 /* Set LHS to be the LHS operand of call statement GS. */
2135 static inline void
2136 gimple_call_set_lhs (gimple gs, tree lhs)
2138 GIMPLE_CHECK (gs, GIMPLE_CALL);
2139 gimple_set_op (gs, 0, lhs);
2140 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2141 SSA_NAME_DEF_STMT (lhs) = gs;
2145 /* Return true if call GS calls an internal-only function, as enumerated
2146 by internal_fn. */
2148 static inline bool
2149 gimple_call_internal_p (const_gimple gs)
2151 GIMPLE_CHECK (gs, GIMPLE_CALL);
2152 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2156 /* Return the target of internal call GS. */
2158 static inline enum internal_fn
2159 gimple_call_internal_fn (const_gimple gs)
2161 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2162 return gs->gimple_call.u.internal_fn;
2166 /* Return the function type of the function called by GS. */
2168 static inline tree
2169 gimple_call_fntype (const_gimple gs)
2171 GIMPLE_CHECK (gs, GIMPLE_CALL);
2172 if (gimple_call_internal_p (gs))
2173 return NULL_TREE;
2174 return gs->gimple_call.u.fntype;
2177 /* Set the type of the function called by GS to FNTYPE. */
2179 static inline void
2180 gimple_call_set_fntype (gimple gs, tree fntype)
2182 GIMPLE_CHECK (gs, GIMPLE_CALL);
2183 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2184 gs->gimple_call.u.fntype = fntype;
2188 /* Return the tree node representing the function called by call
2189 statement GS. */
2191 static inline tree
2192 gimple_call_fn (const_gimple gs)
2194 GIMPLE_CHECK (gs, GIMPLE_CALL);
2195 return gimple_op (gs, 1);
2198 /* Return a pointer to the tree node representing the function called by call
2199 statement GS. */
2201 static inline tree *
2202 gimple_call_fn_ptr (const_gimple gs)
2204 GIMPLE_CHECK (gs, GIMPLE_CALL);
2205 return gimple_op_ptr (gs, 1);
2209 /* Set FN to be the function called by call statement GS. */
2211 static inline void
2212 gimple_call_set_fn (gimple gs, tree fn)
2214 GIMPLE_CHECK (gs, GIMPLE_CALL);
2215 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2216 gimple_set_op (gs, 1, fn);
2220 /* Set FNDECL to be the function called by call statement GS. */
2222 static inline void
2223 gimple_call_set_fndecl (gimple gs, tree decl)
2225 GIMPLE_CHECK (gs, GIMPLE_CALL);
2226 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2227 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2231 /* Set internal function FN to be the function called by call statement GS. */
2233 static inline void
2234 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2236 GIMPLE_CHECK (gs, GIMPLE_CALL);
2237 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2238 gs->gimple_call.u.internal_fn = fn;
2242 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2243 associated with the callee if known. Otherwise return NULL_TREE. */
2245 static inline tree
2246 gimple_call_addr_fndecl (const_tree fn)
2248 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2250 tree fndecl = TREE_OPERAND (fn, 0);
2251 if (TREE_CODE (fndecl) == MEM_REF
2252 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2253 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2254 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2255 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2256 return fndecl;
2258 return NULL_TREE;
2261 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2262 Otherwise return NULL. This function is analogous to
2263 get_callee_fndecl in tree land. */
2265 static inline tree
2266 gimple_call_fndecl (const_gimple gs)
2268 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2272 /* Return the type returned by call statement GS. */
2274 static inline tree
2275 gimple_call_return_type (const_gimple gs)
2277 tree type = gimple_call_fntype (gs);
2279 if (type == NULL_TREE)
2280 return TREE_TYPE (gimple_call_lhs (gs));
2282 /* The type returned by a function is the type of its
2283 function type. */
2284 return TREE_TYPE (type);
2288 /* Return the static chain for call statement GS. */
2290 static inline tree
2291 gimple_call_chain (const_gimple gs)
2293 GIMPLE_CHECK (gs, GIMPLE_CALL);
2294 return gimple_op (gs, 2);
2298 /* Return a pointer to the static chain for call statement GS. */
2300 static inline tree *
2301 gimple_call_chain_ptr (const_gimple gs)
2303 GIMPLE_CHECK (gs, GIMPLE_CALL);
2304 return gimple_op_ptr (gs, 2);
2307 /* Set CHAIN to be the static chain for call statement GS. */
2309 static inline void
2310 gimple_call_set_chain (gimple gs, tree chain)
2312 GIMPLE_CHECK (gs, GIMPLE_CALL);
2314 gimple_set_op (gs, 2, chain);
2318 /* Return the number of arguments used by call statement GS. */
2320 static inline unsigned
2321 gimple_call_num_args (const_gimple gs)
2323 unsigned num_ops;
2324 GIMPLE_CHECK (gs, GIMPLE_CALL);
2325 num_ops = gimple_num_ops (gs);
2326 return num_ops - 3;
2330 /* Return the argument at position INDEX for call statement GS. */
2332 static inline tree
2333 gimple_call_arg (const_gimple gs, unsigned index)
2335 GIMPLE_CHECK (gs, GIMPLE_CALL);
2336 return gimple_op (gs, index + 3);
2340 /* Return a pointer to the argument at position INDEX for call
2341 statement GS. */
2343 static inline tree *
2344 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2346 GIMPLE_CHECK (gs, GIMPLE_CALL);
2347 return gimple_op_ptr (gs, index + 3);
2351 /* Set ARG to be the argument at position INDEX for call statement GS. */
2353 static inline void
2354 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2356 GIMPLE_CHECK (gs, GIMPLE_CALL);
2357 gimple_set_op (gs, index + 3, arg);
2361 /* If TAIL_P is true, mark call statement S as being a tail call
2362 (i.e., a call just before the exit of a function). These calls are
2363 candidate for tail call optimization. */
2365 static inline void
2366 gimple_call_set_tail (gimple s, bool tail_p)
2368 GIMPLE_CHECK (s, GIMPLE_CALL);
2369 if (tail_p)
2370 s->gsbase.subcode |= GF_CALL_TAILCALL;
2371 else
2372 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2376 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2378 static inline bool
2379 gimple_call_tail_p (gimple s)
2381 GIMPLE_CHECK (s, GIMPLE_CALL);
2382 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2386 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2387 slot optimization. This transformation uses the target of the call
2388 expansion as the return slot for calls that return in memory. */
2390 static inline void
2391 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2393 GIMPLE_CHECK (s, GIMPLE_CALL);
2394 if (return_slot_opt_p)
2395 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2396 else
2397 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2401 /* Return true if S is marked for return slot optimization. */
2403 static inline bool
2404 gimple_call_return_slot_opt_p (gimple s)
2406 GIMPLE_CHECK (s, GIMPLE_CALL);
2407 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2411 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2412 thunk to the thunked-to function. */
2414 static inline void
2415 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2417 GIMPLE_CHECK (s, GIMPLE_CALL);
2418 if (from_thunk_p)
2419 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2420 else
2421 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2425 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2427 static inline bool
2428 gimple_call_from_thunk_p (gimple s)
2430 GIMPLE_CHECK (s, GIMPLE_CALL);
2431 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2435 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2436 argument pack in its argument list. */
2438 static inline void
2439 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2441 GIMPLE_CHECK (s, GIMPLE_CALL);
2442 if (pass_arg_pack_p)
2443 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2444 else
2445 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2449 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2450 argument pack in its argument list. */
2452 static inline bool
2453 gimple_call_va_arg_pack_p (gimple s)
2455 GIMPLE_CHECK (s, GIMPLE_CALL);
2456 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2460 /* Return true if S is a noreturn call. */
2462 static inline bool
2463 gimple_call_noreturn_p (gimple s)
2465 GIMPLE_CHECK (s, GIMPLE_CALL);
2466 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2470 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2471 even if the called function can throw in other cases. */
2473 static inline void
2474 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2476 GIMPLE_CHECK (s, GIMPLE_CALL);
2477 if (nothrow_p)
2478 s->gsbase.subcode |= GF_CALL_NOTHROW;
2479 else
2480 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2483 /* Return true if S is a nothrow call. */
2485 static inline bool
2486 gimple_call_nothrow_p (gimple s)
2488 GIMPLE_CHECK (s, GIMPLE_CALL);
2489 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2492 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2493 is known to be emitted for VLA objects. Those are wrapped by
2494 stack_save/stack_restore calls and hence can't lead to unbounded
2495 stack growth even when they occur in loops. */
2497 static inline void
2498 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2500 GIMPLE_CHECK (s, GIMPLE_CALL);
2501 if (for_var)
2502 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2503 else
2504 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2507 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2509 static inline bool
2510 gimple_call_alloca_for_var_p (gimple s)
2512 GIMPLE_CHECK (s, GIMPLE_CALL);
2513 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2516 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2518 static inline void
2519 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2521 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2522 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2523 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2527 /* Return a pointer to the points-to solution for the set of call-used
2528 variables of the call CALL. */
2530 static inline struct pt_solution *
2531 gimple_call_use_set (gimple call)
2533 GIMPLE_CHECK (call, GIMPLE_CALL);
2534 return &call->gimple_call.call_used;
2538 /* Return a pointer to the points-to solution for the set of call-used
2539 variables of the call CALL. */
2541 static inline struct pt_solution *
2542 gimple_call_clobber_set (gimple call)
2544 GIMPLE_CHECK (call, GIMPLE_CALL);
2545 return &call->gimple_call.call_clobbered;
2549 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2550 non-NULL lhs. */
2552 static inline bool
2553 gimple_has_lhs (gimple stmt)
2555 return (is_gimple_assign (stmt)
2556 || (is_gimple_call (stmt)
2557 && gimple_call_lhs (stmt) != NULL_TREE));
2561 /* Return the code of the predicate computed by conditional statement GS. */
2563 static inline enum tree_code
2564 gimple_cond_code (const_gimple gs)
2566 GIMPLE_CHECK (gs, GIMPLE_COND);
2567 return (enum tree_code) gs->gsbase.subcode;
2571 /* Set CODE to be the predicate code for the conditional statement GS. */
2573 static inline void
2574 gimple_cond_set_code (gimple gs, enum tree_code code)
2576 GIMPLE_CHECK (gs, GIMPLE_COND);
2577 gs->gsbase.subcode = code;
2581 /* Return the LHS of the predicate computed by conditional statement GS. */
2583 static inline tree
2584 gimple_cond_lhs (const_gimple gs)
2586 GIMPLE_CHECK (gs, GIMPLE_COND);
2587 return gimple_op (gs, 0);
2590 /* Return the pointer to the LHS of the predicate computed by conditional
2591 statement GS. */
2593 static inline tree *
2594 gimple_cond_lhs_ptr (const_gimple gs)
2596 GIMPLE_CHECK (gs, GIMPLE_COND);
2597 return gimple_op_ptr (gs, 0);
2600 /* Set LHS to be the LHS operand of the predicate computed by
2601 conditional statement GS. */
2603 static inline void
2604 gimple_cond_set_lhs (gimple gs, tree lhs)
2606 GIMPLE_CHECK (gs, GIMPLE_COND);
2607 gimple_set_op (gs, 0, lhs);
2611 /* Return the RHS operand of the predicate computed by conditional GS. */
2613 static inline tree
2614 gimple_cond_rhs (const_gimple gs)
2616 GIMPLE_CHECK (gs, GIMPLE_COND);
2617 return gimple_op (gs, 1);
2620 /* Return the pointer to the RHS operand of the predicate computed by
2621 conditional GS. */
2623 static inline tree *
2624 gimple_cond_rhs_ptr (const_gimple gs)
2626 GIMPLE_CHECK (gs, GIMPLE_COND);
2627 return gimple_op_ptr (gs, 1);
2631 /* Set RHS to be the RHS operand of the predicate computed by
2632 conditional statement GS. */
2634 static inline void
2635 gimple_cond_set_rhs (gimple gs, tree rhs)
2637 GIMPLE_CHECK (gs, GIMPLE_COND);
2638 gimple_set_op (gs, 1, rhs);
2642 /* Return the label used by conditional statement GS when its
2643 predicate evaluates to true. */
2645 static inline tree
2646 gimple_cond_true_label (const_gimple gs)
2648 GIMPLE_CHECK (gs, GIMPLE_COND);
2649 return gimple_op (gs, 2);
2653 /* Set LABEL to be the label used by conditional statement GS when its
2654 predicate evaluates to true. */
2656 static inline void
2657 gimple_cond_set_true_label (gimple gs, tree label)
2659 GIMPLE_CHECK (gs, GIMPLE_COND);
2660 gimple_set_op (gs, 2, label);
2664 /* Set LABEL to be the label used by conditional statement GS when its
2665 predicate evaluates to false. */
2667 static inline void
2668 gimple_cond_set_false_label (gimple gs, tree label)
2670 GIMPLE_CHECK (gs, GIMPLE_COND);
2671 gimple_set_op (gs, 3, label);
2675 /* Return the label used by conditional statement GS when its
2676 predicate evaluates to false. */
2678 static inline tree
2679 gimple_cond_false_label (const_gimple gs)
2681 GIMPLE_CHECK (gs, GIMPLE_COND);
2682 return gimple_op (gs, 3);
2686 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2688 static inline void
2689 gimple_cond_make_false (gimple gs)
2691 gimple_cond_set_lhs (gs, boolean_true_node);
2692 gimple_cond_set_rhs (gs, boolean_false_node);
2693 gs->gsbase.subcode = EQ_EXPR;
2697 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2699 static inline void
2700 gimple_cond_make_true (gimple gs)
2702 gimple_cond_set_lhs (gs, boolean_true_node);
2703 gimple_cond_set_rhs (gs, boolean_true_node);
2704 gs->gsbase.subcode = EQ_EXPR;
2707 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2708 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2710 static inline bool
2711 gimple_cond_true_p (const_gimple gs)
2713 tree lhs = gimple_cond_lhs (gs);
2714 tree rhs = gimple_cond_rhs (gs);
2715 enum tree_code code = gimple_cond_code (gs);
2717 if (lhs != boolean_true_node && lhs != boolean_false_node)
2718 return false;
2720 if (rhs != boolean_true_node && rhs != boolean_false_node)
2721 return false;
2723 if (code == NE_EXPR && lhs != rhs)
2724 return true;
2726 if (code == EQ_EXPR && lhs == rhs)
2727 return true;
2729 return false;
2732 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2733 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2735 static inline bool
2736 gimple_cond_false_p (const_gimple gs)
2738 tree lhs = gimple_cond_lhs (gs);
2739 tree rhs = gimple_cond_rhs (gs);
2740 enum tree_code code = gimple_cond_code (gs);
2742 if (lhs != boolean_true_node && lhs != boolean_false_node)
2743 return false;
2745 if (rhs != boolean_true_node && rhs != boolean_false_node)
2746 return false;
2748 if (code == NE_EXPR && lhs == rhs)
2749 return true;
2751 if (code == EQ_EXPR && lhs != rhs)
2752 return true;
2754 return false;
2757 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2758 'if (var == 1)' */
2760 static inline bool
2761 gimple_cond_single_var_p (gimple gs)
2763 if (gimple_cond_code (gs) == NE_EXPR
2764 && gimple_cond_rhs (gs) == boolean_false_node)
2765 return true;
2767 if (gimple_cond_code (gs) == EQ_EXPR
2768 && gimple_cond_rhs (gs) == boolean_true_node)
2769 return true;
2771 return false;
2774 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2776 static inline void
2777 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2779 gimple_cond_set_code (stmt, code);
2780 gimple_cond_set_lhs (stmt, lhs);
2781 gimple_cond_set_rhs (stmt, rhs);
2784 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2786 static inline tree
2787 gimple_label_label (const_gimple gs)
2789 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2790 return gimple_op (gs, 0);
2794 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2795 GS. */
2797 static inline void
2798 gimple_label_set_label (gimple gs, tree label)
2800 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2801 gimple_set_op (gs, 0, label);
2805 /* Return the destination of the unconditional jump GS. */
2807 static inline tree
2808 gimple_goto_dest (const_gimple gs)
2810 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2811 return gimple_op (gs, 0);
2815 /* Set DEST to be the destination of the unconditonal jump GS. */
2817 static inline void
2818 gimple_goto_set_dest (gimple gs, tree dest)
2820 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2821 gimple_set_op (gs, 0, dest);
2825 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2827 static inline tree
2828 gimple_bind_vars (const_gimple gs)
2830 GIMPLE_CHECK (gs, GIMPLE_BIND);
2831 return gs->gimple_bind.vars;
2835 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2836 statement GS. */
2838 static inline void
2839 gimple_bind_set_vars (gimple gs, tree vars)
2841 GIMPLE_CHECK (gs, GIMPLE_BIND);
2842 gs->gimple_bind.vars = vars;
2846 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2847 statement GS. */
2849 static inline void
2850 gimple_bind_append_vars (gimple gs, tree vars)
2852 GIMPLE_CHECK (gs, GIMPLE_BIND);
2853 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2857 static inline gimple_seq *
2858 gimple_bind_body_ptr (gimple gs)
2860 GIMPLE_CHECK (gs, GIMPLE_BIND);
2861 return &gs->gimple_bind.body;
2864 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2866 static inline gimple_seq
2867 gimple_bind_body (gimple gs)
2869 return *gimple_bind_body_ptr (gs);
2873 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2874 statement GS. */
2876 static inline void
2877 gimple_bind_set_body (gimple gs, gimple_seq seq)
2879 GIMPLE_CHECK (gs, GIMPLE_BIND);
2880 gs->gimple_bind.body = seq;
2884 /* Append a statement to the end of a GIMPLE_BIND's body. */
2886 static inline void
2887 gimple_bind_add_stmt (gimple gs, gimple stmt)
2889 GIMPLE_CHECK (gs, GIMPLE_BIND);
2890 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2894 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2896 static inline void
2897 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2899 GIMPLE_CHECK (gs, GIMPLE_BIND);
2900 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2904 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2905 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2907 static inline tree
2908 gimple_bind_block (const_gimple gs)
2910 GIMPLE_CHECK (gs, GIMPLE_BIND);
2911 return gs->gimple_bind.block;
2915 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2916 statement GS. */
2918 static inline void
2919 gimple_bind_set_block (gimple gs, tree block)
2921 GIMPLE_CHECK (gs, GIMPLE_BIND);
2922 gcc_gimple_checking_assert (block == NULL_TREE
2923 || TREE_CODE (block) == BLOCK);
2924 gs->gimple_bind.block = block;
2928 /* Return the number of input operands for GIMPLE_ASM GS. */
2930 static inline unsigned
2931 gimple_asm_ninputs (const_gimple gs)
2933 GIMPLE_CHECK (gs, GIMPLE_ASM);
2934 return gs->gimple_asm.ni;
2938 /* Return the number of output operands for GIMPLE_ASM GS. */
2940 static inline unsigned
2941 gimple_asm_noutputs (const_gimple gs)
2943 GIMPLE_CHECK (gs, GIMPLE_ASM);
2944 return gs->gimple_asm.no;
2948 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2950 static inline unsigned
2951 gimple_asm_nclobbers (const_gimple gs)
2953 GIMPLE_CHECK (gs, GIMPLE_ASM);
2954 return gs->gimple_asm.nc;
2957 /* Return the number of label operands for GIMPLE_ASM GS. */
2959 static inline unsigned
2960 gimple_asm_nlabels (const_gimple gs)
2962 GIMPLE_CHECK (gs, GIMPLE_ASM);
2963 return gs->gimple_asm.nl;
2966 /* Return input operand INDEX of GIMPLE_ASM GS. */
2968 static inline tree
2969 gimple_asm_input_op (const_gimple gs, unsigned index)
2971 GIMPLE_CHECK (gs, GIMPLE_ASM);
2972 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2973 return gimple_op (gs, index + gs->gimple_asm.no);
2976 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2978 static inline tree *
2979 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2981 GIMPLE_CHECK (gs, GIMPLE_ASM);
2982 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2983 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
2987 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2989 static inline void
2990 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2992 GIMPLE_CHECK (gs, GIMPLE_ASM);
2993 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
2994 && TREE_CODE (in_op) == TREE_LIST);
2995 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
2999 /* Return output operand INDEX of GIMPLE_ASM GS. */
3001 static inline tree
3002 gimple_asm_output_op (const_gimple gs, unsigned index)
3004 GIMPLE_CHECK (gs, GIMPLE_ASM);
3005 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3006 return gimple_op (gs, index);
3009 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3011 static inline tree *
3012 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3014 GIMPLE_CHECK (gs, GIMPLE_ASM);
3015 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3016 return gimple_op_ptr (gs, index);
3020 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3022 static inline void
3023 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3025 GIMPLE_CHECK (gs, GIMPLE_ASM);
3026 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3027 && TREE_CODE (out_op) == TREE_LIST);
3028 gimple_set_op (gs, index, out_op);
3032 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3034 static inline tree
3035 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3037 GIMPLE_CHECK (gs, GIMPLE_ASM);
3038 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3039 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3043 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3045 static inline void
3046 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3048 GIMPLE_CHECK (gs, GIMPLE_ASM);
3049 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3050 && TREE_CODE (clobber_op) == TREE_LIST);
3051 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3054 /* Return label operand INDEX of GIMPLE_ASM GS. */
3056 static inline tree
3057 gimple_asm_label_op (const_gimple gs, unsigned index)
3059 GIMPLE_CHECK (gs, GIMPLE_ASM);
3060 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3061 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3064 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3066 static inline void
3067 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3069 GIMPLE_CHECK (gs, GIMPLE_ASM);
3070 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3071 && TREE_CODE (label_op) == TREE_LIST);
3072 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3075 /* Return the string representing the assembly instruction in
3076 GIMPLE_ASM GS. */
3078 static inline const char *
3079 gimple_asm_string (const_gimple gs)
3081 GIMPLE_CHECK (gs, GIMPLE_ASM);
3082 return gs->gimple_asm.string;
3086 /* Return true if GS is an asm statement marked volatile. */
3088 static inline bool
3089 gimple_asm_volatile_p (const_gimple gs)
3091 GIMPLE_CHECK (gs, GIMPLE_ASM);
3092 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3096 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3098 static inline void
3099 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3101 GIMPLE_CHECK (gs, GIMPLE_ASM);
3102 if (volatile_p)
3103 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3104 else
3105 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3109 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3111 static inline void
3112 gimple_asm_set_input (gimple gs, bool input_p)
3114 GIMPLE_CHECK (gs, GIMPLE_ASM);
3115 if (input_p)
3116 gs->gsbase.subcode |= GF_ASM_INPUT;
3117 else
3118 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3122 /* Return true if asm GS is an ASM_INPUT. */
3124 static inline bool
3125 gimple_asm_input_p (const_gimple gs)
3127 GIMPLE_CHECK (gs, GIMPLE_ASM);
3128 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3132 /* Return the types handled by GIMPLE_CATCH statement GS. */
3134 static inline tree
3135 gimple_catch_types (const_gimple gs)
3137 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3138 return gs->gimple_catch.types;
3142 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3144 static inline tree *
3145 gimple_catch_types_ptr (gimple gs)
3147 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3148 return &gs->gimple_catch.types;
3152 /* Return a pointer to the GIMPLE sequence representing the body of
3153 the handler of GIMPLE_CATCH statement GS. */
3155 static inline gimple_seq *
3156 gimple_catch_handler_ptr (gimple gs)
3158 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3159 return &gs->gimple_catch.handler;
3163 /* Return the GIMPLE sequence representing the body of the handler of
3164 GIMPLE_CATCH statement GS. */
3166 static inline gimple_seq
3167 gimple_catch_handler (gimple gs)
3169 return *gimple_catch_handler_ptr (gs);
3173 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3175 static inline void
3176 gimple_catch_set_types (gimple gs, tree t)
3178 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3179 gs->gimple_catch.types = t;
3183 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3185 static inline void
3186 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3188 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3189 gs->gimple_catch.handler = handler;
3193 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3195 static inline tree
3196 gimple_eh_filter_types (const_gimple gs)
3198 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3199 return gs->gimple_eh_filter.types;
3203 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3204 GS. */
3206 static inline tree *
3207 gimple_eh_filter_types_ptr (gimple gs)
3209 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3210 return &gs->gimple_eh_filter.types;
3214 /* Return a pointer to the sequence of statement to execute when
3215 GIMPLE_EH_FILTER statement fails. */
3217 static inline gimple_seq *
3218 gimple_eh_filter_failure_ptr (gimple gs)
3220 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3221 return &gs->gimple_eh_filter.failure;
3225 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3226 statement fails. */
3228 static inline gimple_seq
3229 gimple_eh_filter_failure (gimple gs)
3231 return *gimple_eh_filter_failure_ptr (gs);
3235 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3237 static inline void
3238 gimple_eh_filter_set_types (gimple gs, tree types)
3240 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3241 gs->gimple_eh_filter.types = types;
3245 /* Set FAILURE to be the sequence of statements to execute on failure
3246 for GIMPLE_EH_FILTER GS. */
3248 static inline void
3249 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3251 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3252 gs->gimple_eh_filter.failure = failure;
3255 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3257 static inline tree
3258 gimple_eh_must_not_throw_fndecl (gimple gs)
3260 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3261 return gs->gimple_eh_mnt.fndecl;
3264 /* Set the function decl to be called by GS to DECL. */
3266 static inline void
3267 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3269 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3270 gs->gimple_eh_mnt.fndecl = decl;
3273 /* GIMPLE_EH_ELSE accessors. */
3275 static inline gimple_seq *
3276 gimple_eh_else_n_body_ptr (gimple gs)
3278 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3279 return &gs->gimple_eh_else.n_body;
3282 static inline gimple_seq
3283 gimple_eh_else_n_body (gimple gs)
3285 return *gimple_eh_else_n_body_ptr (gs);
3288 static inline gimple_seq *
3289 gimple_eh_else_e_body_ptr (gimple gs)
3291 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3292 return &gs->gimple_eh_else.e_body;
3295 static inline gimple_seq
3296 gimple_eh_else_e_body (gimple gs)
3298 return *gimple_eh_else_e_body_ptr (gs);
3301 static inline void
3302 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3304 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3305 gs->gimple_eh_else.n_body = seq;
3308 static inline void
3309 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3311 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3312 gs->gimple_eh_else.e_body = seq;
3315 /* GIMPLE_TRY accessors. */
3317 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3318 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3320 static inline enum gimple_try_flags
3321 gimple_try_kind (const_gimple gs)
3323 GIMPLE_CHECK (gs, GIMPLE_TRY);
3324 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3328 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3330 static inline void
3331 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3333 GIMPLE_CHECK (gs, GIMPLE_TRY);
3334 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3335 || kind == GIMPLE_TRY_FINALLY);
3336 if (gimple_try_kind (gs) != kind)
3337 gs->gsbase.subcode = (unsigned int) kind;
3341 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3343 static inline bool
3344 gimple_try_catch_is_cleanup (const_gimple gs)
3346 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3347 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3351 /* Return a pointer to the sequence of statements used as the
3352 body for GIMPLE_TRY GS. */
3354 static inline gimple_seq *
3355 gimple_try_eval_ptr (gimple gs)
3357 GIMPLE_CHECK (gs, GIMPLE_TRY);
3358 return &gs->gimple_try.eval;
3362 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3364 static inline gimple_seq
3365 gimple_try_eval (gimple gs)
3367 return *gimple_try_eval_ptr (gs);
3371 /* Return a pointer to the sequence of statements used as the cleanup body for
3372 GIMPLE_TRY GS. */
3374 static inline gimple_seq *
3375 gimple_try_cleanup_ptr (gimple gs)
3377 GIMPLE_CHECK (gs, GIMPLE_TRY);
3378 return &gs->gimple_try.cleanup;
3382 /* Return the sequence of statements used as the cleanup body for
3383 GIMPLE_TRY GS. */
3385 static inline gimple_seq
3386 gimple_try_cleanup (gimple gs)
3388 return *gimple_try_cleanup_ptr (gs);
3392 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3394 static inline void
3395 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3397 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3398 if (catch_is_cleanup)
3399 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3400 else
3401 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3405 /* Set EVAL to be the sequence of statements to use as the body for
3406 GIMPLE_TRY GS. */
3408 static inline void
3409 gimple_try_set_eval (gimple gs, gimple_seq eval)
3411 GIMPLE_CHECK (gs, GIMPLE_TRY);
3412 gs->gimple_try.eval = eval;
3416 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3417 body for GIMPLE_TRY GS. */
3419 static inline void
3420 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3422 GIMPLE_CHECK (gs, GIMPLE_TRY);
3423 gs->gimple_try.cleanup = cleanup;
3427 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3429 static inline gimple_seq *
3430 gimple_wce_cleanup_ptr (gimple gs)
3432 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3433 return &gs->gimple_wce.cleanup;
3437 /* Return the cleanup sequence for cleanup statement GS. */
3439 static inline gimple_seq
3440 gimple_wce_cleanup (gimple gs)
3442 return *gimple_wce_cleanup_ptr (gs);
3446 /* Set CLEANUP to be the cleanup sequence for GS. */
3448 static inline void
3449 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3451 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3452 gs->gimple_wce.cleanup = cleanup;
3456 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3458 static inline bool
3459 gimple_wce_cleanup_eh_only (const_gimple gs)
3461 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3462 return gs->gsbase.subcode != 0;
3466 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3468 static inline void
3469 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3471 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3472 gs->gsbase.subcode = (unsigned int) eh_only_p;
3476 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3478 static inline unsigned
3479 gimple_phi_capacity (const_gimple gs)
3481 GIMPLE_CHECK (gs, GIMPLE_PHI);
3482 return gs->gimple_phi.capacity;
3486 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3487 be exactly the number of incoming edges for the basic block holding
3488 GS. */
3490 static inline unsigned
3491 gimple_phi_num_args (const_gimple gs)
3493 GIMPLE_CHECK (gs, GIMPLE_PHI);
3494 return gs->gimple_phi.nargs;
3498 /* Return the SSA name created by GIMPLE_PHI GS. */
3500 static inline tree
3501 gimple_phi_result (const_gimple gs)
3503 GIMPLE_CHECK (gs, GIMPLE_PHI);
3504 return gs->gimple_phi.result;
3507 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3509 static inline tree *
3510 gimple_phi_result_ptr (gimple gs)
3512 GIMPLE_CHECK (gs, GIMPLE_PHI);
3513 return &gs->gimple_phi.result;
3516 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3518 static inline void
3519 gimple_phi_set_result (gimple gs, tree result)
3521 GIMPLE_CHECK (gs, GIMPLE_PHI);
3522 gs->gimple_phi.result = result;
3523 if (result && TREE_CODE (result) == SSA_NAME)
3524 SSA_NAME_DEF_STMT (result) = gs;
3528 /* Return the PHI argument corresponding to incoming edge INDEX for
3529 GIMPLE_PHI GS. */
3531 static inline struct phi_arg_d *
3532 gimple_phi_arg (gimple gs, unsigned index)
3534 GIMPLE_CHECK (gs, GIMPLE_PHI);
3535 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3536 return &(gs->gimple_phi.args[index]);
3539 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3540 for GIMPLE_PHI GS. */
3542 static inline void
3543 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3545 GIMPLE_CHECK (gs, GIMPLE_PHI);
3546 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3547 gs->gimple_phi.args[index] = *phiarg;
3550 /* Return the region number for GIMPLE_RESX GS. */
3552 static inline int
3553 gimple_resx_region (const_gimple gs)
3555 GIMPLE_CHECK (gs, GIMPLE_RESX);
3556 return gs->gimple_eh_ctrl.region;
3559 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3561 static inline void
3562 gimple_resx_set_region (gimple gs, int region)
3564 GIMPLE_CHECK (gs, GIMPLE_RESX);
3565 gs->gimple_eh_ctrl.region = region;
3568 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3570 static inline int
3571 gimple_eh_dispatch_region (const_gimple gs)
3573 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3574 return gs->gimple_eh_ctrl.region;
3577 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3579 static inline void
3580 gimple_eh_dispatch_set_region (gimple gs, int region)
3582 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3583 gs->gimple_eh_ctrl.region = region;
3586 /* Return the number of labels associated with the switch statement GS. */
3588 static inline unsigned
3589 gimple_switch_num_labels (const_gimple gs)
3591 unsigned num_ops;
3592 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3593 num_ops = gimple_num_ops (gs);
3594 gcc_gimple_checking_assert (num_ops > 1);
3595 return num_ops - 1;
3599 /* Set NLABELS to be the number of labels for the switch statement GS. */
3601 static inline void
3602 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3604 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3605 gimple_set_num_ops (g, nlabels + 1);
3609 /* Return the index variable used by the switch statement GS. */
3611 static inline tree
3612 gimple_switch_index (const_gimple gs)
3614 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3615 return gimple_op (gs, 0);
3619 /* Return a pointer to the index variable for the switch statement GS. */
3621 static inline tree *
3622 gimple_switch_index_ptr (const_gimple gs)
3624 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3625 return gimple_op_ptr (gs, 0);
3629 /* Set INDEX to be the index variable for switch statement GS. */
3631 static inline void
3632 gimple_switch_set_index (gimple gs, tree index)
3634 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3635 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3636 gimple_set_op (gs, 0, index);
3640 /* Return the label numbered INDEX. The default label is 0, followed by any
3641 labels in a switch statement. */
3643 static inline tree
3644 gimple_switch_label (const_gimple gs, unsigned index)
3646 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3647 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3648 return gimple_op (gs, index + 1);
3651 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3653 static inline void
3654 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3656 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3657 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3658 && (label == NULL_TREE
3659 || TREE_CODE (label) == CASE_LABEL_EXPR));
3660 gimple_set_op (gs, index + 1, label);
3663 /* Return the default label for a switch statement. */
3665 static inline tree
3666 gimple_switch_default_label (const_gimple gs)
3668 tree label = gimple_switch_label (gs, 0);
3669 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3670 return label;
3673 /* Set the default label for a switch statement. */
3675 static inline void
3676 gimple_switch_set_default_label (gimple gs, tree label)
3678 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3679 gimple_switch_set_label (gs, 0, label);
3682 /* Return true if GS is a GIMPLE_DEBUG statement. */
3684 static inline bool
3685 is_gimple_debug (const_gimple gs)
3687 return gimple_code (gs) == GIMPLE_DEBUG;
3690 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3692 static inline bool
3693 gimple_debug_bind_p (const_gimple s)
3695 if (is_gimple_debug (s))
3696 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3698 return false;
3701 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3703 static inline tree
3704 gimple_debug_bind_get_var (gimple dbg)
3706 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3707 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3708 return gimple_op (dbg, 0);
3711 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3712 statement. */
3714 static inline tree
3715 gimple_debug_bind_get_value (gimple dbg)
3717 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3718 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3719 return gimple_op (dbg, 1);
3722 /* Return a pointer to the value bound to the variable in a
3723 GIMPLE_DEBUG bind statement. */
3725 static inline tree *
3726 gimple_debug_bind_get_value_ptr (gimple dbg)
3728 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3729 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3730 return gimple_op_ptr (dbg, 1);
3733 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3735 static inline void
3736 gimple_debug_bind_set_var (gimple dbg, tree var)
3738 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3739 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3740 gimple_set_op (dbg, 0, var);
3743 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3744 statement. */
3746 static inline void
3747 gimple_debug_bind_set_value (gimple dbg, tree value)
3749 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3750 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3751 gimple_set_op (dbg, 1, value);
3754 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3755 optimized away. */
3756 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3758 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3759 statement. */
3761 static inline void
3762 gimple_debug_bind_reset_value (gimple dbg)
3764 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3765 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3766 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3769 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3770 value. */
3772 static inline bool
3773 gimple_debug_bind_has_value_p (gimple dbg)
3775 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3776 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3777 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3780 #undef GIMPLE_DEBUG_BIND_NOVALUE
3782 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3784 static inline bool
3785 gimple_debug_source_bind_p (const_gimple s)
3787 if (is_gimple_debug (s))
3788 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3790 return false;
3793 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3795 static inline tree
3796 gimple_debug_source_bind_get_var (gimple dbg)
3798 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3799 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3800 return gimple_op (dbg, 0);
3803 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3804 statement. */
3806 static inline tree
3807 gimple_debug_source_bind_get_value (gimple dbg)
3809 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3810 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3811 return gimple_op (dbg, 1);
3814 /* Return a pointer to the value bound to the variable in a
3815 GIMPLE_DEBUG source bind statement. */
3817 static inline tree *
3818 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3820 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3821 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3822 return gimple_op_ptr (dbg, 1);
3825 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3827 static inline void
3828 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3830 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3831 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3832 gimple_set_op (dbg, 0, var);
3835 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3836 statement. */
3838 static inline void
3839 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3841 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3842 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3843 gimple_set_op (dbg, 1, value);
3846 /* Return a pointer to the body for the OMP statement GS. */
3848 static inline gimple_seq *
3849 gimple_omp_body_ptr (gimple gs)
3851 return &gs->omp.body;
3854 /* Return the body for the OMP statement GS. */
3856 static inline gimple_seq
3857 gimple_omp_body (gimple gs)
3859 return *gimple_omp_body_ptr (gs);
3862 /* Set BODY to be the body for the OMP statement GS. */
3864 static inline void
3865 gimple_omp_set_body (gimple gs, gimple_seq body)
3867 gs->omp.body = body;
3871 /* Return the name associated with OMP_CRITICAL statement GS. */
3873 static inline tree
3874 gimple_omp_critical_name (const_gimple gs)
3876 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3877 return gs->gimple_omp_critical.name;
3881 /* Return a pointer to the name associated with OMP critical statement GS. */
3883 static inline tree *
3884 gimple_omp_critical_name_ptr (gimple gs)
3886 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3887 return &gs->gimple_omp_critical.name;
3891 /* Set NAME to be the name associated with OMP critical statement GS. */
3893 static inline void
3894 gimple_omp_critical_set_name (gimple gs, tree name)
3896 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3897 gs->gimple_omp_critical.name = name;
3901 /* Return the clauses associated with OMP_FOR GS. */
3903 static inline tree
3904 gimple_omp_for_clauses (const_gimple gs)
3906 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3907 return gs->gimple_omp_for.clauses;
3911 /* Return a pointer to the OMP_FOR GS. */
3913 static inline tree *
3914 gimple_omp_for_clauses_ptr (gimple gs)
3916 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3917 return &gs->gimple_omp_for.clauses;
3921 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3923 static inline void
3924 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3926 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3927 gs->gimple_omp_for.clauses = clauses;
3931 /* Get the collapse count of OMP_FOR GS. */
3933 static inline size_t
3934 gimple_omp_for_collapse (gimple gs)
3936 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3937 return gs->gimple_omp_for.collapse;
3941 /* Return the index variable for OMP_FOR GS. */
3943 static inline tree
3944 gimple_omp_for_index (const_gimple gs, size_t i)
3946 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3947 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3948 return gs->gimple_omp_for.iter[i].index;
3952 /* Return a pointer to the index variable for OMP_FOR GS. */
3954 static inline tree *
3955 gimple_omp_for_index_ptr (gimple gs, size_t i)
3957 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3958 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3959 return &gs->gimple_omp_for.iter[i].index;
3963 /* Set INDEX to be the index variable for OMP_FOR GS. */
3965 static inline void
3966 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3968 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3969 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3970 gs->gimple_omp_for.iter[i].index = index;
3974 /* Return the initial value for OMP_FOR GS. */
3976 static inline tree
3977 gimple_omp_for_initial (const_gimple gs, size_t i)
3979 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3980 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3981 return gs->gimple_omp_for.iter[i].initial;
3985 /* Return a pointer to the initial value for OMP_FOR GS. */
3987 static inline tree *
3988 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3990 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3991 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3992 return &gs->gimple_omp_for.iter[i].initial;
3996 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3998 static inline void
3999 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4001 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4002 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4003 gs->gimple_omp_for.iter[i].initial = initial;
4007 /* Return the final value for OMP_FOR GS. */
4009 static inline tree
4010 gimple_omp_for_final (const_gimple gs, size_t i)
4012 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4013 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4014 return gs->gimple_omp_for.iter[i].final;
4018 /* Return a pointer to the final value for OMP_FOR GS. */
4020 static inline tree *
4021 gimple_omp_for_final_ptr (gimple gs, size_t i)
4023 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4024 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4025 return &gs->gimple_omp_for.iter[i].final;
4029 /* Set FINAL to be the final value for OMP_FOR GS. */
4031 static inline void
4032 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4034 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4035 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4036 gs->gimple_omp_for.iter[i].final = final;
4040 /* Return the increment value for OMP_FOR GS. */
4042 static inline tree
4043 gimple_omp_for_incr (const_gimple gs, size_t i)
4045 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4046 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4047 return gs->gimple_omp_for.iter[i].incr;
4051 /* Return a pointer to the increment value for OMP_FOR GS. */
4053 static inline tree *
4054 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4056 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4057 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4058 return &gs->gimple_omp_for.iter[i].incr;
4062 /* Set INCR to be the increment value for OMP_FOR GS. */
4064 static inline void
4065 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4067 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4068 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4069 gs->gimple_omp_for.iter[i].incr = incr;
4073 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4074 statement GS starts. */
4076 static inline gimple_seq *
4077 gimple_omp_for_pre_body_ptr (gimple gs)
4079 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4080 return &gs->gimple_omp_for.pre_body;
4084 /* Return the sequence of statements to execute before the OMP_FOR
4085 statement GS starts. */
4087 static inline gimple_seq
4088 gimple_omp_for_pre_body (gimple gs)
4090 return *gimple_omp_for_pre_body_ptr (gs);
4094 /* Set PRE_BODY to be the sequence of statements to execute before the
4095 OMP_FOR statement GS starts. */
4097 static inline void
4098 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4100 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4101 gs->gimple_omp_for.pre_body = pre_body;
4105 /* Return the clauses associated with OMP_PARALLEL GS. */
4107 static inline tree
4108 gimple_omp_parallel_clauses (const_gimple gs)
4110 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4111 return gs->gimple_omp_parallel.clauses;
4115 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4117 static inline tree *
4118 gimple_omp_parallel_clauses_ptr (gimple gs)
4120 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4121 return &gs->gimple_omp_parallel.clauses;
4125 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4126 GS. */
4128 static inline void
4129 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4131 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4132 gs->gimple_omp_parallel.clauses = clauses;
4136 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4138 static inline tree
4139 gimple_omp_parallel_child_fn (const_gimple gs)
4141 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4142 return gs->gimple_omp_parallel.child_fn;
4145 /* Return a pointer to the child function used to hold the body of
4146 OMP_PARALLEL GS. */
4148 static inline tree *
4149 gimple_omp_parallel_child_fn_ptr (gimple gs)
4151 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4152 return &gs->gimple_omp_parallel.child_fn;
4156 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4158 static inline void
4159 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4161 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4162 gs->gimple_omp_parallel.child_fn = child_fn;
4166 /* Return the artificial argument used to send variables and values
4167 from the parent to the children threads in OMP_PARALLEL GS. */
4169 static inline tree
4170 gimple_omp_parallel_data_arg (const_gimple gs)
4172 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4173 return gs->gimple_omp_parallel.data_arg;
4177 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4179 static inline tree *
4180 gimple_omp_parallel_data_arg_ptr (gimple gs)
4182 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4183 return &gs->gimple_omp_parallel.data_arg;
4187 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4189 static inline void
4190 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4192 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4193 gs->gimple_omp_parallel.data_arg = data_arg;
4197 /* Return the clauses associated with OMP_TASK GS. */
4199 static inline tree
4200 gimple_omp_task_clauses (const_gimple gs)
4202 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4203 return gs->gimple_omp_parallel.clauses;
4207 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4209 static inline tree *
4210 gimple_omp_task_clauses_ptr (gimple gs)
4212 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4213 return &gs->gimple_omp_parallel.clauses;
4217 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4218 GS. */
4220 static inline void
4221 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4223 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4224 gs->gimple_omp_parallel.clauses = clauses;
4228 /* Return the child function used to hold the body of OMP_TASK GS. */
4230 static inline tree
4231 gimple_omp_task_child_fn (const_gimple gs)
4233 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4234 return gs->gimple_omp_parallel.child_fn;
4237 /* Return a pointer to the child function used to hold the body of
4238 OMP_TASK GS. */
4240 static inline tree *
4241 gimple_omp_task_child_fn_ptr (gimple gs)
4243 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4244 return &gs->gimple_omp_parallel.child_fn;
4248 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4250 static inline void
4251 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4253 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4254 gs->gimple_omp_parallel.child_fn = child_fn;
4258 /* Return the artificial argument used to send variables and values
4259 from the parent to the children threads in OMP_TASK GS. */
4261 static inline tree
4262 gimple_omp_task_data_arg (const_gimple gs)
4264 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4265 return gs->gimple_omp_parallel.data_arg;
4269 /* Return a pointer to the data argument for OMP_TASK GS. */
4271 static inline tree *
4272 gimple_omp_task_data_arg_ptr (gimple gs)
4274 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4275 return &gs->gimple_omp_parallel.data_arg;
4279 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4281 static inline void
4282 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4284 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4285 gs->gimple_omp_parallel.data_arg = data_arg;
4289 /* Return the clauses associated with OMP_TASK GS. */
4291 static inline tree
4292 gimple_omp_taskreg_clauses (const_gimple gs)
4294 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4295 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4296 return gs->gimple_omp_parallel.clauses;
4300 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4302 static inline tree *
4303 gimple_omp_taskreg_clauses_ptr (gimple gs)
4305 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4306 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4307 return &gs->gimple_omp_parallel.clauses;
4311 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4312 GS. */
4314 static inline void
4315 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4317 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4318 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4319 gs->gimple_omp_parallel.clauses = clauses;
4323 /* Return the child function used to hold the body of OMP_TASK GS. */
4325 static inline tree
4326 gimple_omp_taskreg_child_fn (const_gimple gs)
4328 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4329 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4330 return gs->gimple_omp_parallel.child_fn;
4333 /* Return a pointer to the child function used to hold the body of
4334 OMP_TASK GS. */
4336 static inline tree *
4337 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4339 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4340 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4341 return &gs->gimple_omp_parallel.child_fn;
4345 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4347 static inline void
4348 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4350 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4351 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4352 gs->gimple_omp_parallel.child_fn = child_fn;
4356 /* Return the artificial argument used to send variables and values
4357 from the parent to the children threads in OMP_TASK GS. */
4359 static inline tree
4360 gimple_omp_taskreg_data_arg (const_gimple gs)
4362 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4363 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4364 return gs->gimple_omp_parallel.data_arg;
4368 /* Return a pointer to the data argument for OMP_TASK GS. */
4370 static inline tree *
4371 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4373 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4374 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4375 return &gs->gimple_omp_parallel.data_arg;
4379 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4381 static inline void
4382 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4384 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4385 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4386 gs->gimple_omp_parallel.data_arg = data_arg;
4390 /* Return the copy function used to hold the body of OMP_TASK GS. */
4392 static inline tree
4393 gimple_omp_task_copy_fn (const_gimple gs)
4395 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4396 return gs->gimple_omp_task.copy_fn;
4399 /* Return a pointer to the copy function used to hold the body of
4400 OMP_TASK GS. */
4402 static inline tree *
4403 gimple_omp_task_copy_fn_ptr (gimple gs)
4405 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4406 return &gs->gimple_omp_task.copy_fn;
4410 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4412 static inline void
4413 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4415 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4416 gs->gimple_omp_task.copy_fn = copy_fn;
4420 /* Return size of the data block in bytes in OMP_TASK GS. */
4422 static inline tree
4423 gimple_omp_task_arg_size (const_gimple gs)
4425 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4426 return gs->gimple_omp_task.arg_size;
4430 /* Return a pointer to the data block size for OMP_TASK GS. */
4432 static inline tree *
4433 gimple_omp_task_arg_size_ptr (gimple gs)
4435 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4436 return &gs->gimple_omp_task.arg_size;
4440 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4442 static inline void
4443 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4445 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4446 gs->gimple_omp_task.arg_size = arg_size;
4450 /* Return align of the data block in bytes in OMP_TASK GS. */
4452 static inline tree
4453 gimple_omp_task_arg_align (const_gimple gs)
4455 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4456 return gs->gimple_omp_task.arg_align;
4460 /* Return a pointer to the data block align for OMP_TASK GS. */
4462 static inline tree *
4463 gimple_omp_task_arg_align_ptr (gimple gs)
4465 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4466 return &gs->gimple_omp_task.arg_align;
4470 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4472 static inline void
4473 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4475 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4476 gs->gimple_omp_task.arg_align = arg_align;
4480 /* Return the clauses associated with OMP_SINGLE GS. */
4482 static inline tree
4483 gimple_omp_single_clauses (const_gimple gs)
4485 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4486 return gs->gimple_omp_single.clauses;
4490 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4492 static inline tree *
4493 gimple_omp_single_clauses_ptr (gimple gs)
4495 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4496 return &gs->gimple_omp_single.clauses;
4500 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4502 static inline void
4503 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4505 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4506 gs->gimple_omp_single.clauses = clauses;
4510 /* Return the clauses associated with OMP_SECTIONS GS. */
4512 static inline tree
4513 gimple_omp_sections_clauses (const_gimple gs)
4515 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4516 return gs->gimple_omp_sections.clauses;
4520 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4522 static inline tree *
4523 gimple_omp_sections_clauses_ptr (gimple gs)
4525 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4526 return &gs->gimple_omp_sections.clauses;
4530 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4531 GS. */
4533 static inline void
4534 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4536 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4537 gs->gimple_omp_sections.clauses = clauses;
4541 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4542 in GS. */
4544 static inline tree
4545 gimple_omp_sections_control (const_gimple gs)
4547 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4548 return gs->gimple_omp_sections.control;
4552 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4553 GS. */
4555 static inline tree *
4556 gimple_omp_sections_control_ptr (gimple gs)
4558 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4559 return &gs->gimple_omp_sections.control;
4563 /* Set CONTROL to be the set of clauses associated with the
4564 GIMPLE_OMP_SECTIONS in GS. */
4566 static inline void
4567 gimple_omp_sections_set_control (gimple gs, tree control)
4569 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4570 gs->gimple_omp_sections.control = control;
4574 /* Set COND to be the condition code for OMP_FOR GS. */
4576 static inline void
4577 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4579 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4580 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4581 && i < gs->gimple_omp_for.collapse);
4582 gs->gimple_omp_for.iter[i].cond = cond;
4586 /* Return the condition code associated with OMP_FOR GS. */
4588 static inline enum tree_code
4589 gimple_omp_for_cond (const_gimple gs, size_t i)
4591 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4592 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4593 return gs->gimple_omp_for.iter[i].cond;
4597 /* Set the value being stored in an atomic store. */
4599 static inline void
4600 gimple_omp_atomic_store_set_val (gimple g, tree val)
4602 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4603 g->gimple_omp_atomic_store.val = val;
4607 /* Return the value being stored in an atomic store. */
4609 static inline tree
4610 gimple_omp_atomic_store_val (const_gimple g)
4612 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4613 return g->gimple_omp_atomic_store.val;
4617 /* Return a pointer to the value being stored in an atomic store. */
4619 static inline tree *
4620 gimple_omp_atomic_store_val_ptr (gimple g)
4622 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4623 return &g->gimple_omp_atomic_store.val;
4627 /* Set the LHS of an atomic load. */
4629 static inline void
4630 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4632 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4633 g->gimple_omp_atomic_load.lhs = lhs;
4637 /* Get the LHS of an atomic load. */
4639 static inline tree
4640 gimple_omp_atomic_load_lhs (const_gimple g)
4642 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4643 return g->gimple_omp_atomic_load.lhs;
4647 /* Return a pointer to the LHS of an atomic load. */
4649 static inline tree *
4650 gimple_omp_atomic_load_lhs_ptr (gimple g)
4652 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4653 return &g->gimple_omp_atomic_load.lhs;
4657 /* Set the RHS of an atomic load. */
4659 static inline void
4660 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4662 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4663 g->gimple_omp_atomic_load.rhs = rhs;
4667 /* Get the RHS of an atomic load. */
4669 static inline tree
4670 gimple_omp_atomic_load_rhs (const_gimple g)
4672 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4673 return g->gimple_omp_atomic_load.rhs;
4677 /* Return a pointer to the RHS of an atomic load. */
4679 static inline tree *
4680 gimple_omp_atomic_load_rhs_ptr (gimple g)
4682 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4683 return &g->gimple_omp_atomic_load.rhs;
4687 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4689 static inline tree
4690 gimple_omp_continue_control_def (const_gimple g)
4692 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4693 return g->gimple_omp_continue.control_def;
4696 /* The same as above, but return the address. */
4698 static inline tree *
4699 gimple_omp_continue_control_def_ptr (gimple g)
4701 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4702 return &g->gimple_omp_continue.control_def;
4705 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4707 static inline void
4708 gimple_omp_continue_set_control_def (gimple g, tree def)
4710 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4711 g->gimple_omp_continue.control_def = def;
4715 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4717 static inline tree
4718 gimple_omp_continue_control_use (const_gimple g)
4720 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4721 return g->gimple_omp_continue.control_use;
4725 /* The same as above, but return the address. */
4727 static inline tree *
4728 gimple_omp_continue_control_use_ptr (gimple g)
4730 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4731 return &g->gimple_omp_continue.control_use;
4735 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4737 static inline void
4738 gimple_omp_continue_set_control_use (gimple g, tree use)
4740 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4741 g->gimple_omp_continue.control_use = use;
4744 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4746 static inline gimple_seq *
4747 gimple_transaction_body_ptr (gimple gs)
4749 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4750 return &gs->gimple_transaction.body;
4753 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4755 static inline gimple_seq
4756 gimple_transaction_body (gimple gs)
4758 return *gimple_transaction_body_ptr (gs);
4761 /* Return the label associated with a GIMPLE_TRANSACTION. */
4763 static inline tree
4764 gimple_transaction_label (const_gimple gs)
4766 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4767 return gs->gimple_transaction.label;
4770 static inline tree *
4771 gimple_transaction_label_ptr (gimple gs)
4773 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4774 return &gs->gimple_transaction.label;
4777 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4779 static inline unsigned int
4780 gimple_transaction_subcode (const_gimple gs)
4782 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4783 return gs->gsbase.subcode;
4786 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4788 static inline void
4789 gimple_transaction_set_body (gimple gs, gimple_seq body)
4791 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4792 gs->gimple_transaction.body = body;
4795 /* Set the label associated with a GIMPLE_TRANSACTION. */
4797 static inline void
4798 gimple_transaction_set_label (gimple gs, tree label)
4800 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4801 gs->gimple_transaction.label = label;
4804 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4806 static inline void
4807 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4809 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4810 gs->gsbase.subcode = subcode;
4814 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4816 static inline tree *
4817 gimple_return_retval_ptr (const_gimple gs)
4819 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4820 return gimple_op_ptr (gs, 0);
4823 /* Return the return value for GIMPLE_RETURN GS. */
4825 static inline tree
4826 gimple_return_retval (const_gimple gs)
4828 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4829 return gimple_op (gs, 0);
4833 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4835 static inline void
4836 gimple_return_set_retval (gimple gs, tree retval)
4838 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4839 gimple_set_op (gs, 0, retval);
4843 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4845 #define CASE_GIMPLE_OMP \
4846 case GIMPLE_OMP_PARALLEL: \
4847 case GIMPLE_OMP_TASK: \
4848 case GIMPLE_OMP_FOR: \
4849 case GIMPLE_OMP_SECTIONS: \
4850 case GIMPLE_OMP_SECTIONS_SWITCH: \
4851 case GIMPLE_OMP_SINGLE: \
4852 case GIMPLE_OMP_SECTION: \
4853 case GIMPLE_OMP_MASTER: \
4854 case GIMPLE_OMP_ORDERED: \
4855 case GIMPLE_OMP_CRITICAL: \
4856 case GIMPLE_OMP_RETURN: \
4857 case GIMPLE_OMP_ATOMIC_LOAD: \
4858 case GIMPLE_OMP_ATOMIC_STORE: \
4859 case GIMPLE_OMP_CONTINUE
4861 static inline bool
4862 is_gimple_omp (const_gimple stmt)
4864 switch (gimple_code (stmt))
4866 CASE_GIMPLE_OMP:
4867 return true;
4868 default:
4869 return false;
4874 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4876 static inline bool
4877 gimple_nop_p (const_gimple g)
4879 return gimple_code (g) == GIMPLE_NOP;
4883 /* Return true if GS is a GIMPLE_RESX. */
4885 static inline bool
4886 is_gimple_resx (const_gimple gs)
4888 return gimple_code (gs) == GIMPLE_RESX;
4891 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4893 static inline enum br_predictor
4894 gimple_predict_predictor (gimple gs)
4896 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4897 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4901 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4903 static inline void
4904 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4906 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4907 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4908 | (unsigned) predictor;
4912 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4914 static inline enum prediction
4915 gimple_predict_outcome (gimple gs)
4917 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4918 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4922 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4924 static inline void
4925 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4927 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4928 if (outcome == TAKEN)
4929 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4930 else
4931 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4935 /* Return the type of the main expression computed by STMT. Return
4936 void_type_node if the statement computes nothing. */
4938 static inline tree
4939 gimple_expr_type (const_gimple stmt)
4941 enum gimple_code code = gimple_code (stmt);
4943 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4945 tree type;
4946 /* In general we want to pass out a type that can be substituted
4947 for both the RHS and the LHS types if there is a possibly
4948 useless conversion involved. That means returning the
4949 original RHS type as far as we can reconstruct it. */
4950 if (code == GIMPLE_CALL)
4951 type = gimple_call_return_type (stmt);
4952 else
4953 switch (gimple_assign_rhs_code (stmt))
4955 case POINTER_PLUS_EXPR:
4956 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4957 break;
4959 default:
4960 /* As fallback use the type of the LHS. */
4961 type = TREE_TYPE (gimple_get_lhs (stmt));
4962 break;
4964 return type;
4966 else if (code == GIMPLE_COND)
4967 return boolean_type_node;
4968 else
4969 return void_type_node;
4972 /* Return true if TYPE is a suitable type for a scalar register variable. */
4974 static inline bool
4975 is_gimple_reg_type (tree type)
4977 return !AGGREGATE_TYPE_P (type);
4980 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4982 static inline gimple_stmt_iterator
4983 gsi_start_1 (gimple_seq *seq)
4985 gimple_stmt_iterator i;
4987 i.ptr = gimple_seq_first (*seq);
4988 i.seq = seq;
4989 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
4991 return i;
4994 #define gsi_start(x) gsi_start_1(&(x))
4996 static inline gimple_stmt_iterator
4997 gsi_none (void)
4999 gimple_stmt_iterator i;
5000 i.ptr = NULL;
5001 i.seq = NULL;
5002 i.bb = NULL;
5003 return i;
5006 /* Return a new iterator pointing to the first statement in basic block BB. */
5008 static inline gimple_stmt_iterator
5009 gsi_start_bb (basic_block bb)
5011 gimple_stmt_iterator i;
5012 gimple_seq *seq;
5014 seq = bb_seq_addr (bb);
5015 i.ptr = gimple_seq_first (*seq);
5016 i.seq = seq;
5017 i.bb = bb;
5019 return i;
5023 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5025 static inline gimple_stmt_iterator
5026 gsi_last_1 (gimple_seq *seq)
5028 gimple_stmt_iterator i;
5030 i.ptr = gimple_seq_last (*seq);
5031 i.seq = seq;
5032 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5034 return i;
5037 #define gsi_last(x) gsi_last_1(&(x))
5039 /* Return a new iterator pointing to the last statement in basic block BB. */
5041 static inline gimple_stmt_iterator
5042 gsi_last_bb (basic_block bb)
5044 gimple_stmt_iterator i;
5045 gimple_seq *seq;
5047 seq = bb_seq_addr (bb);
5048 i.ptr = gimple_seq_last (*seq);
5049 i.seq = seq;
5050 i.bb = bb;
5052 return i;
5056 /* Return true if I is at the end of its sequence. */
5058 static inline bool
5059 gsi_end_p (gimple_stmt_iterator i)
5061 return i.ptr == NULL;
5065 /* Return true if I is one statement before the end of its sequence. */
5067 static inline bool
5068 gsi_one_before_end_p (gimple_stmt_iterator i)
5070 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5074 /* Advance the iterator to the next gimple statement. */
5076 static inline void
5077 gsi_next (gimple_stmt_iterator *i)
5079 i->ptr = i->ptr->gsbase.next;
5082 /* Advance the iterator to the previous gimple statement. */
5084 static inline void
5085 gsi_prev (gimple_stmt_iterator *i)
5087 gimple prev = i->ptr->gsbase.prev;
5088 if (prev->gsbase.next)
5089 i->ptr = prev;
5090 else
5091 i->ptr = NULL;
5094 /* Return the current stmt. */
5096 static inline gimple
5097 gsi_stmt (gimple_stmt_iterator i)
5099 return i.ptr;
5102 /* Return a block statement iterator that points to the first non-label
5103 statement in block BB. */
5105 static inline gimple_stmt_iterator
5106 gsi_after_labels (basic_block bb)
5108 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5110 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5111 gsi_next (&gsi);
5113 return gsi;
5116 /* Advance the iterator to the next non-debug gimple statement. */
5118 static inline void
5119 gsi_next_nondebug (gimple_stmt_iterator *i)
5123 gsi_next (i);
5125 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5128 /* Advance the iterator to the next non-debug gimple statement. */
5130 static inline void
5131 gsi_prev_nondebug (gimple_stmt_iterator *i)
5135 gsi_prev (i);
5137 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5140 /* Return a new iterator pointing to the first non-debug statement in
5141 basic block BB. */
5143 static inline gimple_stmt_iterator
5144 gsi_start_nondebug_bb (basic_block bb)
5146 gimple_stmt_iterator i = gsi_start_bb (bb);
5148 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5149 gsi_next_nondebug (&i);
5151 return i;
5154 /* Return a new iterator pointing to the last non-debug statement in
5155 basic block BB. */
5157 static inline gimple_stmt_iterator
5158 gsi_last_nondebug_bb (basic_block bb)
5160 gimple_stmt_iterator i = gsi_last_bb (bb);
5162 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5163 gsi_prev_nondebug (&i);
5165 return i;
5169 /* Return the basic block associated with this iterator. */
5171 static inline basic_block
5172 gsi_bb (gimple_stmt_iterator i)
5174 return i.bb;
5178 /* Return the sequence associated with this iterator. */
5180 static inline gimple_seq
5181 gsi_seq (gimple_stmt_iterator i)
5183 return *i.seq;
5187 enum gsi_iterator_update
5189 GSI_NEW_STMT, /* Only valid when single statement is added, move
5190 iterator to it. */
5191 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5192 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5193 for linking other statements in the same
5194 direction. */
5197 /* In gimple-iterator.c */
5198 gimple_stmt_iterator gsi_start_phis (basic_block);
5199 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5200 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5201 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5202 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5203 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5204 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5205 enum gsi_iterator_update);
5206 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5207 enum gsi_iterator_update);
5208 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5209 enum gsi_iterator_update);
5210 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5211 enum gsi_iterator_update);
5212 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5213 enum gsi_iterator_update);
5214 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5215 enum gsi_iterator_update);
5216 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5217 enum gsi_iterator_update);
5218 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5219 enum gsi_iterator_update);
5220 bool gsi_remove (gimple_stmt_iterator *, bool);
5221 gimple_stmt_iterator gsi_for_stmt (gimple);
5222 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5223 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5224 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5225 void gsi_insert_on_edge (edge, gimple);
5226 void gsi_insert_seq_on_edge (edge, gimple_seq);
5227 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5228 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5229 void gsi_commit_one_edge_insert (edge, basic_block *);
5230 void gsi_commit_edge_inserts (void);
5231 gimple gimple_call_copy_skip_args (gimple, bitmap);
5234 /* Convenience routines to walk all statements of a gimple function.
5235 Note that this is useful exclusively before the code is converted
5236 into SSA form. Once the program is in SSA form, the standard
5237 operand interface should be used to analyze/modify statements. */
5238 struct walk_stmt_info
5240 /* Points to the current statement being walked. */
5241 gimple_stmt_iterator gsi;
5243 /* Additional data that the callback functions may want to carry
5244 through the recursion. */
5245 void *info;
5247 /* Pointer map used to mark visited tree nodes when calling
5248 walk_tree on each operand. If set to NULL, duplicate tree nodes
5249 will be visited more than once. */
5250 struct pointer_set_t *pset;
5252 /* Operand returned by the callbacks. This is set when calling
5253 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5254 returns non-NULL, this field will contain the tree returned by
5255 the last callback. */
5256 tree callback_result;
5258 /* Indicates whether the operand being examined may be replaced
5259 with something that matches is_gimple_val (if true) or something
5260 slightly more complicated (if false). "Something" technically
5261 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5262 but we never try to form anything more complicated than that, so
5263 we don't bother checking.
5265 Also note that CALLBACK should update this flag while walking the
5266 sub-expressions of a statement. For instance, when walking the
5267 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5268 to true, however, when walking &var, the operand of that
5269 ADDR_EXPR does not need to be a GIMPLE value. */
5270 BOOL_BITFIELD val_only : 1;
5272 /* True if we are currently walking the LHS of an assignment. */
5273 BOOL_BITFIELD is_lhs : 1;
5275 /* Optional. Set to true by the callback functions if they made any
5276 changes. */
5277 BOOL_BITFIELD changed : 1;
5279 /* True if we're interested in location information. */
5280 BOOL_BITFIELD want_locations : 1;
5282 /* True if we've removed the statement that was processed. */
5283 BOOL_BITFIELD removed_stmt : 1;
5286 /* Callback for walk_gimple_stmt. Called for every statement found
5287 during traversal. The first argument points to the statement to
5288 walk. The second argument is a flag that the callback sets to
5289 'true' if it the callback handled all the operands and
5290 sub-statements of the statement (the default value of this flag is
5291 'false'). The third argument is an anonymous pointer to data
5292 to be used by the callback. */
5293 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5294 struct walk_stmt_info *);
5296 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5297 struct walk_stmt_info *);
5298 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5299 struct walk_stmt_info *);
5300 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5301 struct walk_stmt_info *);
5302 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5304 /* Enum and arrays used for allocation stats. Keep in sync with
5305 gimple.c:gimple_alloc_kind_names. */
5306 enum gimple_alloc_kind
5308 gimple_alloc_kind_assign, /* Assignments. */
5309 gimple_alloc_kind_phi, /* PHI nodes. */
5310 gimple_alloc_kind_cond, /* Conditionals. */
5311 gimple_alloc_kind_rest, /* Everything else. */
5312 gimple_alloc_kind_all
5315 extern int gimple_alloc_counts[];
5316 extern int gimple_alloc_sizes[];
5318 /* Return the allocation kind for a given stmt CODE. */
5319 static inline enum gimple_alloc_kind
5320 gimple_alloc_kind (enum gimple_code code)
5322 switch (code)
5324 case GIMPLE_ASSIGN:
5325 return gimple_alloc_kind_assign;
5326 case GIMPLE_PHI:
5327 return gimple_alloc_kind_phi;
5328 case GIMPLE_COND:
5329 return gimple_alloc_kind_cond;
5330 default:
5331 return gimple_alloc_kind_rest;
5335 extern void dump_gimple_statistics (void);
5337 /* In gimple-fold.c. */
5338 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5339 tree gimple_fold_builtin (gimple);
5340 bool fold_stmt (gimple_stmt_iterator *);
5341 bool fold_stmt_inplace (gimple_stmt_iterator *);
5342 tree get_symbol_constant_value (tree);
5343 tree canonicalize_constructor_val (tree, tree);
5344 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5345 enum tree_code, tree, tree);
5346 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5347 enum tree_code, tree, tree);
5349 bool gimple_val_nonnegative_real_p (tree);
5350 #endif /* GCC_GIMPLE_H */