2014-07-16 Yvan Roux <yvan.roux@linaro.org>
[official-gcc.git] / gcc-4_8-branch / gcc / gimple.h
blob2e57f10889dd6ee379f3848c9da4826d84d5783b
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 struct gimple_stmt_iterator_d
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;
146 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
147 are for 64 bit hosts. */
149 struct GTY((chain_next ("%h.next"))) gimple_statement_base {
150 /* [ WORD 1 ]
151 Main identifying code for a tuple. */
152 ENUM_BITFIELD(gimple_code) code : 8;
154 /* Nonzero if a warning should not be emitted on this tuple. */
155 unsigned int no_warning : 1;
157 /* Nonzero if this tuple has been visited. Passes are responsible
158 for clearing this bit before using it. */
159 unsigned int visited : 1;
161 /* Nonzero if this tuple represents a non-temporal move. */
162 unsigned int nontemporal_move : 1;
164 /* Pass local flags. These flags are free for any pass to use as
165 they see fit. Passes should not assume that these flags contain
166 any useful value when the pass starts. Any initial state that
167 the pass requires should be set on entry to the pass. See
168 gimple_set_plf and gimple_plf for usage. */
169 unsigned int plf : 2;
171 /* Nonzero if this statement has been modified and needs to have its
172 operands rescanned. */
173 unsigned modified : 1;
175 /* Nonzero if this statement contains volatile operands. */
176 unsigned has_volatile_ops : 1;
178 /* Padding to get subcode to 16 bit alignment. */
179 unsigned pad : 1;
181 /* The SUBCODE field can be used for tuple-specific flags for tuples
182 that do not require subcodes. Note that SUBCODE should be at
183 least as wide as tree codes, as several tuples store tree codes
184 in there. */
185 unsigned int subcode : 16;
187 /* UID of this statement. This is used by passes that want to
188 assign IDs to statements. It must be assigned and used by each
189 pass. By default it should be assumed to contain garbage. */
190 unsigned uid;
192 /* [ WORD 2 ]
193 Locus information for debug info. */
194 location_t location;
196 /* Number of operands in this tuple. */
197 unsigned num_ops;
199 /* [ WORD 3 ]
200 Basic block holding this statement. */
201 basic_block bb;
203 /* [ WORD 4-5 ]
204 Linked lists of gimple statements. The next pointers form
205 a NULL terminated list, the prev pointers are a cyclic list.
206 A gimple statement is hence also a double-ended list of
207 statements, with the pointer itself being the first element,
208 and the prev pointer being the last. */
209 gimple next;
210 gimple GTY((skip)) prev;
214 /* Base structure for tuples with operands. */
216 struct GTY(()) gimple_statement_with_ops_base
218 /* [ WORD 1-6 ] */
219 struct gimple_statement_base gsbase;
221 /* [ WORD 7 ]
222 SSA operand vectors. NOTE: It should be possible to
223 amalgamate these vectors with the operand vector OP. However,
224 the SSA operand vectors are organized differently and contain
225 more information (like immediate use chaining). */
226 struct use_optype_d GTY((skip (""))) *use_ops;
230 /* Statements that take register operands. */
232 struct GTY(()) gimple_statement_with_ops
234 /* [ WORD 1-7 ] */
235 struct gimple_statement_with_ops_base opbase;
237 /* [ WORD 8 ]
238 Operand vector. NOTE! This must always be the last field
239 of this structure. In particular, this means that this
240 structure cannot be embedded inside another one. */
241 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
245 /* Base for statements that take both memory and register operands. */
247 struct GTY(()) gimple_statement_with_memory_ops_base
249 /* [ WORD 1-7 ] */
250 struct gimple_statement_with_ops_base opbase;
252 /* [ WORD 8-9 ]
253 Virtual operands for this statement. The GC will pick them
254 up via the ssa_names array. */
255 tree GTY((skip (""))) vdef;
256 tree GTY((skip (""))) vuse;
260 /* Statements that take both memory and register operands. */
262 struct GTY(()) gimple_statement_with_memory_ops
264 /* [ WORD 1-9 ] */
265 struct gimple_statement_with_memory_ops_base membase;
267 /* [ WORD 10 ]
268 Operand vector. NOTE! This must always be the last field
269 of this structure. In particular, this means that this
270 structure cannot be embedded inside another one. */
271 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
275 /* Call statements that take both memory and register operands. */
277 struct GTY(()) gimple_statement_call
279 /* [ WORD 1-9 ] */
280 struct gimple_statement_with_memory_ops_base membase;
282 /* [ WORD 10-13 ] */
283 struct pt_solution call_used;
284 struct pt_solution call_clobbered;
286 /* [ WORD 14 ] */
287 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
288 tree GTY ((tag ("0"))) fntype;
289 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
290 } u;
292 /* [ WORD 15 ]
293 Operand vector. NOTE! This must always be the last field
294 of this structure. In particular, this means that this
295 structure cannot be embedded inside another one. */
296 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
300 /* OpenMP statements (#pragma omp). */
302 struct GTY(()) gimple_statement_omp {
303 /* [ WORD 1-6 ] */
304 struct gimple_statement_base gsbase;
306 /* [ WORD 7 ] */
307 gimple_seq body;
311 /* GIMPLE_BIND */
313 struct GTY(()) gimple_statement_bind {
314 /* [ WORD 1-6 ] */
315 struct gimple_statement_base gsbase;
317 /* [ WORD 7 ]
318 Variables declared in this scope. */
319 tree vars;
321 /* [ WORD 8 ]
322 This is different than the BLOCK field in gimple_statement_base,
323 which is analogous to TREE_BLOCK (i.e., the lexical block holding
324 this statement). This field is the equivalent of BIND_EXPR_BLOCK
325 in tree land (i.e., the lexical scope defined by this bind). See
326 gimple-low.c. */
327 tree block;
329 /* [ WORD 9 ] */
330 gimple_seq body;
334 /* GIMPLE_CATCH */
336 struct GTY(()) gimple_statement_catch {
337 /* [ WORD 1-6 ] */
338 struct gimple_statement_base gsbase;
340 /* [ WORD 7 ] */
341 tree types;
343 /* [ WORD 8 ] */
344 gimple_seq handler;
348 /* GIMPLE_EH_FILTER */
350 struct GTY(()) gimple_statement_eh_filter {
351 /* [ WORD 1-6 ] */
352 struct gimple_statement_base gsbase;
354 /* [ WORD 7 ]
355 Filter types. */
356 tree types;
358 /* [ WORD 8 ]
359 Failure actions. */
360 gimple_seq failure;
363 /* GIMPLE_EH_ELSE */
365 struct GTY(()) gimple_statement_eh_else {
366 /* [ WORD 1-6 ] */
367 struct gimple_statement_base gsbase;
369 /* [ WORD 7,8 ] */
370 gimple_seq n_body, e_body;
373 /* GIMPLE_EH_MUST_NOT_THROW */
375 struct GTY(()) gimple_statement_eh_mnt {
376 /* [ WORD 1-6 ] */
377 struct gimple_statement_base gsbase;
379 /* [ WORD 7 ] Abort function decl. */
380 tree fndecl;
383 /* GIMPLE_PHI */
385 struct GTY(()) gimple_statement_phi {
386 /* [ WORD 1-6 ] */
387 struct gimple_statement_base gsbase;
389 /* [ WORD 7 ] */
390 unsigned capacity;
391 unsigned nargs;
393 /* [ WORD 8 ] */
394 tree result;
396 /* [ WORD 9 ] */
397 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
401 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
403 struct GTY(()) gimple_statement_eh_ctrl
405 /* [ WORD 1-6 ] */
406 struct gimple_statement_base gsbase;
408 /* [ WORD 7 ]
409 Exception region number. */
410 int region;
414 /* GIMPLE_TRY */
416 struct GTY(()) gimple_statement_try {
417 /* [ WORD 1-6 ] */
418 struct gimple_statement_base gsbase;
420 /* [ WORD 7 ]
421 Expression to evaluate. */
422 gimple_seq eval;
424 /* [ WORD 8 ]
425 Cleanup expression. */
426 gimple_seq cleanup;
429 /* Kind of GIMPLE_TRY statements. */
430 enum gimple_try_flags
432 /* A try/catch. */
433 GIMPLE_TRY_CATCH = 1 << 0,
435 /* A try/finally. */
436 GIMPLE_TRY_FINALLY = 1 << 1,
437 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
439 /* Analogous to TRY_CATCH_IS_CLEANUP. */
440 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
443 /* GIMPLE_WITH_CLEANUP_EXPR */
445 struct GTY(()) gimple_statement_wce {
446 /* [ WORD 1-6 ] */
447 struct gimple_statement_base gsbase;
449 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
450 executed if an exception is thrown, not on normal exit of its
451 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
452 in TARGET_EXPRs. */
454 /* [ WORD 7 ]
455 Cleanup expression. */
456 gimple_seq cleanup;
460 /* GIMPLE_ASM */
462 struct GTY(()) gimple_statement_asm
464 /* [ WORD 1-9 ] */
465 struct gimple_statement_with_memory_ops_base membase;
467 /* [ WORD 10 ]
468 __asm__ statement. */
469 const char *string;
471 /* [ WORD 11 ]
472 Number of inputs, outputs, clobbers, labels. */
473 unsigned char ni;
474 unsigned char no;
475 unsigned char nc;
476 unsigned char nl;
478 /* [ WORD 12 ]
479 Operand vector. NOTE! This must always be the last field
480 of this structure. In particular, this means that this
481 structure cannot be embedded inside another one. */
482 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
485 /* GIMPLE_OMP_CRITICAL */
487 struct GTY(()) gimple_statement_omp_critical {
488 /* [ WORD 1-7 ] */
489 struct gimple_statement_omp omp;
491 /* [ WORD 8 ]
492 Critical section name. */
493 tree name;
497 struct GTY(()) gimple_omp_for_iter {
498 /* Condition code. */
499 enum tree_code cond;
501 /* Index variable. */
502 tree index;
504 /* Initial value. */
505 tree initial;
507 /* Final value. */
508 tree final;
510 /* Increment. */
511 tree incr;
514 /* GIMPLE_OMP_FOR */
516 struct GTY(()) gimple_statement_omp_for {
517 /* [ WORD 1-7 ] */
518 struct gimple_statement_omp omp;
520 /* [ WORD 8 ] */
521 tree clauses;
523 /* [ WORD 9 ]
524 Number of elements in iter array. */
525 size_t collapse;
527 /* [ WORD 10 ] */
528 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
530 /* [ WORD 11 ]
531 Pre-body evaluated before the loop body begins. */
532 gimple_seq pre_body;
536 /* GIMPLE_OMP_PARALLEL */
538 struct GTY(()) gimple_statement_omp_parallel {
539 /* [ WORD 1-7 ] */
540 struct gimple_statement_omp omp;
542 /* [ WORD 8 ]
543 Clauses. */
544 tree clauses;
546 /* [ WORD 9 ]
547 Child function holding the body of the parallel region. */
548 tree child_fn;
550 /* [ WORD 10 ]
551 Shared data argument. */
552 tree data_arg;
556 /* GIMPLE_OMP_TASK */
558 struct GTY(()) gimple_statement_omp_task {
559 /* [ WORD 1-10 ] */
560 struct gimple_statement_omp_parallel par;
562 /* [ WORD 11 ]
563 Child function holding firstprivate initialization if needed. */
564 tree copy_fn;
566 /* [ WORD 12-13 ]
567 Size and alignment in bytes of the argument data block. */
568 tree arg_size;
569 tree arg_align;
573 /* GIMPLE_OMP_SECTION */
574 /* Uses struct gimple_statement_omp. */
577 /* GIMPLE_OMP_SECTIONS */
579 struct GTY(()) gimple_statement_omp_sections {
580 /* [ WORD 1-7 ] */
581 struct gimple_statement_omp omp;
583 /* [ WORD 8 ] */
584 tree clauses;
586 /* [ WORD 9 ]
587 The control variable used for deciding which of the sections to
588 execute. */
589 tree control;
592 /* GIMPLE_OMP_CONTINUE.
594 Note: This does not inherit from gimple_statement_omp, because we
595 do not need the body field. */
597 struct GTY(()) gimple_statement_omp_continue {
598 /* [ WORD 1-6 ] */
599 struct gimple_statement_base gsbase;
601 /* [ WORD 7 ] */
602 tree control_def;
604 /* [ WORD 8 ] */
605 tree control_use;
608 /* GIMPLE_OMP_SINGLE */
610 struct GTY(()) gimple_statement_omp_single {
611 /* [ WORD 1-7 ] */
612 struct gimple_statement_omp omp;
614 /* [ WORD 7 ] */
615 tree clauses;
619 /* GIMPLE_OMP_ATOMIC_LOAD.
620 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
621 contains a sequence, which we don't need here. */
623 struct GTY(()) gimple_statement_omp_atomic_load {
624 /* [ WORD 1-6 ] */
625 struct gimple_statement_base gsbase;
627 /* [ WORD 7-8 ] */
628 tree rhs, lhs;
631 /* GIMPLE_OMP_ATOMIC_STORE.
632 See note on GIMPLE_OMP_ATOMIC_LOAD. */
634 struct GTY(()) gimple_statement_omp_atomic_store {
635 /* [ WORD 1-6 ] */
636 struct gimple_statement_base gsbase;
638 /* [ WORD 7 ] */
639 tree val;
642 /* GIMPLE_TRANSACTION. */
644 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
646 /* The __transaction_atomic was declared [[outer]] or it is
647 __transaction_relaxed. */
648 #define GTMA_IS_OUTER (1u << 0)
649 #define GTMA_IS_RELAXED (1u << 1)
650 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
652 /* The transaction is seen to not have an abort. */
653 #define GTMA_HAVE_ABORT (1u << 2)
654 /* The transaction is seen to have loads or stores. */
655 #define GTMA_HAVE_LOAD (1u << 3)
656 #define GTMA_HAVE_STORE (1u << 4)
657 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
658 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
659 /* The transaction WILL enter serial irrevocable mode.
660 An irrevocable block post-dominates the entire transaction, such
661 that all invocations of the transaction will go serial-irrevocable.
662 In such case, we don't bother instrumenting the transaction, and
663 tell the runtime that it should begin the transaction in
664 serial-irrevocable mode. */
665 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
666 /* The transaction contains no instrumentation code whatsover, most
667 likely because it is guaranteed to go irrevocable upon entry. */
668 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
670 struct GTY(()) gimple_statement_transaction
672 /* [ WORD 1-9 ] */
673 struct gimple_statement_with_memory_ops_base gsbase;
675 /* [ WORD 10 ] */
676 gimple_seq body;
678 /* [ WORD 11 ] */
679 tree label;
682 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
683 enum gimple_statement_structure_enum {
684 #include "gsstruct.def"
685 LAST_GSS_ENUM
687 #undef DEFGSSTRUCT
690 /* Define the overall contents of a gimple tuple. It may be any of the
691 structures declared above for various types of tuples. */
693 union GTY ((desc ("gimple_statement_structure (&%h)"),
694 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
695 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
696 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
697 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
698 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
699 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
700 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
701 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
702 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
703 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
704 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
705 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
706 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
707 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
708 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
709 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
710 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
711 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
712 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
713 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
714 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
715 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
716 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
717 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
718 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
719 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
720 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
723 /* In gimple.c. */
725 /* Offset in bytes to the location of the operand vector.
726 Zero if there is no operand vector for this tuple structure. */
727 extern size_t const gimple_ops_offset_[];
729 /* Map GIMPLE codes to GSS codes. */
730 extern enum gimple_statement_structure_enum const gss_for_code_[];
732 /* This variable holds the currently expanded gimple statement for purposes
733 of comminucating the profile info to the builtin expanders. */
734 extern gimple currently_expanding_gimple_stmt;
736 gimple gimple_build_return (tree);
738 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
739 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
741 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
743 gimple
744 gimple_build_assign_with_ops (enum tree_code, tree,
745 tree, tree CXX_MEM_STAT_INFO);
746 gimple
747 gimple_build_assign_with_ops (enum tree_code, tree,
748 tree, tree, tree CXX_MEM_STAT_INFO);
750 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
751 #define gimple_build_debug_bind(var,val,stmt) \
752 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
753 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
754 #define gimple_build_debug_source_bind(var,val,stmt) \
755 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
757 gimple gimple_build_call_vec (tree, vec<tree> );
758 gimple gimple_build_call (tree, unsigned, ...);
759 gimple gimple_build_call_valist (tree, unsigned, va_list);
760 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
761 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
762 gimple gimple_build_call_from_tree (tree);
763 gimple gimplify_assign (tree, tree, gimple_seq *);
764 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
765 gimple gimple_build_label (tree label);
766 gimple gimple_build_goto (tree dest);
767 gimple gimple_build_nop (void);
768 gimple gimple_build_bind (tree, gimple_seq, tree);
769 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
770 vec<tree, va_gc> *, vec<tree, va_gc> *,
771 vec<tree, va_gc> *);
772 gimple gimple_build_catch (tree, gimple_seq);
773 gimple gimple_build_eh_filter (tree, gimple_seq);
774 gimple gimple_build_eh_must_not_throw (tree);
775 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
776 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
777 gimple gimple_build_wce (gimple_seq);
778 gimple gimple_build_resx (int);
779 gimple gimple_build_eh_dispatch (int);
780 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
781 gimple gimple_build_switch (tree, tree, vec<tree> );
782 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
783 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
784 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
785 gimple gimple_build_omp_critical (gimple_seq, tree);
786 gimple gimple_build_omp_section (gimple_seq);
787 gimple gimple_build_omp_continue (tree, tree);
788 gimple gimple_build_omp_master (gimple_seq);
789 gimple gimple_build_omp_return (bool);
790 gimple gimple_build_omp_ordered (gimple_seq);
791 gimple gimple_build_omp_sections (gimple_seq, tree);
792 gimple gimple_build_omp_sections_switch (void);
793 gimple gimple_build_omp_single (gimple_seq, tree);
794 gimple gimple_build_cdt (tree, tree);
795 gimple gimple_build_omp_atomic_load (tree, tree);
796 gimple gimple_build_omp_atomic_store (tree);
797 gimple gimple_build_transaction (gimple_seq, tree);
798 gimple gimple_build_predict (enum br_predictor, enum prediction);
799 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
800 void sort_case_labels (vec<tree> );
801 void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
802 void gimple_set_body (tree, gimple_seq);
803 gimple_seq gimple_body (tree);
804 bool gimple_has_body_p (tree);
805 gimple_seq gimple_seq_alloc (void);
806 void gimple_seq_free (gimple_seq);
807 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
808 gimple_seq gimple_seq_copy (gimple_seq);
809 bool gimple_call_same_target_p (const_gimple, const_gimple);
810 int gimple_call_flags (const_gimple);
811 int gimple_call_return_flags (const_gimple);
812 int gimple_call_arg_flags (const_gimple, unsigned);
813 void gimple_call_reset_alias_info (gimple);
814 bool gimple_assign_copy_p (gimple);
815 bool gimple_assign_ssa_name_copy_p (gimple);
816 bool gimple_assign_unary_nop_p (gimple);
817 void gimple_set_bb (gimple, basic_block);
818 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
819 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
820 tree, tree, tree);
821 tree gimple_get_lhs (const_gimple);
822 void gimple_set_lhs (gimple, tree);
823 void gimple_replace_lhs (gimple, tree);
824 gimple gimple_copy (gimple);
825 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
826 gimple gimple_build_cond_from_tree (tree, tree, tree);
827 void gimple_cond_set_condition_from_tree (gimple, tree);
828 bool gimple_has_side_effects (const_gimple);
829 bool gimple_could_trap_p (gimple);
830 bool gimple_could_trap_p_1 (gimple, bool, bool);
831 bool gimple_assign_rhs_could_trap_p (gimple);
832 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
833 bool empty_body_p (gimple_seq);
834 unsigned get_gimple_rhs_num_ops (enum tree_code);
835 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
836 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
837 const char *gimple_decl_printable_name (tree, int);
838 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
839 tree gimple_extract_devirt_binfo_from_cst (tree);
841 /* Returns true iff T is a scalar register variable. */
842 extern bool is_gimple_reg (tree);
843 /* Returns true iff T is any sort of variable. */
844 extern bool is_gimple_variable (tree);
845 /* Returns true iff T is any sort of symbol. */
846 extern bool is_gimple_id (tree);
847 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
848 extern bool is_gimple_min_lval (tree);
849 /* Returns true iff T is something whose address can be taken. */
850 extern bool is_gimple_addressable (tree);
851 /* Returns true iff T is any valid GIMPLE lvalue. */
852 extern bool is_gimple_lvalue (tree);
854 /* Returns true iff T is a GIMPLE address. */
855 bool is_gimple_address (const_tree);
856 /* Returns true iff T is a GIMPLE invariant address. */
857 bool is_gimple_invariant_address (const_tree);
858 /* Returns true iff T is a GIMPLE invariant address at interprocedural
859 level. */
860 bool is_gimple_ip_invariant_address (const_tree);
861 /* Returns true iff T is a valid GIMPLE constant. */
862 bool is_gimple_constant (const_tree);
863 /* Returns true iff T is a GIMPLE restricted function invariant. */
864 extern bool is_gimple_min_invariant (const_tree);
865 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
866 extern bool is_gimple_ip_invariant (const_tree);
867 /* Returns true iff T is a GIMPLE rvalue. */
868 extern bool is_gimple_val (tree);
869 /* Returns true iff T is a GIMPLE asm statement input. */
870 extern bool is_gimple_asm_val (tree);
871 /* Returns true iff T is a valid address operand of a MEM_REF. */
872 bool is_gimple_mem_ref_addr (tree);
874 /* Returns true iff T is a valid if-statement condition. */
875 extern bool is_gimple_condexpr (tree);
877 /* Returns true iff T is a valid call address expression. */
878 extern bool is_gimple_call_addr (tree);
880 /* Return TRUE iff stmt is a call to a built-in function. */
881 extern bool is_gimple_builtin_call (gimple stmt);
883 extern void recalculate_side_effects (tree);
884 extern bool gimple_compare_field_offset (tree, tree);
885 extern tree gimple_register_canonical_type (tree);
886 extern void print_gimple_types_stats (const char *);
887 extern void free_gimple_type_tables (void);
888 extern tree gimple_unsigned_type (tree);
889 extern tree gimple_signed_type (tree);
890 extern alias_set_type gimple_get_alias_set (tree);
891 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
892 unsigned *);
893 typedef bool (*walk_stmt_load_store_addr_fn) (gimple, tree, tree, void *);
894 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
895 walk_stmt_load_store_addr_fn,
896 walk_stmt_load_store_addr_fn,
897 walk_stmt_load_store_addr_fn);
898 extern bool walk_stmt_load_store_ops (gimple, void *,
899 walk_stmt_load_store_addr_fn,
900 walk_stmt_load_store_addr_fn);
901 extern bool gimple_ior_addresses_taken (bitmap, gimple);
902 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
903 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
904 extern bool gimple_asm_clobbers_memory_p (const_gimple);
906 /* In gimplify.c */
907 extern tree create_tmp_var_raw (tree, const char *);
908 extern tree create_tmp_var_name (const char *);
909 extern tree create_tmp_var (tree, const char *);
910 extern tree create_tmp_reg (tree, const char *);
911 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
912 extern tree get_formal_tmp_var (tree, gimple_seq *);
913 extern void declare_vars (tree, gimple, bool);
914 extern void annotate_all_with_location (gimple_seq, location_t);
916 /* Validation of GIMPLE expressions. Note that these predicates only check
917 the basic form of the expression, they don't recurse to make sure that
918 underlying nodes are also of the right form. */
919 typedef bool (*gimple_predicate)(tree);
922 /* FIXME we should deduce this from the predicate. */
923 enum fallback {
924 fb_none = 0, /* Do not generate a temporary. */
926 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
927 gimplified expression. */
929 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
930 gimplified expression. */
932 fb_mayfail = 4, /* Gimplification may fail. Error issued
933 afterwards. */
934 fb_either= fb_rvalue | fb_lvalue
937 typedef int fallback_t;
939 enum gimplify_status {
940 GS_ERROR = -2, /* Something Bad Seen. */
941 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
942 GS_OK = 0, /* We did something, maybe more to do. */
943 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
946 struct gimplify_ctx
948 struct gimplify_ctx *prev_context;
950 vec<gimple> bind_expr_stack;
951 tree temps;
952 gimple_seq conditional_cleanups;
953 tree exit_label;
954 tree return_temp;
956 vec<tree> case_labels;
957 /* The formal temporary table. Should this be persistent? */
958 htab_t temp_htab;
960 int conditions;
961 bool save_stack;
962 bool into_ssa;
963 bool allow_rhs_cond_expr;
964 bool in_cleanup_point_expr;
967 /* Return true if gimplify_one_sizepos doesn't need to gimplify
968 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
969 fields). */
970 static inline bool
971 is_gimple_sizepos (tree expr)
973 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
974 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
975 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
976 function, the gimplifier will want to replace it with a new variable,
977 but that will cause problems if this type is from outside the function.
978 It's OK to have that here. */
979 return (expr == NULL_TREE
980 || TREE_CONSTANT (expr)
981 || TREE_CODE (expr) == VAR_DECL
982 || CONTAINS_PLACEHOLDER_P (expr));
985 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
986 bool (*) (tree), fallback_t);
987 extern void gimplify_type_sizes (tree, gimple_seq *);
988 extern void gimplify_one_sizepos (tree *, gimple_seq *);
989 enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *,
990 bool, tree);
991 extern bool gimplify_stmt (tree *, gimple_seq *);
992 extern gimple gimplify_body (tree, bool);
993 extern void push_gimplify_context (struct gimplify_ctx *);
994 extern void pop_gimplify_context (gimple);
995 extern void gimplify_and_add (tree, gimple_seq *);
997 /* Miscellaneous helpers. */
998 extern void gimple_add_tmp_var (tree);
999 extern gimple gimple_current_bind_expr (void);
1000 extern vec<gimple> gimple_bind_expr_stack (void);
1001 extern tree voidify_wrapper_expr (tree, tree);
1002 extern tree build_and_jump (tree *);
1003 extern tree force_labels_r (tree *, int *, void *);
1004 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1005 gimple_seq *);
1006 struct gimplify_omp_ctx;
1007 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1008 extern tree gimple_boolify (tree);
1009 extern gimple_predicate rhs_predicate_for (tree);
1010 extern tree canonicalize_cond_expr_cond (tree);
1012 /* In omp-low.c. */
1013 extern tree omp_reduction_init (tree, tree);
1015 /* In trans-mem.c. */
1016 extern void diagnose_tm_safe_errors (tree);
1017 extern void compute_transaction_bits (void);
1019 /* In tree-nested.c. */
1020 extern void lower_nested_functions (tree);
1021 extern void insert_field_into_struct (tree, tree);
1023 /* In gimplify.c. */
1024 extern void gimplify_function_tree (tree);
1026 /* In cfgexpand.c. */
1027 extern tree gimple_assign_rhs_to_tree (gimple);
1029 /* In builtins.c */
1030 extern bool validate_gimple_arglist (const_gimple, ...);
1032 /* In tree-ssa.c */
1033 extern bool tree_ssa_useless_type_conversion (tree);
1034 extern tree tree_ssa_strip_useless_type_conversions (tree);
1035 extern bool useless_type_conversion_p (tree, tree);
1036 extern bool types_compatible_p (tree, tree);
1038 /* In tree-ssa-coalesce.c */
1039 extern bool gimple_can_coalesce_p (tree, tree);
1041 /* Return the first node in GIMPLE sequence S. */
1043 static inline gimple_seq_node
1044 gimple_seq_first (gimple_seq s)
1046 return s;
1050 /* Return the first statement in GIMPLE sequence S. */
1052 static inline gimple
1053 gimple_seq_first_stmt (gimple_seq s)
1055 gimple_seq_node n = gimple_seq_first (s);
1056 return n;
1060 /* Return the last node in GIMPLE sequence S. */
1062 static inline gimple_seq_node
1063 gimple_seq_last (gimple_seq s)
1065 return s ? s->gsbase.prev : NULL;
1069 /* Return the last statement in GIMPLE sequence S. */
1071 static inline gimple
1072 gimple_seq_last_stmt (gimple_seq s)
1074 gimple_seq_node n = gimple_seq_last (s);
1075 return n;
1079 /* Set the last node in GIMPLE sequence *PS to LAST. */
1081 static inline void
1082 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1084 (*ps)->gsbase.prev = last;
1088 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1090 static inline void
1091 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1093 *ps = first;
1097 /* Return true if GIMPLE sequence S is empty. */
1099 static inline bool
1100 gimple_seq_empty_p (gimple_seq s)
1102 return s == NULL;
1106 void gimple_seq_add_stmt (gimple_seq *, gimple);
1108 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1109 *SEQ_P is NULL, a new sequence is allocated. This function is
1110 similar to gimple_seq_add_stmt, but does not scan the operands.
1111 During gimplification, we need to manipulate statement sequences
1112 before the def/use vectors have been constructed. */
1113 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1115 /* Allocate a new sequence and initialize its first element with STMT. */
1117 static inline gimple_seq
1118 gimple_seq_alloc_with_stmt (gimple stmt)
1120 gimple_seq seq = NULL;
1121 gimple_seq_add_stmt (&seq, stmt);
1122 return seq;
1126 /* Returns the sequence of statements in BB. */
1128 static inline gimple_seq
1129 bb_seq (const_basic_block bb)
1131 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1134 static inline gimple_seq *
1135 bb_seq_addr (basic_block bb)
1137 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1140 /* Sets the sequence of statements in BB to SEQ. */
1142 static inline void
1143 set_bb_seq (basic_block bb, gimple_seq seq)
1145 gcc_checking_assert (!(bb->flags & BB_RTL));
1146 bb->il.gimple.seq = seq;
1150 /* Return the code for GIMPLE statement G. */
1152 static inline enum gimple_code
1153 gimple_code (const_gimple g)
1155 return g->gsbase.code;
1159 /* Return the GSS code used by a GIMPLE code. */
1161 static inline enum gimple_statement_structure_enum
1162 gss_for_code (enum gimple_code code)
1164 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1165 return gss_for_code_[code];
1169 /* Return which GSS code is used by GS. */
1171 static inline enum gimple_statement_structure_enum
1172 gimple_statement_structure (gimple gs)
1174 return gss_for_code (gimple_code (gs));
1178 /* Return true if statement G has sub-statements. This is only true for
1179 High GIMPLE statements. */
1181 static inline bool
1182 gimple_has_substatements (gimple g)
1184 switch (gimple_code (g))
1186 case GIMPLE_BIND:
1187 case GIMPLE_CATCH:
1188 case GIMPLE_EH_FILTER:
1189 case GIMPLE_EH_ELSE:
1190 case GIMPLE_TRY:
1191 case GIMPLE_OMP_FOR:
1192 case GIMPLE_OMP_MASTER:
1193 case GIMPLE_OMP_ORDERED:
1194 case GIMPLE_OMP_SECTION:
1195 case GIMPLE_OMP_PARALLEL:
1196 case GIMPLE_OMP_TASK:
1197 case GIMPLE_OMP_SECTIONS:
1198 case GIMPLE_OMP_SINGLE:
1199 case GIMPLE_OMP_CRITICAL:
1200 case GIMPLE_WITH_CLEANUP_EXPR:
1201 case GIMPLE_TRANSACTION:
1202 return true;
1204 default:
1205 return false;
1210 /* Return the basic block holding statement G. */
1212 static inline basic_block
1213 gimple_bb (const_gimple g)
1215 return g->gsbase.bb;
1219 /* Return the lexical scope block holding statement G. */
1221 static inline tree
1222 gimple_block (const_gimple g)
1224 return LOCATION_BLOCK (g->gsbase.location);
1228 /* Set BLOCK to be the lexical scope block holding statement G. */
1230 static inline void
1231 gimple_set_block (gimple g, tree block)
1233 if (block)
1234 g->gsbase.location =
1235 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1236 else
1237 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1241 /* Return location information for statement G. */
1243 static inline location_t
1244 gimple_location (const_gimple g)
1246 return g->gsbase.location;
1249 /* Return pointer to location information for statement G. */
1251 static inline const location_t *
1252 gimple_location_ptr (const_gimple g)
1254 return &g->gsbase.location;
1258 /* Set location information for statement G. */
1260 static inline void
1261 gimple_set_location (gimple g, location_t location)
1263 g->gsbase.location = location;
1267 /* Return true if G contains location information. */
1269 static inline bool
1270 gimple_has_location (const_gimple g)
1272 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1276 /* Return the file name of the location of STMT. */
1278 static inline const char *
1279 gimple_filename (const_gimple stmt)
1281 return LOCATION_FILE (gimple_location (stmt));
1285 /* Return the line number of the location of STMT. */
1287 static inline int
1288 gimple_lineno (const_gimple stmt)
1290 return LOCATION_LINE (gimple_location (stmt));
1294 /* Determine whether SEQ is a singleton. */
1296 static inline bool
1297 gimple_seq_singleton_p (gimple_seq seq)
1299 return ((gimple_seq_first (seq) != NULL)
1300 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1303 /* Return true if no warnings should be emitted for statement STMT. */
1305 static inline bool
1306 gimple_no_warning_p (const_gimple stmt)
1308 return stmt->gsbase.no_warning;
1311 /* Set the no_warning flag of STMT to NO_WARNING. */
1313 static inline void
1314 gimple_set_no_warning (gimple stmt, bool no_warning)
1316 stmt->gsbase.no_warning = (unsigned) no_warning;
1319 /* Set the visited status on statement STMT to VISITED_P. */
1321 static inline void
1322 gimple_set_visited (gimple stmt, bool visited_p)
1324 stmt->gsbase.visited = (unsigned) visited_p;
1328 /* Return the visited status for statement STMT. */
1330 static inline bool
1331 gimple_visited_p (gimple stmt)
1333 return stmt->gsbase.visited;
1337 /* Set pass local flag PLF on statement STMT to VAL_P. */
1339 static inline void
1340 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1342 if (val_p)
1343 stmt->gsbase.plf |= (unsigned int) plf;
1344 else
1345 stmt->gsbase.plf &= ~((unsigned int) plf);
1349 /* Return the value of pass local flag PLF on statement STMT. */
1351 static inline unsigned int
1352 gimple_plf (gimple stmt, enum plf_mask plf)
1354 return stmt->gsbase.plf & ((unsigned int) plf);
1358 /* Set the UID of statement. */
1360 static inline void
1361 gimple_set_uid (gimple g, unsigned uid)
1363 g->gsbase.uid = uid;
1367 /* Return the UID of statement. */
1369 static inline unsigned
1370 gimple_uid (const_gimple g)
1372 return g->gsbase.uid;
1376 /* Make statement G a singleton sequence. */
1378 static inline void
1379 gimple_init_singleton (gimple g)
1381 g->gsbase.next = NULL;
1382 g->gsbase.prev = g;
1386 /* Return true if GIMPLE statement G has register or memory operands. */
1388 static inline bool
1389 gimple_has_ops (const_gimple g)
1391 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1395 /* Return true if GIMPLE statement G has memory operands. */
1397 static inline bool
1398 gimple_has_mem_ops (const_gimple g)
1400 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1404 /* Return the set of USE operands for statement G. */
1406 static inline struct use_optype_d *
1407 gimple_use_ops (const_gimple g)
1409 if (!gimple_has_ops (g))
1410 return NULL;
1411 return g->gsops.opbase.use_ops;
1415 /* Set USE to be the set of USE operands for statement G. */
1417 static inline void
1418 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1420 gcc_gimple_checking_assert (gimple_has_ops (g));
1421 g->gsops.opbase.use_ops = use;
1425 /* Return the set of VUSE operand for statement G. */
1427 static inline use_operand_p
1428 gimple_vuse_op (const_gimple g)
1430 struct use_optype_d *ops;
1431 if (!gimple_has_mem_ops (g))
1432 return NULL_USE_OPERAND_P;
1433 ops = g->gsops.opbase.use_ops;
1434 if (ops
1435 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1436 return USE_OP_PTR (ops);
1437 return NULL_USE_OPERAND_P;
1440 /* Return the set of VDEF operand for statement G. */
1442 static inline def_operand_p
1443 gimple_vdef_op (gimple g)
1445 if (!gimple_has_mem_ops (g))
1446 return NULL_DEF_OPERAND_P;
1447 if (g->gsmembase.vdef)
1448 return &g->gsmembase.vdef;
1449 return NULL_DEF_OPERAND_P;
1453 /* Return the single VUSE operand of the statement G. */
1455 static inline tree
1456 gimple_vuse (const_gimple g)
1458 if (!gimple_has_mem_ops (g))
1459 return NULL_TREE;
1460 return g->gsmembase.vuse;
1463 /* Return the single VDEF operand of the statement G. */
1465 static inline tree
1466 gimple_vdef (const_gimple g)
1468 if (!gimple_has_mem_ops (g))
1469 return NULL_TREE;
1470 return g->gsmembase.vdef;
1473 /* Return the single VUSE operand of the statement G. */
1475 static inline tree *
1476 gimple_vuse_ptr (gimple g)
1478 if (!gimple_has_mem_ops (g))
1479 return NULL;
1480 return &g->gsmembase.vuse;
1483 /* Return the single VDEF operand of the statement G. */
1485 static inline tree *
1486 gimple_vdef_ptr (gimple g)
1488 if (!gimple_has_mem_ops (g))
1489 return NULL;
1490 return &g->gsmembase.vdef;
1493 /* Set the single VUSE operand of the statement G. */
1495 static inline void
1496 gimple_set_vuse (gimple g, tree vuse)
1498 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1499 g->gsmembase.vuse = vuse;
1502 /* Set the single VDEF operand of the statement G. */
1504 static inline void
1505 gimple_set_vdef (gimple g, tree vdef)
1507 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1508 g->gsmembase.vdef = vdef;
1512 /* Return true if statement G has operands and the modified field has
1513 been set. */
1515 static inline bool
1516 gimple_modified_p (const_gimple g)
1518 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1522 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1523 a MODIFIED field. */
1525 static inline void
1526 gimple_set_modified (gimple s, bool modifiedp)
1528 if (gimple_has_ops (s))
1529 s->gsbase.modified = (unsigned) modifiedp;
1533 /* Return the tree code for the expression computed by STMT. This is
1534 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1535 GIMPLE_CALL, return CALL_EXPR as the expression code for
1536 consistency. This is useful when the caller needs to deal with the
1537 three kinds of computation that GIMPLE supports. */
1539 static inline enum tree_code
1540 gimple_expr_code (const_gimple stmt)
1542 enum gimple_code code = gimple_code (stmt);
1543 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1544 return (enum tree_code) stmt->gsbase.subcode;
1545 else
1547 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1548 return CALL_EXPR;
1553 /* Mark statement S as modified, and update it. */
1555 static inline void
1556 update_stmt (gimple s)
1558 if (gimple_has_ops (s))
1560 gimple_set_modified (s, true);
1561 update_stmt_operands (s);
1565 /* Update statement S if it has been optimized. */
1567 static inline void
1568 update_stmt_if_modified (gimple s)
1570 if (gimple_modified_p (s))
1571 update_stmt_operands (s);
1574 /* Return true if statement STMT contains volatile operands. */
1576 static inline bool
1577 gimple_has_volatile_ops (const_gimple stmt)
1579 if (gimple_has_mem_ops (stmt))
1580 return stmt->gsbase.has_volatile_ops;
1581 else
1582 return false;
1586 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1588 static inline void
1589 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1591 if (gimple_has_mem_ops (stmt))
1592 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1595 /* Return true if BB is in a transaction. */
1597 static inline bool
1598 block_in_transaction (basic_block bb)
1600 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1603 /* Return true if STMT is in a transaction. */
1605 static inline bool
1606 gimple_in_transaction (gimple stmt)
1608 return block_in_transaction (gimple_bb (stmt));
1611 /* Return true if statement STMT may access memory. */
1613 static inline bool
1614 gimple_references_memory_p (gimple stmt)
1616 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1620 /* Return the subcode for OMP statement S. */
1622 static inline unsigned
1623 gimple_omp_subcode (const_gimple s)
1625 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1626 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1627 return s->gsbase.subcode;
1630 /* Set the subcode for OMP statement S to SUBCODE. */
1632 static inline void
1633 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1635 /* We only have 16 bits for the subcode. Assert that we are not
1636 overflowing it. */
1637 gcc_gimple_checking_assert (subcode < (1 << 16));
1638 s->gsbase.subcode = subcode;
1641 /* Set the nowait flag on OMP_RETURN statement S. */
1643 static inline void
1644 gimple_omp_return_set_nowait (gimple s)
1646 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1647 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1651 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1652 flag set. */
1654 static inline bool
1655 gimple_omp_return_nowait_p (const_gimple g)
1657 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1658 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1662 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1663 flag set. */
1665 static inline bool
1666 gimple_omp_section_last_p (const_gimple g)
1668 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1669 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1673 /* Set the GF_OMP_SECTION_LAST flag on G. */
1675 static inline void
1676 gimple_omp_section_set_last (gimple g)
1678 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1679 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1683 /* Return true if OMP parallel statement G has the
1684 GF_OMP_PARALLEL_COMBINED flag set. */
1686 static inline bool
1687 gimple_omp_parallel_combined_p (const_gimple g)
1689 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1690 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1694 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1695 value of COMBINED_P. */
1697 static inline void
1698 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1700 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1701 if (combined_p)
1702 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1703 else
1704 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1708 /* Return true if OMP atomic load/store statement G has the
1709 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1711 static inline bool
1712 gimple_omp_atomic_need_value_p (const_gimple g)
1714 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1715 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1716 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1720 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1722 static inline void
1723 gimple_omp_atomic_set_need_value (gimple g)
1725 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1726 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1727 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1731 /* Return the number of operands for statement GS. */
1733 static inline unsigned
1734 gimple_num_ops (const_gimple gs)
1736 return gs->gsbase.num_ops;
1740 /* Set the number of operands for statement GS. */
1742 static inline void
1743 gimple_set_num_ops (gimple gs, unsigned num_ops)
1745 gs->gsbase.num_ops = num_ops;
1749 /* Return the array of operands for statement GS. */
1751 static inline tree *
1752 gimple_ops (gimple gs)
1754 size_t off;
1756 /* All the tuples have their operand vector at the very bottom
1757 of the structure. Note that those structures that do not
1758 have an operand vector have a zero offset. */
1759 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1760 gcc_gimple_checking_assert (off != 0);
1762 return (tree *) ((char *) gs + off);
1766 /* Return operand I for statement GS. */
1768 static inline tree
1769 gimple_op (const_gimple gs, unsigned i)
1771 if (gimple_has_ops (gs))
1773 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1774 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1776 else
1777 return NULL_TREE;
1780 /* Return a pointer to operand I for statement GS. */
1782 static inline tree *
1783 gimple_op_ptr (const_gimple gs, unsigned i)
1785 if (gimple_has_ops (gs))
1787 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1788 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1790 else
1791 return NULL;
1794 /* Set operand I of statement GS to OP. */
1796 static inline void
1797 gimple_set_op (gimple gs, unsigned i, tree op)
1799 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1801 /* Note. It may be tempting to assert that OP matches
1802 is_gimple_operand, but that would be wrong. Different tuples
1803 accept slightly different sets of tree operands. Each caller
1804 should perform its own validation. */
1805 gimple_ops (gs)[i] = op;
1808 /* Return true if GS is a GIMPLE_ASSIGN. */
1810 static inline bool
1811 is_gimple_assign (const_gimple gs)
1813 return gimple_code (gs) == GIMPLE_ASSIGN;
1816 /* Determine if expression CODE is one of the valid expressions that can
1817 be used on the RHS of GIMPLE assignments. */
1819 static inline enum gimple_rhs_class
1820 get_gimple_rhs_class (enum tree_code code)
1822 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1825 /* Return the LHS of assignment statement GS. */
1827 static inline tree
1828 gimple_assign_lhs (const_gimple gs)
1830 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1831 return gimple_op (gs, 0);
1835 /* Return a pointer to the LHS of assignment statement GS. */
1837 static inline tree *
1838 gimple_assign_lhs_ptr (const_gimple gs)
1840 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1841 return gimple_op_ptr (gs, 0);
1845 /* Set LHS to be the LHS operand of assignment statement GS. */
1847 static inline void
1848 gimple_assign_set_lhs (gimple gs, tree lhs)
1850 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1851 gimple_set_op (gs, 0, lhs);
1853 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1854 SSA_NAME_DEF_STMT (lhs) = gs;
1858 /* Return the first operand on the RHS of assignment statement GS. */
1860 static inline tree
1861 gimple_assign_rhs1 (const_gimple gs)
1863 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1864 return gimple_op (gs, 1);
1868 /* Return a pointer to the first operand on the RHS of assignment
1869 statement GS. */
1871 static inline tree *
1872 gimple_assign_rhs1_ptr (const_gimple gs)
1874 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1875 return gimple_op_ptr (gs, 1);
1878 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1880 static inline void
1881 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1883 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1885 gimple_set_op (gs, 1, rhs);
1889 /* Return the second operand on the RHS of assignment statement GS.
1890 If GS does not have two operands, NULL is returned instead. */
1892 static inline tree
1893 gimple_assign_rhs2 (const_gimple gs)
1895 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1897 if (gimple_num_ops (gs) >= 3)
1898 return gimple_op (gs, 2);
1899 else
1900 return NULL_TREE;
1904 /* Return a pointer to the second operand on the RHS of assignment
1905 statement GS. */
1907 static inline tree *
1908 gimple_assign_rhs2_ptr (const_gimple gs)
1910 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1911 return gimple_op_ptr (gs, 2);
1915 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1917 static inline void
1918 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1920 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1922 gimple_set_op (gs, 2, rhs);
1925 /* Return the third operand on the RHS of assignment statement GS.
1926 If GS does not have two operands, NULL is returned instead. */
1928 static inline tree
1929 gimple_assign_rhs3 (const_gimple gs)
1931 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1933 if (gimple_num_ops (gs) >= 4)
1934 return gimple_op (gs, 3);
1935 else
1936 return NULL_TREE;
1939 /* Return a pointer to the third operand on the RHS of assignment
1940 statement GS. */
1942 static inline tree *
1943 gimple_assign_rhs3_ptr (const_gimple gs)
1945 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1946 return gimple_op_ptr (gs, 3);
1950 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1952 static inline void
1953 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1955 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1957 gimple_set_op (gs, 3, rhs);
1960 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1961 to see only a maximum of two operands. */
1963 static inline void
1964 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1965 tree op1, tree op2)
1967 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1970 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1971 to see only a maximum of two operands. */
1973 static inline void
1974 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1975 tree *op1)
1977 tree op2;
1978 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1979 gcc_assert (op2 == NULL_TREE);
1982 /* Returns true if GS is a nontemporal move. */
1984 static inline bool
1985 gimple_assign_nontemporal_move_p (const_gimple gs)
1987 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1988 return gs->gsbase.nontemporal_move;
1991 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1993 static inline void
1994 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1996 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1997 gs->gsbase.nontemporal_move = nontemporal;
2001 /* Return the code of the expression computed on the rhs of assignment
2002 statement GS. In case that the RHS is a single object, returns the
2003 tree code of the object. */
2005 static inline enum tree_code
2006 gimple_assign_rhs_code (const_gimple gs)
2008 enum tree_code code;
2009 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2011 code = (enum tree_code) gs->gsbase.subcode;
2012 /* While we initially set subcode to the TREE_CODE of the rhs for
2013 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2014 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2015 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2016 code = TREE_CODE (gimple_assign_rhs1 (gs));
2018 return code;
2022 /* Set CODE to be the code for the expression computed on the RHS of
2023 assignment S. */
2025 static inline void
2026 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2028 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2029 s->gsbase.subcode = code;
2033 /* Return the gimple rhs class of the code of the expression computed on
2034 the rhs of assignment statement GS.
2035 This will never return GIMPLE_INVALID_RHS. */
2037 static inline enum gimple_rhs_class
2038 gimple_assign_rhs_class (const_gimple gs)
2040 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2043 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2044 there is no operator associated with the assignment itself.
2045 Unlike gimple_assign_copy_p, this predicate returns true for
2046 any RHS operand, including those that perform an operation
2047 and do not have the semantics of a copy, such as COND_EXPR. */
2049 static inline bool
2050 gimple_assign_single_p (gimple gs)
2052 return (is_gimple_assign (gs)
2053 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2056 /* Return true if GS performs a store to its lhs. */
2058 static inline bool
2059 gimple_store_p (gimple gs)
2061 tree lhs = gimple_get_lhs (gs);
2062 return lhs && !is_gimple_reg (lhs);
2065 /* Return true if GS is an assignment that loads from its rhs1. */
2067 static inline bool
2068 gimple_assign_load_p (gimple gs)
2070 tree rhs;
2071 if (!gimple_assign_single_p (gs))
2072 return false;
2073 rhs = gimple_assign_rhs1 (gs);
2074 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2075 return true;
2076 rhs = get_base_address (rhs);
2077 return (DECL_P (rhs)
2078 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2082 /* Return true if S is a type-cast assignment. */
2084 static inline bool
2085 gimple_assign_cast_p (gimple s)
2087 if (is_gimple_assign (s))
2089 enum tree_code sc = gimple_assign_rhs_code (s);
2090 return CONVERT_EXPR_CODE_P (sc)
2091 || sc == VIEW_CONVERT_EXPR
2092 || sc == FIX_TRUNC_EXPR;
2095 return false;
2098 /* Return true if S is a clobber statement. */
2100 static inline bool
2101 gimple_clobber_p (gimple s)
2103 return gimple_assign_single_p (s)
2104 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2107 /* Return true if GS is a GIMPLE_CALL. */
2109 static inline bool
2110 is_gimple_call (const_gimple gs)
2112 return gimple_code (gs) == GIMPLE_CALL;
2115 /* Return the LHS of call statement GS. */
2117 static inline tree
2118 gimple_call_lhs (const_gimple gs)
2120 GIMPLE_CHECK (gs, GIMPLE_CALL);
2121 return gimple_op (gs, 0);
2125 /* Return a pointer to the LHS of call statement GS. */
2127 static inline tree *
2128 gimple_call_lhs_ptr (const_gimple gs)
2130 GIMPLE_CHECK (gs, GIMPLE_CALL);
2131 return gimple_op_ptr (gs, 0);
2135 /* Set LHS to be the LHS operand of call statement GS. */
2137 static inline void
2138 gimple_call_set_lhs (gimple gs, tree lhs)
2140 GIMPLE_CHECK (gs, GIMPLE_CALL);
2141 gimple_set_op (gs, 0, lhs);
2142 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2143 SSA_NAME_DEF_STMT (lhs) = gs;
2147 /* Return true if call GS calls an internal-only function, as enumerated
2148 by internal_fn. */
2150 static inline bool
2151 gimple_call_internal_p (const_gimple gs)
2153 GIMPLE_CHECK (gs, GIMPLE_CALL);
2154 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2158 /* Return the target of internal call GS. */
2160 static inline enum internal_fn
2161 gimple_call_internal_fn (const_gimple gs)
2163 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2164 return gs->gimple_call.u.internal_fn;
2168 /* Return the function type of the function called by GS. */
2170 static inline tree
2171 gimple_call_fntype (const_gimple gs)
2173 GIMPLE_CHECK (gs, GIMPLE_CALL);
2174 if (gimple_call_internal_p (gs))
2175 return NULL_TREE;
2176 return gs->gimple_call.u.fntype;
2179 /* Set the type of the function called by GS to FNTYPE. */
2181 static inline void
2182 gimple_call_set_fntype (gimple gs, tree fntype)
2184 GIMPLE_CHECK (gs, GIMPLE_CALL);
2185 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2186 gs->gimple_call.u.fntype = fntype;
2190 /* Return the tree node representing the function called by call
2191 statement GS. */
2193 static inline tree
2194 gimple_call_fn (const_gimple gs)
2196 GIMPLE_CHECK (gs, GIMPLE_CALL);
2197 return gimple_op (gs, 1);
2200 /* Return a pointer to the tree node representing the function called by call
2201 statement GS. */
2203 static inline tree *
2204 gimple_call_fn_ptr (const_gimple gs)
2206 GIMPLE_CHECK (gs, GIMPLE_CALL);
2207 return gimple_op_ptr (gs, 1);
2211 /* Set FN to be the function called by call statement GS. */
2213 static inline void
2214 gimple_call_set_fn (gimple gs, tree fn)
2216 GIMPLE_CHECK (gs, GIMPLE_CALL);
2217 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2218 gimple_set_op (gs, 1, fn);
2222 /* Set FNDECL to be the function called by call statement GS. */
2224 static inline void
2225 gimple_call_set_fndecl (gimple gs, tree decl)
2227 GIMPLE_CHECK (gs, GIMPLE_CALL);
2228 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2229 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2233 /* Set internal function FN to be the function called by call statement GS. */
2235 static inline void
2236 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2238 GIMPLE_CHECK (gs, GIMPLE_CALL);
2239 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2240 gs->gimple_call.u.internal_fn = fn;
2244 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2245 associated with the callee if known. Otherwise return NULL_TREE. */
2247 static inline tree
2248 gimple_call_addr_fndecl (const_tree fn)
2250 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2252 tree fndecl = TREE_OPERAND (fn, 0);
2253 if (TREE_CODE (fndecl) == MEM_REF
2254 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2255 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2256 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2257 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2258 return fndecl;
2260 return NULL_TREE;
2263 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2264 Otherwise return NULL. This function is analogous to
2265 get_callee_fndecl in tree land. */
2267 static inline tree
2268 gimple_call_fndecl (const_gimple gs)
2270 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2274 /* Return the type returned by call statement GS. */
2276 static inline tree
2277 gimple_call_return_type (const_gimple gs)
2279 tree type = gimple_call_fntype (gs);
2281 if (type == NULL_TREE)
2282 return TREE_TYPE (gimple_call_lhs (gs));
2284 /* The type returned by a function is the type of its
2285 function type. */
2286 return TREE_TYPE (type);
2290 /* Return the static chain for call statement GS. */
2292 static inline tree
2293 gimple_call_chain (const_gimple gs)
2295 GIMPLE_CHECK (gs, GIMPLE_CALL);
2296 return gimple_op (gs, 2);
2300 /* Return a pointer to the static chain for call statement GS. */
2302 static inline tree *
2303 gimple_call_chain_ptr (const_gimple gs)
2305 GIMPLE_CHECK (gs, GIMPLE_CALL);
2306 return gimple_op_ptr (gs, 2);
2309 /* Set CHAIN to be the static chain for call statement GS. */
2311 static inline void
2312 gimple_call_set_chain (gimple gs, tree chain)
2314 GIMPLE_CHECK (gs, GIMPLE_CALL);
2316 gimple_set_op (gs, 2, chain);
2320 /* Return the number of arguments used by call statement GS. */
2322 static inline unsigned
2323 gimple_call_num_args (const_gimple gs)
2325 unsigned num_ops;
2326 GIMPLE_CHECK (gs, GIMPLE_CALL);
2327 num_ops = gimple_num_ops (gs);
2328 return num_ops - 3;
2332 /* Return the argument at position INDEX for call statement GS. */
2334 static inline tree
2335 gimple_call_arg (const_gimple gs, unsigned index)
2337 GIMPLE_CHECK (gs, GIMPLE_CALL);
2338 return gimple_op (gs, index + 3);
2342 /* Return a pointer to the argument at position INDEX for call
2343 statement GS. */
2345 static inline tree *
2346 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2348 GIMPLE_CHECK (gs, GIMPLE_CALL);
2349 return gimple_op_ptr (gs, index + 3);
2353 /* Set ARG to be the argument at position INDEX for call statement GS. */
2355 static inline void
2356 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2358 GIMPLE_CHECK (gs, GIMPLE_CALL);
2359 gimple_set_op (gs, index + 3, arg);
2363 /* If TAIL_P is true, mark call statement S as being a tail call
2364 (i.e., a call just before the exit of a function). These calls are
2365 candidate for tail call optimization. */
2367 static inline void
2368 gimple_call_set_tail (gimple s, bool tail_p)
2370 GIMPLE_CHECK (s, GIMPLE_CALL);
2371 if (tail_p)
2372 s->gsbase.subcode |= GF_CALL_TAILCALL;
2373 else
2374 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2378 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2380 static inline bool
2381 gimple_call_tail_p (gimple s)
2383 GIMPLE_CHECK (s, GIMPLE_CALL);
2384 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2388 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2389 slot optimization. This transformation uses the target of the call
2390 expansion as the return slot for calls that return in memory. */
2392 static inline void
2393 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2395 GIMPLE_CHECK (s, GIMPLE_CALL);
2396 if (return_slot_opt_p)
2397 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2398 else
2399 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2403 /* Return true if S is marked for return slot optimization. */
2405 static inline bool
2406 gimple_call_return_slot_opt_p (gimple s)
2408 GIMPLE_CHECK (s, GIMPLE_CALL);
2409 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2413 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2414 thunk to the thunked-to function. */
2416 static inline void
2417 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2419 GIMPLE_CHECK (s, GIMPLE_CALL);
2420 if (from_thunk_p)
2421 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2422 else
2423 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2427 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2429 static inline bool
2430 gimple_call_from_thunk_p (gimple s)
2432 GIMPLE_CHECK (s, GIMPLE_CALL);
2433 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2437 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2438 argument pack in its argument list. */
2440 static inline void
2441 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2443 GIMPLE_CHECK (s, GIMPLE_CALL);
2444 if (pass_arg_pack_p)
2445 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2446 else
2447 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2451 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2452 argument pack in its argument list. */
2454 static inline bool
2455 gimple_call_va_arg_pack_p (gimple s)
2457 GIMPLE_CHECK (s, GIMPLE_CALL);
2458 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2462 /* Return true if S is a noreturn call. */
2464 static inline bool
2465 gimple_call_noreturn_p (gimple s)
2467 GIMPLE_CHECK (s, GIMPLE_CALL);
2468 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2472 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2473 even if the called function can throw in other cases. */
2475 static inline void
2476 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2478 GIMPLE_CHECK (s, GIMPLE_CALL);
2479 if (nothrow_p)
2480 s->gsbase.subcode |= GF_CALL_NOTHROW;
2481 else
2482 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2485 /* Return true if S is a nothrow call. */
2487 static inline bool
2488 gimple_call_nothrow_p (gimple s)
2490 GIMPLE_CHECK (s, GIMPLE_CALL);
2491 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2494 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2495 is known to be emitted for VLA objects. Those are wrapped by
2496 stack_save/stack_restore calls and hence can't lead to unbounded
2497 stack growth even when they occur in loops. */
2499 static inline void
2500 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2502 GIMPLE_CHECK (s, GIMPLE_CALL);
2503 if (for_var)
2504 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2505 else
2506 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2509 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2511 static inline bool
2512 gimple_call_alloca_for_var_p (gimple s)
2514 GIMPLE_CHECK (s, GIMPLE_CALL);
2515 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2518 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2520 static inline void
2521 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2523 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2524 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2525 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2529 /* Return a pointer to the points-to solution for the set of call-used
2530 variables of the call CALL. */
2532 static inline struct pt_solution *
2533 gimple_call_use_set (gimple call)
2535 GIMPLE_CHECK (call, GIMPLE_CALL);
2536 return &call->gimple_call.call_used;
2540 /* Return a pointer to the points-to solution for the set of call-used
2541 variables of the call CALL. */
2543 static inline struct pt_solution *
2544 gimple_call_clobber_set (gimple call)
2546 GIMPLE_CHECK (call, GIMPLE_CALL);
2547 return &call->gimple_call.call_clobbered;
2551 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2552 non-NULL lhs. */
2554 static inline bool
2555 gimple_has_lhs (gimple stmt)
2557 return (is_gimple_assign (stmt)
2558 || (is_gimple_call (stmt)
2559 && gimple_call_lhs (stmt) != NULL_TREE));
2563 /* Return the code of the predicate computed by conditional statement GS. */
2565 static inline enum tree_code
2566 gimple_cond_code (const_gimple gs)
2568 GIMPLE_CHECK (gs, GIMPLE_COND);
2569 return (enum tree_code) gs->gsbase.subcode;
2573 /* Set CODE to be the predicate code for the conditional statement GS. */
2575 static inline void
2576 gimple_cond_set_code (gimple gs, enum tree_code code)
2578 GIMPLE_CHECK (gs, GIMPLE_COND);
2579 gs->gsbase.subcode = code;
2583 /* Return the LHS of the predicate computed by conditional statement GS. */
2585 static inline tree
2586 gimple_cond_lhs (const_gimple gs)
2588 GIMPLE_CHECK (gs, GIMPLE_COND);
2589 return gimple_op (gs, 0);
2592 /* Return the pointer to the LHS of the predicate computed by conditional
2593 statement GS. */
2595 static inline tree *
2596 gimple_cond_lhs_ptr (const_gimple gs)
2598 GIMPLE_CHECK (gs, GIMPLE_COND);
2599 return gimple_op_ptr (gs, 0);
2602 /* Set LHS to be the LHS operand of the predicate computed by
2603 conditional statement GS. */
2605 static inline void
2606 gimple_cond_set_lhs (gimple gs, tree lhs)
2608 GIMPLE_CHECK (gs, GIMPLE_COND);
2609 gimple_set_op (gs, 0, lhs);
2613 /* Return the RHS operand of the predicate computed by conditional GS. */
2615 static inline tree
2616 gimple_cond_rhs (const_gimple gs)
2618 GIMPLE_CHECK (gs, GIMPLE_COND);
2619 return gimple_op (gs, 1);
2622 /* Return the pointer to the RHS operand of the predicate computed by
2623 conditional GS. */
2625 static inline tree *
2626 gimple_cond_rhs_ptr (const_gimple gs)
2628 GIMPLE_CHECK (gs, GIMPLE_COND);
2629 return gimple_op_ptr (gs, 1);
2633 /* Set RHS to be the RHS operand of the predicate computed by
2634 conditional statement GS. */
2636 static inline void
2637 gimple_cond_set_rhs (gimple gs, tree rhs)
2639 GIMPLE_CHECK (gs, GIMPLE_COND);
2640 gimple_set_op (gs, 1, rhs);
2644 /* Return the label used by conditional statement GS when its
2645 predicate evaluates to true. */
2647 static inline tree
2648 gimple_cond_true_label (const_gimple gs)
2650 GIMPLE_CHECK (gs, GIMPLE_COND);
2651 return gimple_op (gs, 2);
2655 /* Set LABEL to be the label used by conditional statement GS when its
2656 predicate evaluates to true. */
2658 static inline void
2659 gimple_cond_set_true_label (gimple gs, tree label)
2661 GIMPLE_CHECK (gs, GIMPLE_COND);
2662 gimple_set_op (gs, 2, label);
2666 /* Set LABEL to be the label used by conditional statement GS when its
2667 predicate evaluates to false. */
2669 static inline void
2670 gimple_cond_set_false_label (gimple gs, tree label)
2672 GIMPLE_CHECK (gs, GIMPLE_COND);
2673 gimple_set_op (gs, 3, label);
2677 /* Return the label used by conditional statement GS when its
2678 predicate evaluates to false. */
2680 static inline tree
2681 gimple_cond_false_label (const_gimple gs)
2683 GIMPLE_CHECK (gs, GIMPLE_COND);
2684 return gimple_op (gs, 3);
2688 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2690 static inline void
2691 gimple_cond_make_false (gimple gs)
2693 gimple_cond_set_lhs (gs, boolean_true_node);
2694 gimple_cond_set_rhs (gs, boolean_false_node);
2695 gs->gsbase.subcode = EQ_EXPR;
2699 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2701 static inline void
2702 gimple_cond_make_true (gimple gs)
2704 gimple_cond_set_lhs (gs, boolean_true_node);
2705 gimple_cond_set_rhs (gs, boolean_true_node);
2706 gs->gsbase.subcode = EQ_EXPR;
2709 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2710 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2712 static inline bool
2713 gimple_cond_true_p (const_gimple gs)
2715 tree lhs = gimple_cond_lhs (gs);
2716 tree rhs = gimple_cond_rhs (gs);
2717 enum tree_code code = gimple_cond_code (gs);
2719 if (lhs != boolean_true_node && lhs != boolean_false_node)
2720 return false;
2722 if (rhs != boolean_true_node && rhs != boolean_false_node)
2723 return false;
2725 if (code == NE_EXPR && lhs != rhs)
2726 return true;
2728 if (code == EQ_EXPR && lhs == rhs)
2729 return true;
2731 return false;
2734 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2735 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2737 static inline bool
2738 gimple_cond_false_p (const_gimple gs)
2740 tree lhs = gimple_cond_lhs (gs);
2741 tree rhs = gimple_cond_rhs (gs);
2742 enum tree_code code = gimple_cond_code (gs);
2744 if (lhs != boolean_true_node && lhs != boolean_false_node)
2745 return false;
2747 if (rhs != boolean_true_node && rhs != boolean_false_node)
2748 return false;
2750 if (code == NE_EXPR && lhs == rhs)
2751 return true;
2753 if (code == EQ_EXPR && lhs != rhs)
2754 return true;
2756 return false;
2759 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2760 'if (var == 1)' */
2762 static inline bool
2763 gimple_cond_single_var_p (gimple gs)
2765 if (gimple_cond_code (gs) == NE_EXPR
2766 && gimple_cond_rhs (gs) == boolean_false_node)
2767 return true;
2769 if (gimple_cond_code (gs) == EQ_EXPR
2770 && gimple_cond_rhs (gs) == boolean_true_node)
2771 return true;
2773 return false;
2776 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2778 static inline void
2779 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2781 gimple_cond_set_code (stmt, code);
2782 gimple_cond_set_lhs (stmt, lhs);
2783 gimple_cond_set_rhs (stmt, rhs);
2786 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2788 static inline tree
2789 gimple_label_label (const_gimple gs)
2791 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2792 return gimple_op (gs, 0);
2796 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2797 GS. */
2799 static inline void
2800 gimple_label_set_label (gimple gs, tree label)
2802 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2803 gimple_set_op (gs, 0, label);
2807 /* Return the destination of the unconditional jump GS. */
2809 static inline tree
2810 gimple_goto_dest (const_gimple gs)
2812 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2813 return gimple_op (gs, 0);
2817 /* Set DEST to be the destination of the unconditonal jump GS. */
2819 static inline void
2820 gimple_goto_set_dest (gimple gs, tree dest)
2822 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2823 gimple_set_op (gs, 0, dest);
2827 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2829 static inline tree
2830 gimple_bind_vars (const_gimple gs)
2832 GIMPLE_CHECK (gs, GIMPLE_BIND);
2833 return gs->gimple_bind.vars;
2837 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2838 statement GS. */
2840 static inline void
2841 gimple_bind_set_vars (gimple gs, tree vars)
2843 GIMPLE_CHECK (gs, GIMPLE_BIND);
2844 gs->gimple_bind.vars = vars;
2848 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2849 statement GS. */
2851 static inline void
2852 gimple_bind_append_vars (gimple gs, tree vars)
2854 GIMPLE_CHECK (gs, GIMPLE_BIND);
2855 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2859 static inline gimple_seq *
2860 gimple_bind_body_ptr (gimple gs)
2862 GIMPLE_CHECK (gs, GIMPLE_BIND);
2863 return &gs->gimple_bind.body;
2866 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2868 static inline gimple_seq
2869 gimple_bind_body (gimple gs)
2871 return *gimple_bind_body_ptr (gs);
2875 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2876 statement GS. */
2878 static inline void
2879 gimple_bind_set_body (gimple gs, gimple_seq seq)
2881 GIMPLE_CHECK (gs, GIMPLE_BIND);
2882 gs->gimple_bind.body = seq;
2886 /* Append a statement to the end of a GIMPLE_BIND's body. */
2888 static inline void
2889 gimple_bind_add_stmt (gimple gs, gimple stmt)
2891 GIMPLE_CHECK (gs, GIMPLE_BIND);
2892 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2896 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2898 static inline void
2899 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2901 GIMPLE_CHECK (gs, GIMPLE_BIND);
2902 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2906 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2907 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2909 static inline tree
2910 gimple_bind_block (const_gimple gs)
2912 GIMPLE_CHECK (gs, GIMPLE_BIND);
2913 return gs->gimple_bind.block;
2917 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2918 statement GS. */
2920 static inline void
2921 gimple_bind_set_block (gimple gs, tree block)
2923 GIMPLE_CHECK (gs, GIMPLE_BIND);
2924 gcc_gimple_checking_assert (block == NULL_TREE
2925 || TREE_CODE (block) == BLOCK);
2926 gs->gimple_bind.block = block;
2930 /* Return the number of input operands for GIMPLE_ASM GS. */
2932 static inline unsigned
2933 gimple_asm_ninputs (const_gimple gs)
2935 GIMPLE_CHECK (gs, GIMPLE_ASM);
2936 return gs->gimple_asm.ni;
2940 /* Return the number of output operands for GIMPLE_ASM GS. */
2942 static inline unsigned
2943 gimple_asm_noutputs (const_gimple gs)
2945 GIMPLE_CHECK (gs, GIMPLE_ASM);
2946 return gs->gimple_asm.no;
2950 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2952 static inline unsigned
2953 gimple_asm_nclobbers (const_gimple gs)
2955 GIMPLE_CHECK (gs, GIMPLE_ASM);
2956 return gs->gimple_asm.nc;
2959 /* Return the number of label operands for GIMPLE_ASM GS. */
2961 static inline unsigned
2962 gimple_asm_nlabels (const_gimple gs)
2964 GIMPLE_CHECK (gs, GIMPLE_ASM);
2965 return gs->gimple_asm.nl;
2968 /* Return input operand INDEX of GIMPLE_ASM GS. */
2970 static inline tree
2971 gimple_asm_input_op (const_gimple gs, unsigned index)
2973 GIMPLE_CHECK (gs, GIMPLE_ASM);
2974 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2975 return gimple_op (gs, index + gs->gimple_asm.no);
2978 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2980 static inline tree *
2981 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2983 GIMPLE_CHECK (gs, GIMPLE_ASM);
2984 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
2985 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
2989 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2991 static inline void
2992 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2994 GIMPLE_CHECK (gs, GIMPLE_ASM);
2995 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
2996 && TREE_CODE (in_op) == TREE_LIST);
2997 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
3001 /* Return output operand INDEX of GIMPLE_ASM GS. */
3003 static inline tree
3004 gimple_asm_output_op (const_gimple gs, unsigned index)
3006 GIMPLE_CHECK (gs, GIMPLE_ASM);
3007 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3008 return gimple_op (gs, index);
3011 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3013 static inline tree *
3014 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3016 GIMPLE_CHECK (gs, GIMPLE_ASM);
3017 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3018 return gimple_op_ptr (gs, index);
3022 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3024 static inline void
3025 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3027 GIMPLE_CHECK (gs, GIMPLE_ASM);
3028 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3029 && TREE_CODE (out_op) == TREE_LIST);
3030 gimple_set_op (gs, index, out_op);
3034 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3036 static inline tree
3037 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3039 GIMPLE_CHECK (gs, GIMPLE_ASM);
3040 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3041 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3045 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3047 static inline void
3048 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3050 GIMPLE_CHECK (gs, GIMPLE_ASM);
3051 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3052 && TREE_CODE (clobber_op) == TREE_LIST);
3053 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3056 /* Return label operand INDEX of GIMPLE_ASM GS. */
3058 static inline tree
3059 gimple_asm_label_op (const_gimple gs, unsigned index)
3061 GIMPLE_CHECK (gs, GIMPLE_ASM);
3062 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3063 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3066 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3068 static inline void
3069 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3071 GIMPLE_CHECK (gs, GIMPLE_ASM);
3072 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3073 && TREE_CODE (label_op) == TREE_LIST);
3074 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3077 /* Return the string representing the assembly instruction in
3078 GIMPLE_ASM GS. */
3080 static inline const char *
3081 gimple_asm_string (const_gimple gs)
3083 GIMPLE_CHECK (gs, GIMPLE_ASM);
3084 return gs->gimple_asm.string;
3088 /* Return true if GS is an asm statement marked volatile. */
3090 static inline bool
3091 gimple_asm_volatile_p (const_gimple gs)
3093 GIMPLE_CHECK (gs, GIMPLE_ASM);
3094 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3098 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3100 static inline void
3101 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3103 GIMPLE_CHECK (gs, GIMPLE_ASM);
3104 if (volatile_p)
3105 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3106 else
3107 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3111 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3113 static inline void
3114 gimple_asm_set_input (gimple gs, bool input_p)
3116 GIMPLE_CHECK (gs, GIMPLE_ASM);
3117 if (input_p)
3118 gs->gsbase.subcode |= GF_ASM_INPUT;
3119 else
3120 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3124 /* Return true if asm GS is an ASM_INPUT. */
3126 static inline bool
3127 gimple_asm_input_p (const_gimple gs)
3129 GIMPLE_CHECK (gs, GIMPLE_ASM);
3130 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3134 /* Return the types handled by GIMPLE_CATCH statement GS. */
3136 static inline tree
3137 gimple_catch_types (const_gimple gs)
3139 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3140 return gs->gimple_catch.types;
3144 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3146 static inline tree *
3147 gimple_catch_types_ptr (gimple gs)
3149 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3150 return &gs->gimple_catch.types;
3154 /* Return a pointer to the GIMPLE sequence representing the body of
3155 the handler of GIMPLE_CATCH statement GS. */
3157 static inline gimple_seq *
3158 gimple_catch_handler_ptr (gimple gs)
3160 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3161 return &gs->gimple_catch.handler;
3165 /* Return the GIMPLE sequence representing the body of the handler of
3166 GIMPLE_CATCH statement GS. */
3168 static inline gimple_seq
3169 gimple_catch_handler (gimple gs)
3171 return *gimple_catch_handler_ptr (gs);
3175 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3177 static inline void
3178 gimple_catch_set_types (gimple gs, tree t)
3180 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3181 gs->gimple_catch.types = t;
3185 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3187 static inline void
3188 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3190 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3191 gs->gimple_catch.handler = handler;
3195 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3197 static inline tree
3198 gimple_eh_filter_types (const_gimple gs)
3200 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3201 return gs->gimple_eh_filter.types;
3205 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3206 GS. */
3208 static inline tree *
3209 gimple_eh_filter_types_ptr (gimple gs)
3211 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3212 return &gs->gimple_eh_filter.types;
3216 /* Return a pointer to the sequence of statement to execute when
3217 GIMPLE_EH_FILTER statement fails. */
3219 static inline gimple_seq *
3220 gimple_eh_filter_failure_ptr (gimple gs)
3222 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3223 return &gs->gimple_eh_filter.failure;
3227 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3228 statement fails. */
3230 static inline gimple_seq
3231 gimple_eh_filter_failure (gimple gs)
3233 return *gimple_eh_filter_failure_ptr (gs);
3237 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3239 static inline void
3240 gimple_eh_filter_set_types (gimple gs, tree types)
3242 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3243 gs->gimple_eh_filter.types = types;
3247 /* Set FAILURE to be the sequence of statements to execute on failure
3248 for GIMPLE_EH_FILTER GS. */
3250 static inline void
3251 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3253 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3254 gs->gimple_eh_filter.failure = failure;
3257 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3259 static inline tree
3260 gimple_eh_must_not_throw_fndecl (gimple gs)
3262 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3263 return gs->gimple_eh_mnt.fndecl;
3266 /* Set the function decl to be called by GS to DECL. */
3268 static inline void
3269 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3271 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3272 gs->gimple_eh_mnt.fndecl = decl;
3275 /* GIMPLE_EH_ELSE accessors. */
3277 static inline gimple_seq *
3278 gimple_eh_else_n_body_ptr (gimple gs)
3280 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3281 return &gs->gimple_eh_else.n_body;
3284 static inline gimple_seq
3285 gimple_eh_else_n_body (gimple gs)
3287 return *gimple_eh_else_n_body_ptr (gs);
3290 static inline gimple_seq *
3291 gimple_eh_else_e_body_ptr (gimple gs)
3293 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3294 return &gs->gimple_eh_else.e_body;
3297 static inline gimple_seq
3298 gimple_eh_else_e_body (gimple gs)
3300 return *gimple_eh_else_e_body_ptr (gs);
3303 static inline void
3304 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3306 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3307 gs->gimple_eh_else.n_body = seq;
3310 static inline void
3311 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3313 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3314 gs->gimple_eh_else.e_body = seq;
3317 /* GIMPLE_TRY accessors. */
3319 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3320 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3322 static inline enum gimple_try_flags
3323 gimple_try_kind (const_gimple gs)
3325 GIMPLE_CHECK (gs, GIMPLE_TRY);
3326 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3330 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3332 static inline void
3333 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3335 GIMPLE_CHECK (gs, GIMPLE_TRY);
3336 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3337 || kind == GIMPLE_TRY_FINALLY);
3338 if (gimple_try_kind (gs) != kind)
3339 gs->gsbase.subcode = (unsigned int) kind;
3343 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3345 static inline bool
3346 gimple_try_catch_is_cleanup (const_gimple gs)
3348 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3349 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3353 /* Return a pointer to the sequence of statements used as the
3354 body for GIMPLE_TRY GS. */
3356 static inline gimple_seq *
3357 gimple_try_eval_ptr (gimple gs)
3359 GIMPLE_CHECK (gs, GIMPLE_TRY);
3360 return &gs->gimple_try.eval;
3364 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3366 static inline gimple_seq
3367 gimple_try_eval (gimple gs)
3369 return *gimple_try_eval_ptr (gs);
3373 /* Return a pointer to the sequence of statements used as the cleanup body for
3374 GIMPLE_TRY GS. */
3376 static inline gimple_seq *
3377 gimple_try_cleanup_ptr (gimple gs)
3379 GIMPLE_CHECK (gs, GIMPLE_TRY);
3380 return &gs->gimple_try.cleanup;
3384 /* Return the sequence of statements used as the cleanup body for
3385 GIMPLE_TRY GS. */
3387 static inline gimple_seq
3388 gimple_try_cleanup (gimple gs)
3390 return *gimple_try_cleanup_ptr (gs);
3394 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3396 static inline void
3397 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3399 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3400 if (catch_is_cleanup)
3401 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3402 else
3403 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3407 /* Set EVAL to be the sequence of statements to use as the body for
3408 GIMPLE_TRY GS. */
3410 static inline void
3411 gimple_try_set_eval (gimple gs, gimple_seq eval)
3413 GIMPLE_CHECK (gs, GIMPLE_TRY);
3414 gs->gimple_try.eval = eval;
3418 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3419 body for GIMPLE_TRY GS. */
3421 static inline void
3422 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3424 GIMPLE_CHECK (gs, GIMPLE_TRY);
3425 gs->gimple_try.cleanup = cleanup;
3429 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3431 static inline gimple_seq *
3432 gimple_wce_cleanup_ptr (gimple gs)
3434 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3435 return &gs->gimple_wce.cleanup;
3439 /* Return the cleanup sequence for cleanup statement GS. */
3441 static inline gimple_seq
3442 gimple_wce_cleanup (gimple gs)
3444 return *gimple_wce_cleanup_ptr (gs);
3448 /* Set CLEANUP to be the cleanup sequence for GS. */
3450 static inline void
3451 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3453 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3454 gs->gimple_wce.cleanup = cleanup;
3458 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3460 static inline bool
3461 gimple_wce_cleanup_eh_only (const_gimple gs)
3463 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3464 return gs->gsbase.subcode != 0;
3468 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3470 static inline void
3471 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3473 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3474 gs->gsbase.subcode = (unsigned int) eh_only_p;
3478 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3480 static inline unsigned
3481 gimple_phi_capacity (const_gimple gs)
3483 GIMPLE_CHECK (gs, GIMPLE_PHI);
3484 return gs->gimple_phi.capacity;
3488 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3489 be exactly the number of incoming edges for the basic block holding
3490 GS. */
3492 static inline unsigned
3493 gimple_phi_num_args (const_gimple gs)
3495 GIMPLE_CHECK (gs, GIMPLE_PHI);
3496 return gs->gimple_phi.nargs;
3500 /* Return the SSA name created by GIMPLE_PHI GS. */
3502 static inline tree
3503 gimple_phi_result (const_gimple gs)
3505 GIMPLE_CHECK (gs, GIMPLE_PHI);
3506 return gs->gimple_phi.result;
3509 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3511 static inline tree *
3512 gimple_phi_result_ptr (gimple gs)
3514 GIMPLE_CHECK (gs, GIMPLE_PHI);
3515 return &gs->gimple_phi.result;
3518 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3520 static inline void
3521 gimple_phi_set_result (gimple gs, tree result)
3523 GIMPLE_CHECK (gs, GIMPLE_PHI);
3524 gs->gimple_phi.result = result;
3525 if (result && TREE_CODE (result) == SSA_NAME)
3526 SSA_NAME_DEF_STMT (result) = gs;
3530 /* Return the PHI argument corresponding to incoming edge INDEX for
3531 GIMPLE_PHI GS. */
3533 static inline struct phi_arg_d *
3534 gimple_phi_arg (gimple gs, unsigned index)
3536 GIMPLE_CHECK (gs, GIMPLE_PHI);
3537 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3538 return &(gs->gimple_phi.args[index]);
3541 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3542 for GIMPLE_PHI GS. */
3544 static inline void
3545 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3547 GIMPLE_CHECK (gs, GIMPLE_PHI);
3548 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3549 gs->gimple_phi.args[index] = *phiarg;
3552 /* Return the region number for GIMPLE_RESX GS. */
3554 static inline int
3555 gimple_resx_region (const_gimple gs)
3557 GIMPLE_CHECK (gs, GIMPLE_RESX);
3558 return gs->gimple_eh_ctrl.region;
3561 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3563 static inline void
3564 gimple_resx_set_region (gimple gs, int region)
3566 GIMPLE_CHECK (gs, GIMPLE_RESX);
3567 gs->gimple_eh_ctrl.region = region;
3570 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3572 static inline int
3573 gimple_eh_dispatch_region (const_gimple gs)
3575 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3576 return gs->gimple_eh_ctrl.region;
3579 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3581 static inline void
3582 gimple_eh_dispatch_set_region (gimple gs, int region)
3584 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3585 gs->gimple_eh_ctrl.region = region;
3588 /* Return the number of labels associated with the switch statement GS. */
3590 static inline unsigned
3591 gimple_switch_num_labels (const_gimple gs)
3593 unsigned num_ops;
3594 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3595 num_ops = gimple_num_ops (gs);
3596 gcc_gimple_checking_assert (num_ops > 1);
3597 return num_ops - 1;
3601 /* Set NLABELS to be the number of labels for the switch statement GS. */
3603 static inline void
3604 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3606 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3607 gimple_set_num_ops (g, nlabels + 1);
3611 /* Return the index variable used by the switch statement GS. */
3613 static inline tree
3614 gimple_switch_index (const_gimple gs)
3616 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3617 return gimple_op (gs, 0);
3621 /* Return a pointer to the index variable for the switch statement GS. */
3623 static inline tree *
3624 gimple_switch_index_ptr (const_gimple gs)
3626 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3627 return gimple_op_ptr (gs, 0);
3631 /* Set INDEX to be the index variable for switch statement GS. */
3633 static inline void
3634 gimple_switch_set_index (gimple gs, tree index)
3636 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3637 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3638 gimple_set_op (gs, 0, index);
3642 /* Return the label numbered INDEX. The default label is 0, followed by any
3643 labels in a switch statement. */
3645 static inline tree
3646 gimple_switch_label (const_gimple gs, unsigned index)
3648 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3649 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3650 return gimple_op (gs, index + 1);
3653 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3655 static inline void
3656 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3658 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3659 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3660 && (label == NULL_TREE
3661 || TREE_CODE (label) == CASE_LABEL_EXPR));
3662 gimple_set_op (gs, index + 1, label);
3665 /* Return the default label for a switch statement. */
3667 static inline tree
3668 gimple_switch_default_label (const_gimple gs)
3670 tree label = gimple_switch_label (gs, 0);
3671 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3672 return label;
3675 /* Set the default label for a switch statement. */
3677 static inline void
3678 gimple_switch_set_default_label (gimple gs, tree label)
3680 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3681 gimple_switch_set_label (gs, 0, label);
3684 /* Return true if GS is a GIMPLE_DEBUG statement. */
3686 static inline bool
3687 is_gimple_debug (const_gimple gs)
3689 return gimple_code (gs) == GIMPLE_DEBUG;
3692 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3694 static inline bool
3695 gimple_debug_bind_p (const_gimple s)
3697 if (is_gimple_debug (s))
3698 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3700 return false;
3703 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3705 static inline tree
3706 gimple_debug_bind_get_var (gimple dbg)
3708 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3709 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3710 return gimple_op (dbg, 0);
3713 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3714 statement. */
3716 static inline tree
3717 gimple_debug_bind_get_value (gimple dbg)
3719 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3720 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3721 return gimple_op (dbg, 1);
3724 /* Return a pointer to the value bound to the variable in a
3725 GIMPLE_DEBUG bind statement. */
3727 static inline tree *
3728 gimple_debug_bind_get_value_ptr (gimple dbg)
3730 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3731 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3732 return gimple_op_ptr (dbg, 1);
3735 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3737 static inline void
3738 gimple_debug_bind_set_var (gimple dbg, tree var)
3740 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3741 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3742 gimple_set_op (dbg, 0, var);
3745 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3746 statement. */
3748 static inline void
3749 gimple_debug_bind_set_value (gimple dbg, tree value)
3751 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3752 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3753 gimple_set_op (dbg, 1, value);
3756 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3757 optimized away. */
3758 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3760 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3761 statement. */
3763 static inline void
3764 gimple_debug_bind_reset_value (gimple dbg)
3766 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3767 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3768 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3771 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3772 value. */
3774 static inline bool
3775 gimple_debug_bind_has_value_p (gimple dbg)
3777 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3778 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3779 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3782 #undef GIMPLE_DEBUG_BIND_NOVALUE
3784 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3786 static inline bool
3787 gimple_debug_source_bind_p (const_gimple s)
3789 if (is_gimple_debug (s))
3790 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3792 return false;
3795 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3797 static inline tree
3798 gimple_debug_source_bind_get_var (gimple dbg)
3800 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3801 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3802 return gimple_op (dbg, 0);
3805 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3806 statement. */
3808 static inline tree
3809 gimple_debug_source_bind_get_value (gimple dbg)
3811 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3812 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3813 return gimple_op (dbg, 1);
3816 /* Return a pointer to the value bound to the variable in a
3817 GIMPLE_DEBUG source bind statement. */
3819 static inline tree *
3820 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3822 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3823 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3824 return gimple_op_ptr (dbg, 1);
3827 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3829 static inline void
3830 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3832 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3833 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3834 gimple_set_op (dbg, 0, var);
3837 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3838 statement. */
3840 static inline void
3841 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3843 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3844 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3845 gimple_set_op (dbg, 1, value);
3848 /* Return a pointer to the body for the OMP statement GS. */
3850 static inline gimple_seq *
3851 gimple_omp_body_ptr (gimple gs)
3853 return &gs->omp.body;
3856 /* Return the body for the OMP statement GS. */
3858 static inline gimple_seq
3859 gimple_omp_body (gimple gs)
3861 return *gimple_omp_body_ptr (gs);
3864 /* Set BODY to be the body for the OMP statement GS. */
3866 static inline void
3867 gimple_omp_set_body (gimple gs, gimple_seq body)
3869 gs->omp.body = body;
3873 /* Return the name associated with OMP_CRITICAL statement GS. */
3875 static inline tree
3876 gimple_omp_critical_name (const_gimple gs)
3878 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3879 return gs->gimple_omp_critical.name;
3883 /* Return a pointer to the name associated with OMP critical statement GS. */
3885 static inline tree *
3886 gimple_omp_critical_name_ptr (gimple gs)
3888 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3889 return &gs->gimple_omp_critical.name;
3893 /* Set NAME to be the name associated with OMP critical statement GS. */
3895 static inline void
3896 gimple_omp_critical_set_name (gimple gs, tree name)
3898 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3899 gs->gimple_omp_critical.name = name;
3903 /* Return the clauses associated with OMP_FOR GS. */
3905 static inline tree
3906 gimple_omp_for_clauses (const_gimple gs)
3908 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3909 return gs->gimple_omp_for.clauses;
3913 /* Return a pointer to the OMP_FOR GS. */
3915 static inline tree *
3916 gimple_omp_for_clauses_ptr (gimple gs)
3918 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3919 return &gs->gimple_omp_for.clauses;
3923 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3925 static inline void
3926 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3928 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3929 gs->gimple_omp_for.clauses = clauses;
3933 /* Get the collapse count of OMP_FOR GS. */
3935 static inline size_t
3936 gimple_omp_for_collapse (gimple gs)
3938 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3939 return gs->gimple_omp_for.collapse;
3943 /* Return the index variable for OMP_FOR GS. */
3945 static inline tree
3946 gimple_omp_for_index (const_gimple gs, size_t i)
3948 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3949 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3950 return gs->gimple_omp_for.iter[i].index;
3954 /* Return a pointer to the index variable for OMP_FOR GS. */
3956 static inline tree *
3957 gimple_omp_for_index_ptr (gimple gs, size_t i)
3959 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3960 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3961 return &gs->gimple_omp_for.iter[i].index;
3965 /* Set INDEX to be the index variable for OMP_FOR GS. */
3967 static inline void
3968 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3970 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3971 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3972 gs->gimple_omp_for.iter[i].index = index;
3976 /* Return the initial value for OMP_FOR GS. */
3978 static inline tree
3979 gimple_omp_for_initial (const_gimple gs, size_t i)
3981 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3982 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3983 return gs->gimple_omp_for.iter[i].initial;
3987 /* Return a pointer to the initial value for OMP_FOR GS. */
3989 static inline tree *
3990 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3992 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3993 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3994 return &gs->gimple_omp_for.iter[i].initial;
3998 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4000 static inline void
4001 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4003 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4004 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4005 gs->gimple_omp_for.iter[i].initial = initial;
4009 /* Return the final value for OMP_FOR GS. */
4011 static inline tree
4012 gimple_omp_for_final (const_gimple gs, size_t i)
4014 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4015 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4016 return gs->gimple_omp_for.iter[i].final;
4020 /* Return a pointer to the final value for OMP_FOR GS. */
4022 static inline tree *
4023 gimple_omp_for_final_ptr (gimple gs, size_t i)
4025 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4026 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4027 return &gs->gimple_omp_for.iter[i].final;
4031 /* Set FINAL to be the final value for OMP_FOR GS. */
4033 static inline void
4034 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4036 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4037 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4038 gs->gimple_omp_for.iter[i].final = final;
4042 /* Return the increment value for OMP_FOR GS. */
4044 static inline tree
4045 gimple_omp_for_incr (const_gimple gs, size_t i)
4047 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4048 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4049 return gs->gimple_omp_for.iter[i].incr;
4053 /* Return a pointer to the increment value for OMP_FOR GS. */
4055 static inline tree *
4056 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4058 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4059 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4060 return &gs->gimple_omp_for.iter[i].incr;
4064 /* Set INCR to be the increment value for OMP_FOR GS. */
4066 static inline void
4067 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4069 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4070 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4071 gs->gimple_omp_for.iter[i].incr = incr;
4075 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4076 statement GS starts. */
4078 static inline gimple_seq *
4079 gimple_omp_for_pre_body_ptr (gimple gs)
4081 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4082 return &gs->gimple_omp_for.pre_body;
4086 /* Return the sequence of statements to execute before the OMP_FOR
4087 statement GS starts. */
4089 static inline gimple_seq
4090 gimple_omp_for_pre_body (gimple gs)
4092 return *gimple_omp_for_pre_body_ptr (gs);
4096 /* Set PRE_BODY to be the sequence of statements to execute before the
4097 OMP_FOR statement GS starts. */
4099 static inline void
4100 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4102 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4103 gs->gimple_omp_for.pre_body = pre_body;
4107 /* Return the clauses associated with OMP_PARALLEL GS. */
4109 static inline tree
4110 gimple_omp_parallel_clauses (const_gimple gs)
4112 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4113 return gs->gimple_omp_parallel.clauses;
4117 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4119 static inline tree *
4120 gimple_omp_parallel_clauses_ptr (gimple gs)
4122 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4123 return &gs->gimple_omp_parallel.clauses;
4127 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4128 GS. */
4130 static inline void
4131 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4133 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4134 gs->gimple_omp_parallel.clauses = clauses;
4138 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4140 static inline tree
4141 gimple_omp_parallel_child_fn (const_gimple gs)
4143 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4144 return gs->gimple_omp_parallel.child_fn;
4147 /* Return a pointer to the child function used to hold the body of
4148 OMP_PARALLEL GS. */
4150 static inline tree *
4151 gimple_omp_parallel_child_fn_ptr (gimple gs)
4153 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4154 return &gs->gimple_omp_parallel.child_fn;
4158 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4160 static inline void
4161 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4163 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4164 gs->gimple_omp_parallel.child_fn = child_fn;
4168 /* Return the artificial argument used to send variables and values
4169 from the parent to the children threads in OMP_PARALLEL GS. */
4171 static inline tree
4172 gimple_omp_parallel_data_arg (const_gimple gs)
4174 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4175 return gs->gimple_omp_parallel.data_arg;
4179 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4181 static inline tree *
4182 gimple_omp_parallel_data_arg_ptr (gimple gs)
4184 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4185 return &gs->gimple_omp_parallel.data_arg;
4189 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4191 static inline void
4192 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4194 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4195 gs->gimple_omp_parallel.data_arg = data_arg;
4199 /* Return the clauses associated with OMP_TASK GS. */
4201 static inline tree
4202 gimple_omp_task_clauses (const_gimple gs)
4204 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4205 return gs->gimple_omp_parallel.clauses;
4209 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4211 static inline tree *
4212 gimple_omp_task_clauses_ptr (gimple gs)
4214 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4215 return &gs->gimple_omp_parallel.clauses;
4219 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4220 GS. */
4222 static inline void
4223 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4225 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4226 gs->gimple_omp_parallel.clauses = clauses;
4230 /* Return the child function used to hold the body of OMP_TASK GS. */
4232 static inline tree
4233 gimple_omp_task_child_fn (const_gimple gs)
4235 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4236 return gs->gimple_omp_parallel.child_fn;
4239 /* Return a pointer to the child function used to hold the body of
4240 OMP_TASK GS. */
4242 static inline tree *
4243 gimple_omp_task_child_fn_ptr (gimple gs)
4245 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4246 return &gs->gimple_omp_parallel.child_fn;
4250 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4252 static inline void
4253 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4255 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4256 gs->gimple_omp_parallel.child_fn = child_fn;
4260 /* Return the artificial argument used to send variables and values
4261 from the parent to the children threads in OMP_TASK GS. */
4263 static inline tree
4264 gimple_omp_task_data_arg (const_gimple gs)
4266 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4267 return gs->gimple_omp_parallel.data_arg;
4271 /* Return a pointer to the data argument for OMP_TASK GS. */
4273 static inline tree *
4274 gimple_omp_task_data_arg_ptr (gimple gs)
4276 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4277 return &gs->gimple_omp_parallel.data_arg;
4281 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4283 static inline void
4284 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4286 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4287 gs->gimple_omp_parallel.data_arg = data_arg;
4291 /* Return the clauses associated with OMP_TASK GS. */
4293 static inline tree
4294 gimple_omp_taskreg_clauses (const_gimple gs)
4296 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4297 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4298 return gs->gimple_omp_parallel.clauses;
4302 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4304 static inline tree *
4305 gimple_omp_taskreg_clauses_ptr (gimple gs)
4307 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4308 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4309 return &gs->gimple_omp_parallel.clauses;
4313 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4314 GS. */
4316 static inline void
4317 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4319 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4320 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4321 gs->gimple_omp_parallel.clauses = clauses;
4325 /* Return the child function used to hold the body of OMP_TASK GS. */
4327 static inline tree
4328 gimple_omp_taskreg_child_fn (const_gimple gs)
4330 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4331 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4332 return gs->gimple_omp_parallel.child_fn;
4335 /* Return a pointer to the child function used to hold the body of
4336 OMP_TASK GS. */
4338 static inline tree *
4339 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4341 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4342 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4343 return &gs->gimple_omp_parallel.child_fn;
4347 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4349 static inline void
4350 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4352 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4353 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4354 gs->gimple_omp_parallel.child_fn = child_fn;
4358 /* Return the artificial argument used to send variables and values
4359 from the parent to the children threads in OMP_TASK GS. */
4361 static inline tree
4362 gimple_omp_taskreg_data_arg (const_gimple gs)
4364 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4365 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4366 return gs->gimple_omp_parallel.data_arg;
4370 /* Return a pointer to the data argument for OMP_TASK GS. */
4372 static inline tree *
4373 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4375 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4376 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4377 return &gs->gimple_omp_parallel.data_arg;
4381 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4383 static inline void
4384 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4386 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4387 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4388 gs->gimple_omp_parallel.data_arg = data_arg;
4392 /* Return the copy function used to hold the body of OMP_TASK GS. */
4394 static inline tree
4395 gimple_omp_task_copy_fn (const_gimple gs)
4397 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4398 return gs->gimple_omp_task.copy_fn;
4401 /* Return a pointer to the copy function used to hold the body of
4402 OMP_TASK GS. */
4404 static inline tree *
4405 gimple_omp_task_copy_fn_ptr (gimple gs)
4407 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4408 return &gs->gimple_omp_task.copy_fn;
4412 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4414 static inline void
4415 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4417 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4418 gs->gimple_omp_task.copy_fn = copy_fn;
4422 /* Return size of the data block in bytes in OMP_TASK GS. */
4424 static inline tree
4425 gimple_omp_task_arg_size (const_gimple gs)
4427 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4428 return gs->gimple_omp_task.arg_size;
4432 /* Return a pointer to the data block size for OMP_TASK GS. */
4434 static inline tree *
4435 gimple_omp_task_arg_size_ptr (gimple gs)
4437 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4438 return &gs->gimple_omp_task.arg_size;
4442 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4444 static inline void
4445 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4447 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4448 gs->gimple_omp_task.arg_size = arg_size;
4452 /* Return align of the data block in bytes in OMP_TASK GS. */
4454 static inline tree
4455 gimple_omp_task_arg_align (const_gimple gs)
4457 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4458 return gs->gimple_omp_task.arg_align;
4462 /* Return a pointer to the data block align for OMP_TASK GS. */
4464 static inline tree *
4465 gimple_omp_task_arg_align_ptr (gimple gs)
4467 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4468 return &gs->gimple_omp_task.arg_align;
4472 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4474 static inline void
4475 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4477 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4478 gs->gimple_omp_task.arg_align = arg_align;
4482 /* Return the clauses associated with OMP_SINGLE GS. */
4484 static inline tree
4485 gimple_omp_single_clauses (const_gimple gs)
4487 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4488 return gs->gimple_omp_single.clauses;
4492 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4494 static inline tree *
4495 gimple_omp_single_clauses_ptr (gimple gs)
4497 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4498 return &gs->gimple_omp_single.clauses;
4502 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4504 static inline void
4505 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4507 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4508 gs->gimple_omp_single.clauses = clauses;
4512 /* Return the clauses associated with OMP_SECTIONS GS. */
4514 static inline tree
4515 gimple_omp_sections_clauses (const_gimple gs)
4517 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4518 return gs->gimple_omp_sections.clauses;
4522 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4524 static inline tree *
4525 gimple_omp_sections_clauses_ptr (gimple gs)
4527 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4528 return &gs->gimple_omp_sections.clauses;
4532 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4533 GS. */
4535 static inline void
4536 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4538 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4539 gs->gimple_omp_sections.clauses = clauses;
4543 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4544 in GS. */
4546 static inline tree
4547 gimple_omp_sections_control (const_gimple gs)
4549 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4550 return gs->gimple_omp_sections.control;
4554 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4555 GS. */
4557 static inline tree *
4558 gimple_omp_sections_control_ptr (gimple gs)
4560 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4561 return &gs->gimple_omp_sections.control;
4565 /* Set CONTROL to be the set of clauses associated with the
4566 GIMPLE_OMP_SECTIONS in GS. */
4568 static inline void
4569 gimple_omp_sections_set_control (gimple gs, tree control)
4571 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4572 gs->gimple_omp_sections.control = control;
4576 /* Set COND to be the condition code for OMP_FOR GS. */
4578 static inline void
4579 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4581 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4582 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4583 && i < gs->gimple_omp_for.collapse);
4584 gs->gimple_omp_for.iter[i].cond = cond;
4588 /* Return the condition code associated with OMP_FOR GS. */
4590 static inline enum tree_code
4591 gimple_omp_for_cond (const_gimple gs, size_t i)
4593 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4594 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4595 return gs->gimple_omp_for.iter[i].cond;
4599 /* Set the value being stored in an atomic store. */
4601 static inline void
4602 gimple_omp_atomic_store_set_val (gimple g, tree val)
4604 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4605 g->gimple_omp_atomic_store.val = val;
4609 /* Return the value being stored in an atomic store. */
4611 static inline tree
4612 gimple_omp_atomic_store_val (const_gimple g)
4614 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4615 return g->gimple_omp_atomic_store.val;
4619 /* Return a pointer to the value being stored in an atomic store. */
4621 static inline tree *
4622 gimple_omp_atomic_store_val_ptr (gimple g)
4624 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4625 return &g->gimple_omp_atomic_store.val;
4629 /* Set the LHS of an atomic load. */
4631 static inline void
4632 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4634 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4635 g->gimple_omp_atomic_load.lhs = lhs;
4639 /* Get the LHS of an atomic load. */
4641 static inline tree
4642 gimple_omp_atomic_load_lhs (const_gimple g)
4644 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4645 return g->gimple_omp_atomic_load.lhs;
4649 /* Return a pointer to the LHS of an atomic load. */
4651 static inline tree *
4652 gimple_omp_atomic_load_lhs_ptr (gimple g)
4654 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4655 return &g->gimple_omp_atomic_load.lhs;
4659 /* Set the RHS of an atomic load. */
4661 static inline void
4662 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4664 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4665 g->gimple_omp_atomic_load.rhs = rhs;
4669 /* Get the RHS of an atomic load. */
4671 static inline tree
4672 gimple_omp_atomic_load_rhs (const_gimple g)
4674 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4675 return g->gimple_omp_atomic_load.rhs;
4679 /* Return a pointer to the RHS of an atomic load. */
4681 static inline tree *
4682 gimple_omp_atomic_load_rhs_ptr (gimple g)
4684 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4685 return &g->gimple_omp_atomic_load.rhs;
4689 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4691 static inline tree
4692 gimple_omp_continue_control_def (const_gimple g)
4694 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4695 return g->gimple_omp_continue.control_def;
4698 /* The same as above, but return the address. */
4700 static inline tree *
4701 gimple_omp_continue_control_def_ptr (gimple g)
4703 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4704 return &g->gimple_omp_continue.control_def;
4707 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4709 static inline void
4710 gimple_omp_continue_set_control_def (gimple g, tree def)
4712 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4713 g->gimple_omp_continue.control_def = def;
4717 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4719 static inline tree
4720 gimple_omp_continue_control_use (const_gimple g)
4722 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4723 return g->gimple_omp_continue.control_use;
4727 /* The same as above, but return the address. */
4729 static inline tree *
4730 gimple_omp_continue_control_use_ptr (gimple g)
4732 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4733 return &g->gimple_omp_continue.control_use;
4737 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4739 static inline void
4740 gimple_omp_continue_set_control_use (gimple g, tree use)
4742 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4743 g->gimple_omp_continue.control_use = use;
4746 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4748 static inline gimple_seq *
4749 gimple_transaction_body_ptr (gimple gs)
4751 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4752 return &gs->gimple_transaction.body;
4755 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4757 static inline gimple_seq
4758 gimple_transaction_body (gimple gs)
4760 return *gimple_transaction_body_ptr (gs);
4763 /* Return the label associated with a GIMPLE_TRANSACTION. */
4765 static inline tree
4766 gimple_transaction_label (const_gimple gs)
4768 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4769 return gs->gimple_transaction.label;
4772 static inline tree *
4773 gimple_transaction_label_ptr (gimple gs)
4775 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4776 return &gs->gimple_transaction.label;
4779 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4781 static inline unsigned int
4782 gimple_transaction_subcode (const_gimple gs)
4784 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4785 return gs->gsbase.subcode;
4788 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4790 static inline void
4791 gimple_transaction_set_body (gimple gs, gimple_seq body)
4793 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4794 gs->gimple_transaction.body = body;
4797 /* Set the label associated with a GIMPLE_TRANSACTION. */
4799 static inline void
4800 gimple_transaction_set_label (gimple gs, tree label)
4802 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4803 gs->gimple_transaction.label = label;
4806 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4808 static inline void
4809 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4811 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4812 gs->gsbase.subcode = subcode;
4816 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4818 static inline tree *
4819 gimple_return_retval_ptr (const_gimple gs)
4821 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4822 return gimple_op_ptr (gs, 0);
4825 /* Return the return value for GIMPLE_RETURN GS. */
4827 static inline tree
4828 gimple_return_retval (const_gimple gs)
4830 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4831 return gimple_op (gs, 0);
4835 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4837 static inline void
4838 gimple_return_set_retval (gimple gs, tree retval)
4840 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4841 gimple_set_op (gs, 0, retval);
4845 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4847 #define CASE_GIMPLE_OMP \
4848 case GIMPLE_OMP_PARALLEL: \
4849 case GIMPLE_OMP_TASK: \
4850 case GIMPLE_OMP_FOR: \
4851 case GIMPLE_OMP_SECTIONS: \
4852 case GIMPLE_OMP_SECTIONS_SWITCH: \
4853 case GIMPLE_OMP_SINGLE: \
4854 case GIMPLE_OMP_SECTION: \
4855 case GIMPLE_OMP_MASTER: \
4856 case GIMPLE_OMP_ORDERED: \
4857 case GIMPLE_OMP_CRITICAL: \
4858 case GIMPLE_OMP_RETURN: \
4859 case GIMPLE_OMP_ATOMIC_LOAD: \
4860 case GIMPLE_OMP_ATOMIC_STORE: \
4861 case GIMPLE_OMP_CONTINUE
4863 static inline bool
4864 is_gimple_omp (const_gimple stmt)
4866 switch (gimple_code (stmt))
4868 CASE_GIMPLE_OMP:
4869 return true;
4870 default:
4871 return false;
4876 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4878 static inline bool
4879 gimple_nop_p (const_gimple g)
4881 return gimple_code (g) == GIMPLE_NOP;
4885 /* Return true if GS is a GIMPLE_RESX. */
4887 static inline bool
4888 is_gimple_resx (const_gimple gs)
4890 return gimple_code (gs) == GIMPLE_RESX;
4893 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4895 static inline enum br_predictor
4896 gimple_predict_predictor (gimple gs)
4898 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4899 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4903 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4905 static inline void
4906 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4908 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4909 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4910 | (unsigned) predictor;
4914 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4916 static inline enum prediction
4917 gimple_predict_outcome (gimple gs)
4919 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4920 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4924 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4926 static inline void
4927 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4929 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4930 if (outcome == TAKEN)
4931 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4932 else
4933 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4937 /* Return the type of the main expression computed by STMT. Return
4938 void_type_node if the statement computes nothing. */
4940 static inline tree
4941 gimple_expr_type (const_gimple stmt)
4943 enum gimple_code code = gimple_code (stmt);
4945 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4947 tree type;
4948 /* In general we want to pass out a type that can be substituted
4949 for both the RHS and the LHS types if there is a possibly
4950 useless conversion involved. That means returning the
4951 original RHS type as far as we can reconstruct it. */
4952 if (code == GIMPLE_CALL)
4953 type = gimple_call_return_type (stmt);
4954 else
4955 switch (gimple_assign_rhs_code (stmt))
4957 case POINTER_PLUS_EXPR:
4958 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4959 break;
4961 default:
4962 /* As fallback use the type of the LHS. */
4963 type = TREE_TYPE (gimple_get_lhs (stmt));
4964 break;
4966 return type;
4968 else if (code == GIMPLE_COND)
4969 return boolean_type_node;
4970 else
4971 return void_type_node;
4974 /* Return true if TYPE is a suitable type for a scalar register variable. */
4976 static inline bool
4977 is_gimple_reg_type (tree type)
4979 return !AGGREGATE_TYPE_P (type);
4982 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4984 static inline gimple_stmt_iterator
4985 gsi_start_1 (gimple_seq *seq)
4987 gimple_stmt_iterator i;
4989 i.ptr = gimple_seq_first (*seq);
4990 i.seq = seq;
4991 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
4993 return i;
4996 #define gsi_start(x) gsi_start_1(&(x))
4998 static inline gimple_stmt_iterator
4999 gsi_none (void)
5001 gimple_stmt_iterator i;
5002 i.ptr = NULL;
5003 i.seq = NULL;
5004 i.bb = NULL;
5005 return i;
5008 /* Return a new iterator pointing to the first statement in basic block BB. */
5010 static inline gimple_stmt_iterator
5011 gsi_start_bb (basic_block bb)
5013 gimple_stmt_iterator i;
5014 gimple_seq *seq;
5016 seq = bb_seq_addr (bb);
5017 i.ptr = gimple_seq_first (*seq);
5018 i.seq = seq;
5019 i.bb = bb;
5021 return i;
5025 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5027 static inline gimple_stmt_iterator
5028 gsi_last_1 (gimple_seq *seq)
5030 gimple_stmt_iterator i;
5032 i.ptr = gimple_seq_last (*seq);
5033 i.seq = seq;
5034 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5036 return i;
5039 #define gsi_last(x) gsi_last_1(&(x))
5041 /* Return a new iterator pointing to the last statement in basic block BB. */
5043 static inline gimple_stmt_iterator
5044 gsi_last_bb (basic_block bb)
5046 gimple_stmt_iterator i;
5047 gimple_seq *seq;
5049 seq = bb_seq_addr (bb);
5050 i.ptr = gimple_seq_last (*seq);
5051 i.seq = seq;
5052 i.bb = bb;
5054 return i;
5058 /* Return true if I is at the end of its sequence. */
5060 static inline bool
5061 gsi_end_p (gimple_stmt_iterator i)
5063 return i.ptr == NULL;
5067 /* Return true if I is one statement before the end of its sequence. */
5069 static inline bool
5070 gsi_one_before_end_p (gimple_stmt_iterator i)
5072 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5076 /* Advance the iterator to the next gimple statement. */
5078 static inline void
5079 gsi_next (gimple_stmt_iterator *i)
5081 i->ptr = i->ptr->gsbase.next;
5084 /* Advance the iterator to the previous gimple statement. */
5086 static inline void
5087 gsi_prev (gimple_stmt_iterator *i)
5089 gimple prev = i->ptr->gsbase.prev;
5090 if (prev->gsbase.next)
5091 i->ptr = prev;
5092 else
5093 i->ptr = NULL;
5096 /* Return the current stmt. */
5098 static inline gimple
5099 gsi_stmt (gimple_stmt_iterator i)
5101 return i.ptr;
5104 /* Return a block statement iterator that points to the first non-label
5105 statement in block BB. */
5107 static inline gimple_stmt_iterator
5108 gsi_after_labels (basic_block bb)
5110 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5112 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5113 gsi_next (&gsi);
5115 return gsi;
5118 /* Advance the iterator to the next non-debug gimple statement. */
5120 static inline void
5121 gsi_next_nondebug (gimple_stmt_iterator *i)
5125 gsi_next (i);
5127 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5130 /* Advance the iterator to the next non-debug gimple statement. */
5132 static inline void
5133 gsi_prev_nondebug (gimple_stmt_iterator *i)
5137 gsi_prev (i);
5139 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5142 /* Return a new iterator pointing to the first non-debug statement in
5143 basic block BB. */
5145 static inline gimple_stmt_iterator
5146 gsi_start_nondebug_bb (basic_block bb)
5148 gimple_stmt_iterator i = gsi_start_bb (bb);
5150 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5151 gsi_next_nondebug (&i);
5153 return i;
5156 /* Return a new iterator pointing to the last non-debug statement in
5157 basic block BB. */
5159 static inline gimple_stmt_iterator
5160 gsi_last_nondebug_bb (basic_block bb)
5162 gimple_stmt_iterator i = gsi_last_bb (bb);
5164 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5165 gsi_prev_nondebug (&i);
5167 return i;
5171 /* Return the basic block associated with this iterator. */
5173 static inline basic_block
5174 gsi_bb (gimple_stmt_iterator i)
5176 return i.bb;
5180 /* Return the sequence associated with this iterator. */
5182 static inline gimple_seq
5183 gsi_seq (gimple_stmt_iterator i)
5185 return *i.seq;
5189 enum gsi_iterator_update
5191 GSI_NEW_STMT, /* Only valid when single statement is added, move
5192 iterator to it. */
5193 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5194 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5195 for linking other statements in the same
5196 direction. */
5199 /* In gimple-iterator.c */
5200 gimple_stmt_iterator gsi_start_phis (basic_block);
5201 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5202 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5203 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5204 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5205 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5206 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5207 enum gsi_iterator_update);
5208 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5209 enum gsi_iterator_update);
5210 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5211 enum gsi_iterator_update);
5212 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5213 enum gsi_iterator_update);
5214 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5215 enum gsi_iterator_update);
5216 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5217 enum gsi_iterator_update);
5218 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5219 enum gsi_iterator_update);
5220 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5221 enum gsi_iterator_update);
5222 bool gsi_remove (gimple_stmt_iterator *, bool);
5223 gimple_stmt_iterator gsi_for_stmt (gimple);
5224 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5225 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5226 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5227 void gsi_insert_on_edge (edge, gimple);
5228 void gsi_insert_seq_on_edge (edge, gimple_seq);
5229 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5230 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5231 void gsi_commit_one_edge_insert (edge, basic_block *);
5232 void gsi_commit_edge_inserts (void);
5233 gimple gimple_call_copy_skip_args (gimple, bitmap);
5236 /* Convenience routines to walk all statements of a gimple function.
5237 Note that this is useful exclusively before the code is converted
5238 into SSA form. Once the program is in SSA form, the standard
5239 operand interface should be used to analyze/modify statements. */
5240 struct walk_stmt_info
5242 /* Points to the current statement being walked. */
5243 gimple_stmt_iterator gsi;
5245 /* Additional data that the callback functions may want to carry
5246 through the recursion. */
5247 void *info;
5249 /* Pointer map used to mark visited tree nodes when calling
5250 walk_tree on each operand. If set to NULL, duplicate tree nodes
5251 will be visited more than once. */
5252 struct pointer_set_t *pset;
5254 /* Operand returned by the callbacks. This is set when calling
5255 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5256 returns non-NULL, this field will contain the tree returned by
5257 the last callback. */
5258 tree callback_result;
5260 /* Indicates whether the operand being examined may be replaced
5261 with something that matches is_gimple_val (if true) or something
5262 slightly more complicated (if false). "Something" technically
5263 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5264 but we never try to form anything more complicated than that, so
5265 we don't bother checking.
5267 Also note that CALLBACK should update this flag while walking the
5268 sub-expressions of a statement. For instance, when walking the
5269 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5270 to true, however, when walking &var, the operand of that
5271 ADDR_EXPR does not need to be a GIMPLE value. */
5272 BOOL_BITFIELD val_only : 1;
5274 /* True if we are currently walking the LHS of an assignment. */
5275 BOOL_BITFIELD is_lhs : 1;
5277 /* Optional. Set to true by the callback functions if they made any
5278 changes. */
5279 BOOL_BITFIELD changed : 1;
5281 /* True if we're interested in location information. */
5282 BOOL_BITFIELD want_locations : 1;
5284 /* True if we've removed the statement that was processed. */
5285 BOOL_BITFIELD removed_stmt : 1;
5288 /* Callback for walk_gimple_stmt. Called for every statement found
5289 during traversal. The first argument points to the statement to
5290 walk. The second argument is a flag that the callback sets to
5291 'true' if it the callback handled all the operands and
5292 sub-statements of the statement (the default value of this flag is
5293 'false'). The third argument is an anonymous pointer to data
5294 to be used by the callback. */
5295 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5296 struct walk_stmt_info *);
5298 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5299 struct walk_stmt_info *);
5300 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5301 struct walk_stmt_info *);
5302 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5303 struct walk_stmt_info *);
5304 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5306 /* Enum and arrays used for allocation stats. Keep in sync with
5307 gimple.c:gimple_alloc_kind_names. */
5308 enum gimple_alloc_kind
5310 gimple_alloc_kind_assign, /* Assignments. */
5311 gimple_alloc_kind_phi, /* PHI nodes. */
5312 gimple_alloc_kind_cond, /* Conditionals. */
5313 gimple_alloc_kind_rest, /* Everything else. */
5314 gimple_alloc_kind_all
5317 extern int gimple_alloc_counts[];
5318 extern int gimple_alloc_sizes[];
5320 /* Return the allocation kind for a given stmt CODE. */
5321 static inline enum gimple_alloc_kind
5322 gimple_alloc_kind (enum gimple_code code)
5324 switch (code)
5326 case GIMPLE_ASSIGN:
5327 return gimple_alloc_kind_assign;
5328 case GIMPLE_PHI:
5329 return gimple_alloc_kind_phi;
5330 case GIMPLE_COND:
5331 return gimple_alloc_kind_cond;
5332 default:
5333 return gimple_alloc_kind_rest;
5337 extern void dump_gimple_statistics (void);
5339 /* In gimple-fold.c. */
5340 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5341 tree gimple_fold_builtin (gimple);
5342 bool fold_stmt (gimple_stmt_iterator *);
5343 bool fold_stmt_inplace (gimple_stmt_iterator *);
5344 tree get_symbol_constant_value (tree);
5345 tree canonicalize_constructor_val (tree, tree);
5346 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5347 enum tree_code, tree, tree);
5348 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5349 enum tree_code, tree, tree);
5351 bool gimple_val_nonnegative_real_p (tree);
5352 #endif /* GCC_GIMPLE_H */