gcc/ChangeLog
[official-gcc.git] / gcc / gimple.h
blobb4de403e65ce67dcc013b2776910aa259ee03def
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 "hash-table.h"
27 #include "vec.h"
28 #include "ggc.h"
29 #include "basic-block.h"
30 #include "tree.h"
31 #include "tree-ssa-operands.h"
32 #include "tree-ssa-alias.h"
33 #include "internal-fn.h"
35 typedef gimple gimple_seq_node;
37 /* Types of supported temporaries. GIMPLE temporaries may be symbols
38 in normal form (i.e., regular decls) or SSA names. This enum is
39 used by create_gimple_tmp to tell it what kind of temporary the
40 caller wants. */
41 enum ssa_mode {
42 M_SSA = 0,
43 M_NORMAL
46 /* For each block, the PHI nodes that need to be rewritten are stored into
47 these vectors. */
48 typedef vec<gimple> gimple_vec;
50 enum gimple_code {
51 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
52 #include "gimple.def"
53 #undef DEFGSCODE
54 LAST_AND_UNUSED_GIMPLE_CODE
57 extern const char *const gimple_code_name[];
58 extern const unsigned char gimple_rhs_class_table[];
60 /* Error out if a gimple tuple is addressed incorrectly. */
61 #if defined ENABLE_GIMPLE_CHECKING
62 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
63 extern void gimple_check_failed (const_gimple, const char *, int, \
64 const char *, enum gimple_code, \
65 enum tree_code) ATTRIBUTE_NORETURN;
67 #define GIMPLE_CHECK(GS, CODE) \
68 do { \
69 const_gimple __gs = (GS); \
70 if (gimple_code (__gs) != (CODE)) \
71 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
72 (CODE), ERROR_MARK); \
73 } while (0)
74 #else /* not ENABLE_GIMPLE_CHECKING */
75 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
76 #define GIMPLE_CHECK(GS, CODE) (void)0
77 #endif
79 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
80 get_gimple_rhs_class. */
81 enum gimple_rhs_class
83 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
84 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
85 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
86 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
87 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
88 name, a _DECL, a _REF, etc. */
91 /* Specific flags for individual GIMPLE statements. These flags are
92 always stored in gimple_statement_base.subcode and they may only be
93 defined for statement codes that do not use sub-codes.
95 Values for the masks can overlap as long as the overlapping values
96 are never used in the same statement class.
98 The maximum mask value that can be defined is 1 << 15 (i.e., each
99 statement code can hold up to 16 bitflags).
101 Keep this list sorted. */
102 enum gf_mask {
103 GF_ASM_INPUT = 1 << 0,
104 GF_ASM_VOLATILE = 1 << 1,
105 GF_CALL_FROM_THUNK = 1 << 0,
106 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
107 GF_CALL_TAILCALL = 1 << 2,
108 GF_CALL_VA_ARG_PACK = 1 << 3,
109 GF_CALL_NOTHROW = 1 << 4,
110 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
111 GF_CALL_INTERNAL = 1 << 6,
112 GF_OMP_PARALLEL_COMBINED = 1 << 0,
114 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
115 a thread synchronization via some sort of barrier. The exact barrier
116 that would otherwise be emitted is dependent on the OMP statement with
117 which this return is associated. */
118 GF_OMP_RETURN_NOWAIT = 1 << 0,
120 GF_OMP_SECTION_LAST = 1 << 0,
121 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
122 GF_PREDICT_TAKEN = 1 << 15
125 /* Currently, there are only two types of gimple debug stmt. Others are
126 envisioned, for example, to enable the generation of is_stmt notes
127 in line number information, to mark sequence points, etc. This
128 subcode is to be used to tell them apart. */
129 enum gimple_debug_subcode {
130 GIMPLE_DEBUG_BIND = 0,
131 GIMPLE_DEBUG_SOURCE_BIND = 1
134 /* Masks for selecting a pass local flag (PLF) to work on. These
135 masks are used by gimple_set_plf and gimple_plf. */
136 enum plf_mask {
137 GF_PLF_1 = 1 << 0,
138 GF_PLF_2 = 1 << 1
141 /* Iterator object for GIMPLE statement sequences. */
143 struct gimple_stmt_iterator_d
145 /* Sequence node holding the current statement. */
146 gimple_seq_node ptr;
148 /* Sequence and basic block holding the statement. These fields
149 are necessary to handle edge cases such as when statement is
150 added to an empty basic block or when the last statement of a
151 block/sequence is removed. */
152 gimple_seq *seq;
153 basic_block bb;
156 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
157 are for 64 bit hosts. */
159 struct GTY((chain_next ("%h.next"))) gimple_statement_base {
160 /* [ WORD 1 ]
161 Main identifying code for a tuple. */
162 ENUM_BITFIELD(gimple_code) code : 8;
164 /* Nonzero if a warning should not be emitted on this tuple. */
165 unsigned int no_warning : 1;
167 /* Nonzero if this tuple has been visited. Passes are responsible
168 for clearing this bit before using it. */
169 unsigned int visited : 1;
171 /* Nonzero if this tuple represents a non-temporal move. */
172 unsigned int nontemporal_move : 1;
174 /* Pass local flags. These flags are free for any pass to use as
175 they see fit. Passes should not assume that these flags contain
176 any useful value when the pass starts. Any initial state that
177 the pass requires should be set on entry to the pass. See
178 gimple_set_plf and gimple_plf for usage. */
179 unsigned int plf : 2;
181 /* Nonzero if this statement has been modified and needs to have its
182 operands rescanned. */
183 unsigned modified : 1;
185 /* Nonzero if this statement contains volatile operands. */
186 unsigned has_volatile_ops : 1;
188 /* The SUBCODE field can be used for tuple-specific flags for tuples
189 that do not require subcodes. Note that SUBCODE should be at
190 least as wide as tree codes, as several tuples store tree codes
191 in there. */
192 unsigned int subcode : 16;
194 /* UID of this statement. This is used by passes that want to
195 assign IDs to statements. It must be assigned and used by each
196 pass. By default it should be assumed to contain garbage. */
197 unsigned uid;
199 /* [ WORD 2 ]
200 Locus information for debug info. */
201 location_t location;
203 /* Number of operands in this tuple. */
204 unsigned num_ops;
206 /* [ WORD 3 ]
207 Basic block holding this statement. */
208 basic_block bb;
210 /* [ WORD 4-5 ]
211 Linked lists of gimple statements. The next pointers form
212 a NULL terminated list, the prev pointers are a cyclic list.
213 A gimple statement is hence also a double-ended list of
214 statements, with the pointer itself being the first element,
215 and the prev pointer being the last. */
216 gimple next;
217 gimple GTY((skip)) prev;
221 /* Base structure for tuples with operands. */
223 struct GTY(()) gimple_statement_with_ops_base
225 /* [ WORD 1-6 ] */
226 struct gimple_statement_base gsbase;
228 /* [ WORD 7 ]
229 SSA operand vectors. NOTE: It should be possible to
230 amalgamate these vectors with the operand vector OP. However,
231 the SSA operand vectors are organized differently and contain
232 more information (like immediate use chaining). */
233 struct use_optype_d GTY((skip (""))) *use_ops;
237 /* Statements that take register operands. */
239 struct GTY(()) gimple_statement_with_ops
241 /* [ WORD 1-7 ] */
242 struct gimple_statement_with_ops_base opbase;
244 /* [ WORD 8 ]
245 Operand vector. NOTE! This must always be the last field
246 of this structure. In particular, this means that this
247 structure cannot be embedded inside another one. */
248 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
252 /* Base for statements that take both memory and register operands. */
254 struct GTY(()) gimple_statement_with_memory_ops_base
256 /* [ WORD 1-7 ] */
257 struct gimple_statement_with_ops_base opbase;
259 /* [ WORD 8-9 ]
260 Virtual operands for this statement. The GC will pick them
261 up via the ssa_names array. */
262 tree GTY((skip (""))) vdef;
263 tree GTY((skip (""))) vuse;
267 /* Statements that take both memory and register operands. */
269 struct GTY(()) gimple_statement_with_memory_ops
271 /* [ WORD 1-9 ] */
272 struct gimple_statement_with_memory_ops_base membase;
274 /* [ WORD 10 ]
275 Operand vector. NOTE! This must always be the last field
276 of this structure. In particular, this means that this
277 structure cannot be embedded inside another one. */
278 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
282 /* Call statements that take both memory and register operands. */
284 struct GTY(()) gimple_statement_call
286 /* [ WORD 1-9 ] */
287 struct gimple_statement_with_memory_ops_base membase;
289 /* [ WORD 10-13 ] */
290 struct pt_solution call_used;
291 struct pt_solution call_clobbered;
293 /* [ WORD 14 ] */
294 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
295 tree GTY ((tag ("0"))) fntype;
296 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
297 } u;
299 /* [ WORD 15 ]
300 Operand vector. NOTE! This must always be the last field
301 of this structure. In particular, this means that this
302 structure cannot be embedded inside another one. */
303 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
307 /* OpenMP statements (#pragma omp). */
309 struct GTY(()) gimple_statement_omp {
310 /* [ WORD 1-6 ] */
311 struct gimple_statement_base gsbase;
313 /* [ WORD 7 ] */
314 gimple_seq body;
318 /* GIMPLE_BIND */
320 struct GTY(()) gimple_statement_bind {
321 /* [ WORD 1-6 ] */
322 struct gimple_statement_base gsbase;
324 /* [ WORD 7 ]
325 Variables declared in this scope. */
326 tree vars;
328 /* [ WORD 8 ]
329 This is different than the BLOCK field in gimple_statement_base,
330 which is analogous to TREE_BLOCK (i.e., the lexical block holding
331 this statement). This field is the equivalent of BIND_EXPR_BLOCK
332 in tree land (i.e., the lexical scope defined by this bind). See
333 gimple-low.c. */
334 tree block;
336 /* [ WORD 9 ] */
337 gimple_seq body;
341 /* GIMPLE_CATCH */
343 struct GTY(()) gimple_statement_catch {
344 /* [ WORD 1-6 ] */
345 struct gimple_statement_base gsbase;
347 /* [ WORD 7 ] */
348 tree types;
350 /* [ WORD 8 ] */
351 gimple_seq handler;
355 /* GIMPLE_EH_FILTER */
357 struct GTY(()) gimple_statement_eh_filter {
358 /* [ WORD 1-6 ] */
359 struct gimple_statement_base gsbase;
361 /* [ WORD 7 ]
362 Filter types. */
363 tree types;
365 /* [ WORD 8 ]
366 Failure actions. */
367 gimple_seq failure;
370 /* GIMPLE_EH_ELSE */
372 struct GTY(()) gimple_statement_eh_else {
373 /* [ WORD 1-6 ] */
374 struct gimple_statement_base gsbase;
376 /* [ WORD 7,8 ] */
377 gimple_seq n_body, e_body;
380 /* GIMPLE_EH_MUST_NOT_THROW */
382 struct GTY(()) gimple_statement_eh_mnt {
383 /* [ WORD 1-6 ] */
384 struct gimple_statement_base gsbase;
386 /* [ WORD 7 ] Abort function decl. */
387 tree fndecl;
390 /* GIMPLE_PHI */
392 struct GTY(()) gimple_statement_phi {
393 /* [ WORD 1-6 ] */
394 struct gimple_statement_base gsbase;
396 /* [ WORD 7 ] */
397 unsigned capacity;
398 unsigned nargs;
400 /* [ WORD 8 ] */
401 tree result;
403 /* [ WORD 9 ] */
404 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
408 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
410 struct GTY(()) gimple_statement_eh_ctrl
412 /* [ WORD 1-6 ] */
413 struct gimple_statement_base gsbase;
415 /* [ WORD 7 ]
416 Exception region number. */
417 int region;
421 /* GIMPLE_TRY */
423 struct GTY(()) gimple_statement_try {
424 /* [ WORD 1-6 ] */
425 struct gimple_statement_base gsbase;
427 /* [ WORD 7 ]
428 Expression to evaluate. */
429 gimple_seq eval;
431 /* [ WORD 8 ]
432 Cleanup expression. */
433 gimple_seq cleanup;
436 /* Kind of GIMPLE_TRY statements. */
437 enum gimple_try_flags
439 /* A try/catch. */
440 GIMPLE_TRY_CATCH = 1 << 0,
442 /* A try/finally. */
443 GIMPLE_TRY_FINALLY = 1 << 1,
444 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
446 /* Analogous to TRY_CATCH_IS_CLEANUP. */
447 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
450 /* GIMPLE_WITH_CLEANUP_EXPR */
452 struct GTY(()) gimple_statement_wce {
453 /* [ WORD 1-6 ] */
454 struct gimple_statement_base gsbase;
456 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
457 executed if an exception is thrown, not on normal exit of its
458 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
459 in TARGET_EXPRs. */
461 /* [ WORD 7 ]
462 Cleanup expression. */
463 gimple_seq cleanup;
467 /* GIMPLE_ASM */
469 struct GTY(()) gimple_statement_asm
471 /* [ WORD 1-9 ] */
472 struct gimple_statement_with_memory_ops_base membase;
474 /* [ WORD 10 ]
475 __asm__ statement. */
476 const char *string;
478 /* [ WORD 11 ]
479 Number of inputs, outputs, clobbers, labels. */
480 unsigned char ni;
481 unsigned char no;
482 unsigned char nc;
483 unsigned char nl;
485 /* [ WORD 12 ]
486 Operand vector. NOTE! This must always be the last field
487 of this structure. In particular, this means that this
488 structure cannot be embedded inside another one. */
489 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
492 /* GIMPLE_OMP_CRITICAL */
494 struct GTY(()) gimple_statement_omp_critical {
495 /* [ WORD 1-7 ] */
496 struct gimple_statement_omp omp;
498 /* [ WORD 8 ]
499 Critical section name. */
500 tree name;
504 struct GTY(()) gimple_omp_for_iter {
505 /* Condition code. */
506 enum tree_code cond;
508 /* Index variable. */
509 tree index;
511 /* Initial value. */
512 tree initial;
514 /* Final value. */
515 tree final;
517 /* Increment. */
518 tree incr;
521 /* GIMPLE_OMP_FOR */
523 struct GTY(()) gimple_statement_omp_for {
524 /* [ WORD 1-7 ] */
525 struct gimple_statement_omp omp;
527 /* [ WORD 8 ] */
528 tree clauses;
530 /* [ WORD 9 ]
531 Number of elements in iter array. */
532 size_t collapse;
534 /* [ WORD 10 ] */
535 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
537 /* [ WORD 11 ]
538 Pre-body evaluated before the loop body begins. */
539 gimple_seq pre_body;
543 /* GIMPLE_OMP_PARALLEL */
545 struct GTY(()) gimple_statement_omp_parallel {
546 /* [ WORD 1-7 ] */
547 struct gimple_statement_omp omp;
549 /* [ WORD 8 ]
550 Clauses. */
551 tree clauses;
553 /* [ WORD 9 ]
554 Child function holding the body of the parallel region. */
555 tree child_fn;
557 /* [ WORD 10 ]
558 Shared data argument. */
559 tree data_arg;
563 /* GIMPLE_OMP_TASK */
565 struct GTY(()) gimple_statement_omp_task {
566 /* [ WORD 1-10 ] */
567 struct gimple_statement_omp_parallel par;
569 /* [ WORD 11 ]
570 Child function holding firstprivate initialization if needed. */
571 tree copy_fn;
573 /* [ WORD 12-13 ]
574 Size and alignment in bytes of the argument data block. */
575 tree arg_size;
576 tree arg_align;
580 /* GIMPLE_OMP_SECTION */
581 /* Uses struct gimple_statement_omp. */
584 /* GIMPLE_OMP_SECTIONS */
586 struct GTY(()) gimple_statement_omp_sections {
587 /* [ WORD 1-7 ] */
588 struct gimple_statement_omp omp;
590 /* [ WORD 8 ] */
591 tree clauses;
593 /* [ WORD 9 ]
594 The control variable used for deciding which of the sections to
595 execute. */
596 tree control;
599 /* GIMPLE_OMP_CONTINUE.
601 Note: This does not inherit from gimple_statement_omp, because we
602 do not need the body field. */
604 struct GTY(()) gimple_statement_omp_continue {
605 /* [ WORD 1-6 ] */
606 struct gimple_statement_base gsbase;
608 /* [ WORD 7 ] */
609 tree control_def;
611 /* [ WORD 8 ] */
612 tree control_use;
615 /* GIMPLE_OMP_SINGLE */
617 struct GTY(()) gimple_statement_omp_single {
618 /* [ WORD 1-7 ] */
619 struct gimple_statement_omp omp;
621 /* [ WORD 7 ] */
622 tree clauses;
626 /* GIMPLE_OMP_ATOMIC_LOAD.
627 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
628 contains a sequence, which we don't need here. */
630 struct GTY(()) gimple_statement_omp_atomic_load {
631 /* [ WORD 1-6 ] */
632 struct gimple_statement_base gsbase;
634 /* [ WORD 7-8 ] */
635 tree rhs, lhs;
638 /* GIMPLE_OMP_ATOMIC_STORE.
639 See note on GIMPLE_OMP_ATOMIC_LOAD. */
641 struct GTY(()) gimple_statement_omp_atomic_store {
642 /* [ WORD 1-6 ] */
643 struct gimple_statement_base gsbase;
645 /* [ WORD 7 ] */
646 tree val;
649 /* GIMPLE_TRANSACTION. */
651 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
653 /* The __transaction_atomic was declared [[outer]] or it is
654 __transaction_relaxed. */
655 #define GTMA_IS_OUTER (1u << 0)
656 #define GTMA_IS_RELAXED (1u << 1)
657 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
659 /* The transaction is seen to not have an abort. */
660 #define GTMA_HAVE_ABORT (1u << 2)
661 /* The transaction is seen to have loads or stores. */
662 #define GTMA_HAVE_LOAD (1u << 3)
663 #define GTMA_HAVE_STORE (1u << 4)
664 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
665 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
666 /* The transaction WILL enter serial irrevocable mode.
667 An irrevocable block post-dominates the entire transaction, such
668 that all invocations of the transaction will go serial-irrevocable.
669 In such case, we don't bother instrumenting the transaction, and
670 tell the runtime that it should begin the transaction in
671 serial-irrevocable mode. */
672 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
673 /* The transaction contains no instrumentation code whatsover, most
674 likely because it is guaranteed to go irrevocable upon entry. */
675 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
677 struct GTY(()) gimple_statement_transaction
679 /* [ WORD 1-9 ] */
680 struct gimple_statement_with_memory_ops_base gsbase;
682 /* [ WORD 10 ] */
683 gimple_seq body;
685 /* [ WORD 11 ] */
686 tree label;
689 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
690 enum gimple_statement_structure_enum {
691 #include "gsstruct.def"
692 LAST_GSS_ENUM
694 #undef DEFGSSTRUCT
697 /* Define the overall contents of a gimple tuple. It may be any of the
698 structures declared above for various types of tuples. */
700 union GTY ((desc ("gimple_statement_structure (&%h)"),
701 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
702 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
703 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
704 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
705 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
706 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
707 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
708 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
709 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
710 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
711 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
712 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
713 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
714 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
715 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
716 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
717 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
718 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
719 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
720 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
721 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
722 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
723 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
724 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
725 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
726 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
727 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
730 /* In gimple.c. */
732 /* Helper functions to build GIMPLE statements. */
733 tree create_gimple_tmp (tree, enum ssa_mode = M_SSA);
734 gimple build_assign (enum tree_code, tree, int, enum ssa_mode = M_SSA);
735 gimple build_assign (enum tree_code, gimple, int, enum ssa_mode = M_SSA);
736 gimple build_assign (enum tree_code, tree, tree, enum ssa_mode = M_SSA);
737 gimple build_assign (enum tree_code, gimple, tree, enum ssa_mode = M_SSA);
738 gimple build_assign (enum tree_code, tree, gimple, enum ssa_mode = M_SSA);
739 gimple build_assign (enum tree_code, gimple, gimple, enum ssa_mode = M_SSA);
740 gimple build_type_cast (tree, tree, enum ssa_mode = M_SSA);
741 gimple build_type_cast (tree, gimple, enum ssa_mode = M_SSA);
743 /* Offset in bytes to the location of the operand vector.
744 Zero if there is no operand vector for this tuple structure. */
745 extern size_t const gimple_ops_offset_[];
747 /* Map GIMPLE codes to GSS codes. */
748 extern enum gimple_statement_structure_enum const gss_for_code_[];
750 /* This variable holds the currently expanded gimple statement for purposes
751 of comminucating the profile info to the builtin expanders. */
752 extern gimple currently_expanding_gimple_stmt;
754 gimple gimple_build_return (tree);
756 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
757 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
759 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
761 gimple
762 gimple_build_assign_with_ops (enum tree_code, tree,
763 tree, tree CXX_MEM_STAT_INFO);
764 gimple
765 gimple_build_assign_with_ops (enum tree_code, tree,
766 tree, tree, tree CXX_MEM_STAT_INFO);
768 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
769 #define gimple_build_debug_bind(var,val,stmt) \
770 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
771 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
772 #define gimple_build_debug_source_bind(var,val,stmt) \
773 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
775 gimple gimple_build_call_vec (tree, vec<tree> );
776 gimple gimple_build_call (tree, unsigned, ...);
777 gimple gimple_build_call_valist (tree, unsigned, va_list);
778 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
779 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
780 gimple gimple_build_call_from_tree (tree);
781 gimple gimplify_assign (tree, tree, gimple_seq *);
782 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
783 gimple gimple_build_label (tree label);
784 gimple gimple_build_goto (tree dest);
785 gimple gimple_build_nop (void);
786 gimple gimple_build_bind (tree, gimple_seq, tree);
787 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
788 vec<tree, va_gc> *, vec<tree, va_gc> *,
789 vec<tree, va_gc> *);
790 gimple gimple_build_catch (tree, gimple_seq);
791 gimple gimple_build_eh_filter (tree, gimple_seq);
792 gimple gimple_build_eh_must_not_throw (tree);
793 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
794 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
795 gimple gimple_build_wce (gimple_seq);
796 gimple gimple_build_resx (int);
797 gimple gimple_build_eh_dispatch (int);
798 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
799 gimple gimple_build_switch (tree, tree, vec<tree> );
800 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
801 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
802 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
803 gimple gimple_build_omp_critical (gimple_seq, tree);
804 gimple gimple_build_omp_section (gimple_seq);
805 gimple gimple_build_omp_continue (tree, tree);
806 gimple gimple_build_omp_master (gimple_seq);
807 gimple gimple_build_omp_return (bool);
808 gimple gimple_build_omp_ordered (gimple_seq);
809 gimple gimple_build_omp_sections (gimple_seq, tree);
810 gimple gimple_build_omp_sections_switch (void);
811 gimple gimple_build_omp_single (gimple_seq, tree);
812 gimple gimple_build_cdt (tree, tree);
813 gimple gimple_build_omp_atomic_load (tree, tree);
814 gimple gimple_build_omp_atomic_store (tree);
815 gimple gimple_build_transaction (gimple_seq, tree);
816 gimple gimple_build_predict (enum br_predictor, enum prediction);
817 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
818 void sort_case_labels (vec<tree> );
819 void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
820 void gimple_set_body (tree, gimple_seq);
821 gimple_seq gimple_body (tree);
822 bool gimple_has_body_p (tree);
823 gimple_seq gimple_seq_alloc (void);
824 void gimple_seq_free (gimple_seq);
825 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
826 gimple_seq gimple_seq_copy (gimple_seq);
827 bool gimple_call_same_target_p (const_gimple, const_gimple);
828 int gimple_call_flags (const_gimple);
829 int gimple_call_return_flags (const_gimple);
830 int gimple_call_arg_flags (const_gimple, unsigned);
831 void gimple_call_reset_alias_info (gimple);
832 bool gimple_assign_copy_p (gimple);
833 bool gimple_assign_ssa_name_copy_p (gimple);
834 bool gimple_assign_unary_nop_p (gimple);
835 void gimple_set_bb (gimple, basic_block);
836 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
837 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
838 tree, tree, tree);
839 tree gimple_get_lhs (const_gimple);
840 void gimple_set_lhs (gimple, tree);
841 void gimple_replace_lhs (gimple, tree);
842 gimple gimple_copy (gimple);
843 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
844 gimple gimple_build_cond_from_tree (tree, tree, tree);
845 void gimple_cond_set_condition_from_tree (gimple, tree);
846 bool gimple_has_side_effects (const_gimple);
847 bool gimple_could_trap_p (gimple);
848 bool gimple_could_trap_p_1 (gimple, bool, bool);
849 bool gimple_assign_rhs_could_trap_p (gimple);
850 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
851 bool empty_body_p (gimple_seq);
852 unsigned get_gimple_rhs_num_ops (enum tree_code);
853 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
854 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
855 const char *gimple_decl_printable_name (tree, int);
856 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
857 tree gimple_extract_devirt_binfo_from_cst (tree);
859 /* Returns true iff T is a scalar register variable. */
860 extern bool is_gimple_reg (tree);
861 /* Returns true iff T is any sort of variable. */
862 extern bool is_gimple_variable (tree);
863 /* Returns true iff T is any sort of symbol. */
864 extern bool is_gimple_id (tree);
865 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
866 extern bool is_gimple_min_lval (tree);
867 /* Returns true iff T is something whose address can be taken. */
868 extern bool is_gimple_addressable (tree);
869 /* Returns true iff T is any valid GIMPLE lvalue. */
870 extern bool is_gimple_lvalue (tree);
872 /* Returns true iff T is a GIMPLE address. */
873 bool is_gimple_address (const_tree);
874 /* Returns true iff T is a GIMPLE invariant address. */
875 bool is_gimple_invariant_address (const_tree);
876 /* Returns true iff T is a GIMPLE invariant address at interprocedural
877 level. */
878 bool is_gimple_ip_invariant_address (const_tree);
879 /* Returns true iff T is a valid GIMPLE constant. */
880 bool is_gimple_constant (const_tree);
881 /* Returns true iff T is a GIMPLE restricted function invariant. */
882 extern bool is_gimple_min_invariant (const_tree);
883 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
884 extern bool is_gimple_ip_invariant (const_tree);
885 /* Returns true iff T is a GIMPLE rvalue. */
886 extern bool is_gimple_val (tree);
887 /* Returns true iff T is a GIMPLE asm statement input. */
888 extern bool is_gimple_asm_val (tree);
889 /* Returns true iff T is a valid address operand of a MEM_REF. */
890 bool is_gimple_mem_ref_addr (tree);
892 /* Returns true iff T is a valid if-statement condition. */
893 extern bool is_gimple_condexpr (tree);
895 /* Returns true iff T is a valid call address expression. */
896 extern bool is_gimple_call_addr (tree);
898 /* Return TRUE iff stmt is a call to a built-in function. */
899 extern bool is_gimple_builtin_call (gimple stmt);
901 extern void recalculate_side_effects (tree);
902 extern bool gimple_compare_field_offset (tree, tree);
903 extern tree gimple_register_canonical_type (tree);
904 extern void print_gimple_types_stats (const char *);
905 extern void free_gimple_type_tables (void);
906 extern tree gimple_unsigned_type (tree);
907 extern tree gimple_signed_type (tree);
908 extern alias_set_type gimple_get_alias_set (tree);
909 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
910 unsigned *);
911 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
912 bool (*)(gimple, tree, void *),
913 bool (*)(gimple, tree, void *),
914 bool (*)(gimple, tree, void *));
915 extern bool walk_stmt_load_store_ops (gimple, void *,
916 bool (*)(gimple, tree, void *),
917 bool (*)(gimple, tree, void *));
918 extern bool gimple_ior_addresses_taken (bitmap, gimple);
919 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
920 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
921 extern bool gimple_asm_clobbers_memory_p (const_gimple);
923 /* In gimplify.c */
924 extern tree create_tmp_var_raw (tree, const char *);
925 extern tree create_tmp_var_name (const char *);
926 extern tree create_tmp_var (tree, const char *);
927 extern tree create_tmp_reg (tree, const char *);
928 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
929 extern tree get_formal_tmp_var (tree, gimple_seq *);
930 extern void declare_vars (tree, gimple, bool);
931 extern void annotate_all_with_location (gimple_seq, location_t);
933 /* Validation of GIMPLE expressions. Note that these predicates only check
934 the basic form of the expression, they don't recurse to make sure that
935 underlying nodes are also of the right form. */
936 typedef bool (*gimple_predicate)(tree);
939 /* FIXME we should deduce this from the predicate. */
940 enum fallback {
941 fb_none = 0, /* Do not generate a temporary. */
943 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
944 gimplified expression. */
946 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
947 gimplified expression. */
949 fb_mayfail = 4, /* Gimplification may fail. Error issued
950 afterwards. */
951 fb_either= fb_rvalue | fb_lvalue
954 typedef int fallback_t;
956 enum gimplify_status {
957 GS_ERROR = -2, /* Something Bad Seen. */
958 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
959 GS_OK = 0, /* We did something, maybe more to do. */
960 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
963 /* Formal (expression) temporary table handling: multiple occurrences of
964 the same scalar expression are evaluated into the same temporary. */
966 typedef struct gimple_temp_hash_elt
968 tree val; /* Key */
969 tree temp; /* Value */
970 } elt_t;
972 /* Gimplify hashtable helper. */
974 struct gimplify_hasher : typed_free_remove <elt_t>
976 typedef elt_t value_type;
977 typedef elt_t compare_type;
978 static inline hashval_t hash (const value_type *);
979 static inline bool equal (const value_type *, const compare_type *);
982 inline hashval_t
983 gimplify_hasher::hash (const value_type *p)
985 tree t = p->val;
986 return iterative_hash_expr (t, 0);
989 inline bool
990 gimplify_hasher::equal (const value_type *p1, const compare_type *p2)
992 tree t1 = p1->val;
993 tree t2 = p2->val;
994 enum tree_code code = TREE_CODE (t1);
996 if (TREE_CODE (t2) != code
997 || TREE_TYPE (t1) != TREE_TYPE (t2))
998 return false;
1000 if (!operand_equal_p (t1, t2, 0))
1001 return false;
1003 #ifdef ENABLE_CHECKING
1004 /* Only allow them to compare equal if they also hash equal; otherwise
1005 results are nondeterminate, and we fail bootstrap comparison. */
1006 gcc_assert (hash (p1) == hash (p2));
1007 #endif
1009 return true;
1012 struct gimplify_ctx
1014 struct gimplify_ctx *prev_context;
1016 vec<gimple> bind_expr_stack;
1017 tree temps;
1018 gimple_seq conditional_cleanups;
1019 tree exit_label;
1020 tree return_temp;
1022 vec<tree> case_labels;
1023 /* The formal temporary table. Should this be persistent? */
1024 hash_table <gimplify_hasher> temp_htab;
1026 int conditions;
1027 bool save_stack;
1028 bool into_ssa;
1029 bool allow_rhs_cond_expr;
1030 bool in_cleanup_point_expr;
1033 /* Return true if gimplify_one_sizepos doesn't need to gimplify
1034 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
1035 fields). */
1036 static inline bool
1037 is_gimple_sizepos (tree expr)
1039 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
1040 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
1041 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
1042 function, the gimplifier will want to replace it with a new variable,
1043 but that will cause problems if this type is from outside the function.
1044 It's OK to have that here. */
1045 return (expr == NULL_TREE
1046 || TREE_CONSTANT (expr)
1047 || TREE_CODE (expr) == VAR_DECL
1048 || CONTAINS_PLACEHOLDER_P (expr));
1051 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1052 bool (*) (tree), fallback_t);
1053 extern void gimplify_type_sizes (tree, gimple_seq *);
1054 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1055 enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *,
1056 bool, tree);
1057 extern bool gimplify_stmt (tree *, gimple_seq *);
1058 extern gimple gimplify_body (tree, bool);
1059 extern void push_gimplify_context (struct gimplify_ctx *);
1060 extern void pop_gimplify_context (gimple);
1061 extern void gimplify_and_add (tree, gimple_seq *);
1063 /* Miscellaneous helpers. */
1064 extern void gimple_add_tmp_var (tree);
1065 extern gimple gimple_current_bind_expr (void);
1066 extern vec<gimple> gimple_bind_expr_stack (void);
1067 extern tree voidify_wrapper_expr (tree, tree);
1068 extern tree build_and_jump (tree *);
1069 extern tree force_labels_r (tree *, int *, void *);
1070 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1071 gimple_seq *);
1072 struct gimplify_omp_ctx;
1073 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1074 extern tree gimple_boolify (tree);
1075 extern gimple_predicate rhs_predicate_for (tree);
1076 extern tree canonicalize_cond_expr_cond (tree);
1078 /* In omp-low.c. */
1079 extern tree omp_reduction_init (tree, tree);
1081 /* In trans-mem.c. */
1082 extern void diagnose_tm_safe_errors (tree);
1083 extern void compute_transaction_bits (void);
1085 /* In tree-nested.c. */
1086 extern void lower_nested_functions (tree);
1087 extern void insert_field_into_struct (tree, tree);
1089 /* In gimplify.c. */
1090 extern void gimplify_function_tree (tree);
1092 /* In cfgexpand.c. */
1093 extern tree gimple_assign_rhs_to_tree (gimple);
1095 /* In builtins.c */
1096 extern bool validate_gimple_arglist (const_gimple, ...);
1098 /* In tree-ssa.c */
1099 extern bool tree_ssa_useless_type_conversion (tree);
1100 extern tree tree_ssa_strip_useless_type_conversions (tree);
1101 extern bool useless_type_conversion_p (tree, tree);
1102 extern bool types_compatible_p (tree, tree);
1104 /* Return the first node in GIMPLE sequence S. */
1106 static inline gimple_seq_node
1107 gimple_seq_first (gimple_seq s)
1109 return s;
1113 /* Return the first statement in GIMPLE sequence S. */
1115 static inline gimple
1116 gimple_seq_first_stmt (gimple_seq s)
1118 gimple_seq_node n = gimple_seq_first (s);
1119 return n;
1123 /* Return the last node in GIMPLE sequence S. */
1125 static inline gimple_seq_node
1126 gimple_seq_last (gimple_seq s)
1128 return s ? s->gsbase.prev : NULL;
1132 /* Return the last statement in GIMPLE sequence S. */
1134 static inline gimple
1135 gimple_seq_last_stmt (gimple_seq s)
1137 gimple_seq_node n = gimple_seq_last (s);
1138 return n;
1142 /* Set the last node in GIMPLE sequence *PS to LAST. */
1144 static inline void
1145 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1147 (*ps)->gsbase.prev = last;
1151 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1153 static inline void
1154 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1156 *ps = first;
1160 /* Return true if GIMPLE sequence S is empty. */
1162 static inline bool
1163 gimple_seq_empty_p (gimple_seq s)
1165 return s == NULL;
1168 void gimple_seq_add_stmt (gimple_seq *, gimple);
1170 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1171 *SEQ_P is NULL, a new sequence is allocated. This function is
1172 similar to gimple_seq_add_stmt, but does not scan the operands.
1173 During gimplification, we need to manipulate statement sequences
1174 before the def/use vectors have been constructed. */
1175 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1177 /* Allocate a new sequence and initialize its first element with STMT. */
1179 static inline gimple_seq
1180 gimple_seq_alloc_with_stmt (gimple stmt)
1182 gimple_seq seq = NULL;
1183 gimple_seq_add_stmt (&seq, stmt);
1184 return seq;
1188 /* Returns the sequence of statements in BB. */
1190 static inline gimple_seq
1191 bb_seq (const_basic_block bb)
1193 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1196 static inline gimple_seq *
1197 bb_seq_addr (basic_block bb)
1199 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1202 /* Sets the sequence of statements in BB to SEQ. */
1204 static inline void
1205 set_bb_seq (basic_block bb, gimple_seq seq)
1207 gcc_checking_assert (!(bb->flags & BB_RTL));
1208 bb->il.gimple.seq = seq;
1212 /* Return the code for GIMPLE statement G. */
1214 static inline enum gimple_code
1215 gimple_code (const_gimple g)
1217 return g->gsbase.code;
1221 /* Return the GSS code used by a GIMPLE code. */
1223 static inline enum gimple_statement_structure_enum
1224 gss_for_code (enum gimple_code code)
1226 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1227 return gss_for_code_[code];
1231 /* Return which GSS code is used by GS. */
1233 static inline enum gimple_statement_structure_enum
1234 gimple_statement_structure (gimple gs)
1236 return gss_for_code (gimple_code (gs));
1240 /* Return true if statement G has sub-statements. This is only true for
1241 High GIMPLE statements. */
1243 static inline bool
1244 gimple_has_substatements (gimple g)
1246 switch (gimple_code (g))
1248 case GIMPLE_BIND:
1249 case GIMPLE_CATCH:
1250 case GIMPLE_EH_FILTER:
1251 case GIMPLE_EH_ELSE:
1252 case GIMPLE_TRY:
1253 case GIMPLE_OMP_FOR:
1254 case GIMPLE_OMP_MASTER:
1255 case GIMPLE_OMP_ORDERED:
1256 case GIMPLE_OMP_SECTION:
1257 case GIMPLE_OMP_PARALLEL:
1258 case GIMPLE_OMP_TASK:
1259 case GIMPLE_OMP_SECTIONS:
1260 case GIMPLE_OMP_SINGLE:
1261 case GIMPLE_OMP_CRITICAL:
1262 case GIMPLE_WITH_CLEANUP_EXPR:
1263 case GIMPLE_TRANSACTION:
1264 return true;
1266 default:
1267 return false;
1272 /* Return the basic block holding statement G. */
1274 static inline basic_block
1275 gimple_bb (const_gimple g)
1277 return g->gsbase.bb;
1281 /* Return the lexical scope block holding statement G. */
1283 static inline tree
1284 gimple_block (const_gimple g)
1286 return LOCATION_BLOCK (g->gsbase.location);
1290 /* Set BLOCK to be the lexical scope block holding statement G. */
1292 static inline void
1293 gimple_set_block (gimple g, tree block)
1295 if (block)
1296 g->gsbase.location =
1297 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1298 else
1299 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1303 /* Return location information for statement G. */
1305 static inline location_t
1306 gimple_location (const_gimple g)
1308 return g->gsbase.location;
1311 /* Return pointer to location information for statement G. */
1313 static inline const location_t *
1314 gimple_location_ptr (const_gimple g)
1316 return &g->gsbase.location;
1320 /* Set location information for statement G. */
1322 static inline void
1323 gimple_set_location (gimple g, location_t location)
1325 g->gsbase.location = location;
1329 /* Return true if G contains location information. */
1331 static inline bool
1332 gimple_has_location (const_gimple g)
1334 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1338 /* Return the file name of the location of STMT. */
1340 static inline const char *
1341 gimple_filename (const_gimple stmt)
1343 return LOCATION_FILE (gimple_location (stmt));
1347 /* Return the line number of the location of STMT. */
1349 static inline int
1350 gimple_lineno (const_gimple stmt)
1352 return LOCATION_LINE (gimple_location (stmt));
1356 /* Determine whether SEQ is a singleton. */
1358 static inline bool
1359 gimple_seq_singleton_p (gimple_seq seq)
1361 return ((gimple_seq_first (seq) != NULL)
1362 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1365 /* Return true if no warnings should be emitted for statement STMT. */
1367 static inline bool
1368 gimple_no_warning_p (const_gimple stmt)
1370 return stmt->gsbase.no_warning;
1373 /* Set the no_warning flag of STMT to NO_WARNING. */
1375 static inline void
1376 gimple_set_no_warning (gimple stmt, bool no_warning)
1378 stmt->gsbase.no_warning = (unsigned) no_warning;
1381 /* Set the visited status on statement STMT to VISITED_P. */
1383 static inline void
1384 gimple_set_visited (gimple stmt, bool visited_p)
1386 stmt->gsbase.visited = (unsigned) visited_p;
1390 /* Return the visited status for statement STMT. */
1392 static inline bool
1393 gimple_visited_p (gimple stmt)
1395 return stmt->gsbase.visited;
1399 /* Set pass local flag PLF on statement STMT to VAL_P. */
1401 static inline void
1402 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1404 if (val_p)
1405 stmt->gsbase.plf |= (unsigned int) plf;
1406 else
1407 stmt->gsbase.plf &= ~((unsigned int) plf);
1411 /* Return the value of pass local flag PLF on statement STMT. */
1413 static inline unsigned int
1414 gimple_plf (gimple stmt, enum plf_mask plf)
1416 return stmt->gsbase.plf & ((unsigned int) plf);
1420 /* Set the UID of statement. */
1422 static inline void
1423 gimple_set_uid (gimple g, unsigned uid)
1425 g->gsbase.uid = uid;
1429 /* Return the UID of statement. */
1431 static inline unsigned
1432 gimple_uid (const_gimple g)
1434 return g->gsbase.uid;
1438 /* Make statement G a singleton sequence. */
1440 static inline void
1441 gimple_init_singleton (gimple g)
1443 g->gsbase.next = NULL;
1444 g->gsbase.prev = g;
1448 /* Return true if GIMPLE statement G has register or memory operands. */
1450 static inline bool
1451 gimple_has_ops (const_gimple g)
1453 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1457 /* Return true if GIMPLE statement G has memory operands. */
1459 static inline bool
1460 gimple_has_mem_ops (const_gimple g)
1462 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1466 /* Return the set of USE operands for statement G. */
1468 static inline struct use_optype_d *
1469 gimple_use_ops (const_gimple g)
1471 if (!gimple_has_ops (g))
1472 return NULL;
1473 return g->gsops.opbase.use_ops;
1477 /* Set USE to be the set of USE operands for statement G. */
1479 static inline void
1480 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1482 gcc_gimple_checking_assert (gimple_has_ops (g));
1483 g->gsops.opbase.use_ops = use;
1487 /* Return the set of VUSE operand for statement G. */
1489 static inline use_operand_p
1490 gimple_vuse_op (const_gimple g)
1492 struct use_optype_d *ops;
1493 if (!gimple_has_mem_ops (g))
1494 return NULL_USE_OPERAND_P;
1495 ops = g->gsops.opbase.use_ops;
1496 if (ops
1497 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1498 return USE_OP_PTR (ops);
1499 return NULL_USE_OPERAND_P;
1502 /* Return the set of VDEF operand for statement G. */
1504 static inline def_operand_p
1505 gimple_vdef_op (gimple g)
1507 if (!gimple_has_mem_ops (g))
1508 return NULL_DEF_OPERAND_P;
1509 if (g->gsmembase.vdef)
1510 return &g->gsmembase.vdef;
1511 return NULL_DEF_OPERAND_P;
1515 /* Return the single VUSE operand of the statement G. */
1517 static inline tree
1518 gimple_vuse (const_gimple g)
1520 if (!gimple_has_mem_ops (g))
1521 return NULL_TREE;
1522 return g->gsmembase.vuse;
1525 /* Return the single VDEF operand of the statement G. */
1527 static inline tree
1528 gimple_vdef (const_gimple g)
1530 if (!gimple_has_mem_ops (g))
1531 return NULL_TREE;
1532 return g->gsmembase.vdef;
1535 /* Return the single VUSE operand of the statement G. */
1537 static inline tree *
1538 gimple_vuse_ptr (gimple g)
1540 if (!gimple_has_mem_ops (g))
1541 return NULL;
1542 return &g->gsmembase.vuse;
1545 /* Return the single VDEF operand of the statement G. */
1547 static inline tree *
1548 gimple_vdef_ptr (gimple g)
1550 if (!gimple_has_mem_ops (g))
1551 return NULL;
1552 return &g->gsmembase.vdef;
1555 /* Set the single VUSE operand of the statement G. */
1557 static inline void
1558 gimple_set_vuse (gimple g, tree vuse)
1560 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1561 g->gsmembase.vuse = vuse;
1564 /* Set the single VDEF operand of the statement G. */
1566 static inline void
1567 gimple_set_vdef (gimple g, tree vdef)
1569 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1570 g->gsmembase.vdef = vdef;
1574 /* Return true if statement G has operands and the modified field has
1575 been set. */
1577 static inline bool
1578 gimple_modified_p (const_gimple g)
1580 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1584 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1585 a MODIFIED field. */
1587 static inline void
1588 gimple_set_modified (gimple s, bool modifiedp)
1590 if (gimple_has_ops (s))
1591 s->gsbase.modified = (unsigned) modifiedp;
1595 /* Return the tree code for the expression computed by STMT. This is
1596 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1597 GIMPLE_CALL, return CALL_EXPR as the expression code for
1598 consistency. This is useful when the caller needs to deal with the
1599 three kinds of computation that GIMPLE supports. */
1601 static inline enum tree_code
1602 gimple_expr_code (const_gimple stmt)
1604 enum gimple_code code = gimple_code (stmt);
1605 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1606 return (enum tree_code) stmt->gsbase.subcode;
1607 else
1609 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1610 return CALL_EXPR;
1615 /* Mark statement S as modified, and update it. */
1617 static inline void
1618 update_stmt (gimple s)
1620 if (gimple_has_ops (s))
1622 gimple_set_modified (s, true);
1623 update_stmt_operands (s);
1627 /* Update statement S if it has been optimized. */
1629 static inline void
1630 update_stmt_if_modified (gimple s)
1632 if (gimple_modified_p (s))
1633 update_stmt_operands (s);
1636 /* Return true if statement STMT contains volatile operands. */
1638 static inline bool
1639 gimple_has_volatile_ops (const_gimple stmt)
1641 if (gimple_has_mem_ops (stmt))
1642 return stmt->gsbase.has_volatile_ops;
1643 else
1644 return false;
1648 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1650 static inline void
1651 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1653 if (gimple_has_mem_ops (stmt))
1654 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1657 /* Return true if BB is in a transaction. */
1659 static inline bool
1660 block_in_transaction (basic_block bb)
1662 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1665 /* Return true if STMT is in a transaction. */
1667 static inline bool
1668 gimple_in_transaction (gimple stmt)
1670 return block_in_transaction (gimple_bb (stmt));
1673 /* Return true if statement STMT may access memory. */
1675 static inline bool
1676 gimple_references_memory_p (gimple stmt)
1678 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1682 /* Return the subcode for OMP statement S. */
1684 static inline unsigned
1685 gimple_omp_subcode (const_gimple s)
1687 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1688 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1689 return s->gsbase.subcode;
1692 /* Set the subcode for OMP statement S to SUBCODE. */
1694 static inline void
1695 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1697 /* We only have 16 bits for the subcode. Assert that we are not
1698 overflowing it. */
1699 gcc_gimple_checking_assert (subcode < (1 << 16));
1700 s->gsbase.subcode = subcode;
1703 /* Set the nowait flag on OMP_RETURN statement S. */
1705 static inline void
1706 gimple_omp_return_set_nowait (gimple s)
1708 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1709 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1713 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1714 flag set. */
1716 static inline bool
1717 gimple_omp_return_nowait_p (const_gimple g)
1719 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1720 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1724 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1725 flag set. */
1727 static inline bool
1728 gimple_omp_section_last_p (const_gimple g)
1730 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1731 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1735 /* Set the GF_OMP_SECTION_LAST flag on G. */
1737 static inline void
1738 gimple_omp_section_set_last (gimple g)
1740 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1741 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1745 /* Return true if OMP parallel statement G has the
1746 GF_OMP_PARALLEL_COMBINED flag set. */
1748 static inline bool
1749 gimple_omp_parallel_combined_p (const_gimple g)
1751 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1752 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1756 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1757 value of COMBINED_P. */
1759 static inline void
1760 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1762 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1763 if (combined_p)
1764 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1765 else
1766 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1770 /* Return true if OMP atomic load/store statement G has the
1771 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1773 static inline bool
1774 gimple_omp_atomic_need_value_p (const_gimple g)
1776 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1777 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1778 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1782 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1784 static inline void
1785 gimple_omp_atomic_set_need_value (gimple g)
1787 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1788 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1789 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1793 /* Return the number of operands for statement GS. */
1795 static inline unsigned
1796 gimple_num_ops (const_gimple gs)
1798 return gs->gsbase.num_ops;
1802 /* Set the number of operands for statement GS. */
1804 static inline void
1805 gimple_set_num_ops (gimple gs, unsigned num_ops)
1807 gs->gsbase.num_ops = num_ops;
1811 /* Return the array of operands for statement GS. */
1813 static inline tree *
1814 gimple_ops (gimple gs)
1816 size_t off;
1818 /* All the tuples have their operand vector at the very bottom
1819 of the structure. Note that those structures that do not
1820 have an operand vector have a zero offset. */
1821 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1822 gcc_gimple_checking_assert (off != 0);
1824 return (tree *) ((char *) gs + off);
1828 /* Return operand I for statement GS. */
1830 static inline tree
1831 gimple_op (const_gimple gs, unsigned i)
1833 if (gimple_has_ops (gs))
1835 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1836 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1838 else
1839 return NULL_TREE;
1842 /* Return a pointer to operand I for statement GS. */
1844 static inline tree *
1845 gimple_op_ptr (const_gimple gs, unsigned i)
1847 if (gimple_has_ops (gs))
1849 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1850 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1852 else
1853 return NULL;
1856 /* Set operand I of statement GS to OP. */
1858 static inline void
1859 gimple_set_op (gimple gs, unsigned i, tree op)
1861 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1863 /* Note. It may be tempting to assert that OP matches
1864 is_gimple_operand, but that would be wrong. Different tuples
1865 accept slightly different sets of tree operands. Each caller
1866 should perform its own validation. */
1867 gimple_ops (gs)[i] = op;
1870 /* Return true if GS is a GIMPLE_ASSIGN. */
1872 static inline bool
1873 is_gimple_assign (const_gimple gs)
1875 return gimple_code (gs) == GIMPLE_ASSIGN;
1878 /* Determine if expression CODE is one of the valid expressions that can
1879 be used on the RHS of GIMPLE assignments. */
1881 static inline enum gimple_rhs_class
1882 get_gimple_rhs_class (enum tree_code code)
1884 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1887 /* Return the LHS of assignment statement GS. */
1889 static inline tree
1890 gimple_assign_lhs (const_gimple gs)
1892 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1893 return gimple_op (gs, 0);
1897 /* Return a pointer to the LHS of assignment statement GS. */
1899 static inline tree *
1900 gimple_assign_lhs_ptr (const_gimple gs)
1902 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1903 return gimple_op_ptr (gs, 0);
1907 /* Set LHS to be the LHS operand of assignment statement GS. */
1909 static inline void
1910 gimple_assign_set_lhs (gimple gs, tree lhs)
1912 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1913 gimple_set_op (gs, 0, lhs);
1915 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1916 SSA_NAME_DEF_STMT (lhs) = gs;
1920 /* Return the first operand on the RHS of assignment statement GS. */
1922 static inline tree
1923 gimple_assign_rhs1 (const_gimple gs)
1925 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1926 return gimple_op (gs, 1);
1930 /* Return a pointer to the first operand on the RHS of assignment
1931 statement GS. */
1933 static inline tree *
1934 gimple_assign_rhs1_ptr (const_gimple gs)
1936 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1937 return gimple_op_ptr (gs, 1);
1940 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1942 static inline void
1943 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1945 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1947 gimple_set_op (gs, 1, rhs);
1951 /* Return the second operand on the RHS of assignment statement GS.
1952 If GS does not have two operands, NULL is returned instead. */
1954 static inline tree
1955 gimple_assign_rhs2 (const_gimple gs)
1957 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1959 if (gimple_num_ops (gs) >= 3)
1960 return gimple_op (gs, 2);
1961 else
1962 return NULL_TREE;
1966 /* Return a pointer to the second operand on the RHS of assignment
1967 statement GS. */
1969 static inline tree *
1970 gimple_assign_rhs2_ptr (const_gimple gs)
1972 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1973 return gimple_op_ptr (gs, 2);
1977 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1979 static inline void
1980 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1982 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1984 gimple_set_op (gs, 2, rhs);
1987 /* Return the third operand on the RHS of assignment statement GS.
1988 If GS does not have two operands, NULL is returned instead. */
1990 static inline tree
1991 gimple_assign_rhs3 (const_gimple gs)
1993 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1995 if (gimple_num_ops (gs) >= 4)
1996 return gimple_op (gs, 3);
1997 else
1998 return NULL_TREE;
2001 /* Return a pointer to the third operand on the RHS of assignment
2002 statement GS. */
2004 static inline tree *
2005 gimple_assign_rhs3_ptr (const_gimple gs)
2007 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2008 return gimple_op_ptr (gs, 3);
2012 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2014 static inline void
2015 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2017 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2019 gimple_set_op (gs, 3, rhs);
2022 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2023 to see only a maximum of two operands. */
2025 static inline void
2026 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2027 tree op1, tree op2)
2029 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2032 /* A wrapper around extract_ops_from_tree_1, for callers which expect
2033 to see only a maximum of two operands. */
2035 static inline void
2036 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
2037 tree *op1)
2039 tree op2;
2040 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
2041 gcc_assert (op2 == NULL_TREE);
2044 /* Returns true if GS is a nontemporal move. */
2046 static inline bool
2047 gimple_assign_nontemporal_move_p (const_gimple gs)
2049 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2050 return gs->gsbase.nontemporal_move;
2053 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2055 static inline void
2056 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2058 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2059 gs->gsbase.nontemporal_move = nontemporal;
2063 /* Return the code of the expression computed on the rhs of assignment
2064 statement GS. In case that the RHS is a single object, returns the
2065 tree code of the object. */
2067 static inline enum tree_code
2068 gimple_assign_rhs_code (const_gimple gs)
2070 enum tree_code code;
2071 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2073 code = (enum tree_code) gs->gsbase.subcode;
2074 /* While we initially set subcode to the TREE_CODE of the rhs for
2075 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2076 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2077 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2078 code = TREE_CODE (gimple_assign_rhs1 (gs));
2080 return code;
2084 /* Set CODE to be the code for the expression computed on the RHS of
2085 assignment S. */
2087 static inline void
2088 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2090 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2091 s->gsbase.subcode = code;
2095 /* Return the gimple rhs class of the code of the expression computed on
2096 the rhs of assignment statement GS.
2097 This will never return GIMPLE_INVALID_RHS. */
2099 static inline enum gimple_rhs_class
2100 gimple_assign_rhs_class (const_gimple gs)
2102 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2105 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2106 there is no operator associated with the assignment itself.
2107 Unlike gimple_assign_copy_p, this predicate returns true for
2108 any RHS operand, including those that perform an operation
2109 and do not have the semantics of a copy, such as COND_EXPR. */
2111 static inline bool
2112 gimple_assign_single_p (gimple gs)
2114 return (is_gimple_assign (gs)
2115 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2118 /* Return true if GS performs a store to its lhs. */
2120 static inline bool
2121 gimple_store_p (gimple gs)
2123 tree lhs = gimple_get_lhs (gs);
2124 return lhs && !is_gimple_reg (lhs);
2127 /* Return true if GS is an assignment that loads from its rhs1. */
2129 static inline bool
2130 gimple_assign_load_p (gimple gs)
2132 tree rhs;
2133 if (!gimple_assign_single_p (gs))
2134 return false;
2135 rhs = gimple_assign_rhs1 (gs);
2136 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2137 return true;
2138 rhs = get_base_address (rhs);
2139 return (DECL_P (rhs)
2140 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2144 /* Return true if S is a type-cast assignment. */
2146 static inline bool
2147 gimple_assign_cast_p (gimple s)
2149 if (is_gimple_assign (s))
2151 enum tree_code sc = gimple_assign_rhs_code (s);
2152 return CONVERT_EXPR_CODE_P (sc)
2153 || sc == VIEW_CONVERT_EXPR
2154 || sc == FIX_TRUNC_EXPR;
2157 return false;
2160 /* Return true if S is a clobber statement. */
2162 static inline bool
2163 gimple_clobber_p (gimple s)
2165 return gimple_assign_single_p (s)
2166 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2169 /* Return true if GS is a GIMPLE_CALL. */
2171 static inline bool
2172 is_gimple_call (const_gimple gs)
2174 return gimple_code (gs) == GIMPLE_CALL;
2177 /* Return the LHS of call statement GS. */
2179 static inline tree
2180 gimple_call_lhs (const_gimple gs)
2182 GIMPLE_CHECK (gs, GIMPLE_CALL);
2183 return gimple_op (gs, 0);
2187 /* Return a pointer to the LHS of call statement GS. */
2189 static inline tree *
2190 gimple_call_lhs_ptr (const_gimple gs)
2192 GIMPLE_CHECK (gs, GIMPLE_CALL);
2193 return gimple_op_ptr (gs, 0);
2197 /* Set LHS to be the LHS operand of call statement GS. */
2199 static inline void
2200 gimple_call_set_lhs (gimple gs, tree lhs)
2202 GIMPLE_CHECK (gs, GIMPLE_CALL);
2203 gimple_set_op (gs, 0, lhs);
2204 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2205 SSA_NAME_DEF_STMT (lhs) = gs;
2209 /* Return true if call GS calls an internal-only function, as enumerated
2210 by internal_fn. */
2212 static inline bool
2213 gimple_call_internal_p (const_gimple gs)
2215 GIMPLE_CHECK (gs, GIMPLE_CALL);
2216 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2220 /* Return the target of internal call GS. */
2222 static inline enum internal_fn
2223 gimple_call_internal_fn (const_gimple gs)
2225 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2226 return gs->gimple_call.u.internal_fn;
2230 /* Return the function type of the function called by GS. */
2232 static inline tree
2233 gimple_call_fntype (const_gimple gs)
2235 GIMPLE_CHECK (gs, GIMPLE_CALL);
2236 if (gimple_call_internal_p (gs))
2237 return NULL_TREE;
2238 return gs->gimple_call.u.fntype;
2241 /* Set the type of the function called by GS to FNTYPE. */
2243 static inline void
2244 gimple_call_set_fntype (gimple gs, tree fntype)
2246 GIMPLE_CHECK (gs, GIMPLE_CALL);
2247 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2248 gs->gimple_call.u.fntype = fntype;
2252 /* Return the tree node representing the function called by call
2253 statement GS. */
2255 static inline tree
2256 gimple_call_fn (const_gimple gs)
2258 GIMPLE_CHECK (gs, GIMPLE_CALL);
2259 return gimple_op (gs, 1);
2262 /* Return a pointer to the tree node representing the function called by call
2263 statement GS. */
2265 static inline tree *
2266 gimple_call_fn_ptr (const_gimple gs)
2268 GIMPLE_CHECK (gs, GIMPLE_CALL);
2269 return gimple_op_ptr (gs, 1);
2273 /* Set FN to be the function called by call statement GS. */
2275 static inline void
2276 gimple_call_set_fn (gimple gs, tree fn)
2278 GIMPLE_CHECK (gs, GIMPLE_CALL);
2279 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2280 gimple_set_op (gs, 1, fn);
2284 /* Set FNDECL to be the function called by call statement GS. */
2286 static inline void
2287 gimple_call_set_fndecl (gimple gs, tree decl)
2289 GIMPLE_CHECK (gs, GIMPLE_CALL);
2290 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2291 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2295 /* Set internal function FN to be the function called by call statement GS. */
2297 static inline void
2298 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2300 GIMPLE_CHECK (gs, GIMPLE_CALL);
2301 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2302 gs->gimple_call.u.internal_fn = fn;
2306 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2307 associated with the callee if known. Otherwise return NULL_TREE. */
2309 static inline tree
2310 gimple_call_addr_fndecl (const_tree fn)
2312 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2314 tree fndecl = TREE_OPERAND (fn, 0);
2315 if (TREE_CODE (fndecl) == MEM_REF
2316 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2317 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2318 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2319 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2320 return fndecl;
2322 return NULL_TREE;
2325 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2326 Otherwise return NULL. This function is analogous to
2327 get_callee_fndecl in tree land. */
2329 static inline tree
2330 gimple_call_fndecl (const_gimple gs)
2332 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2336 /* Return the type returned by call statement GS. */
2338 static inline tree
2339 gimple_call_return_type (const_gimple gs)
2341 tree type = gimple_call_fntype (gs);
2343 if (type == NULL_TREE)
2344 return TREE_TYPE (gimple_call_lhs (gs));
2346 /* The type returned by a function is the type of its
2347 function type. */
2348 return TREE_TYPE (type);
2352 /* Return the static chain for call statement GS. */
2354 static inline tree
2355 gimple_call_chain (const_gimple gs)
2357 GIMPLE_CHECK (gs, GIMPLE_CALL);
2358 return gimple_op (gs, 2);
2362 /* Return a pointer to the static chain for call statement GS. */
2364 static inline tree *
2365 gimple_call_chain_ptr (const_gimple gs)
2367 GIMPLE_CHECK (gs, GIMPLE_CALL);
2368 return gimple_op_ptr (gs, 2);
2371 /* Set CHAIN to be the static chain for call statement GS. */
2373 static inline void
2374 gimple_call_set_chain (gimple gs, tree chain)
2376 GIMPLE_CHECK (gs, GIMPLE_CALL);
2378 gimple_set_op (gs, 2, chain);
2382 /* Return the number of arguments used by call statement GS. */
2384 static inline unsigned
2385 gimple_call_num_args (const_gimple gs)
2387 unsigned num_ops;
2388 GIMPLE_CHECK (gs, GIMPLE_CALL);
2389 num_ops = gimple_num_ops (gs);
2390 return num_ops - 3;
2394 /* Return the argument at position INDEX for call statement GS. */
2396 static inline tree
2397 gimple_call_arg (const_gimple gs, unsigned index)
2399 GIMPLE_CHECK (gs, GIMPLE_CALL);
2400 return gimple_op (gs, index + 3);
2404 /* Return a pointer to the argument at position INDEX for call
2405 statement GS. */
2407 static inline tree *
2408 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2410 GIMPLE_CHECK (gs, GIMPLE_CALL);
2411 return gimple_op_ptr (gs, index + 3);
2415 /* Set ARG to be the argument at position INDEX for call statement GS. */
2417 static inline void
2418 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2420 GIMPLE_CHECK (gs, GIMPLE_CALL);
2421 gimple_set_op (gs, index + 3, arg);
2425 /* If TAIL_P is true, mark call statement S as being a tail call
2426 (i.e., a call just before the exit of a function). These calls are
2427 candidate for tail call optimization. */
2429 static inline void
2430 gimple_call_set_tail (gimple s, bool tail_p)
2432 GIMPLE_CHECK (s, GIMPLE_CALL);
2433 if (tail_p)
2434 s->gsbase.subcode |= GF_CALL_TAILCALL;
2435 else
2436 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2440 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2442 static inline bool
2443 gimple_call_tail_p (gimple s)
2445 GIMPLE_CHECK (s, GIMPLE_CALL);
2446 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2450 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2451 slot optimization. This transformation uses the target of the call
2452 expansion as the return slot for calls that return in memory. */
2454 static inline void
2455 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2457 GIMPLE_CHECK (s, GIMPLE_CALL);
2458 if (return_slot_opt_p)
2459 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2460 else
2461 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2465 /* Return true if S is marked for return slot optimization. */
2467 static inline bool
2468 gimple_call_return_slot_opt_p (gimple s)
2470 GIMPLE_CHECK (s, GIMPLE_CALL);
2471 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2475 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2476 thunk to the thunked-to function. */
2478 static inline void
2479 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2481 GIMPLE_CHECK (s, GIMPLE_CALL);
2482 if (from_thunk_p)
2483 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2484 else
2485 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2489 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2491 static inline bool
2492 gimple_call_from_thunk_p (gimple s)
2494 GIMPLE_CHECK (s, GIMPLE_CALL);
2495 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2499 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2500 argument pack in its argument list. */
2502 static inline void
2503 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2505 GIMPLE_CHECK (s, GIMPLE_CALL);
2506 if (pass_arg_pack_p)
2507 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2508 else
2509 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2513 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2514 argument pack in its argument list. */
2516 static inline bool
2517 gimple_call_va_arg_pack_p (gimple s)
2519 GIMPLE_CHECK (s, GIMPLE_CALL);
2520 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2524 /* Return true if S is a noreturn call. */
2526 static inline bool
2527 gimple_call_noreturn_p (gimple s)
2529 GIMPLE_CHECK (s, GIMPLE_CALL);
2530 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2534 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2535 even if the called function can throw in other cases. */
2537 static inline void
2538 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2540 GIMPLE_CHECK (s, GIMPLE_CALL);
2541 if (nothrow_p)
2542 s->gsbase.subcode |= GF_CALL_NOTHROW;
2543 else
2544 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2547 /* Return true if S is a nothrow call. */
2549 static inline bool
2550 gimple_call_nothrow_p (gimple s)
2552 GIMPLE_CHECK (s, GIMPLE_CALL);
2553 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2556 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2557 is known to be emitted for VLA objects. Those are wrapped by
2558 stack_save/stack_restore calls and hence can't lead to unbounded
2559 stack growth even when they occur in loops. */
2561 static inline void
2562 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2564 GIMPLE_CHECK (s, GIMPLE_CALL);
2565 if (for_var)
2566 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2567 else
2568 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2571 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2573 static inline bool
2574 gimple_call_alloca_for_var_p (gimple s)
2576 GIMPLE_CHECK (s, GIMPLE_CALL);
2577 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2580 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2582 static inline void
2583 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2585 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2586 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2587 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2591 /* Return a pointer to the points-to solution for the set of call-used
2592 variables of the call CALL. */
2594 static inline struct pt_solution *
2595 gimple_call_use_set (gimple call)
2597 GIMPLE_CHECK (call, GIMPLE_CALL);
2598 return &call->gimple_call.call_used;
2602 /* Return a pointer to the points-to solution for the set of call-used
2603 variables of the call CALL. */
2605 static inline struct pt_solution *
2606 gimple_call_clobber_set (gimple call)
2608 GIMPLE_CHECK (call, GIMPLE_CALL);
2609 return &call->gimple_call.call_clobbered;
2613 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2614 non-NULL lhs. */
2616 static inline bool
2617 gimple_has_lhs (gimple stmt)
2619 return (is_gimple_assign (stmt)
2620 || (is_gimple_call (stmt)
2621 && gimple_call_lhs (stmt) != NULL_TREE));
2625 /* Return the code of the predicate computed by conditional statement GS. */
2627 static inline enum tree_code
2628 gimple_cond_code (const_gimple gs)
2630 GIMPLE_CHECK (gs, GIMPLE_COND);
2631 return (enum tree_code) gs->gsbase.subcode;
2635 /* Set CODE to be the predicate code for the conditional statement GS. */
2637 static inline void
2638 gimple_cond_set_code (gimple gs, enum tree_code code)
2640 GIMPLE_CHECK (gs, GIMPLE_COND);
2641 gs->gsbase.subcode = code;
2645 /* Return the LHS of the predicate computed by conditional statement GS. */
2647 static inline tree
2648 gimple_cond_lhs (const_gimple gs)
2650 GIMPLE_CHECK (gs, GIMPLE_COND);
2651 return gimple_op (gs, 0);
2654 /* Return the pointer to the LHS of the predicate computed by conditional
2655 statement GS. */
2657 static inline tree *
2658 gimple_cond_lhs_ptr (const_gimple gs)
2660 GIMPLE_CHECK (gs, GIMPLE_COND);
2661 return gimple_op_ptr (gs, 0);
2664 /* Set LHS to be the LHS operand of the predicate computed by
2665 conditional statement GS. */
2667 static inline void
2668 gimple_cond_set_lhs (gimple gs, tree lhs)
2670 GIMPLE_CHECK (gs, GIMPLE_COND);
2671 gimple_set_op (gs, 0, lhs);
2675 /* Return the RHS operand of the predicate computed by conditional GS. */
2677 static inline tree
2678 gimple_cond_rhs (const_gimple gs)
2680 GIMPLE_CHECK (gs, GIMPLE_COND);
2681 return gimple_op (gs, 1);
2684 /* Return the pointer to the RHS operand of the predicate computed by
2685 conditional GS. */
2687 static inline tree *
2688 gimple_cond_rhs_ptr (const_gimple gs)
2690 GIMPLE_CHECK (gs, GIMPLE_COND);
2691 return gimple_op_ptr (gs, 1);
2695 /* Set RHS to be the RHS operand of the predicate computed by
2696 conditional statement GS. */
2698 static inline void
2699 gimple_cond_set_rhs (gimple gs, tree rhs)
2701 GIMPLE_CHECK (gs, GIMPLE_COND);
2702 gimple_set_op (gs, 1, rhs);
2706 /* Return the label used by conditional statement GS when its
2707 predicate evaluates to true. */
2709 static inline tree
2710 gimple_cond_true_label (const_gimple gs)
2712 GIMPLE_CHECK (gs, GIMPLE_COND);
2713 return gimple_op (gs, 2);
2717 /* Set LABEL to be the label used by conditional statement GS when its
2718 predicate evaluates to true. */
2720 static inline void
2721 gimple_cond_set_true_label (gimple gs, tree label)
2723 GIMPLE_CHECK (gs, GIMPLE_COND);
2724 gimple_set_op (gs, 2, label);
2728 /* Set LABEL to be the label used by conditional statement GS when its
2729 predicate evaluates to false. */
2731 static inline void
2732 gimple_cond_set_false_label (gimple gs, tree label)
2734 GIMPLE_CHECK (gs, GIMPLE_COND);
2735 gimple_set_op (gs, 3, label);
2739 /* Return the label used by conditional statement GS when its
2740 predicate evaluates to false. */
2742 static inline tree
2743 gimple_cond_false_label (const_gimple gs)
2745 GIMPLE_CHECK (gs, GIMPLE_COND);
2746 return gimple_op (gs, 3);
2750 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2752 static inline void
2753 gimple_cond_make_false (gimple gs)
2755 gimple_cond_set_lhs (gs, boolean_true_node);
2756 gimple_cond_set_rhs (gs, boolean_false_node);
2757 gs->gsbase.subcode = EQ_EXPR;
2761 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2763 static inline void
2764 gimple_cond_make_true (gimple gs)
2766 gimple_cond_set_lhs (gs, boolean_true_node);
2767 gimple_cond_set_rhs (gs, boolean_true_node);
2768 gs->gsbase.subcode = EQ_EXPR;
2771 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2772 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2774 static inline bool
2775 gimple_cond_true_p (const_gimple gs)
2777 tree lhs = gimple_cond_lhs (gs);
2778 tree rhs = gimple_cond_rhs (gs);
2779 enum tree_code code = gimple_cond_code (gs);
2781 if (lhs != boolean_true_node && lhs != boolean_false_node)
2782 return false;
2784 if (rhs != boolean_true_node && rhs != boolean_false_node)
2785 return false;
2787 if (code == NE_EXPR && lhs != rhs)
2788 return true;
2790 if (code == EQ_EXPR && lhs == rhs)
2791 return true;
2793 return false;
2796 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2797 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2799 static inline bool
2800 gimple_cond_false_p (const_gimple gs)
2802 tree lhs = gimple_cond_lhs (gs);
2803 tree rhs = gimple_cond_rhs (gs);
2804 enum tree_code code = gimple_cond_code (gs);
2806 if (lhs != boolean_true_node && lhs != boolean_false_node)
2807 return false;
2809 if (rhs != boolean_true_node && rhs != boolean_false_node)
2810 return false;
2812 if (code == NE_EXPR && lhs == rhs)
2813 return true;
2815 if (code == EQ_EXPR && lhs != rhs)
2816 return true;
2818 return false;
2821 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2823 static inline void
2824 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2826 gimple_cond_set_code (stmt, code);
2827 gimple_cond_set_lhs (stmt, lhs);
2828 gimple_cond_set_rhs (stmt, rhs);
2831 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2833 static inline tree
2834 gimple_label_label (const_gimple gs)
2836 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2837 return gimple_op (gs, 0);
2841 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2842 GS. */
2844 static inline void
2845 gimple_label_set_label (gimple gs, tree label)
2847 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2848 gimple_set_op (gs, 0, label);
2852 /* Return the destination of the unconditional jump GS. */
2854 static inline tree
2855 gimple_goto_dest (const_gimple gs)
2857 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2858 return gimple_op (gs, 0);
2862 /* Set DEST to be the destination of the unconditonal jump GS. */
2864 static inline void
2865 gimple_goto_set_dest (gimple gs, tree dest)
2867 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2868 gimple_set_op (gs, 0, dest);
2872 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2874 static inline tree
2875 gimple_bind_vars (const_gimple gs)
2877 GIMPLE_CHECK (gs, GIMPLE_BIND);
2878 return gs->gimple_bind.vars;
2882 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2883 statement GS. */
2885 static inline void
2886 gimple_bind_set_vars (gimple gs, tree vars)
2888 GIMPLE_CHECK (gs, GIMPLE_BIND);
2889 gs->gimple_bind.vars = vars;
2893 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2894 statement GS. */
2896 static inline void
2897 gimple_bind_append_vars (gimple gs, tree vars)
2899 GIMPLE_CHECK (gs, GIMPLE_BIND);
2900 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2904 static inline gimple_seq *
2905 gimple_bind_body_ptr (gimple gs)
2907 GIMPLE_CHECK (gs, GIMPLE_BIND);
2908 return &gs->gimple_bind.body;
2911 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2913 static inline gimple_seq
2914 gimple_bind_body (gimple gs)
2916 return *gimple_bind_body_ptr (gs);
2920 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2921 statement GS. */
2923 static inline void
2924 gimple_bind_set_body (gimple gs, gimple_seq seq)
2926 GIMPLE_CHECK (gs, GIMPLE_BIND);
2927 gs->gimple_bind.body = seq;
2931 /* Append a statement to the end of a GIMPLE_BIND's body. */
2933 static inline void
2934 gimple_bind_add_stmt (gimple gs, gimple stmt)
2936 GIMPLE_CHECK (gs, GIMPLE_BIND);
2937 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2941 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2943 static inline void
2944 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2946 GIMPLE_CHECK (gs, GIMPLE_BIND);
2947 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2951 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2952 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2954 static inline tree
2955 gimple_bind_block (const_gimple gs)
2957 GIMPLE_CHECK (gs, GIMPLE_BIND);
2958 return gs->gimple_bind.block;
2962 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2963 statement GS. */
2965 static inline void
2966 gimple_bind_set_block (gimple gs, tree block)
2968 GIMPLE_CHECK (gs, GIMPLE_BIND);
2969 gcc_gimple_checking_assert (block == NULL_TREE
2970 || TREE_CODE (block) == BLOCK);
2971 gs->gimple_bind.block = block;
2975 /* Return the number of input operands for GIMPLE_ASM GS. */
2977 static inline unsigned
2978 gimple_asm_ninputs (const_gimple gs)
2980 GIMPLE_CHECK (gs, GIMPLE_ASM);
2981 return gs->gimple_asm.ni;
2985 /* Return the number of output operands for GIMPLE_ASM GS. */
2987 static inline unsigned
2988 gimple_asm_noutputs (const_gimple gs)
2990 GIMPLE_CHECK (gs, GIMPLE_ASM);
2991 return gs->gimple_asm.no;
2995 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2997 static inline unsigned
2998 gimple_asm_nclobbers (const_gimple gs)
3000 GIMPLE_CHECK (gs, GIMPLE_ASM);
3001 return gs->gimple_asm.nc;
3004 /* Return the number of label operands for GIMPLE_ASM GS. */
3006 static inline unsigned
3007 gimple_asm_nlabels (const_gimple gs)
3009 GIMPLE_CHECK (gs, GIMPLE_ASM);
3010 return gs->gimple_asm.nl;
3013 /* Return input operand INDEX of GIMPLE_ASM GS. */
3015 static inline tree
3016 gimple_asm_input_op (const_gimple gs, unsigned index)
3018 GIMPLE_CHECK (gs, GIMPLE_ASM);
3019 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
3020 return gimple_op (gs, index + gs->gimple_asm.no);
3023 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3025 static inline tree *
3026 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3028 GIMPLE_CHECK (gs, GIMPLE_ASM);
3029 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
3030 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
3034 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3036 static inline void
3037 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3039 GIMPLE_CHECK (gs, GIMPLE_ASM);
3040 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
3041 && TREE_CODE (in_op) == TREE_LIST);
3042 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
3046 /* Return output operand INDEX of GIMPLE_ASM GS. */
3048 static inline tree
3049 gimple_asm_output_op (const_gimple gs, unsigned index)
3051 GIMPLE_CHECK (gs, GIMPLE_ASM);
3052 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3053 return gimple_op (gs, index);
3056 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3058 static inline tree *
3059 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3061 GIMPLE_CHECK (gs, GIMPLE_ASM);
3062 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3063 return gimple_op_ptr (gs, index);
3067 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3069 static inline void
3070 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3072 GIMPLE_CHECK (gs, GIMPLE_ASM);
3073 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3074 && TREE_CODE (out_op) == TREE_LIST);
3075 gimple_set_op (gs, index, out_op);
3079 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3081 static inline tree
3082 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3084 GIMPLE_CHECK (gs, GIMPLE_ASM);
3085 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3086 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3090 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3092 static inline void
3093 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3095 GIMPLE_CHECK (gs, GIMPLE_ASM);
3096 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3097 && TREE_CODE (clobber_op) == TREE_LIST);
3098 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3101 /* Return label operand INDEX of GIMPLE_ASM GS. */
3103 static inline tree
3104 gimple_asm_label_op (const_gimple gs, unsigned index)
3106 GIMPLE_CHECK (gs, GIMPLE_ASM);
3107 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3108 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3111 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3113 static inline void
3114 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3116 GIMPLE_CHECK (gs, GIMPLE_ASM);
3117 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3118 && TREE_CODE (label_op) == TREE_LIST);
3119 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3122 /* Return the string representing the assembly instruction in
3123 GIMPLE_ASM GS. */
3125 static inline const char *
3126 gimple_asm_string (const_gimple gs)
3128 GIMPLE_CHECK (gs, GIMPLE_ASM);
3129 return gs->gimple_asm.string;
3133 /* Return true if GS is an asm statement marked volatile. */
3135 static inline bool
3136 gimple_asm_volatile_p (const_gimple gs)
3138 GIMPLE_CHECK (gs, GIMPLE_ASM);
3139 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3143 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3145 static inline void
3146 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3148 GIMPLE_CHECK (gs, GIMPLE_ASM);
3149 if (volatile_p)
3150 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3151 else
3152 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3156 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3158 static inline void
3159 gimple_asm_set_input (gimple gs, bool input_p)
3161 GIMPLE_CHECK (gs, GIMPLE_ASM);
3162 if (input_p)
3163 gs->gsbase.subcode |= GF_ASM_INPUT;
3164 else
3165 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3169 /* Return true if asm GS is an ASM_INPUT. */
3171 static inline bool
3172 gimple_asm_input_p (const_gimple gs)
3174 GIMPLE_CHECK (gs, GIMPLE_ASM);
3175 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3179 /* Return the types handled by GIMPLE_CATCH statement GS. */
3181 static inline tree
3182 gimple_catch_types (const_gimple gs)
3184 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3185 return gs->gimple_catch.types;
3189 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3191 static inline tree *
3192 gimple_catch_types_ptr (gimple gs)
3194 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3195 return &gs->gimple_catch.types;
3199 /* Return a pointer to the GIMPLE sequence representing the body of
3200 the handler of GIMPLE_CATCH statement GS. */
3202 static inline gimple_seq *
3203 gimple_catch_handler_ptr (gimple gs)
3205 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3206 return &gs->gimple_catch.handler;
3210 /* Return the GIMPLE sequence representing the body of the handler of
3211 GIMPLE_CATCH statement GS. */
3213 static inline gimple_seq
3214 gimple_catch_handler (gimple gs)
3216 return *gimple_catch_handler_ptr (gs);
3220 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3222 static inline void
3223 gimple_catch_set_types (gimple gs, tree t)
3225 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3226 gs->gimple_catch.types = t;
3230 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3232 static inline void
3233 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3235 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3236 gs->gimple_catch.handler = handler;
3240 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3242 static inline tree
3243 gimple_eh_filter_types (const_gimple gs)
3245 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3246 return gs->gimple_eh_filter.types;
3250 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3251 GS. */
3253 static inline tree *
3254 gimple_eh_filter_types_ptr (gimple gs)
3256 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3257 return &gs->gimple_eh_filter.types;
3261 /* Return a pointer to the sequence of statement to execute when
3262 GIMPLE_EH_FILTER statement fails. */
3264 static inline gimple_seq *
3265 gimple_eh_filter_failure_ptr (gimple gs)
3267 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3268 return &gs->gimple_eh_filter.failure;
3272 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3273 statement fails. */
3275 static inline gimple_seq
3276 gimple_eh_filter_failure (gimple gs)
3278 return *gimple_eh_filter_failure_ptr (gs);
3282 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3284 static inline void
3285 gimple_eh_filter_set_types (gimple gs, tree types)
3287 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3288 gs->gimple_eh_filter.types = types;
3292 /* Set FAILURE to be the sequence of statements to execute on failure
3293 for GIMPLE_EH_FILTER GS. */
3295 static inline void
3296 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3298 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3299 gs->gimple_eh_filter.failure = failure;
3302 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3304 static inline tree
3305 gimple_eh_must_not_throw_fndecl (gimple gs)
3307 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3308 return gs->gimple_eh_mnt.fndecl;
3311 /* Set the function decl to be called by GS to DECL. */
3313 static inline void
3314 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3316 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3317 gs->gimple_eh_mnt.fndecl = decl;
3320 /* GIMPLE_EH_ELSE accessors. */
3322 static inline gimple_seq *
3323 gimple_eh_else_n_body_ptr (gimple gs)
3325 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3326 return &gs->gimple_eh_else.n_body;
3329 static inline gimple_seq
3330 gimple_eh_else_n_body (gimple gs)
3332 return *gimple_eh_else_n_body_ptr (gs);
3335 static inline gimple_seq *
3336 gimple_eh_else_e_body_ptr (gimple gs)
3338 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3339 return &gs->gimple_eh_else.e_body;
3342 static inline gimple_seq
3343 gimple_eh_else_e_body (gimple gs)
3345 return *gimple_eh_else_e_body_ptr (gs);
3348 static inline void
3349 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3351 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3352 gs->gimple_eh_else.n_body = seq;
3355 static inline void
3356 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3358 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3359 gs->gimple_eh_else.e_body = seq;
3362 /* GIMPLE_TRY accessors. */
3364 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3365 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3367 static inline enum gimple_try_flags
3368 gimple_try_kind (const_gimple gs)
3370 GIMPLE_CHECK (gs, GIMPLE_TRY);
3371 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3375 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3377 static inline void
3378 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3380 GIMPLE_CHECK (gs, GIMPLE_TRY);
3381 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3382 || kind == GIMPLE_TRY_FINALLY);
3383 if (gimple_try_kind (gs) != kind)
3384 gs->gsbase.subcode = (unsigned int) kind;
3388 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3390 static inline bool
3391 gimple_try_catch_is_cleanup (const_gimple gs)
3393 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3394 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3398 /* Return a pointer to the sequence of statements used as the
3399 body for GIMPLE_TRY GS. */
3401 static inline gimple_seq *
3402 gimple_try_eval_ptr (gimple gs)
3404 GIMPLE_CHECK (gs, GIMPLE_TRY);
3405 return &gs->gimple_try.eval;
3409 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3411 static inline gimple_seq
3412 gimple_try_eval (gimple gs)
3414 return *gimple_try_eval_ptr (gs);
3418 /* Return a pointer to the sequence of statements used as the cleanup body for
3419 GIMPLE_TRY GS. */
3421 static inline gimple_seq *
3422 gimple_try_cleanup_ptr (gimple gs)
3424 GIMPLE_CHECK (gs, GIMPLE_TRY);
3425 return &gs->gimple_try.cleanup;
3429 /* Return the sequence of statements used as the cleanup body for
3430 GIMPLE_TRY GS. */
3432 static inline gimple_seq
3433 gimple_try_cleanup (gimple gs)
3435 return *gimple_try_cleanup_ptr (gs);
3439 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3441 static inline void
3442 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3444 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3445 if (catch_is_cleanup)
3446 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3447 else
3448 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3452 /* Set EVAL to be the sequence of statements to use as the body for
3453 GIMPLE_TRY GS. */
3455 static inline void
3456 gimple_try_set_eval (gimple gs, gimple_seq eval)
3458 GIMPLE_CHECK (gs, GIMPLE_TRY);
3459 gs->gimple_try.eval = eval;
3463 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3464 body for GIMPLE_TRY GS. */
3466 static inline void
3467 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3469 GIMPLE_CHECK (gs, GIMPLE_TRY);
3470 gs->gimple_try.cleanup = cleanup;
3474 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3476 static inline gimple_seq *
3477 gimple_wce_cleanup_ptr (gimple gs)
3479 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3480 return &gs->gimple_wce.cleanup;
3484 /* Return the cleanup sequence for cleanup statement GS. */
3486 static inline gimple_seq
3487 gimple_wce_cleanup (gimple gs)
3489 return *gimple_wce_cleanup_ptr (gs);
3493 /* Set CLEANUP to be the cleanup sequence for GS. */
3495 static inline void
3496 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3498 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3499 gs->gimple_wce.cleanup = cleanup;
3503 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3505 static inline bool
3506 gimple_wce_cleanup_eh_only (const_gimple gs)
3508 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3509 return gs->gsbase.subcode != 0;
3513 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3515 static inline void
3516 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3518 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3519 gs->gsbase.subcode = (unsigned int) eh_only_p;
3523 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3525 static inline unsigned
3526 gimple_phi_capacity (const_gimple gs)
3528 GIMPLE_CHECK (gs, GIMPLE_PHI);
3529 return gs->gimple_phi.capacity;
3533 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3534 be exactly the number of incoming edges for the basic block holding
3535 GS. */
3537 static inline unsigned
3538 gimple_phi_num_args (const_gimple gs)
3540 GIMPLE_CHECK (gs, GIMPLE_PHI);
3541 return gs->gimple_phi.nargs;
3545 /* Return the SSA name created by GIMPLE_PHI GS. */
3547 static inline tree
3548 gimple_phi_result (const_gimple gs)
3550 GIMPLE_CHECK (gs, GIMPLE_PHI);
3551 return gs->gimple_phi.result;
3554 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3556 static inline tree *
3557 gimple_phi_result_ptr (gimple gs)
3559 GIMPLE_CHECK (gs, GIMPLE_PHI);
3560 return &gs->gimple_phi.result;
3563 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3565 static inline void
3566 gimple_phi_set_result (gimple gs, tree result)
3568 GIMPLE_CHECK (gs, GIMPLE_PHI);
3569 gs->gimple_phi.result = result;
3570 if (result && TREE_CODE (result) == SSA_NAME)
3571 SSA_NAME_DEF_STMT (result) = gs;
3575 /* Return the PHI argument corresponding to incoming edge INDEX for
3576 GIMPLE_PHI GS. */
3578 static inline struct phi_arg_d *
3579 gimple_phi_arg (gimple gs, unsigned index)
3581 GIMPLE_CHECK (gs, GIMPLE_PHI);
3582 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3583 return &(gs->gimple_phi.args[index]);
3586 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3587 for GIMPLE_PHI GS. */
3589 static inline void
3590 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3592 GIMPLE_CHECK (gs, GIMPLE_PHI);
3593 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3594 gs->gimple_phi.args[index] = *phiarg;
3597 /* Return the region number for GIMPLE_RESX GS. */
3599 static inline int
3600 gimple_resx_region (const_gimple gs)
3602 GIMPLE_CHECK (gs, GIMPLE_RESX);
3603 return gs->gimple_eh_ctrl.region;
3606 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3608 static inline void
3609 gimple_resx_set_region (gimple gs, int region)
3611 GIMPLE_CHECK (gs, GIMPLE_RESX);
3612 gs->gimple_eh_ctrl.region = region;
3615 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3617 static inline int
3618 gimple_eh_dispatch_region (const_gimple gs)
3620 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3621 return gs->gimple_eh_ctrl.region;
3624 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3626 static inline void
3627 gimple_eh_dispatch_set_region (gimple gs, int region)
3629 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3630 gs->gimple_eh_ctrl.region = region;
3633 /* Return the number of labels associated with the switch statement GS. */
3635 static inline unsigned
3636 gimple_switch_num_labels (const_gimple gs)
3638 unsigned num_ops;
3639 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3640 num_ops = gimple_num_ops (gs);
3641 gcc_gimple_checking_assert (num_ops > 1);
3642 return num_ops - 1;
3646 /* Set NLABELS to be the number of labels for the switch statement GS. */
3648 static inline void
3649 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3651 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3652 gimple_set_num_ops (g, nlabels + 1);
3656 /* Return the index variable used by the switch statement GS. */
3658 static inline tree
3659 gimple_switch_index (const_gimple gs)
3661 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3662 return gimple_op (gs, 0);
3666 /* Return a pointer to the index variable for the switch statement GS. */
3668 static inline tree *
3669 gimple_switch_index_ptr (const_gimple gs)
3671 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3672 return gimple_op_ptr (gs, 0);
3676 /* Set INDEX to be the index variable for switch statement GS. */
3678 static inline void
3679 gimple_switch_set_index (gimple gs, tree index)
3681 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3682 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3683 gimple_set_op (gs, 0, index);
3687 /* Return the label numbered INDEX. The default label is 0, followed by any
3688 labels in a switch statement. */
3690 static inline tree
3691 gimple_switch_label (const_gimple gs, unsigned index)
3693 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3694 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3695 return gimple_op (gs, index + 1);
3698 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3700 static inline void
3701 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3703 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3704 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3705 && (label == NULL_TREE
3706 || TREE_CODE (label) == CASE_LABEL_EXPR));
3707 gimple_set_op (gs, index + 1, label);
3710 /* Return the default label for a switch statement. */
3712 static inline tree
3713 gimple_switch_default_label (const_gimple gs)
3715 tree label = gimple_switch_label (gs, 0);
3716 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3717 return label;
3720 /* Set the default label for a switch statement. */
3722 static inline void
3723 gimple_switch_set_default_label (gimple gs, tree label)
3725 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
3726 gimple_switch_set_label (gs, 0, label);
3729 /* Return true if GS is a GIMPLE_DEBUG statement. */
3731 static inline bool
3732 is_gimple_debug (const_gimple gs)
3734 return gimple_code (gs) == GIMPLE_DEBUG;
3737 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3739 static inline bool
3740 gimple_debug_bind_p (const_gimple s)
3742 if (is_gimple_debug (s))
3743 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3745 return false;
3748 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3750 static inline tree
3751 gimple_debug_bind_get_var (gimple dbg)
3753 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3754 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3755 return gimple_op (dbg, 0);
3758 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3759 statement. */
3761 static inline tree
3762 gimple_debug_bind_get_value (gimple dbg)
3764 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3765 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3766 return gimple_op (dbg, 1);
3769 /* Return a pointer to the value bound to the variable in a
3770 GIMPLE_DEBUG bind statement. */
3772 static inline tree *
3773 gimple_debug_bind_get_value_ptr (gimple dbg)
3775 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3776 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3777 return gimple_op_ptr (dbg, 1);
3780 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3782 static inline void
3783 gimple_debug_bind_set_var (gimple dbg, tree var)
3785 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3786 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3787 gimple_set_op (dbg, 0, var);
3790 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3791 statement. */
3793 static inline void
3794 gimple_debug_bind_set_value (gimple dbg, tree value)
3796 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3797 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3798 gimple_set_op (dbg, 1, value);
3801 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3802 optimized away. */
3803 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3805 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3806 statement. */
3808 static inline void
3809 gimple_debug_bind_reset_value (gimple dbg)
3811 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3812 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3813 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3816 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3817 value. */
3819 static inline bool
3820 gimple_debug_bind_has_value_p (gimple dbg)
3822 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3823 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3824 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3827 #undef GIMPLE_DEBUG_BIND_NOVALUE
3829 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3831 static inline bool
3832 gimple_debug_source_bind_p (const_gimple s)
3834 if (is_gimple_debug (s))
3835 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3837 return false;
3840 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3842 static inline tree
3843 gimple_debug_source_bind_get_var (gimple dbg)
3845 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3846 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3847 return gimple_op (dbg, 0);
3850 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3851 statement. */
3853 static inline tree
3854 gimple_debug_source_bind_get_value (gimple dbg)
3856 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3857 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3858 return gimple_op (dbg, 1);
3861 /* Return a pointer to the value bound to the variable in a
3862 GIMPLE_DEBUG source bind statement. */
3864 static inline tree *
3865 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3867 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3868 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3869 return gimple_op_ptr (dbg, 1);
3872 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3874 static inline void
3875 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3877 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3878 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3879 gimple_set_op (dbg, 0, var);
3882 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3883 statement. */
3885 static inline void
3886 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3888 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3889 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3890 gimple_set_op (dbg, 1, value);
3893 /* Return a pointer to the body for the OMP statement GS. */
3895 static inline gimple_seq *
3896 gimple_omp_body_ptr (gimple gs)
3898 return &gs->omp.body;
3901 /* Return the body for the OMP statement GS. */
3903 static inline gimple_seq
3904 gimple_omp_body (gimple gs)
3906 return *gimple_omp_body_ptr (gs);
3909 /* Set BODY to be the body for the OMP statement GS. */
3911 static inline void
3912 gimple_omp_set_body (gimple gs, gimple_seq body)
3914 gs->omp.body = body;
3918 /* Return the name associated with OMP_CRITICAL statement GS. */
3920 static inline tree
3921 gimple_omp_critical_name (const_gimple gs)
3923 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3924 return gs->gimple_omp_critical.name;
3928 /* Return a pointer to the name associated with OMP critical statement GS. */
3930 static inline tree *
3931 gimple_omp_critical_name_ptr (gimple gs)
3933 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3934 return &gs->gimple_omp_critical.name;
3938 /* Set NAME to be the name associated with OMP critical statement GS. */
3940 static inline void
3941 gimple_omp_critical_set_name (gimple gs, tree name)
3943 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3944 gs->gimple_omp_critical.name = name;
3948 /* Return the clauses associated with OMP_FOR GS. */
3950 static inline tree
3951 gimple_omp_for_clauses (const_gimple gs)
3953 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3954 return gs->gimple_omp_for.clauses;
3958 /* Return a pointer to the OMP_FOR GS. */
3960 static inline tree *
3961 gimple_omp_for_clauses_ptr (gimple gs)
3963 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3964 return &gs->gimple_omp_for.clauses;
3968 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3970 static inline void
3971 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3973 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3974 gs->gimple_omp_for.clauses = clauses;
3978 /* Get the collapse count of OMP_FOR GS. */
3980 static inline size_t
3981 gimple_omp_for_collapse (gimple gs)
3983 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3984 return gs->gimple_omp_for.collapse;
3988 /* Return the index variable for OMP_FOR GS. */
3990 static inline tree
3991 gimple_omp_for_index (const_gimple gs, size_t i)
3993 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3994 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3995 return gs->gimple_omp_for.iter[i].index;
3999 /* Return a pointer to the index variable for OMP_FOR GS. */
4001 static inline tree *
4002 gimple_omp_for_index_ptr (gimple gs, size_t i)
4004 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4005 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4006 return &gs->gimple_omp_for.iter[i].index;
4010 /* Set INDEX to be the index variable for OMP_FOR GS. */
4012 static inline void
4013 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4015 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4016 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4017 gs->gimple_omp_for.iter[i].index = index;
4021 /* Return the initial value for OMP_FOR GS. */
4023 static inline tree
4024 gimple_omp_for_initial (const_gimple gs, size_t i)
4026 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4027 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4028 return gs->gimple_omp_for.iter[i].initial;
4032 /* Return a pointer to the initial value for OMP_FOR GS. */
4034 static inline tree *
4035 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4037 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4038 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4039 return &gs->gimple_omp_for.iter[i].initial;
4043 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4045 static inline void
4046 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4048 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4049 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4050 gs->gimple_omp_for.iter[i].initial = initial;
4054 /* Return the final value for OMP_FOR GS. */
4056 static inline tree
4057 gimple_omp_for_final (const_gimple gs, size_t i)
4059 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4060 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4061 return gs->gimple_omp_for.iter[i].final;
4065 /* Return a pointer to the final value for OMP_FOR GS. */
4067 static inline tree *
4068 gimple_omp_for_final_ptr (gimple gs, size_t i)
4070 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4071 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4072 return &gs->gimple_omp_for.iter[i].final;
4076 /* Set FINAL to be the final value for OMP_FOR GS. */
4078 static inline void
4079 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4081 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4082 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4083 gs->gimple_omp_for.iter[i].final = final;
4087 /* Return the increment value for OMP_FOR GS. */
4089 static inline tree
4090 gimple_omp_for_incr (const_gimple gs, size_t i)
4092 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4093 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4094 return gs->gimple_omp_for.iter[i].incr;
4098 /* Return a pointer to the increment value for OMP_FOR GS. */
4100 static inline tree *
4101 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4103 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4104 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4105 return &gs->gimple_omp_for.iter[i].incr;
4109 /* Set INCR to be the increment value for OMP_FOR GS. */
4111 static inline void
4112 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4114 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4115 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4116 gs->gimple_omp_for.iter[i].incr = incr;
4120 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4121 statement GS starts. */
4123 static inline gimple_seq *
4124 gimple_omp_for_pre_body_ptr (gimple gs)
4126 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4127 return &gs->gimple_omp_for.pre_body;
4131 /* Return the sequence of statements to execute before the OMP_FOR
4132 statement GS starts. */
4134 static inline gimple_seq
4135 gimple_omp_for_pre_body (gimple gs)
4137 return *gimple_omp_for_pre_body_ptr (gs);
4141 /* Set PRE_BODY to be the sequence of statements to execute before the
4142 OMP_FOR statement GS starts. */
4144 static inline void
4145 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4147 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4148 gs->gimple_omp_for.pre_body = pre_body;
4152 /* Return the clauses associated with OMP_PARALLEL GS. */
4154 static inline tree
4155 gimple_omp_parallel_clauses (const_gimple gs)
4157 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4158 return gs->gimple_omp_parallel.clauses;
4162 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4164 static inline tree *
4165 gimple_omp_parallel_clauses_ptr (gimple gs)
4167 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4168 return &gs->gimple_omp_parallel.clauses;
4172 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4173 GS. */
4175 static inline void
4176 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4178 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4179 gs->gimple_omp_parallel.clauses = clauses;
4183 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4185 static inline tree
4186 gimple_omp_parallel_child_fn (const_gimple gs)
4188 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4189 return gs->gimple_omp_parallel.child_fn;
4192 /* Return a pointer to the child function used to hold the body of
4193 OMP_PARALLEL GS. */
4195 static inline tree *
4196 gimple_omp_parallel_child_fn_ptr (gimple gs)
4198 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4199 return &gs->gimple_omp_parallel.child_fn;
4203 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4205 static inline void
4206 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4208 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4209 gs->gimple_omp_parallel.child_fn = child_fn;
4213 /* Return the artificial argument used to send variables and values
4214 from the parent to the children threads in OMP_PARALLEL GS. */
4216 static inline tree
4217 gimple_omp_parallel_data_arg (const_gimple gs)
4219 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4220 return gs->gimple_omp_parallel.data_arg;
4224 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4226 static inline tree *
4227 gimple_omp_parallel_data_arg_ptr (gimple gs)
4229 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4230 return &gs->gimple_omp_parallel.data_arg;
4234 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4236 static inline void
4237 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4239 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4240 gs->gimple_omp_parallel.data_arg = data_arg;
4244 /* Return the clauses associated with OMP_TASK GS. */
4246 static inline tree
4247 gimple_omp_task_clauses (const_gimple gs)
4249 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4250 return gs->gimple_omp_parallel.clauses;
4254 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4256 static inline tree *
4257 gimple_omp_task_clauses_ptr (gimple gs)
4259 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4260 return &gs->gimple_omp_parallel.clauses;
4264 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4265 GS. */
4267 static inline void
4268 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4270 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4271 gs->gimple_omp_parallel.clauses = clauses;
4275 /* Return the child function used to hold the body of OMP_TASK GS. */
4277 static inline tree
4278 gimple_omp_task_child_fn (const_gimple gs)
4280 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4281 return gs->gimple_omp_parallel.child_fn;
4284 /* Return a pointer to the child function used to hold the body of
4285 OMP_TASK GS. */
4287 static inline tree *
4288 gimple_omp_task_child_fn_ptr (gimple gs)
4290 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4291 return &gs->gimple_omp_parallel.child_fn;
4295 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4297 static inline void
4298 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4300 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4301 gs->gimple_omp_parallel.child_fn = child_fn;
4305 /* Return the artificial argument used to send variables and values
4306 from the parent to the children threads in OMP_TASK GS. */
4308 static inline tree
4309 gimple_omp_task_data_arg (const_gimple gs)
4311 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4312 return gs->gimple_omp_parallel.data_arg;
4316 /* Return a pointer to the data argument for OMP_TASK GS. */
4318 static inline tree *
4319 gimple_omp_task_data_arg_ptr (gimple gs)
4321 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4322 return &gs->gimple_omp_parallel.data_arg;
4326 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4328 static inline void
4329 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4331 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4332 gs->gimple_omp_parallel.data_arg = data_arg;
4336 /* Return the clauses associated with OMP_TASK GS. */
4338 static inline tree
4339 gimple_omp_taskreg_clauses (const_gimple gs)
4341 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4342 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4343 return gs->gimple_omp_parallel.clauses;
4347 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4349 static inline tree *
4350 gimple_omp_taskreg_clauses_ptr (gimple gs)
4352 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4353 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4354 return &gs->gimple_omp_parallel.clauses;
4358 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4359 GS. */
4361 static inline void
4362 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4364 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4365 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4366 gs->gimple_omp_parallel.clauses = clauses;
4370 /* Return the child function used to hold the body of OMP_TASK GS. */
4372 static inline tree
4373 gimple_omp_taskreg_child_fn (const_gimple gs)
4375 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4376 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4377 return gs->gimple_omp_parallel.child_fn;
4380 /* Return a pointer to the child function used to hold the body of
4381 OMP_TASK GS. */
4383 static inline tree *
4384 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4386 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4387 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4388 return &gs->gimple_omp_parallel.child_fn;
4392 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4394 static inline void
4395 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4397 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4398 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4399 gs->gimple_omp_parallel.child_fn = child_fn;
4403 /* Return the artificial argument used to send variables and values
4404 from the parent to the children threads in OMP_TASK GS. */
4406 static inline tree
4407 gimple_omp_taskreg_data_arg (const_gimple gs)
4409 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4410 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4411 return gs->gimple_omp_parallel.data_arg;
4415 /* Return a pointer to the data argument for OMP_TASK GS. */
4417 static inline tree *
4418 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4420 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4421 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4422 return &gs->gimple_omp_parallel.data_arg;
4426 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4428 static inline void
4429 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4431 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4432 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4433 gs->gimple_omp_parallel.data_arg = data_arg;
4437 /* Return the copy function used to hold the body of OMP_TASK GS. */
4439 static inline tree
4440 gimple_omp_task_copy_fn (const_gimple gs)
4442 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4443 return gs->gimple_omp_task.copy_fn;
4446 /* Return a pointer to the copy function used to hold the body of
4447 OMP_TASK GS. */
4449 static inline tree *
4450 gimple_omp_task_copy_fn_ptr (gimple gs)
4452 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4453 return &gs->gimple_omp_task.copy_fn;
4457 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4459 static inline void
4460 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4462 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4463 gs->gimple_omp_task.copy_fn = copy_fn;
4467 /* Return size of the data block in bytes in OMP_TASK GS. */
4469 static inline tree
4470 gimple_omp_task_arg_size (const_gimple gs)
4472 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4473 return gs->gimple_omp_task.arg_size;
4477 /* Return a pointer to the data block size for OMP_TASK GS. */
4479 static inline tree *
4480 gimple_omp_task_arg_size_ptr (gimple gs)
4482 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4483 return &gs->gimple_omp_task.arg_size;
4487 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4489 static inline void
4490 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4492 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4493 gs->gimple_omp_task.arg_size = arg_size;
4497 /* Return align of the data block in bytes in OMP_TASK GS. */
4499 static inline tree
4500 gimple_omp_task_arg_align (const_gimple gs)
4502 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4503 return gs->gimple_omp_task.arg_align;
4507 /* Return a pointer to the data block align for OMP_TASK GS. */
4509 static inline tree *
4510 gimple_omp_task_arg_align_ptr (gimple gs)
4512 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4513 return &gs->gimple_omp_task.arg_align;
4517 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4519 static inline void
4520 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4522 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4523 gs->gimple_omp_task.arg_align = arg_align;
4527 /* Return the clauses associated with OMP_SINGLE GS. */
4529 static inline tree
4530 gimple_omp_single_clauses (const_gimple gs)
4532 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4533 return gs->gimple_omp_single.clauses;
4537 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4539 static inline tree *
4540 gimple_omp_single_clauses_ptr (gimple gs)
4542 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4543 return &gs->gimple_omp_single.clauses;
4547 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4549 static inline void
4550 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4552 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4553 gs->gimple_omp_single.clauses = clauses;
4557 /* Return the clauses associated with OMP_SECTIONS GS. */
4559 static inline tree
4560 gimple_omp_sections_clauses (const_gimple gs)
4562 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4563 return gs->gimple_omp_sections.clauses;
4567 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4569 static inline tree *
4570 gimple_omp_sections_clauses_ptr (gimple gs)
4572 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4573 return &gs->gimple_omp_sections.clauses;
4577 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4578 GS. */
4580 static inline void
4581 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4583 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4584 gs->gimple_omp_sections.clauses = clauses;
4588 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4589 in GS. */
4591 static inline tree
4592 gimple_omp_sections_control (const_gimple gs)
4594 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4595 return gs->gimple_omp_sections.control;
4599 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4600 GS. */
4602 static inline tree *
4603 gimple_omp_sections_control_ptr (gimple gs)
4605 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4606 return &gs->gimple_omp_sections.control;
4610 /* Set CONTROL to be the set of clauses associated with the
4611 GIMPLE_OMP_SECTIONS in GS. */
4613 static inline void
4614 gimple_omp_sections_set_control (gimple gs, tree control)
4616 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4617 gs->gimple_omp_sections.control = control;
4621 /* Set COND to be the condition code for OMP_FOR GS. */
4623 static inline void
4624 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4626 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4627 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4628 && i < gs->gimple_omp_for.collapse);
4629 gs->gimple_omp_for.iter[i].cond = cond;
4633 /* Return the condition code associated with OMP_FOR GS. */
4635 static inline enum tree_code
4636 gimple_omp_for_cond (const_gimple gs, size_t i)
4638 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4639 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4640 return gs->gimple_omp_for.iter[i].cond;
4644 /* Set the value being stored in an atomic store. */
4646 static inline void
4647 gimple_omp_atomic_store_set_val (gimple g, tree val)
4649 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4650 g->gimple_omp_atomic_store.val = val;
4654 /* Return the value being stored in an atomic store. */
4656 static inline tree
4657 gimple_omp_atomic_store_val (const_gimple g)
4659 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4660 return g->gimple_omp_atomic_store.val;
4664 /* Return a pointer to the value being stored in an atomic store. */
4666 static inline tree *
4667 gimple_omp_atomic_store_val_ptr (gimple g)
4669 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4670 return &g->gimple_omp_atomic_store.val;
4674 /* Set the LHS of an atomic load. */
4676 static inline void
4677 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4679 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4680 g->gimple_omp_atomic_load.lhs = lhs;
4684 /* Get the LHS of an atomic load. */
4686 static inline tree
4687 gimple_omp_atomic_load_lhs (const_gimple g)
4689 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4690 return g->gimple_omp_atomic_load.lhs;
4694 /* Return a pointer to the LHS of an atomic load. */
4696 static inline tree *
4697 gimple_omp_atomic_load_lhs_ptr (gimple g)
4699 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4700 return &g->gimple_omp_atomic_load.lhs;
4704 /* Set the RHS of an atomic load. */
4706 static inline void
4707 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4709 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4710 g->gimple_omp_atomic_load.rhs = rhs;
4714 /* Get the RHS of an atomic load. */
4716 static inline tree
4717 gimple_omp_atomic_load_rhs (const_gimple g)
4719 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4720 return g->gimple_omp_atomic_load.rhs;
4724 /* Return a pointer to the RHS of an atomic load. */
4726 static inline tree *
4727 gimple_omp_atomic_load_rhs_ptr (gimple g)
4729 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4730 return &g->gimple_omp_atomic_load.rhs;
4734 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4736 static inline tree
4737 gimple_omp_continue_control_def (const_gimple g)
4739 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4740 return g->gimple_omp_continue.control_def;
4743 /* The same as above, but return the address. */
4745 static inline tree *
4746 gimple_omp_continue_control_def_ptr (gimple g)
4748 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4749 return &g->gimple_omp_continue.control_def;
4752 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4754 static inline void
4755 gimple_omp_continue_set_control_def (gimple g, tree def)
4757 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4758 g->gimple_omp_continue.control_def = def;
4762 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4764 static inline tree
4765 gimple_omp_continue_control_use (const_gimple g)
4767 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4768 return g->gimple_omp_continue.control_use;
4772 /* The same as above, but return the address. */
4774 static inline tree *
4775 gimple_omp_continue_control_use_ptr (gimple g)
4777 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4778 return &g->gimple_omp_continue.control_use;
4782 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4784 static inline void
4785 gimple_omp_continue_set_control_use (gimple g, tree use)
4787 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4788 g->gimple_omp_continue.control_use = use;
4791 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4793 static inline gimple_seq *
4794 gimple_transaction_body_ptr (gimple gs)
4796 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4797 return &gs->gimple_transaction.body;
4800 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4802 static inline gimple_seq
4803 gimple_transaction_body (gimple gs)
4805 return *gimple_transaction_body_ptr (gs);
4808 /* Return the label associated with a GIMPLE_TRANSACTION. */
4810 static inline tree
4811 gimple_transaction_label (const_gimple gs)
4813 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4814 return gs->gimple_transaction.label;
4817 static inline tree *
4818 gimple_transaction_label_ptr (gimple gs)
4820 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4821 return &gs->gimple_transaction.label;
4824 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4826 static inline unsigned int
4827 gimple_transaction_subcode (const_gimple gs)
4829 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4830 return gs->gsbase.subcode;
4833 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4835 static inline void
4836 gimple_transaction_set_body (gimple gs, gimple_seq body)
4838 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4839 gs->gimple_transaction.body = body;
4842 /* Set the label associated with a GIMPLE_TRANSACTION. */
4844 static inline void
4845 gimple_transaction_set_label (gimple gs, tree label)
4847 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4848 gs->gimple_transaction.label = label;
4851 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4853 static inline void
4854 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4856 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4857 gs->gsbase.subcode = subcode;
4861 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4863 static inline tree *
4864 gimple_return_retval_ptr (const_gimple gs)
4866 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4867 return gimple_op_ptr (gs, 0);
4870 /* Return the return value for GIMPLE_RETURN GS. */
4872 static inline tree
4873 gimple_return_retval (const_gimple gs)
4875 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4876 return gimple_op (gs, 0);
4880 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4882 static inline void
4883 gimple_return_set_retval (gimple gs, tree retval)
4885 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4886 gimple_set_op (gs, 0, retval);
4890 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4892 #define CASE_GIMPLE_OMP \
4893 case GIMPLE_OMP_PARALLEL: \
4894 case GIMPLE_OMP_TASK: \
4895 case GIMPLE_OMP_FOR: \
4896 case GIMPLE_OMP_SECTIONS: \
4897 case GIMPLE_OMP_SECTIONS_SWITCH: \
4898 case GIMPLE_OMP_SINGLE: \
4899 case GIMPLE_OMP_SECTION: \
4900 case GIMPLE_OMP_MASTER: \
4901 case GIMPLE_OMP_ORDERED: \
4902 case GIMPLE_OMP_CRITICAL: \
4903 case GIMPLE_OMP_RETURN: \
4904 case GIMPLE_OMP_ATOMIC_LOAD: \
4905 case GIMPLE_OMP_ATOMIC_STORE: \
4906 case GIMPLE_OMP_CONTINUE
4908 static inline bool
4909 is_gimple_omp (const_gimple stmt)
4911 switch (gimple_code (stmt))
4913 CASE_GIMPLE_OMP:
4914 return true;
4915 default:
4916 return false;
4921 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4923 static inline bool
4924 gimple_nop_p (const_gimple g)
4926 return gimple_code (g) == GIMPLE_NOP;
4930 /* Return true if GS is a GIMPLE_RESX. */
4932 static inline bool
4933 is_gimple_resx (const_gimple gs)
4935 return gimple_code (gs) == GIMPLE_RESX;
4938 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4940 static inline enum br_predictor
4941 gimple_predict_predictor (gimple gs)
4943 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4944 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4948 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4950 static inline void
4951 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4953 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4954 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4955 | (unsigned) predictor;
4959 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4961 static inline enum prediction
4962 gimple_predict_outcome (gimple gs)
4964 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4965 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4969 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4971 static inline void
4972 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4974 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4975 if (outcome == TAKEN)
4976 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4977 else
4978 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4982 /* Return the type of the main expression computed by STMT. Return
4983 void_type_node if the statement computes nothing. */
4985 static inline tree
4986 gimple_expr_type (const_gimple stmt)
4988 enum gimple_code code = gimple_code (stmt);
4990 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4992 tree type;
4993 /* In general we want to pass out a type that can be substituted
4994 for both the RHS and the LHS types if there is a possibly
4995 useless conversion involved. That means returning the
4996 original RHS type as far as we can reconstruct it. */
4997 if (code == GIMPLE_CALL)
4998 type = gimple_call_return_type (stmt);
4999 else
5000 switch (gimple_assign_rhs_code (stmt))
5002 case POINTER_PLUS_EXPR:
5003 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5004 break;
5006 default:
5007 /* As fallback use the type of the LHS. */
5008 type = TREE_TYPE (gimple_get_lhs (stmt));
5009 break;
5011 return type;
5013 else if (code == GIMPLE_COND)
5014 return boolean_type_node;
5015 else
5016 return void_type_node;
5019 /* Return true if TYPE is a suitable type for a scalar register variable. */
5021 static inline bool
5022 is_gimple_reg_type (tree type)
5024 return !AGGREGATE_TYPE_P (type);
5027 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
5029 static inline gimple_stmt_iterator
5030 gsi_start_1 (gimple_seq *seq)
5032 gimple_stmt_iterator i;
5034 i.ptr = gimple_seq_first (*seq);
5035 i.seq = seq;
5036 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5038 return i;
5041 #define gsi_start(x) gsi_start_1(&(x))
5043 static inline gimple_stmt_iterator
5044 gsi_none (void)
5046 gimple_stmt_iterator i;
5047 i.ptr = NULL;
5048 i.seq = NULL;
5049 i.bb = NULL;
5050 return i;
5053 /* Return a new iterator pointing to the first statement in basic block BB. */
5055 static inline gimple_stmt_iterator
5056 gsi_start_bb (basic_block bb)
5058 gimple_stmt_iterator i;
5059 gimple_seq *seq;
5061 seq = bb_seq_addr (bb);
5062 i.ptr = gimple_seq_first (*seq);
5063 i.seq = seq;
5064 i.bb = bb;
5066 return i;
5070 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5072 static inline gimple_stmt_iterator
5073 gsi_last_1 (gimple_seq *seq)
5075 gimple_stmt_iterator i;
5077 i.ptr = gimple_seq_last (*seq);
5078 i.seq = seq;
5079 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5081 return i;
5084 #define gsi_last(x) gsi_last_1(&(x))
5086 /* Return a new iterator pointing to the last statement in basic block BB. */
5088 static inline gimple_stmt_iterator
5089 gsi_last_bb (basic_block bb)
5091 gimple_stmt_iterator i;
5092 gimple_seq *seq;
5094 seq = bb_seq_addr (bb);
5095 i.ptr = gimple_seq_last (*seq);
5096 i.seq = seq;
5097 i.bb = bb;
5099 return i;
5103 /* Return true if I is at the end of its sequence. */
5105 static inline bool
5106 gsi_end_p (gimple_stmt_iterator i)
5108 return i.ptr == NULL;
5112 /* Return true if I is one statement before the end of its sequence. */
5114 static inline bool
5115 gsi_one_before_end_p (gimple_stmt_iterator i)
5117 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5121 /* Advance the iterator to the next gimple statement. */
5123 static inline void
5124 gsi_next (gimple_stmt_iterator *i)
5126 i->ptr = i->ptr->gsbase.next;
5129 /* Advance the iterator to the previous gimple statement. */
5131 static inline void
5132 gsi_prev (gimple_stmt_iterator *i)
5134 gimple prev = i->ptr->gsbase.prev;
5135 if (prev->gsbase.next)
5136 i->ptr = prev;
5137 else
5138 i->ptr = NULL;
5141 /* Return the current stmt. */
5143 static inline gimple
5144 gsi_stmt (gimple_stmt_iterator i)
5146 return i.ptr;
5149 /* Return a block statement iterator that points to the first non-label
5150 statement in block BB. */
5152 static inline gimple_stmt_iterator
5153 gsi_after_labels (basic_block bb)
5155 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5157 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5158 gsi_next (&gsi);
5160 return gsi;
5163 /* Advance the iterator to the next non-debug gimple statement. */
5165 static inline void
5166 gsi_next_nondebug (gimple_stmt_iterator *i)
5170 gsi_next (i);
5172 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5175 /* Advance the iterator to the next non-debug gimple statement. */
5177 static inline void
5178 gsi_prev_nondebug (gimple_stmt_iterator *i)
5182 gsi_prev (i);
5184 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5187 /* Return a new iterator pointing to the first non-debug statement in
5188 basic block BB. */
5190 static inline gimple_stmt_iterator
5191 gsi_start_nondebug_bb (basic_block bb)
5193 gimple_stmt_iterator i = gsi_start_bb (bb);
5195 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5196 gsi_next_nondebug (&i);
5198 return i;
5201 /* Return a new iterator pointing to the last non-debug statement in
5202 basic block BB. */
5204 static inline gimple_stmt_iterator
5205 gsi_last_nondebug_bb (basic_block bb)
5207 gimple_stmt_iterator i = gsi_last_bb (bb);
5209 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5210 gsi_prev_nondebug (&i);
5212 return i;
5216 /* Return the basic block associated with this iterator. */
5218 static inline basic_block
5219 gsi_bb (gimple_stmt_iterator i)
5221 return i.bb;
5225 /* Return the sequence associated with this iterator. */
5227 static inline gimple_seq
5228 gsi_seq (gimple_stmt_iterator i)
5230 return *i.seq;
5234 enum gsi_iterator_update
5236 GSI_NEW_STMT, /* Only valid when single statement is added, move
5237 iterator to it. */
5238 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5239 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5240 for linking other statements in the same
5241 direction. */
5244 /* In gimple-iterator.c */
5245 gimple_stmt_iterator gsi_start_phis (basic_block);
5246 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5247 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5248 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5249 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5250 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5251 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5252 enum gsi_iterator_update);
5253 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5254 enum gsi_iterator_update);
5255 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5256 enum gsi_iterator_update);
5257 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5258 enum gsi_iterator_update);
5259 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5260 enum gsi_iterator_update);
5261 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5262 enum gsi_iterator_update);
5263 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5264 enum gsi_iterator_update);
5265 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5266 enum gsi_iterator_update);
5267 bool gsi_remove (gimple_stmt_iterator *, bool);
5268 gimple_stmt_iterator gsi_for_stmt (gimple);
5269 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5270 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5271 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5272 void gsi_insert_on_edge (edge, gimple);
5273 void gsi_insert_seq_on_edge (edge, gimple_seq);
5274 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5275 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5276 void gsi_commit_one_edge_insert (edge, basic_block *);
5277 void gsi_commit_edge_inserts (void);
5278 gimple gimple_call_copy_skip_args (gimple, bitmap);
5281 /* Convenience routines to walk all statements of a gimple function.
5282 Note that this is useful exclusively before the code is converted
5283 into SSA form. Once the program is in SSA form, the standard
5284 operand interface should be used to analyze/modify statements. */
5285 struct walk_stmt_info
5287 /* Points to the current statement being walked. */
5288 gimple_stmt_iterator gsi;
5290 /* Additional data that the callback functions may want to carry
5291 through the recursion. */
5292 void *info;
5294 /* Pointer map used to mark visited tree nodes when calling
5295 walk_tree on each operand. If set to NULL, duplicate tree nodes
5296 will be visited more than once. */
5297 struct pointer_set_t *pset;
5299 /* Operand returned by the callbacks. This is set when calling
5300 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5301 returns non-NULL, this field will contain the tree returned by
5302 the last callback. */
5303 tree callback_result;
5305 /* Indicates whether the operand being examined may be replaced
5306 with something that matches is_gimple_val (if true) or something
5307 slightly more complicated (if false). "Something" technically
5308 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5309 but we never try to form anything more complicated than that, so
5310 we don't bother checking.
5312 Also note that CALLBACK should update this flag while walking the
5313 sub-expressions of a statement. For instance, when walking the
5314 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5315 to true, however, when walking &var, the operand of that
5316 ADDR_EXPR does not need to be a GIMPLE value. */
5317 BOOL_BITFIELD val_only : 1;
5319 /* True if we are currently walking the LHS of an assignment. */
5320 BOOL_BITFIELD is_lhs : 1;
5322 /* Optional. Set to true by the callback functions if they made any
5323 changes. */
5324 BOOL_BITFIELD changed : 1;
5326 /* True if we're interested in location information. */
5327 BOOL_BITFIELD want_locations : 1;
5329 /* True if we've removed the statement that was processed. */
5330 BOOL_BITFIELD removed_stmt : 1;
5333 /* Callback for walk_gimple_stmt. Called for every statement found
5334 during traversal. The first argument points to the statement to
5335 walk. The second argument is a flag that the callback sets to
5336 'true' if it the callback handled all the operands and
5337 sub-statements of the statement (the default value of this flag is
5338 'false'). The third argument is an anonymous pointer to data
5339 to be used by the callback. */
5340 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5341 struct walk_stmt_info *);
5343 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5344 struct walk_stmt_info *);
5345 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5346 struct walk_stmt_info *);
5347 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5348 struct walk_stmt_info *);
5349 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5351 /* Enum and arrays used for allocation stats. Keep in sync with
5352 gimple.c:gimple_alloc_kind_names. */
5353 enum gimple_alloc_kind
5355 gimple_alloc_kind_assign, /* Assignments. */
5356 gimple_alloc_kind_phi, /* PHI nodes. */
5357 gimple_alloc_kind_cond, /* Conditionals. */
5358 gimple_alloc_kind_rest, /* Everything else. */
5359 gimple_alloc_kind_all
5362 extern int gimple_alloc_counts[];
5363 extern int gimple_alloc_sizes[];
5365 /* Return the allocation kind for a given stmt CODE. */
5366 static inline enum gimple_alloc_kind
5367 gimple_alloc_kind (enum gimple_code code)
5369 switch (code)
5371 case GIMPLE_ASSIGN:
5372 return gimple_alloc_kind_assign;
5373 case GIMPLE_PHI:
5374 return gimple_alloc_kind_phi;
5375 case GIMPLE_COND:
5376 return gimple_alloc_kind_cond;
5377 default:
5378 return gimple_alloc_kind_rest;
5382 extern void dump_gimple_statistics (void);
5384 /* In gimple-fold.c. */
5385 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5386 tree gimple_fold_builtin (gimple);
5387 bool fold_stmt (gimple_stmt_iterator *);
5388 bool fold_stmt_inplace (gimple_stmt_iterator *);
5389 tree get_symbol_constant_value (tree);
5390 tree canonicalize_constructor_val (tree, tree);
5391 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5392 enum tree_code, tree, tree);
5393 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5394 enum tree_code, tree, tree);
5396 bool gimple_val_nonnegative_real_p (tree);
5399 /* Set the location of all statements in SEQ to LOC. */
5401 static inline void
5402 gimple_seq_set_location (gimple_seq seq, location_t loc)
5404 for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
5405 gimple_set_location (gsi_stmt (i), loc);
5408 #endif /* GCC_GIMPLE_H */