fix other language issues, cmpxchg issues
[official-gcc.git] / gcc / gimple.h
blobe87679045a71b7b27a5d84bb011a17d1ea9bf3f9
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2013 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "pointer-set.h"
26 #include "vec.h"
27 #include "ggc.h"
28 #include "basic-block.h"
29 #include "tree.h"
30 #include "tree-ssa-operands.h"
31 #include "tree-ssa-alias.h"
32 #include "internal-fn.h"
34 typedef gimple gimple_seq_node;
36 /* For each block, the PHI nodes that need to be rewritten are stored into
37 these vectors. */
38 typedef vec<gimple> gimple_vec;
40 enum gimple_code {
41 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
42 #include "gimple.def"
43 #undef DEFGSCODE
44 LAST_AND_UNUSED_GIMPLE_CODE
47 extern const char *const gimple_code_name[];
48 extern const unsigned char gimple_rhs_class_table[];
50 /* Error out if a gimple tuple is addressed incorrectly. */
51 #if defined ENABLE_GIMPLE_CHECKING
52 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
53 extern void gimple_check_failed (const_gimple, const char *, int, \
54 const char *, enum gimple_code, \
55 enum tree_code) ATTRIBUTE_NORETURN;
57 #define GIMPLE_CHECK(GS, CODE) \
58 do { \
59 const_gimple __gs = (GS); \
60 if (gimple_code (__gs) != (CODE)) \
61 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
62 (CODE), ERROR_MARK); \
63 } while (0)
64 #else /* not ENABLE_GIMPLE_CHECKING */
65 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
66 #define GIMPLE_CHECK(GS, CODE) (void)0
67 #endif
69 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
70 get_gimple_rhs_class. */
71 enum gimple_rhs_class
73 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
74 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
75 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
76 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
77 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
78 name, a _DECL, a _REF, etc. */
81 /* Amount to shift gf_mask value to access these atomic fields. */
82 #define GF_ATOMIC_KIND_SHIFT 0
83 #define GF_ATOMIC_ARITH_OP_SHIFT 4
85 /* Specific flags for individual GIMPLE statements. These flags are
86 always stored in gimple_statement_base.subcode and they may only be
87 defined for statement codes that do not use sub-codes.
89 Values for the masks can overlap as long as the overlapping values
90 are never used in the same statement class.
92 The maximum mask value that can be defined is 1 << 15 (i.e., each
93 statement code can hold up to 16 bitflags).
95 Keep this list sorted. */
96 enum gf_mask {
97 GF_ASM_INPUT = 1 << 0,
98 GF_ASM_VOLATILE = 1 << 1,
99 GF_ATOMIC_ARITH_OP = 0x07 << GF_ATOMIC_ARITH_OP_SHIFT, /* 3 bits */
100 GF_ATOMIC_KIND = 0x0F << GF_ATOMIC_KIND_SHIFT, /* 4 bits */
101 GF_ATOMIC_SYNC = 1 << 14,
102 GF_ATOMIC_THREAD_FENCE = 1 << 15,
103 GF_ATOMIC_WEAK = 1 << 15,
104 GF_CALL_FROM_THUNK = 1 << 0,
105 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
106 GF_CALL_TAILCALL = 1 << 2,
107 GF_CALL_VA_ARG_PACK = 1 << 3,
108 GF_CALL_NOTHROW = 1 << 4,
109 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
110 GF_CALL_INTERNAL = 1 << 6,
111 GF_OMP_PARALLEL_COMBINED = 1 << 0,
113 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
114 a thread synchronization via some sort of barrier. The exact barrier
115 that would otherwise be emitted is dependent on the OMP statement with
116 which this return is associated. */
117 GF_OMP_RETURN_NOWAIT = 1 << 0,
119 GF_OMP_SECTION_LAST = 1 << 0,
120 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
121 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 typedef struct
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;
154 } gimple_stmt_iterator;
157 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
158 are for 64 bit hosts. */
160 struct GTY((chain_next ("%h.next"))) gimple_statement_base {
161 /* [ WORD 1 ]
162 Main identifying code for a tuple. */
163 ENUM_BITFIELD(gimple_code) code : 8;
165 /* Nonzero if a warning should not be emitted on this tuple. */
166 unsigned int no_warning : 1;
168 /* Nonzero if this tuple has been visited. Passes are responsible
169 for clearing this bit before using it. */
170 unsigned int visited : 1;
172 /* Nonzero if this tuple represents a non-temporal move. */
173 unsigned int nontemporal_move : 1;
175 /* Pass local flags. These flags are free for any pass to use as
176 they see fit. Passes should not assume that these flags contain
177 any useful value when the pass starts. Any initial state that
178 the pass requires should be set on entry to the pass. See
179 gimple_set_plf and gimple_plf for usage. */
180 unsigned int plf : 2;
182 /* Nonzero if this statement has been modified and needs to have its
183 operands rescanned. */
184 unsigned modified : 1;
186 /* Nonzero if this statement contains volatile operands. */
187 unsigned has_volatile_ops : 1;
189 /* The SUBCODE field can be used for tuple-specific flags for tuples
190 that do not require subcodes. Note that SUBCODE should be at
191 least as wide as tree codes, as several tuples store tree codes
192 in there. */
193 unsigned int subcode : 16;
195 /* UID of this statement. This is used by passes that want to
196 assign IDs to statements. It must be assigned and used by each
197 pass. By default it should be assumed to contain garbage. */
198 unsigned uid;
200 /* [ WORD 2 ]
201 Locus information for debug info. */
202 location_t location;
204 /* Number of operands in this tuple. */
205 unsigned num_ops;
207 /* [ WORD 3 ]
208 Basic block holding this statement. */
209 basic_block bb;
211 /* [ WORD 4-5 ]
212 Linked lists of gimple statements. The next pointers form
213 a NULL terminated list, the prev pointers are a cyclic list.
214 A gimple statement is hence also a double-ended list of
215 statements, with the pointer itself being the first element,
216 and the prev pointer being the last. */
217 gimple next;
218 gimple GTY((skip)) prev;
222 /* Base structure for tuples with operands. */
224 struct GTY(()) gimple_statement_with_ops_base
226 /* [ WORD 1-6 ] */
227 struct gimple_statement_base gsbase;
229 /* [ WORD 7 ]
230 SSA operand vectors. NOTE: It should be possible to
231 amalgamate these vectors with the operand vector OP. However,
232 the SSA operand vectors are organized differently and contain
233 more information (like immediate use chaining). */
234 struct use_optype_d GTY((skip (""))) *use_ops;
238 /* Statements that take register operands. */
240 struct GTY(()) gimple_statement_with_ops
242 /* [ WORD 1-7 ] */
243 struct gimple_statement_with_ops_base opbase;
245 /* [ WORD 8 ]
246 Operand vector. NOTE! This must always be the last field
247 of this structure. In particular, this means that this
248 structure cannot be embedded inside another one. */
249 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
253 /* Base for statements that take both memory and register operands. */
255 struct GTY(()) gimple_statement_with_memory_ops_base
257 /* [ WORD 1-7 ] */
258 struct gimple_statement_with_ops_base opbase;
260 /* [ WORD 8-9 ]
261 Virtual operands for this statement. The GC will pick them
262 up via the ssa_names array. */
263 tree GTY((skip (""))) vdef;
264 tree GTY((skip (""))) vuse;
268 /* Statements that take both memory and register operands. */
270 struct GTY(()) gimple_statement_with_memory_ops
272 /* [ WORD 1-9 ] */
273 struct gimple_statement_with_memory_ops_base membase;
275 /* [ WORD 10 ]
276 Operand vector. NOTE! This must always be the last field
277 of this structure. In particular, this means that this
278 structure cannot be embedded inside another one. */
279 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
283 /* Call statements that take both memory and register operands. */
285 struct GTY(()) gimple_statement_call
287 /* [ WORD 1-9 ] */
288 struct gimple_statement_with_memory_ops_base membase;
290 /* [ WORD 10-13 ] */
291 struct pt_solution call_used;
292 struct pt_solution call_clobbered;
294 /* [ WORD 14 ] */
295 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
296 tree GTY ((tag ("0"))) fntype;
297 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
298 } u;
300 /* [ WORD 15 ]
301 Operand vector. NOTE! This must always be the last field
302 of this structure. In particular, this means that this
303 structure cannot be embedded inside another one. */
304 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
307 /* Kind of GIMPLE_ATOMIC statements. 4 bits reserved. */
308 enum gimple_atomic_kind
310 /* 2 result kinds. */
311 GIMPLE_ATOMIC_COMPARE_EXCHANGE_GENERIC,
313 /* 1 result kinds. */
314 GIMPLE_ATOMIC_LOAD,
315 GIMPLE_ATOMIC_EXCHANGE,
316 GIMPLE_ATOMIC_COMPARE_EXCHANGE,
317 GIMPLE_ATOMIC_COMPARE_EXCHANGE_LIBRARY,
318 GIMPLE_ATOMIC_FETCH_OP,
319 GIMPLE_ATOMIC_OP_FETCH,
320 GIMPLE_ATOMIC_TEST_AND_SET,
322 /* 0 result kinds. */
323 GIMPLE_ATOMIC_LOAD_GENERIC,
324 GIMPLE_ATOMIC_STORE_GENERIC,
325 GIMPLE_ATOMIC_EXCHANGE_GENERIC,
326 GIMPLE_ATOMIC_STORE,
327 GIMPLE_ATOMIC_CLEAR,
328 GIMPLE_ATOMIC_FENCE
332 /* Arithmetic operations for the FETCH_OP and OP_FETCH statements. */
333 enum gimple_atomic_arith_op
335 GIMPLE_ATOMIC_ARITH_OP_ADD,
336 GIMPLE_ATOMIC_ARITH_OP_SUB,
337 GIMPLE_ATOMIC_ARITH_OP_AND,
338 GIMPLE_ATOMIC_ARITH_OP_XOR,
339 GIMPLE_ATOMIC_ARITH_OP_OR,
340 GIMPLE_ATOMIC_ARITH_OP_NAND
343 /* GIMPLE_ATOMIC statement. */
344 /* Layout of the OPS vector for the different atomic kinds. Capitalized fields
345 are passed by pointer.
346 LOAD | lhs | TARGET | order |
347 STORE | expr | TARGET | order |
348 EXCHANGE | lhs | expr | TARGET | order |
349 COMPARE_EXCHG| lhs | lhs2 | fail | expected | expr | TARGET | order |
350 FETCH | lhs | expr | TARGET | order |
351 TEST_AND_SET | lhs | TARGET | order |
352 CLEAR | TARGET| order |
353 FENCE | order |
355 Generic formats allow arbitrary sized objects so the LHS object is instead
356 passed by address
357 The other non-order fields are all pointers as well.
359 LOAD_GENERIC | RET | TARGET | order |
360 STORE_GENERIC | EXPR | TARGET | order |
361 EXCHANGE_GENERIC | RET | EXPR | TARGET | order
362 COMPARE_EXCHG_GENERIC | lhs | fail | EXPECTED | EXPR | TARGET | order |
364 There is a library format for compare exchange when it is known that an
365 external library call will be made. There is no point in expanding to a two
366 result instruction if it is going to have to be mapped back to a one result
367 library call, so the TARGET EXPECTED field is also passed by address.
369 COMPARE_EXCHG_LIBRARY | lhs | fail | expected | EXPR | TARGET | order |
371 The atomic kind is encoded in the subword.
372 The operation for FETCH_OP and OP_FETCH is also encoded in the subword.
376 struct GTY(()) gimple_statement_atomic
378 /* [ WORD 1-8 ] */
379 struct gimple_statement_with_memory_ops_base membase;
381 /* [ WORD 9 ] */
382 tree target_type;
384 /* [ WORD 10 ]
385 Operand vector. NOTE! This must always be the last field
386 of this structure. In particular, this means that this
387 structure cannot be embedded inside another one. */
388 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
392 /* OpenMP statements (#pragma omp). */
394 struct GTY(()) gimple_statement_omp {
395 /* [ WORD 1-6 ] */
396 struct gimple_statement_base gsbase;
398 /* [ WORD 7 ] */
399 gimple_seq body;
403 /* GIMPLE_BIND */
405 struct GTY(()) gimple_statement_bind {
406 /* [ WORD 1-6 ] */
407 struct gimple_statement_base gsbase;
409 /* [ WORD 7 ]
410 Variables declared in this scope. */
411 tree vars;
413 /* [ WORD 8 ]
414 This is different than the BLOCK field in gimple_statement_base,
415 which is analogous to TREE_BLOCK (i.e., the lexical block holding
416 this statement). This field is the equivalent of BIND_EXPR_BLOCK
417 in tree land (i.e., the lexical scope defined by this bind). See
418 gimple-low.c. */
419 tree block;
421 /* [ WORD 9 ] */
422 gimple_seq body;
426 /* GIMPLE_CATCH */
428 struct GTY(()) gimple_statement_catch {
429 /* [ WORD 1-6 ] */
430 struct gimple_statement_base gsbase;
432 /* [ WORD 7 ] */
433 tree types;
435 /* [ WORD 8 ] */
436 gimple_seq handler;
440 /* GIMPLE_EH_FILTER */
442 struct GTY(()) gimple_statement_eh_filter {
443 /* [ WORD 1-6 ] */
444 struct gimple_statement_base gsbase;
446 /* [ WORD 7 ]
447 Filter types. */
448 tree types;
450 /* [ WORD 8 ]
451 Failure actions. */
452 gimple_seq failure;
455 /* GIMPLE_EH_ELSE */
457 struct GTY(()) gimple_statement_eh_else {
458 /* [ WORD 1-6 ] */
459 struct gimple_statement_base gsbase;
461 /* [ WORD 7,8 ] */
462 gimple_seq n_body, e_body;
465 /* GIMPLE_EH_MUST_NOT_THROW */
467 struct GTY(()) gimple_statement_eh_mnt {
468 /* [ WORD 1-6 ] */
469 struct gimple_statement_base gsbase;
471 /* [ WORD 7 ] Abort function decl. */
472 tree fndecl;
475 /* GIMPLE_PHI */
477 struct GTY(()) gimple_statement_phi {
478 /* [ WORD 1-6 ] */
479 struct gimple_statement_base gsbase;
481 /* [ WORD 7 ] */
482 unsigned capacity;
483 unsigned nargs;
485 /* [ WORD 8 ] */
486 tree result;
488 /* [ WORD 9 ] */
489 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
493 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
495 struct GTY(()) gimple_statement_eh_ctrl
497 /* [ WORD 1-6 ] */
498 struct gimple_statement_base gsbase;
500 /* [ WORD 7 ]
501 Exception region number. */
502 int region;
506 /* GIMPLE_TRY */
508 struct GTY(()) gimple_statement_try {
509 /* [ WORD 1-6 ] */
510 struct gimple_statement_base gsbase;
512 /* [ WORD 7 ]
513 Expression to evaluate. */
514 gimple_seq eval;
516 /* [ WORD 8 ]
517 Cleanup expression. */
518 gimple_seq cleanup;
521 /* Kind of GIMPLE_TRY statements. */
522 enum gimple_try_flags
524 /* A try/catch. */
525 GIMPLE_TRY_CATCH = 1 << 0,
527 /* A try/finally. */
528 GIMPLE_TRY_FINALLY = 1 << 1,
529 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
531 /* Analogous to TRY_CATCH_IS_CLEANUP. */
532 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
535 /* GIMPLE_WITH_CLEANUP_EXPR */
537 struct GTY(()) gimple_statement_wce {
538 /* [ WORD 1-6 ] */
539 struct gimple_statement_base gsbase;
541 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
542 executed if an exception is thrown, not on normal exit of its
543 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
544 in TARGET_EXPRs. */
546 /* [ WORD 7 ]
547 Cleanup expression. */
548 gimple_seq cleanup;
552 /* GIMPLE_ASM */
554 struct GTY(()) gimple_statement_asm
556 /* [ WORD 1-9 ] */
557 struct gimple_statement_with_memory_ops_base membase;
559 /* [ WORD 10 ]
560 __asm__ statement. */
561 const char *string;
563 /* [ WORD 11 ]
564 Number of inputs, outputs, clobbers, labels. */
565 unsigned char ni;
566 unsigned char no;
567 unsigned char nc;
568 unsigned char nl;
570 /* [ WORD 12 ]
571 Operand vector. NOTE! This must always be the last field
572 of this structure. In particular, this means that this
573 structure cannot be embedded inside another one. */
574 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
577 /* GIMPLE_OMP_CRITICAL */
579 struct GTY(()) gimple_statement_omp_critical {
580 /* [ WORD 1-7 ] */
581 struct gimple_statement_omp omp;
583 /* [ WORD 8 ]
584 Critical section name. */
585 tree name;
589 struct GTY(()) gimple_omp_for_iter {
590 /* Condition code. */
591 enum tree_code cond;
593 /* Index variable. */
594 tree index;
596 /* Initial value. */
597 tree initial;
599 /* Final value. */
600 tree final;
602 /* Increment. */
603 tree incr;
606 /* GIMPLE_OMP_FOR */
608 struct GTY(()) gimple_statement_omp_for {
609 /* [ WORD 1-7 ] */
610 struct gimple_statement_omp omp;
612 /* [ WORD 8 ] */
613 tree clauses;
615 /* [ WORD 9 ]
616 Number of elements in iter array. */
617 size_t collapse;
619 /* [ WORD 10 ] */
620 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
622 /* [ WORD 11 ]
623 Pre-body evaluated before the loop body begins. */
624 gimple_seq pre_body;
628 /* GIMPLE_OMP_PARALLEL */
630 struct GTY(()) gimple_statement_omp_parallel {
631 /* [ WORD 1-7 ] */
632 struct gimple_statement_omp omp;
634 /* [ WORD 8 ]
635 Clauses. */
636 tree clauses;
638 /* [ WORD 9 ]
639 Child function holding the body of the parallel region. */
640 tree child_fn;
642 /* [ WORD 10 ]
643 Shared data argument. */
644 tree data_arg;
648 /* GIMPLE_OMP_TASK */
650 struct GTY(()) gimple_statement_omp_task {
651 /* [ WORD 1-10 ] */
652 struct gimple_statement_omp_parallel par;
654 /* [ WORD 11 ]
655 Child function holding firstprivate initialization if needed. */
656 tree copy_fn;
658 /* [ WORD 12-13 ]
659 Size and alignment in bytes of the argument data block. */
660 tree arg_size;
661 tree arg_align;
665 /* GIMPLE_OMP_SECTION */
666 /* Uses struct gimple_statement_omp. */
669 /* GIMPLE_OMP_SECTIONS */
671 struct GTY(()) gimple_statement_omp_sections {
672 /* [ WORD 1-7 ] */
673 struct gimple_statement_omp omp;
675 /* [ WORD 8 ] */
676 tree clauses;
678 /* [ WORD 9 ]
679 The control variable used for deciding which of the sections to
680 execute. */
681 tree control;
684 /* GIMPLE_OMP_CONTINUE.
686 Note: This does not inherit from gimple_statement_omp, because we
687 do not need the body field. */
689 struct GTY(()) gimple_statement_omp_continue {
690 /* [ WORD 1-6 ] */
691 struct gimple_statement_base gsbase;
693 /* [ WORD 7 ] */
694 tree control_def;
696 /* [ WORD 8 ] */
697 tree control_use;
700 /* GIMPLE_OMP_SINGLE */
702 struct GTY(()) gimple_statement_omp_single {
703 /* [ WORD 1-7 ] */
704 struct gimple_statement_omp omp;
706 /* [ WORD 7 ] */
707 tree clauses;
711 /* GIMPLE_OMP_ATOMIC_LOAD.
712 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
713 contains a sequence, which we don't need here. */
715 struct GTY(()) gimple_statement_omp_atomic_load {
716 /* [ WORD 1-6 ] */
717 struct gimple_statement_base gsbase;
719 /* [ WORD 7-8 ] */
720 tree rhs, lhs;
723 /* GIMPLE_OMP_ATOMIC_STORE.
724 See note on GIMPLE_OMP_ATOMIC_LOAD. */
726 struct GTY(()) gimple_statement_omp_atomic_store {
727 /* [ WORD 1-6 ] */
728 struct gimple_statement_base gsbase;
730 /* [ WORD 7 ] */
731 tree val;
734 /* GIMPLE_TRANSACTION. */
736 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
738 /* The __transaction_atomic was declared [[outer]] or it is
739 __transaction_relaxed. */
740 #define GTMA_IS_OUTER (1u << 0)
741 #define GTMA_IS_RELAXED (1u << 1)
742 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
744 /* The transaction is seen to not have an abort. */
745 #define GTMA_HAVE_ABORT (1u << 2)
746 /* The transaction is seen to have loads or stores. */
747 #define GTMA_HAVE_LOAD (1u << 3)
748 #define GTMA_HAVE_STORE (1u << 4)
749 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
750 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
751 /* The transaction WILL enter serial irrevocable mode.
752 An irrevocable block post-dominates the entire transaction, such
753 that all invocations of the transaction will go serial-irrevocable.
754 In such case, we don't bother instrumenting the transaction, and
755 tell the runtime that it should begin the transaction in
756 serial-irrevocable mode. */
757 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
759 struct GTY(()) gimple_statement_transaction
761 /* [ WORD 1-9 ] */
762 struct gimple_statement_with_memory_ops_base gsbase;
764 /* [ WORD 10 ] */
765 gimple_seq body;
767 /* [ WORD 11 ] */
768 tree label;
771 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
772 enum gimple_statement_structure_enum {
773 #include "gsstruct.def"
774 LAST_GSS_ENUM
776 #undef DEFGSSTRUCT
779 /* Define the overall contents of a gimple tuple. It may be any of the
780 structures declared above for various types of tuples. */
782 union GTY ((desc ("gimple_statement_structure (&%h)"),
783 chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d {
784 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
785 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
786 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
787 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
788 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
789 struct gimple_statement_atomic GTY ((tag("GSS_ATOMIC"))) gimple_atomic;
790 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
791 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
792 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
793 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
794 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
795 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
796 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
797 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
798 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
799 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
800 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
801 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
802 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
803 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
804 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
805 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
806 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
807 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
808 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
809 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
810 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
813 /* In gimple.c. */
815 /* Offset in bytes to the location of the operand vector.
816 Zero if there is no operand vector for this tuple structure. */
817 extern size_t const gimple_ops_offset_[];
819 /* Map GIMPLE codes to GSS codes. */
820 extern enum gimple_statement_structure_enum const gss_for_code_[];
822 /* This variable holds the currently expanded gimple statement for purposes
823 of comminucating the profile info to the builtin expanders. */
824 extern gimple currently_expanding_gimple_stmt;
826 gimple gimple_build_return (tree);
828 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
829 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
831 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
833 gimple
834 gimple_build_assign_with_ops (enum tree_code, tree,
835 tree, tree CXX_MEM_STAT_INFO);
836 gimple
837 gimple_build_assign_with_ops (enum tree_code, tree,
838 tree, tree, tree CXX_MEM_STAT_INFO);
840 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
841 #define gimple_build_debug_bind(var,val,stmt) \
842 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
843 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
844 #define gimple_build_debug_source_bind(var,val,stmt) \
845 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
848 gimple gimple_build_atomic_load (tree, tree, tree);
849 gimple gimple_build_atomic_load_generic (tree, tree, tree, tree);
850 gimple gimple_build_atomic_store (tree, tree, tree, tree);
851 gimple gimple_build_atomic_store_generic (tree, tree, tree, tree);
852 gimple gimple_build_atomic_exchange (tree, tree, tree, tree);
853 gimple gimple_build_atomic_exchange_generic (tree, tree, tree, tree, tree);
854 gimple gimple_build_atomic_compare_exchange (tree, tree, tree, tree, tree,
855 tree, bool);
856 gimple gimple_build_atomic_compare_exchange_generic (tree, tree, tree, tree,
857 tree, tree, bool);
858 gimple gimple_build_atomic_compare_exchange_library (tree, tree, tree, tree,
859 tree, tree, bool);
860 gimple gimple_build_atomic_fetch_op (tree, tree, tree, enum tree_code, tree);
861 gimple gimple_build_atomic_op_fetch (tree, tree, tree, enum tree_code, tree);
862 gimple gimple_build_atomic_test_and_set (tree, tree);
863 gimple gimple_build_atomic_clear (tree, tree);
864 gimple gimple_build_atomic_fence (tree, bool);
866 const char *gimple_atomic_op_name (const_gimple);
867 const char *gimple_atomic_type_size_string (const_gimple);
868 tree atomic_function_required_type (tree function_decl);
870 gimple gimple_build_call_vec (tree, vec<tree> );
871 gimple gimple_build_call (tree, unsigned, ...);
872 gimple gimple_build_call_valist (tree, unsigned, va_list);
873 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
874 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
875 gimple gimple_build_call_from_tree (tree);
876 gimple gimplify_assign (tree, tree, gimple_seq *);
877 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
878 gimple gimple_build_label (tree label);
879 gimple gimple_build_goto (tree dest);
880 gimple gimple_build_nop (void);
881 gimple gimple_build_bind (tree, gimple_seq, tree);
882 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
883 vec<tree, va_gc> *, vec<tree, va_gc> *,
884 vec<tree, va_gc> *);
885 gimple gimple_build_catch (tree, gimple_seq);
886 gimple gimple_build_eh_filter (tree, gimple_seq);
887 gimple gimple_build_eh_must_not_throw (tree);
888 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
889 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
890 gimple gimple_build_wce (gimple_seq);
891 gimple gimple_build_resx (int);
892 gimple gimple_build_eh_dispatch (int);
893 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
894 gimple gimple_build_switch (tree, tree, vec<tree> );
895 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
896 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
897 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
898 gimple gimple_build_omp_critical (gimple_seq, tree);
899 gimple gimple_build_omp_section (gimple_seq);
900 gimple gimple_build_omp_continue (tree, tree);
901 gimple gimple_build_omp_master (gimple_seq);
902 gimple gimple_build_omp_return (bool);
903 gimple gimple_build_omp_ordered (gimple_seq);
904 gimple gimple_build_omp_sections (gimple_seq, tree);
905 gimple gimple_build_omp_sections_switch (void);
906 gimple gimple_build_omp_single (gimple_seq, tree);
907 gimple gimple_build_cdt (tree, tree);
908 gimple gimple_build_omp_atomic_load (tree, tree);
909 gimple gimple_build_omp_atomic_store (tree);
910 gimple gimple_build_transaction (gimple_seq, tree);
911 gimple gimple_build_predict (enum br_predictor, enum prediction);
912 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
913 void sort_case_labels (vec<tree> );
914 void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
915 void gimple_set_body (tree, gimple_seq);
916 gimple_seq gimple_body (tree);
917 bool gimple_has_body_p (tree);
918 gimple_seq gimple_seq_alloc (void);
919 void gimple_seq_free (gimple_seq);
920 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
921 gimple_seq gimple_seq_copy (gimple_seq);
922 bool gimple_call_same_target_p (const_gimple, const_gimple);
923 int gimple_call_flags (const_gimple);
924 int gimple_call_return_flags (const_gimple);
925 int gimple_call_arg_flags (const_gimple, unsigned);
926 void gimple_call_reset_alias_info (gimple);
927 bool gimple_assign_copy_p (gimple);
928 bool gimple_assign_ssa_name_copy_p (gimple);
929 bool gimple_assign_unary_nop_p (gimple);
930 void gimple_set_bb (gimple, basic_block);
931 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
932 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
933 tree, tree, tree);
934 tree gimple_get_lhs (const_gimple);
935 void gimple_set_lhs (gimple, tree);
936 void gimple_replace_lhs (gimple, tree);
937 gimple gimple_copy (gimple);
938 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
939 gimple gimple_build_cond_from_tree (tree, tree, tree);
940 void gimple_cond_set_condition_from_tree (gimple, tree);
941 bool gimple_has_side_effects (const_gimple);
942 bool gimple_could_trap_p (gimple);
943 bool gimple_could_trap_p_1 (gimple, bool, bool);
944 bool gimple_assign_rhs_could_trap_p (gimple);
945 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
946 bool empty_body_p (gimple_seq);
947 unsigned get_gimple_rhs_num_ops (enum tree_code);
948 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
949 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
950 const char *gimple_decl_printable_name (tree, int);
951 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
952 tree gimple_extract_devirt_binfo_from_cst (tree);
954 /* Returns true iff T is a scalar register variable. */
955 extern bool is_gimple_reg (tree);
956 /* Returns true iff T is any sort of variable. */
957 extern bool is_gimple_variable (tree);
958 /* Returns true iff T is any sort of symbol. */
959 extern bool is_gimple_id (tree);
960 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
961 extern bool is_gimple_min_lval (tree);
962 /* Returns true iff T is something whose address can be taken. */
963 extern bool is_gimple_addressable (tree);
964 /* Returns true iff T is any valid GIMPLE lvalue. */
965 extern bool is_gimple_lvalue (tree);
967 /* Returns true iff T is a GIMPLE address. */
968 bool is_gimple_address (const_tree);
969 /* Returns true iff T is a GIMPLE invariant address. */
970 bool is_gimple_invariant_address (const_tree);
971 /* Returns true iff T is a GIMPLE invariant address at interprocedural
972 level. */
973 bool is_gimple_ip_invariant_address (const_tree);
974 /* Returns true iff T is a valid GIMPLE constant. */
975 bool is_gimple_constant (const_tree);
976 /* Returns true iff T is a GIMPLE restricted function invariant. */
977 extern bool is_gimple_min_invariant (const_tree);
978 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
979 extern bool is_gimple_ip_invariant (const_tree);
980 /* Returns true iff T is a GIMPLE rvalue. */
981 extern bool is_gimple_val (tree);
982 /* Returns true iff T is a GIMPLE asm statement input. */
983 extern bool is_gimple_asm_val (tree);
984 /* Returns true iff T is a valid address operand of a MEM_REF. */
985 bool is_gimple_mem_ref_addr (tree);
987 /* Returns true iff T is a valid if-statement condition. */
988 extern bool is_gimple_condexpr (tree);
990 /* Returns true iff T is a valid call address expression. */
991 extern bool is_gimple_call_addr (tree);
993 /* Return TRUE iff stmt is a call to a built-in function. */
994 extern bool is_gimple_builtin_call (gimple stmt);
996 extern void recalculate_side_effects (tree);
997 extern bool gimple_compare_field_offset (tree, tree);
998 extern tree gimple_register_canonical_type (tree);
999 extern void print_gimple_types_stats (const char *);
1000 extern void free_gimple_type_tables (void);
1001 extern tree gimple_unsigned_type (tree);
1002 extern tree gimple_signed_type (tree);
1003 extern alias_set_type gimple_get_alias_set (tree);
1004 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
1005 unsigned *);
1006 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
1007 bool (*)(gimple, tree, void *),
1008 bool (*)(gimple, tree, void *),
1009 bool (*)(gimple, tree, void *));
1010 extern bool walk_stmt_load_store_ops (gimple, void *,
1011 bool (*)(gimple, tree, void *),
1012 bool (*)(gimple, tree, void *));
1013 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1014 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
1015 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
1016 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1018 /* In gimplify.c */
1019 extern tree create_tmp_var_raw (tree, const char *);
1020 extern tree create_tmp_var_name (const char *);
1021 extern tree create_tmp_var (tree, const char *);
1022 extern tree create_tmp_reg (tree, const char *);
1023 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
1024 extern tree get_formal_tmp_var (tree, gimple_seq *);
1025 extern void declare_vars (tree, gimple, bool);
1026 extern void annotate_all_with_location (gimple_seq, location_t);
1028 /* Validation of GIMPLE expressions. Note that these predicates only check
1029 the basic form of the expression, they don't recurse to make sure that
1030 underlying nodes are also of the right form. */
1031 typedef bool (*gimple_predicate)(tree);
1034 /* FIXME we should deduce this from the predicate. */
1035 enum fallback {
1036 fb_none = 0, /* Do not generate a temporary. */
1038 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
1039 gimplified expression. */
1041 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
1042 gimplified expression. */
1044 fb_mayfail = 4, /* Gimplification may fail. Error issued
1045 afterwards. */
1046 fb_either= fb_rvalue | fb_lvalue
1049 typedef int fallback_t;
1051 enum gimplify_status {
1052 GS_ERROR = -2, /* Something Bad Seen. */
1053 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
1054 GS_OK = 0, /* We did something, maybe more to do. */
1055 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1058 struct gimplify_ctx
1060 struct gimplify_ctx *prev_context;
1062 vec<gimple> bind_expr_stack;
1063 tree temps;
1064 gimple_seq conditional_cleanups;
1065 tree exit_label;
1066 tree return_temp;
1068 vec<tree> case_labels;
1069 /* The formal temporary table. Should this be persistent? */
1070 htab_t temp_htab;
1072 int conditions;
1073 bool save_stack;
1074 bool into_ssa;
1075 bool allow_rhs_cond_expr;
1076 bool in_cleanup_point_expr;
1079 /* Return true if gimplify_one_sizepos doesn't need to gimplify
1080 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
1081 fields). */
1082 static inline bool
1083 is_gimple_sizepos (tree expr)
1085 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
1086 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
1087 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
1088 function, the gimplifier will want to replace it with a new variable,
1089 but that will cause problems if this type is from outside the function.
1090 It's OK to have that here. */
1091 return (expr == NULL_TREE
1092 || TREE_CONSTANT (expr)
1093 || TREE_CODE (expr) == VAR_DECL
1094 || CONTAINS_PLACEHOLDER_P (expr));
1097 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1098 bool (*) (tree), fallback_t);
1099 extern void gimplify_type_sizes (tree, gimple_seq *);
1100 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1101 enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *,
1102 bool, tree);
1103 extern bool gimplify_stmt (tree *, gimple_seq *);
1104 extern gimple gimplify_body (tree, bool);
1105 extern void push_gimplify_context (struct gimplify_ctx *);
1106 extern void pop_gimplify_context (gimple);
1107 extern void gimplify_and_add (tree, gimple_seq *);
1109 /* Miscellaneous helpers. */
1110 extern void gimple_add_tmp_var (tree);
1111 extern gimple gimple_current_bind_expr (void);
1112 extern vec<gimple> gimple_bind_expr_stack (void);
1113 extern tree voidify_wrapper_expr (tree, tree);
1114 extern tree build_and_jump (tree *);
1115 extern tree force_labels_r (tree *, int *, void *);
1116 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1117 gimple_seq *);
1118 struct gimplify_omp_ctx;
1119 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1120 extern tree gimple_boolify (tree);
1121 extern gimple_predicate rhs_predicate_for (tree);
1122 extern tree canonicalize_cond_expr_cond (tree);
1124 /* In omp-low.c. */
1125 extern tree omp_reduction_init (tree, tree);
1127 /* In trans-mem.c. */
1128 extern void diagnose_tm_safe_errors (tree);
1129 extern void compute_transaction_bits (void);
1131 /* In tree-nested.c. */
1132 extern void lower_nested_functions (tree);
1133 extern void insert_field_into_struct (tree, tree);
1135 /* In gimplify.c. */
1136 extern void gimplify_function_tree (tree);
1138 /* In cfgexpand.c. */
1139 extern tree gimple_assign_rhs_to_tree (gimple);
1140 extern void expand_gimple_assign_move (tree, rtx, rtx, bool);
1142 /* In gimple-atomic.c. */
1143 extern void expand_gimple_atomic_load (gimple);
1144 extern void expand_gimple_atomic_load_generic (gimple);
1145 extern void expand_gimple_atomic_store (gimple);
1146 extern void expand_gimple_atomic_store_generic (gimple);
1147 extern void expand_gimple_atomic_exchange (gimple);
1148 extern void expand_gimple_atomic_exchange_generic (gimple);
1149 extern void expand_gimple_atomic_compare_exchange (gimple);
1150 extern void expand_gimple_atomic_compare_exchange_generic (gimple);
1151 extern void expand_gimple_atomic_compare_exchange_library (gimple);
1152 extern void expand_gimple_atomic_fetch_op (gimple);
1153 extern void expand_gimple_atomic_op_fetch (gimple);
1154 extern void expand_gimple_atomic_test_and_set (gimple);
1155 extern void expand_gimple_atomic_clear (gimple);
1156 extern void expand_gimple_atomic_fence (gimple);
1158 extern enum gimplify_status gimplify_atomic_expr (tree *, gimple_seq *,
1159 gimple_seq *);
1160 extern enum gimplify_status gimplify_atomic_call_expr (tree *, gimple_seq *);
1164 /* In builtins.c */
1165 extern bool validate_gimple_arglist (const_gimple, ...);
1167 /* In tree-ssa.c */
1168 extern bool tree_ssa_useless_type_conversion (tree);
1169 extern tree tree_ssa_strip_useless_type_conversions (tree);
1170 extern bool useless_type_conversion_p (tree, tree);
1171 extern bool types_compatible_p (tree, tree);
1173 /* Return the first node in GIMPLE sequence S. */
1175 static inline gimple_seq_node
1176 gimple_seq_first (gimple_seq s)
1178 return s;
1182 /* Return the first statement in GIMPLE sequence S. */
1184 static inline gimple
1185 gimple_seq_first_stmt (gimple_seq s)
1187 gimple_seq_node n = gimple_seq_first (s);
1188 return n;
1192 /* Return the last node in GIMPLE sequence S. */
1194 static inline gimple_seq_node
1195 gimple_seq_last (gimple_seq s)
1197 return s ? s->gsbase.prev : NULL;
1201 /* Return the last statement in GIMPLE sequence S. */
1203 static inline gimple
1204 gimple_seq_last_stmt (gimple_seq s)
1206 gimple_seq_node n = gimple_seq_last (s);
1207 return n;
1211 /* Set the last node in GIMPLE sequence *PS to LAST. */
1213 static inline void
1214 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1216 (*ps)->gsbase.prev = last;
1220 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1222 static inline void
1223 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1225 *ps = first;
1229 /* Return true if GIMPLE sequence S is empty. */
1231 static inline bool
1232 gimple_seq_empty_p (gimple_seq s)
1234 return s == NULL;
1238 void gimple_seq_add_stmt (gimple_seq *, gimple);
1240 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1241 *SEQ_P is NULL, a new sequence is allocated. This function is
1242 similar to gimple_seq_add_stmt, but does not scan the operands.
1243 During gimplification, we need to manipulate statement sequences
1244 before the def/use vectors have been constructed. */
1245 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1247 /* Allocate a new sequence and initialize its first element with STMT. */
1249 static inline gimple_seq
1250 gimple_seq_alloc_with_stmt (gimple stmt)
1252 gimple_seq seq = NULL;
1253 gimple_seq_add_stmt (&seq, stmt);
1254 return seq;
1258 /* Returns the sequence of statements in BB. */
1260 static inline gimple_seq
1261 bb_seq (const_basic_block bb)
1263 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1266 static inline gimple_seq *
1267 bb_seq_addr (basic_block bb)
1269 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1272 /* Sets the sequence of statements in BB to SEQ. */
1274 static inline void
1275 set_bb_seq (basic_block bb, gimple_seq seq)
1277 gcc_checking_assert (!(bb->flags & BB_RTL));
1278 bb->il.gimple.seq = seq;
1282 /* Return the code for GIMPLE statement G. */
1284 static inline enum gimple_code
1285 gimple_code (const_gimple g)
1287 return g->gsbase.code;
1291 /* Return the GSS code used by a GIMPLE code. */
1293 static inline enum gimple_statement_structure_enum
1294 gss_for_code (enum gimple_code code)
1296 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1297 return gss_for_code_[code];
1301 /* Return which GSS code is used by GS. */
1303 static inline enum gimple_statement_structure_enum
1304 gimple_statement_structure (gimple gs)
1306 return gss_for_code (gimple_code (gs));
1310 /* Return true if statement G has sub-statements. This is only true for
1311 High GIMPLE statements. */
1313 static inline bool
1314 gimple_has_substatements (gimple g)
1316 switch (gimple_code (g))
1318 case GIMPLE_BIND:
1319 case GIMPLE_CATCH:
1320 case GIMPLE_EH_FILTER:
1321 case GIMPLE_EH_ELSE:
1322 case GIMPLE_TRY:
1323 case GIMPLE_OMP_FOR:
1324 case GIMPLE_OMP_MASTER:
1325 case GIMPLE_OMP_ORDERED:
1326 case GIMPLE_OMP_SECTION:
1327 case GIMPLE_OMP_PARALLEL:
1328 case GIMPLE_OMP_TASK:
1329 case GIMPLE_OMP_SECTIONS:
1330 case GIMPLE_OMP_SINGLE:
1331 case GIMPLE_OMP_CRITICAL:
1332 case GIMPLE_WITH_CLEANUP_EXPR:
1333 case GIMPLE_TRANSACTION:
1334 return true;
1336 default:
1337 return false;
1342 /* Return the basic block holding statement G. */
1344 static inline basic_block
1345 gimple_bb (const_gimple g)
1347 return g->gsbase.bb;
1351 /* Return the lexical scope block holding statement G. */
1353 static inline tree
1354 gimple_block (const_gimple g)
1356 return LOCATION_BLOCK (g->gsbase.location);
1360 /* Set BLOCK to be the lexical scope block holding statement G. */
1362 static inline void
1363 gimple_set_block (gimple g, tree block)
1365 if (block)
1366 g->gsbase.location =
1367 COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block);
1368 else
1369 g->gsbase.location = LOCATION_LOCUS (g->gsbase.location);
1373 /* Return location information for statement G. */
1375 static inline location_t
1376 gimple_location (const_gimple g)
1378 return g->gsbase.location;
1381 /* Return pointer to location information for statement G. */
1383 static inline const location_t *
1384 gimple_location_ptr (const_gimple g)
1386 return &g->gsbase.location;
1390 /* Set location information for statement G. */
1392 static inline void
1393 gimple_set_location (gimple g, location_t location)
1395 g->gsbase.location = location;
1399 /* Return true if G contains location information. */
1401 static inline bool
1402 gimple_has_location (const_gimple g)
1404 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1408 /* Return the file name of the location of STMT. */
1410 static inline const char *
1411 gimple_filename (const_gimple stmt)
1413 return LOCATION_FILE (gimple_location (stmt));
1417 /* Return the line number of the location of STMT. */
1419 static inline int
1420 gimple_lineno (const_gimple stmt)
1422 return LOCATION_LINE (gimple_location (stmt));
1426 /* Determine whether SEQ is a singleton. */
1428 static inline bool
1429 gimple_seq_singleton_p (gimple_seq seq)
1431 return ((gimple_seq_first (seq) != NULL)
1432 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1435 /* Return true if no warnings should be emitted for statement STMT. */
1437 static inline bool
1438 gimple_no_warning_p (const_gimple stmt)
1440 return stmt->gsbase.no_warning;
1443 /* Set the no_warning flag of STMT to NO_WARNING. */
1445 static inline void
1446 gimple_set_no_warning (gimple stmt, bool no_warning)
1448 stmt->gsbase.no_warning = (unsigned) no_warning;
1451 /* Set the visited status on statement STMT to VISITED_P. */
1453 static inline void
1454 gimple_set_visited (gimple stmt, bool visited_p)
1456 stmt->gsbase.visited = (unsigned) visited_p;
1460 /* Return the visited status for statement STMT. */
1462 static inline bool
1463 gimple_visited_p (gimple stmt)
1465 return stmt->gsbase.visited;
1469 /* Set pass local flag PLF on statement STMT to VAL_P. */
1471 static inline void
1472 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1474 if (val_p)
1475 stmt->gsbase.plf |= (unsigned int) plf;
1476 else
1477 stmt->gsbase.plf &= ~((unsigned int) plf);
1481 /* Return the value of pass local flag PLF on statement STMT. */
1483 static inline unsigned int
1484 gimple_plf (gimple stmt, enum plf_mask plf)
1486 return stmt->gsbase.plf & ((unsigned int) plf);
1490 /* Set the UID of statement. */
1492 static inline void
1493 gimple_set_uid (gimple g, unsigned uid)
1495 g->gsbase.uid = uid;
1499 /* Return the UID of statement. */
1501 static inline unsigned
1502 gimple_uid (const_gimple g)
1504 return g->gsbase.uid;
1508 /* Make statement G a singleton sequence. */
1510 static inline void
1511 gimple_init_singleton (gimple g)
1513 g->gsbase.next = NULL;
1514 g->gsbase.prev = g;
1518 /* Return true if GIMPLE statement G has register or memory operands. */
1520 static inline bool
1521 gimple_has_ops (const_gimple g)
1523 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1527 /* Return true if GIMPLE statement G has memory operands. */
1529 static inline bool
1530 gimple_has_mem_ops (const_gimple g)
1532 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1536 /* Return the set of USE operands for statement G. */
1538 static inline struct use_optype_d *
1539 gimple_use_ops (const_gimple g)
1541 if (!gimple_has_ops (g))
1542 return NULL;
1543 return g->gsops.opbase.use_ops;
1547 /* Set USE to be the set of USE operands for statement G. */
1549 static inline void
1550 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1552 gcc_gimple_checking_assert (gimple_has_ops (g));
1553 g->gsops.opbase.use_ops = use;
1557 /* Return the set of VUSE operand for statement G. */
1559 static inline use_operand_p
1560 gimple_vuse_op (const_gimple g)
1562 struct use_optype_d *ops;
1563 if (!gimple_has_mem_ops (g))
1564 return NULL_USE_OPERAND_P;
1565 ops = g->gsops.opbase.use_ops;
1566 if (ops
1567 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1568 return USE_OP_PTR (ops);
1569 return NULL_USE_OPERAND_P;
1572 /* Return the set of VDEF operand for statement G. */
1574 static inline def_operand_p
1575 gimple_vdef_op (gimple g)
1577 if (!gimple_has_mem_ops (g))
1578 return NULL_DEF_OPERAND_P;
1579 if (g->gsmembase.vdef)
1580 return &g->gsmembase.vdef;
1581 return NULL_DEF_OPERAND_P;
1585 /* Return the single VUSE operand of the statement G. */
1587 static inline tree
1588 gimple_vuse (const_gimple g)
1590 if (!gimple_has_mem_ops (g))
1591 return NULL_TREE;
1592 return g->gsmembase.vuse;
1595 /* Return the single VDEF operand of the statement G. */
1597 static inline tree
1598 gimple_vdef (const_gimple g)
1600 if (!gimple_has_mem_ops (g))
1601 return NULL_TREE;
1602 return g->gsmembase.vdef;
1605 /* Return the single VUSE operand of the statement G. */
1607 static inline tree *
1608 gimple_vuse_ptr (gimple g)
1610 if (!gimple_has_mem_ops (g))
1611 return NULL;
1612 return &g->gsmembase.vuse;
1615 /* Return the single VDEF operand of the statement G. */
1617 static inline tree *
1618 gimple_vdef_ptr (gimple g)
1620 if (!gimple_has_mem_ops (g))
1621 return NULL;
1622 return &g->gsmembase.vdef;
1625 /* Set the single VUSE operand of the statement G. */
1627 static inline void
1628 gimple_set_vuse (gimple g, tree vuse)
1630 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1631 g->gsmembase.vuse = vuse;
1634 /* Set the single VDEF operand of the statement G. */
1636 static inline void
1637 gimple_set_vdef (gimple g, tree vdef)
1639 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1640 g->gsmembase.vdef = vdef;
1644 /* Return true if statement G has operands and the modified field has
1645 been set. */
1647 static inline bool
1648 gimple_modified_p (const_gimple g)
1650 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1654 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1655 a MODIFIED field. */
1657 static inline void
1658 gimple_set_modified (gimple s, bool modifiedp)
1660 if (gimple_has_ops (s))
1661 s->gsbase.modified = (unsigned) modifiedp;
1665 /* Return the tree code for the expression computed by STMT. This is
1666 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1667 GIMPLE_CALL, return CALL_EXPR as the expression code for
1668 consistency. This is useful when the caller needs to deal with the
1669 three kinds of computation that GIMPLE supports. */
1671 static inline enum tree_code
1672 gimple_expr_code (const_gimple stmt)
1674 enum gimple_code code = gimple_code (stmt);
1675 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1676 return (enum tree_code) stmt->gsbase.subcode;
1677 else
1679 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1680 return CALL_EXPR;
1685 /* Mark statement S as modified, and update it. */
1687 static inline void
1688 update_stmt (gimple s)
1690 if (gimple_has_ops (s))
1692 gimple_set_modified (s, true);
1693 update_stmt_operands (s);
1697 /* Update statement S if it has been optimized. */
1699 static inline void
1700 update_stmt_if_modified (gimple s)
1702 if (gimple_modified_p (s))
1703 update_stmt_operands (s);
1706 /* Return true if statement STMT contains volatile operands. */
1708 static inline bool
1709 gimple_has_volatile_ops (const_gimple stmt)
1711 if (gimple_has_mem_ops (stmt))
1712 return stmt->gsbase.has_volatile_ops;
1713 else
1714 return false;
1718 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1720 static inline void
1721 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1723 if (gimple_has_mem_ops (stmt))
1724 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1727 /* Return true if BB is in a transaction. */
1729 static inline bool
1730 block_in_transaction (basic_block bb)
1732 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1735 /* Return true if STMT is in a transaction. */
1737 static inline bool
1738 gimple_in_transaction (gimple stmt)
1740 return block_in_transaction (gimple_bb (stmt));
1743 /* Return true if statement STMT may access memory. */
1745 static inline bool
1746 gimple_references_memory_p (gimple stmt)
1748 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1752 /* Return the subcode for OMP statement S. */
1754 static inline unsigned
1755 gimple_omp_subcode (const_gimple s)
1757 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1758 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1759 return s->gsbase.subcode;
1762 /* Set the subcode for OMP statement S to SUBCODE. */
1764 static inline void
1765 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1767 /* We only have 16 bits for the subcode. Assert that we are not
1768 overflowing it. */
1769 gcc_gimple_checking_assert (subcode < (1 << 16));
1770 s->gsbase.subcode = subcode;
1773 /* Set the nowait flag on OMP_RETURN statement S. */
1775 static inline void
1776 gimple_omp_return_set_nowait (gimple s)
1778 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1779 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1783 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1784 flag set. */
1786 static inline bool
1787 gimple_omp_return_nowait_p (const_gimple g)
1789 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1790 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1794 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1795 flag set. */
1797 static inline bool
1798 gimple_omp_section_last_p (const_gimple g)
1800 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1801 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1805 /* Set the GF_OMP_SECTION_LAST flag on G. */
1807 static inline void
1808 gimple_omp_section_set_last (gimple g)
1810 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1811 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1815 /* Return true if OMP parallel statement G has the
1816 GF_OMP_PARALLEL_COMBINED flag set. */
1818 static inline bool
1819 gimple_omp_parallel_combined_p (const_gimple g)
1821 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1822 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1826 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1827 value of COMBINED_P. */
1829 static inline void
1830 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1832 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1833 if (combined_p)
1834 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1835 else
1836 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1840 /* Return true if OMP atomic load/store statement G has the
1841 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1843 static inline bool
1844 gimple_omp_atomic_need_value_p (const_gimple g)
1846 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1847 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1848 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1852 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1854 static inline void
1855 gimple_omp_atomic_set_need_value (gimple g)
1857 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1858 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1859 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1863 /* Return the number of operands for statement GS. */
1865 static inline unsigned
1866 gimple_num_ops (const_gimple gs)
1868 return gs->gsbase.num_ops;
1872 /* Set the number of operands for statement GS. */
1874 static inline void
1875 gimple_set_num_ops (gimple gs, unsigned num_ops)
1877 gs->gsbase.num_ops = num_ops;
1881 /* Return the array of operands for statement GS. */
1883 static inline tree *
1884 gimple_ops (gimple gs)
1886 size_t off;
1888 /* All the tuples have their operand vector at the very bottom
1889 of the structure. Note that those structures that do not
1890 have an operand vector have a zero offset. */
1891 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1892 gcc_gimple_checking_assert (off != 0);
1894 return (tree *) ((char *) gs + off);
1898 /* Return operand I for statement GS. */
1900 static inline tree
1901 gimple_op (const_gimple gs, unsigned i)
1903 if (gimple_has_ops (gs))
1905 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1906 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1908 else
1909 return NULL_TREE;
1912 /* Return a pointer to operand I for statement GS. */
1914 static inline tree *
1915 gimple_op_ptr (const_gimple gs, unsigned i)
1917 if (gimple_has_ops (gs))
1919 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1920 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1922 else
1923 return NULL;
1926 /* Set operand I of statement GS to OP. */
1928 static inline void
1929 gimple_set_op (gimple gs, unsigned i, tree op)
1931 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1933 /* Note. It may be tempting to assert that OP matches
1934 is_gimple_operand, but that would be wrong. Different tuples
1935 accept slightly different sets of tree operands. Each caller
1936 should perform its own validation. */
1937 gimple_ops (gs)[i] = op;
1940 /* Return true if GS is a GIMPLE_ATOMIC. */
1942 static inline bool
1943 is_gimple_atomic (const_gimple gs)
1945 return (gimple_code (gs) == GIMPLE_ATOMIC);
1948 /* Return the kind of atomic operation GS. */
1950 static inline enum gimple_atomic_kind
1951 gimple_atomic_kind (const_gimple gs)
1953 gcc_checking_assert (is_gimple_atomic (gs));
1954 return (enum gimple_atomic_kind) ((gs->gsbase.subcode & GF_ATOMIC_KIND)
1955 >> GF_ATOMIC_KIND_SHIFT);
1958 /* Set the kind of atomic operation GS to K. */
1960 static inline void
1961 gimple_atomic_set_kind (gimple gs, enum gimple_atomic_kind k)
1963 gcc_checking_assert (is_gimple_atomic (gs));
1964 gs->gsbase.subcode = (gs->gsbase.subcode & ~GF_ATOMIC_KIND)
1965 | (k << GF_ATOMIC_KIND_SHIFT);
1968 /* Return the arithmetic operation tree code for atomic operation GS. */
1970 static inline enum gimple_atomic_arith_op
1971 gimple_atomic_op_code (const_gimple gs)
1973 gcc_checking_assert (gimple_atomic_kind (gs) == GIMPLE_ATOMIC_FETCH_OP
1974 || gimple_atomic_kind (gs) == GIMPLE_ATOMIC_OP_FETCH);
1975 return (enum gimple_atomic_arith_op)((gs->gsbase.subcode & GF_ATOMIC_ARITH_OP)
1976 >> GF_ATOMIC_ARITH_OP_SHIFT);
1979 /* Set the arithmetic operation tree code for atomic operation GS. */
1981 static inline void
1982 gimple_atomic_set_op_code (gimple gs, enum gimple_atomic_arith_op op)
1984 gcc_checking_assert (gimple_atomic_kind (gs) == GIMPLE_ATOMIC_FETCH_OP
1985 || gimple_atomic_kind (gs) == GIMPLE_ATOMIC_OP_FETCH);
1986 gs->gsbase.subcode = (gs->gsbase.subcode & ~GF_ATOMIC_ARITH_OP)
1987 | (op << GF_ATOMIC_ARITH_OP_SHIFT);
1990 static inline enum tree_code
1991 gimple_atomic_arith_op_to_tree_code (enum gimple_atomic_arith_op op)
1993 switch (op)
1995 case GIMPLE_ATOMIC_ARITH_OP_ADD:
1996 return PLUS_EXPR;
1998 case GIMPLE_ATOMIC_ARITH_OP_SUB:
1999 return MINUS_EXPR;
2001 case GIMPLE_ATOMIC_ARITH_OP_AND:
2002 return BIT_AND_EXPR;
2004 case GIMPLE_ATOMIC_ARITH_OP_XOR:
2005 return BIT_XOR_EXPR;
2007 case GIMPLE_ATOMIC_ARITH_OP_OR:
2008 return BIT_IOR_EXPR;
2010 case GIMPLE_ATOMIC_ARITH_OP_NAND:
2011 return BIT_NOT_EXPR;
2013 default:
2014 break;
2016 gcc_unreachable ();
2019 static inline enum gimple_atomic_arith_op
2020 gimple_atomic_tree_code_to_arith_op (enum tree_code tc)
2022 switch (tc)
2024 case PLUS_EXPR:
2025 return GIMPLE_ATOMIC_ARITH_OP_ADD;
2027 case MINUS_EXPR:
2028 return GIMPLE_ATOMIC_ARITH_OP_SUB;
2030 case BIT_AND_EXPR:
2031 return GIMPLE_ATOMIC_ARITH_OP_AND;
2033 case BIT_XOR_EXPR:
2034 return GIMPLE_ATOMIC_ARITH_OP_XOR;
2036 case BIT_IOR_EXPR:
2037 return GIMPLE_ATOMIC_ARITH_OP_OR;
2039 case BIT_NOT_EXPR:
2040 return GIMPLE_ATOMIC_ARITH_OP_NAND;
2042 default:
2043 break;
2045 gcc_unreachable ();
2048 static inline bool
2049 gimple_atomic_is_store (const_gimple gs)
2051 enum gimple_atomic_kind kind = gimple_atomic_kind (gs);
2052 if (kind == GIMPLE_ATOMIC_STORE || kind == GIMPLE_ATOMIC_STORE_GENERIC)
2053 return true;
2054 return false;
2057 static inline bool
2058 gimple_atomic_is_load (const_gimple gs)
2060 enum gimple_atomic_kind kind = gimple_atomic_kind (gs);
2061 if (kind == GIMPLE_ATOMIC_LOAD || kind == GIMPLE_ATOMIC_LOAD_GENERIC)
2062 return true;
2063 return false;
2066 static inline bool
2067 gimple_atomic_is_exchange (const_gimple gs)
2069 enum gimple_atomic_kind kind = gimple_atomic_kind (gs);
2070 if (kind == GIMPLE_ATOMIC_EXCHANGE || kind == GIMPLE_ATOMIC_EXCHANGE_GENERIC)
2071 return true;
2072 return false;
2075 static inline bool
2076 gimple_atomic_is_compare_exchange (const_gimple gs)
2078 enum gimple_atomic_kind kind = gimple_atomic_kind (gs);
2079 if (kind == GIMPLE_ATOMIC_COMPARE_EXCHANGE
2080 || kind == GIMPLE_ATOMIC_COMPARE_EXCHANGE_GENERIC
2081 || kind == GIMPLE_ATOMIC_COMPARE_EXCHANGE_LIBRARY)
2082 return true;
2083 return false;
2086 /* Return true if atomic fence GS is a thread fence rather than a signal
2087 fence. */
2089 static inline bool
2090 gimple_atomic_thread_fence (const_gimple gs)
2092 gcc_checking_assert (gimple_atomic_kind (gs) == GIMPLE_ATOMIC_FENCE);
2093 return (gs->gsbase.subcode & GF_ATOMIC_THREAD_FENCE) != 0;
2096 /* Set the thread fence field of atomic fence GS to THREAD. */
2098 static inline void
2099 gimple_atomic_set_thread_fence (gimple gs, bool thread)
2101 gcc_checking_assert (gimple_atomic_kind (gs) == GIMPLE_ATOMIC_FENCE);
2102 if (thread)
2103 gs->gsbase.subcode |= GF_ATOMIC_THREAD_FENCE;
2104 else
2105 gs->gsbase.subcode &= ~GF_ATOMIC_THREAD_FENCE;
2108 /* Return the weak flag of atomic operation GS. */
2110 static inline bool
2111 gimple_atomic_weak (const_gimple gs)
2113 gcc_checking_assert (gimple_atomic_is_compare_exchange (gs));
2114 return (gs->gsbase.subcode & GF_ATOMIC_WEAK) != 0;
2117 /* set the weak flag of atomic operation GS to WEAK. */
2119 static inline void
2120 gimple_atomic_set_weak (gimple gs, bool weak)
2122 gcc_checking_assert (gimple_atomic_is_compare_exchange (gs));
2123 if (weak)
2124 gs->gsbase.subcode |= GF_ATOMIC_WEAK;
2125 else
2126 gs->gsbase.subcode &= ~GF_ATOMIC_WEAK;
2130 /* Return true if the atomic operation orginated from a __sync operation. */
2132 static inline bool
2133 gimple_atomic_from_sync (const_gimple gs)
2135 gcc_gimple_checking_assert (is_gimple_atomic (gs));
2136 return (gs->gsbase.subcode & GF_ATOMIC_SYNC) != 0;
2139 /* Set the sync origination flag of atomic operation GS. */
2141 static inline void
2142 gimple_atomic_set_from_sync (gimple gs, bool sync)
2144 gcc_gimple_checking_assert (is_gimple_atomic (gs));
2145 if (sync)
2146 gs->gsbase.subcode |= GF_ATOMIC_SYNC;
2147 else
2148 gs->gsbase.subcode &= ~GF_ATOMIC_SYNC;
2151 /* Return the true if atomic operation GS is in generic form. */
2153 static inline bool
2154 gimple_atomic_is_generic (const_gimple gs)
2156 enum gimple_atomic_kind kind = gimple_atomic_kind (gs);
2157 switch (kind)
2159 case GIMPLE_ATOMIC_LOAD_GENERIC:
2160 case GIMPLE_ATOMIC_STORE_GENERIC:
2161 case GIMPLE_ATOMIC_EXCHANGE_GENERIC:
2162 case GIMPLE_ATOMIC_COMPARE_EXCHANGE_GENERIC:
2163 return true;
2164 default:
2165 break;
2167 return false;
2171 /* Return the base type of the atomic operation GS. */
2172 static inline tree
2173 gimple_atomic_type (const_gimple gs)
2175 gcc_checking_assert (gimple_atomic_kind (gs) != GIMPLE_ATOMIC_FENCE);
2176 return gs->gimple_atomic.target_type;
2179 /* Set the base type of atomic operation GS to T. */
2181 static inline void
2182 gimple_atomic_set_type (gimple gs, tree t)
2184 gcc_checking_assert (gimple_atomic_kind (gs) != GIMPLE_ATOMIC_FENCE);
2185 gs->gimple_atomic.target_type = t;
2189 /* Return the number of possible results for atomic operation GS. */
2191 static inline unsigned
2192 gimple_atomic_num_lhs (const_gimple gs)
2194 switch (gimple_atomic_kind (gs))
2196 case GIMPLE_ATOMIC_COMPARE_EXCHANGE:
2197 return 2;
2199 case GIMPLE_ATOMIC_LOAD_GENERIC:
2200 case GIMPLE_ATOMIC_STORE_GENERIC:
2201 case GIMPLE_ATOMIC_EXCHANGE_GENERIC:
2202 case GIMPLE_ATOMIC_STORE:
2203 case GIMPLE_ATOMIC_CLEAR:
2204 case GIMPLE_ATOMIC_FENCE:
2205 return 0;
2207 default:
2208 break;
2210 return 1;
2213 /* Return the LHS of atomic operation GS. */
2215 static inline tree
2216 gimple_atomic_lhs (const_gimple gs)
2218 gcc_checking_assert (gimple_atomic_num_lhs (gs) != 0);
2219 return gimple_op (gs, 0);
2222 /* Return the pointer to LHS of atomic operation GS. */
2224 static inline tree *
2225 gimple_atomic_lhs_ptr (const_gimple gs)
2227 gcc_checking_assert (gimple_atomic_num_lhs (gs) != 0);
2228 return gimple_op_ptr (gs, 0);
2231 /* Set the LHS of atomic operation GS to EXPR. */
2233 static inline void
2234 gimple_atomic_set_lhs (gimple gs, tree expr)
2236 gcc_checking_assert (gimple_atomic_num_lhs (gs) != 0);
2237 gimple_set_op (gs, 0, expr);
2240 /* Return the second LHS of atomic operation GS. */
2242 static inline tree
2243 gimple_atomic_2nd_lhs (const_gimple gs)
2245 gcc_checking_assert (gimple_atomic_kind (gs)
2246 == GIMPLE_ATOMIC_COMPARE_EXCHANGE);
2247 return gimple_op (gs, 1);
2250 /* Return the pointer to the second LHS of atomic operation GS. */
2252 static inline tree *
2253 gimple_atomic_2nd_lhs_ptr (const_gimple gs)
2255 gcc_checking_assert (gimple_atomic_kind (gs)
2256 == GIMPLE_ATOMIC_COMPARE_EXCHANGE);
2257 return gimple_op_ptr (gs, 1);
2260 /* Set the second LHS of atomic operation GS to EXPR. */
2262 static inline void
2263 gimple_atomic_set_2nd_lhs (gimple gs, tree expr)
2265 gcc_checking_assert (gimple_atomic_kind (gs)
2266 == GIMPLE_ATOMIC_COMPARE_EXCHANGE);
2267 gimple_set_op (gs, 1, expr);
2269 /* Return the memory order for atomic operation GS. */
2271 static inline tree
2272 gimple_atomic_order (const_gimple gs)
2274 gcc_gimple_checking_assert (is_gimple_atomic (gs));
2275 return gimple_op (gs, gimple_num_ops (gs) - 1);
2278 /* Return a pointer to the memory order for atomic operation GS. */
2280 static inline tree *
2281 gimple_atomic_order_ptr (const_gimple gs)
2283 gcc_gimple_checking_assert (is_gimple_atomic (gs));
2284 return gimple_op_ptr (gs, gimple_num_ops (gs) - 1);
2288 /* set the memory order for atomic operation GS to T. */
2290 static inline void
2291 gimple_atomic_set_order (gimple gs, tree t)
2293 gcc_gimple_checking_assert (is_gimple_atomic (gs));
2294 gimple_set_op (gs, gimple_num_ops (gs) - 1, t);
2297 /* Return the target location of atomic operation GS. */
2299 static inline tree
2300 gimple_atomic_target (const_gimple gs)
2302 gcc_checking_assert (gimple_atomic_kind (gs) != GIMPLE_ATOMIC_FENCE);
2303 return gimple_op (gs, gimple_num_ops (gs) - 2);
2306 /* Return a pointer to the target location of atomic operation GS. */
2308 static inline tree *
2309 gimple_atomic_target_ptr (const_gimple gs)
2311 gcc_checking_assert (gimple_atomic_kind (gs) != GIMPLE_ATOMIC_FENCE);
2312 return gimple_op_ptr (gs, gimple_num_ops (gs) - 2);
2315 /* Set the target location of atomic operation GS to T. */
2317 static inline void
2318 gimple_atomic_set_target (gimple gs, tree t)
2320 gcc_checking_assert (gimple_atomic_kind (gs) != GIMPLE_ATOMIC_FENCE);
2321 gimple_set_op (gs, gimple_num_ops (gs) - 2, t);
2324 /* Return the expression field of atomic operation GS. */
2326 static inline tree
2327 gimple_atomic_expr (const_gimple gs)
2329 gcc_checking_assert (gimple_num_ops (gs) > 3
2330 || gimple_atomic_is_store (gs));
2331 return gimple_op (gs, gimple_num_ops (gs) - 3);
2334 /* Return a pointer to the expression field of atomic operation GS. */
2336 static inline tree *
2337 gimple_atomic_expr_ptr (const_gimple gs)
2339 gcc_checking_assert (gimple_num_ops (gs) > 3
2340 || gimple_atomic_is_store (gs));
2341 return gimple_op_ptr (gs, gimple_num_ops (gs) - 3);
2344 /* Set the expression field of atomic operation GS. */
2346 static inline void
2347 gimple_atomic_set_expr (gimple gs, tree t)
2349 gcc_checking_assert (gimple_num_ops (gs) > 3
2350 || gimple_atomic_is_store (gs));
2351 gimple_set_op (gs, gimple_num_ops (gs) - 3, t);
2354 /* Return the expected field of atomic operation GS. */
2356 static inline tree
2357 gimple_atomic_expected (const_gimple gs)
2359 gcc_checking_assert (gimple_atomic_is_compare_exchange (gs));
2361 return gimple_op (gs, gimple_num_ops (gs) - 4);
2364 /* Return a pointer to the expected field of atomic operation GS. */
2366 static inline tree *
2367 gimple_atomic_expected_ptr (const_gimple gs)
2369 gcc_checking_assert (gimple_atomic_is_compare_exchange (gs));
2370 return gimple_op_ptr (gs, gimple_num_ops (gs) - 4);
2373 /* Set the expected field of atomic operation GS. */
2375 static inline void
2376 gimple_atomic_set_expected (gimple gs, tree t)
2378 gcc_checking_assert (gimple_atomic_is_compare_exchange (gs));
2379 gimple_set_op (gs, gimple_num_ops (gs) - 4, t);
2382 /* Return the RETURN field of generic atomic operation GS. */
2384 static inline tree
2385 gimple_atomic_return (const_gimple gs)
2387 gcc_checking_assert (gimple_atomic_kind (gs) == GIMPLE_ATOMIC_LOAD_GENERIC
2388 || gimple_atomic_kind (gs)
2389 == GIMPLE_ATOMIC_EXCHANGE_GENERIC);
2390 return gimple_op (gs, 0);
2393 /* Return a pointer to the return field of atomic operation GS. */
2395 static inline tree *
2396 gimple_atomic_return_ptr (const_gimple gs)
2398 gcc_checking_assert (gimple_atomic_kind (gs) == GIMPLE_ATOMIC_LOAD_GENERIC
2399 || gimple_atomic_kind (gs)
2400 == GIMPLE_ATOMIC_EXCHANGE_GENERIC);
2401 return gimple_op_ptr (gs, 0);
2404 /* Set the return field of atomic operation GS. */
2406 static inline void
2407 gimple_atomic_set_return (gimple gs, tree t)
2409 gcc_checking_assert (gimple_atomic_kind (gs) == GIMPLE_ATOMIC_LOAD_GENERIC
2410 || gimple_atomic_kind (gs)
2411 == GIMPLE_ATOMIC_EXCHANGE_GENERIC);
2412 gimple_set_op (gs, 0, t);
2416 /* Return the fail_order field of atomic operation GS. */
2418 static inline tree
2419 gimple_atomic_fail_order (const_gimple gs)
2421 gcc_checking_assert (gimple_atomic_is_compare_exchange (gs));
2422 return gimple_op (gs, gimple_num_ops (gs) - 5);
2425 /* Return a pointer to the fail_order field of atomic operation GS. */
2427 static inline tree *
2428 gimple_atomic_fail_order_ptr (const_gimple gs)
2430 gcc_checking_assert (gimple_atomic_is_compare_exchange (gs));
2431 return gimple_op_ptr (gs, gimple_num_ops (gs) - 5);
2435 /* Set the fail_order field of atomic operation GS. */
2437 static inline void
2438 gimple_atomic_set_fail_order (gimple gs, tree t)
2440 gcc_checking_assert (gimple_atomic_is_compare_exchange (gs));
2441 gimple_set_op (gs, gimple_num_ops (gs) - 5, t);
2444 /* Return true if GS is a GIMPLE_ASSIGN. */
2446 static inline bool
2447 is_gimple_assign (const_gimple gs)
2449 return gimple_code (gs) == GIMPLE_ASSIGN;
2452 /* Determine if expression CODE is one of the valid expressions that can
2453 be used on the RHS of GIMPLE assignments. */
2455 static inline enum gimple_rhs_class
2456 get_gimple_rhs_class (enum tree_code code)
2458 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2461 /* Return the LHS of assignment statement GS. */
2463 static inline tree
2464 gimple_assign_lhs (const_gimple gs)
2466 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2467 return gimple_op (gs, 0);
2471 /* Return a pointer to the LHS of assignment statement GS. */
2473 static inline tree *
2474 gimple_assign_lhs_ptr (const_gimple gs)
2476 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2477 return gimple_op_ptr (gs, 0);
2481 /* Set LHS to be the LHS operand of assignment statement GS. */
2483 static inline void
2484 gimple_assign_set_lhs (gimple gs, tree lhs)
2486 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2487 gimple_set_op (gs, 0, lhs);
2489 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2490 SSA_NAME_DEF_STMT (lhs) = gs;
2494 /* Return the first operand on the RHS of assignment statement GS. */
2496 static inline tree
2497 gimple_assign_rhs1 (const_gimple gs)
2499 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2500 return gimple_op (gs, 1);
2504 /* Return a pointer to the first operand on the RHS of assignment
2505 statement GS. */
2507 static inline tree *
2508 gimple_assign_rhs1_ptr (const_gimple gs)
2510 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2511 return gimple_op_ptr (gs, 1);
2514 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2516 static inline void
2517 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2519 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2521 gimple_set_op (gs, 1, rhs);
2525 /* Return the second operand on the RHS of assignment statement GS.
2526 If GS does not have two operands, NULL is returned instead. */
2528 static inline tree
2529 gimple_assign_rhs2 (const_gimple gs)
2531 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2533 if (gimple_num_ops (gs) >= 3)
2534 return gimple_op (gs, 2);
2535 else
2536 return NULL_TREE;
2540 /* Return a pointer to the second operand on the RHS of assignment
2541 statement GS. */
2543 static inline tree *
2544 gimple_assign_rhs2_ptr (const_gimple gs)
2546 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2547 return gimple_op_ptr (gs, 2);
2551 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2553 static inline void
2554 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2556 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2558 gimple_set_op (gs, 2, rhs);
2561 /* Return the third operand on the RHS of assignment statement GS.
2562 If GS does not have two operands, NULL is returned instead. */
2564 static inline tree
2565 gimple_assign_rhs3 (const_gimple gs)
2567 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2569 if (gimple_num_ops (gs) >= 4)
2570 return gimple_op (gs, 3);
2571 else
2572 return NULL_TREE;
2575 /* Return a pointer to the third operand on the RHS of assignment
2576 statement GS. */
2578 static inline tree *
2579 gimple_assign_rhs3_ptr (const_gimple gs)
2581 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2582 return gimple_op_ptr (gs, 3);
2586 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2588 static inline void
2589 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2591 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2593 gimple_set_op (gs, 3, rhs);
2596 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2597 to see only a maximum of two operands. */
2599 static inline void
2600 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2601 tree op1, tree op2)
2603 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2606 /* A wrapper around extract_ops_from_tree_1, for callers which expect
2607 to see only a maximum of two operands. */
2609 static inline void
2610 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
2611 tree *op1)
2613 tree op2;
2614 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
2615 gcc_assert (op2 == NULL_TREE);
2618 /* Returns true if GS is a nontemporal move. */
2620 static inline bool
2621 gimple_assign_nontemporal_move_p (const_gimple gs)
2623 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2624 return gs->gsbase.nontemporal_move;
2627 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2629 static inline void
2630 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2632 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2633 gs->gsbase.nontemporal_move = nontemporal;
2637 /* Return the code of the expression computed on the rhs of assignment
2638 statement GS. In case that the RHS is a single object, returns the
2639 tree code of the object. */
2641 static inline enum tree_code
2642 gimple_assign_rhs_code (const_gimple gs)
2644 enum tree_code code;
2645 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2647 code = (enum tree_code) gs->gsbase.subcode;
2648 /* While we initially set subcode to the TREE_CODE of the rhs for
2649 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2650 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2651 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2652 code = TREE_CODE (gimple_assign_rhs1 (gs));
2654 return code;
2658 /* Set CODE to be the code for the expression computed on the RHS of
2659 assignment S. */
2661 static inline void
2662 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2664 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2665 s->gsbase.subcode = code;
2669 /* Return the gimple rhs class of the code of the expression computed on
2670 the rhs of assignment statement GS.
2671 This will never return GIMPLE_INVALID_RHS. */
2673 static inline enum gimple_rhs_class
2674 gimple_assign_rhs_class (const_gimple gs)
2676 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2679 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2680 there is no operator associated with the assignment itself.
2681 Unlike gimple_assign_copy_p, this predicate returns true for
2682 any RHS operand, including those that perform an operation
2683 and do not have the semantics of a copy, such as COND_EXPR. */
2685 static inline bool
2686 gimple_assign_single_p (gimple gs)
2688 return (is_gimple_assign (gs)
2689 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2692 /* Return true if GS performs a store to its lhs. */
2694 static inline bool
2695 gimple_store_p (gimple gs)
2697 tree lhs = gimple_get_lhs (gs);
2698 return lhs && !is_gimple_reg (lhs);
2701 /* Return true if GS is an assignment that loads from its rhs1. */
2703 static inline bool
2704 gimple_assign_load_p (gimple gs)
2706 tree rhs;
2707 if (!gimple_assign_single_p (gs))
2708 return false;
2709 rhs = gimple_assign_rhs1 (gs);
2710 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2711 return true;
2712 rhs = get_base_address (rhs);
2713 return (DECL_P (rhs)
2714 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2718 /* Return true if S is a type-cast assignment. */
2720 static inline bool
2721 gimple_assign_cast_p (gimple s)
2723 if (is_gimple_assign (s))
2725 enum tree_code sc = gimple_assign_rhs_code (s);
2726 return CONVERT_EXPR_CODE_P (sc)
2727 || sc == VIEW_CONVERT_EXPR
2728 || sc == FIX_TRUNC_EXPR;
2731 return false;
2734 /* Return true if S is a clobber statement. */
2736 static inline bool
2737 gimple_clobber_p (gimple s)
2739 return gimple_assign_single_p (s)
2740 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2743 /* Return true if GS is a GIMPLE_CALL. */
2745 static inline bool
2746 is_gimple_call (const_gimple gs)
2748 return gimple_code (gs) == GIMPLE_CALL;
2751 /* Return the LHS of call statement GS. */
2753 static inline tree
2754 gimple_call_lhs (const_gimple gs)
2756 GIMPLE_CHECK (gs, GIMPLE_CALL);
2757 return gimple_op (gs, 0);
2761 /* Return a pointer to the LHS of call statement GS. */
2763 static inline tree *
2764 gimple_call_lhs_ptr (const_gimple gs)
2766 GIMPLE_CHECK (gs, GIMPLE_CALL);
2767 return gimple_op_ptr (gs, 0);
2771 /* Set LHS to be the LHS operand of call statement GS. */
2773 static inline void
2774 gimple_call_set_lhs (gimple gs, tree lhs)
2776 GIMPLE_CHECK (gs, GIMPLE_CALL);
2777 gimple_set_op (gs, 0, lhs);
2778 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2779 SSA_NAME_DEF_STMT (lhs) = gs;
2783 /* Return true if call GS calls an internal-only function, as enumerated
2784 by internal_fn. */
2786 static inline bool
2787 gimple_call_internal_p (const_gimple gs)
2789 GIMPLE_CHECK (gs, GIMPLE_CALL);
2790 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2794 /* Return the target of internal call GS. */
2796 static inline enum internal_fn
2797 gimple_call_internal_fn (const_gimple gs)
2799 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2800 return gs->gimple_call.u.internal_fn;
2804 /* Return the function type of the function called by GS. */
2806 static inline tree
2807 gimple_call_fntype (const_gimple gs)
2809 GIMPLE_CHECK (gs, GIMPLE_CALL);
2810 if (gimple_call_internal_p (gs))
2811 return NULL_TREE;
2812 return gs->gimple_call.u.fntype;
2815 /* Set the type of the function called by GS to FNTYPE. */
2817 static inline void
2818 gimple_call_set_fntype (gimple gs, tree fntype)
2820 GIMPLE_CHECK (gs, GIMPLE_CALL);
2821 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2822 gs->gimple_call.u.fntype = fntype;
2826 /* Return the tree node representing the function called by call
2827 statement GS. */
2829 static inline tree
2830 gimple_call_fn (const_gimple gs)
2832 GIMPLE_CHECK (gs, GIMPLE_CALL);
2833 return gimple_op (gs, 1);
2836 /* Return a pointer to the tree node representing the function called by call
2837 statement GS. */
2839 static inline tree *
2840 gimple_call_fn_ptr (const_gimple gs)
2842 GIMPLE_CHECK (gs, GIMPLE_CALL);
2843 return gimple_op_ptr (gs, 1);
2847 /* Set FN to be the function called by call statement GS. */
2849 static inline void
2850 gimple_call_set_fn (gimple gs, tree fn)
2852 GIMPLE_CHECK (gs, GIMPLE_CALL);
2853 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2854 gimple_set_op (gs, 1, fn);
2858 /* Set FNDECL to be the function called by call statement GS. */
2860 static inline void
2861 gimple_call_set_fndecl (gimple gs, tree decl)
2863 GIMPLE_CHECK (gs, GIMPLE_CALL);
2864 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2865 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2869 /* Set internal function FN to be the function called by call statement GS. */
2871 static inline void
2872 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2874 GIMPLE_CHECK (gs, GIMPLE_CALL);
2875 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2876 gs->gimple_call.u.internal_fn = fn;
2880 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2881 associated with the callee if known. Otherwise return NULL_TREE. */
2883 static inline tree
2884 gimple_call_addr_fndecl (const_tree fn)
2886 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2888 tree fndecl = TREE_OPERAND (fn, 0);
2889 if (TREE_CODE (fndecl) == MEM_REF
2890 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2891 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2892 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2893 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2894 return fndecl;
2896 return NULL_TREE;
2899 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2900 Otherwise return NULL. This function is analogous to
2901 get_callee_fndecl in tree land. */
2903 static inline tree
2904 gimple_call_fndecl (const_gimple gs)
2906 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2910 /* Return the type returned by call statement GS. */
2912 static inline tree
2913 gimple_call_return_type (const_gimple gs)
2915 tree type = gimple_call_fntype (gs);
2917 if (type == NULL_TREE)
2918 return TREE_TYPE (gimple_call_lhs (gs));
2920 /* The type returned by a function is the type of its
2921 function type. */
2922 return TREE_TYPE (type);
2926 /* Return the static chain for call statement GS. */
2928 static inline tree
2929 gimple_call_chain (const_gimple gs)
2931 GIMPLE_CHECK (gs, GIMPLE_CALL);
2932 return gimple_op (gs, 2);
2936 /* Return a pointer to the static chain for call statement GS. */
2938 static inline tree *
2939 gimple_call_chain_ptr (const_gimple gs)
2941 GIMPLE_CHECK (gs, GIMPLE_CALL);
2942 return gimple_op_ptr (gs, 2);
2945 /* Set CHAIN to be the static chain for call statement GS. */
2947 static inline void
2948 gimple_call_set_chain (gimple gs, tree chain)
2950 GIMPLE_CHECK (gs, GIMPLE_CALL);
2952 gimple_set_op (gs, 2, chain);
2956 /* Return the number of arguments used by call statement GS. */
2958 static inline unsigned
2959 gimple_call_num_args (const_gimple gs)
2961 unsigned num_ops;
2962 GIMPLE_CHECK (gs, GIMPLE_CALL);
2963 num_ops = gimple_num_ops (gs);
2964 return num_ops - 3;
2968 /* Return the argument at position INDEX for call statement GS. */
2970 static inline tree
2971 gimple_call_arg (const_gimple gs, unsigned index)
2973 GIMPLE_CHECK (gs, GIMPLE_CALL);
2974 return gimple_op (gs, index + 3);
2978 /* Return a pointer to the argument at position INDEX for call
2979 statement GS. */
2981 static inline tree *
2982 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2984 GIMPLE_CHECK (gs, GIMPLE_CALL);
2985 return gimple_op_ptr (gs, index + 3);
2989 /* Set ARG to be the argument at position INDEX for call statement GS. */
2991 static inline void
2992 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2994 GIMPLE_CHECK (gs, GIMPLE_CALL);
2995 gimple_set_op (gs, index + 3, arg);
2999 /* If TAIL_P is true, mark call statement S as being a tail call
3000 (i.e., a call just before the exit of a function). These calls are
3001 candidate for tail call optimization. */
3003 static inline void
3004 gimple_call_set_tail (gimple s, bool tail_p)
3006 GIMPLE_CHECK (s, GIMPLE_CALL);
3007 if (tail_p)
3008 s->gsbase.subcode |= GF_CALL_TAILCALL;
3009 else
3010 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
3014 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3016 static inline bool
3017 gimple_call_tail_p (gimple s)
3019 GIMPLE_CHECK (s, GIMPLE_CALL);
3020 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
3024 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3025 slot optimization. This transformation uses the target of the call
3026 expansion as the return slot for calls that return in memory. */
3028 static inline void
3029 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
3031 GIMPLE_CHECK (s, GIMPLE_CALL);
3032 if (return_slot_opt_p)
3033 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
3034 else
3035 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3039 /* Return true if S is marked for return slot optimization. */
3041 static inline bool
3042 gimple_call_return_slot_opt_p (gimple s)
3044 GIMPLE_CHECK (s, GIMPLE_CALL);
3045 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3049 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3050 thunk to the thunked-to function. */
3052 static inline void
3053 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
3055 GIMPLE_CHECK (s, GIMPLE_CALL);
3056 if (from_thunk_p)
3057 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
3058 else
3059 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
3063 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3065 static inline bool
3066 gimple_call_from_thunk_p (gimple s)
3068 GIMPLE_CHECK (s, GIMPLE_CALL);
3069 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
3073 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3074 argument pack in its argument list. */
3076 static inline void
3077 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
3079 GIMPLE_CHECK (s, GIMPLE_CALL);
3080 if (pass_arg_pack_p)
3081 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
3082 else
3083 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
3087 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3088 argument pack in its argument list. */
3090 static inline bool
3091 gimple_call_va_arg_pack_p (gimple s)
3093 GIMPLE_CHECK (s, GIMPLE_CALL);
3094 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
3098 /* Return true if S is a noreturn call. */
3100 static inline bool
3101 gimple_call_noreturn_p (gimple s)
3103 GIMPLE_CHECK (s, GIMPLE_CALL);
3104 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3108 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3109 even if the called function can throw in other cases. */
3111 static inline void
3112 gimple_call_set_nothrow (gimple s, bool nothrow_p)
3114 GIMPLE_CHECK (s, GIMPLE_CALL);
3115 if (nothrow_p)
3116 s->gsbase.subcode |= GF_CALL_NOTHROW;
3117 else
3118 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
3121 /* Return true if S is a nothrow call. */
3123 static inline bool
3124 gimple_call_nothrow_p (gimple s)
3126 GIMPLE_CHECK (s, GIMPLE_CALL);
3127 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3130 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3131 is known to be emitted for VLA objects. Those are wrapped by
3132 stack_save/stack_restore calls and hence can't lead to unbounded
3133 stack growth even when they occur in loops. */
3135 static inline void
3136 gimple_call_set_alloca_for_var (gimple s, bool for_var)
3138 GIMPLE_CHECK (s, GIMPLE_CALL);
3139 if (for_var)
3140 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
3141 else
3142 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3145 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3147 static inline bool
3148 gimple_call_alloca_for_var_p (gimple s)
3150 GIMPLE_CHECK (s, GIMPLE_CALL);
3151 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3154 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3156 static inline void
3157 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
3159 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
3160 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
3161 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
3165 /* Return a pointer to the points-to solution for the set of call-used
3166 variables of the call CALL. */
3168 static inline struct pt_solution *
3169 gimple_call_use_set (gimple call)
3171 GIMPLE_CHECK (call, GIMPLE_CALL);
3172 return &call->gimple_call.call_used;
3176 /* Return a pointer to the points-to solution for the set of call-used
3177 variables of the call CALL. */
3179 static inline struct pt_solution *
3180 gimple_call_clobber_set (gimple call)
3182 GIMPLE_CHECK (call, GIMPLE_CALL);
3183 return &call->gimple_call.call_clobbered;
3187 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3188 non-NULL lhs. */
3190 static inline bool
3191 gimple_has_lhs (gimple stmt)
3193 return (is_gimple_assign (stmt)
3194 || (is_gimple_call (stmt)
3195 && gimple_call_lhs (stmt) != NULL_TREE));
3199 /* Return the code of the predicate computed by conditional statement GS. */
3201 static inline enum tree_code
3202 gimple_cond_code (const_gimple gs)
3204 GIMPLE_CHECK (gs, GIMPLE_COND);
3205 return (enum tree_code) gs->gsbase.subcode;
3209 /* Set CODE to be the predicate code for the conditional statement GS. */
3211 static inline void
3212 gimple_cond_set_code (gimple gs, enum tree_code code)
3214 GIMPLE_CHECK (gs, GIMPLE_COND);
3215 gs->gsbase.subcode = code;
3219 /* Return the LHS of the predicate computed by conditional statement GS. */
3221 static inline tree
3222 gimple_cond_lhs (const_gimple gs)
3224 GIMPLE_CHECK (gs, GIMPLE_COND);
3225 return gimple_op (gs, 0);
3228 /* Return the pointer to the LHS of the predicate computed by conditional
3229 statement GS. */
3231 static inline tree *
3232 gimple_cond_lhs_ptr (const_gimple gs)
3234 GIMPLE_CHECK (gs, GIMPLE_COND);
3235 return gimple_op_ptr (gs, 0);
3238 /* Set LHS to be the LHS operand of the predicate computed by
3239 conditional statement GS. */
3241 static inline void
3242 gimple_cond_set_lhs (gimple gs, tree lhs)
3244 GIMPLE_CHECK (gs, GIMPLE_COND);
3245 gimple_set_op (gs, 0, lhs);
3249 /* Return the RHS operand of the predicate computed by conditional GS. */
3251 static inline tree
3252 gimple_cond_rhs (const_gimple gs)
3254 GIMPLE_CHECK (gs, GIMPLE_COND);
3255 return gimple_op (gs, 1);
3258 /* Return the pointer to the RHS operand of the predicate computed by
3259 conditional GS. */
3261 static inline tree *
3262 gimple_cond_rhs_ptr (const_gimple gs)
3264 GIMPLE_CHECK (gs, GIMPLE_COND);
3265 return gimple_op_ptr (gs, 1);
3269 /* Set RHS to be the RHS operand of the predicate computed by
3270 conditional statement GS. */
3272 static inline void
3273 gimple_cond_set_rhs (gimple gs, tree rhs)
3275 GIMPLE_CHECK (gs, GIMPLE_COND);
3276 gimple_set_op (gs, 1, rhs);
3280 /* Return the label used by conditional statement GS when its
3281 predicate evaluates to true. */
3283 static inline tree
3284 gimple_cond_true_label (const_gimple gs)
3286 GIMPLE_CHECK (gs, GIMPLE_COND);
3287 return gimple_op (gs, 2);
3291 /* Set LABEL to be the label used by conditional statement GS when its
3292 predicate evaluates to true. */
3294 static inline void
3295 gimple_cond_set_true_label (gimple gs, tree label)
3297 GIMPLE_CHECK (gs, GIMPLE_COND);
3298 gimple_set_op (gs, 2, label);
3302 /* Set LABEL to be the label used by conditional statement GS when its
3303 predicate evaluates to false. */
3305 static inline void
3306 gimple_cond_set_false_label (gimple gs, tree label)
3308 GIMPLE_CHECK (gs, GIMPLE_COND);
3309 gimple_set_op (gs, 3, label);
3313 /* Return the label used by conditional statement GS when its
3314 predicate evaluates to false. */
3316 static inline tree
3317 gimple_cond_false_label (const_gimple gs)
3319 GIMPLE_CHECK (gs, GIMPLE_COND);
3320 return gimple_op (gs, 3);
3324 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3326 static inline void
3327 gimple_cond_make_false (gimple gs)
3329 gimple_cond_set_lhs (gs, boolean_true_node);
3330 gimple_cond_set_rhs (gs, boolean_false_node);
3331 gs->gsbase.subcode = EQ_EXPR;
3335 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3337 static inline void
3338 gimple_cond_make_true (gimple gs)
3340 gimple_cond_set_lhs (gs, boolean_true_node);
3341 gimple_cond_set_rhs (gs, boolean_true_node);
3342 gs->gsbase.subcode = EQ_EXPR;
3345 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3346 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3348 static inline bool
3349 gimple_cond_true_p (const_gimple gs)
3351 tree lhs = gimple_cond_lhs (gs);
3352 tree rhs = gimple_cond_rhs (gs);
3353 enum tree_code code = gimple_cond_code (gs);
3355 if (lhs != boolean_true_node && lhs != boolean_false_node)
3356 return false;
3358 if (rhs != boolean_true_node && rhs != boolean_false_node)
3359 return false;
3361 if (code == NE_EXPR && lhs != rhs)
3362 return true;
3364 if (code == EQ_EXPR && lhs == rhs)
3365 return true;
3367 return false;
3370 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3371 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3373 static inline bool
3374 gimple_cond_false_p (const_gimple gs)
3376 tree lhs = gimple_cond_lhs (gs);
3377 tree rhs = gimple_cond_rhs (gs);
3378 enum tree_code code = gimple_cond_code (gs);
3380 if (lhs != boolean_true_node && lhs != boolean_false_node)
3381 return false;
3383 if (rhs != boolean_true_node && rhs != boolean_false_node)
3384 return false;
3386 if (code == NE_EXPR && lhs == rhs)
3387 return true;
3389 if (code == EQ_EXPR && lhs != rhs)
3390 return true;
3392 return false;
3395 /* Check if conditional statement GS is of the form 'if (var != 0)' or
3396 'if (var == 1)' */
3398 static inline bool
3399 gimple_cond_single_var_p (gimple gs)
3401 if (gimple_cond_code (gs) == NE_EXPR
3402 && gimple_cond_rhs (gs) == boolean_false_node)
3403 return true;
3405 if (gimple_cond_code (gs) == EQ_EXPR
3406 && gimple_cond_rhs (gs) == boolean_true_node)
3407 return true;
3409 return false;
3412 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3414 static inline void
3415 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
3417 gimple_cond_set_code (stmt, code);
3418 gimple_cond_set_lhs (stmt, lhs);
3419 gimple_cond_set_rhs (stmt, rhs);
3422 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3424 static inline tree
3425 gimple_label_label (const_gimple gs)
3427 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3428 return gimple_op (gs, 0);
3432 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3433 GS. */
3435 static inline void
3436 gimple_label_set_label (gimple gs, tree label)
3438 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3439 gimple_set_op (gs, 0, label);
3443 /* Return the destination of the unconditional jump GS. */
3445 static inline tree
3446 gimple_goto_dest (const_gimple gs)
3448 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3449 return gimple_op (gs, 0);
3453 /* Set DEST to be the destination of the unconditonal jump GS. */
3455 static inline void
3456 gimple_goto_set_dest (gimple gs, tree dest)
3458 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3459 gimple_set_op (gs, 0, dest);
3463 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3465 static inline tree
3466 gimple_bind_vars (const_gimple gs)
3468 GIMPLE_CHECK (gs, GIMPLE_BIND);
3469 return gs->gimple_bind.vars;
3473 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3474 statement GS. */
3476 static inline void
3477 gimple_bind_set_vars (gimple gs, tree vars)
3479 GIMPLE_CHECK (gs, GIMPLE_BIND);
3480 gs->gimple_bind.vars = vars;
3484 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3485 statement GS. */
3487 static inline void
3488 gimple_bind_append_vars (gimple gs, tree vars)
3490 GIMPLE_CHECK (gs, GIMPLE_BIND);
3491 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
3495 static inline gimple_seq *
3496 gimple_bind_body_ptr (gimple gs)
3498 GIMPLE_CHECK (gs, GIMPLE_BIND);
3499 return &gs->gimple_bind.body;
3502 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3504 static inline gimple_seq
3505 gimple_bind_body (gimple gs)
3507 return *gimple_bind_body_ptr (gs);
3511 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3512 statement GS. */
3514 static inline void
3515 gimple_bind_set_body (gimple gs, gimple_seq seq)
3517 GIMPLE_CHECK (gs, GIMPLE_BIND);
3518 gs->gimple_bind.body = seq;
3522 /* Append a statement to the end of a GIMPLE_BIND's body. */
3524 static inline void
3525 gimple_bind_add_stmt (gimple gs, gimple stmt)
3527 GIMPLE_CHECK (gs, GIMPLE_BIND);
3528 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
3532 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3534 static inline void
3535 gimple_bind_add_seq (gimple gs, gimple_seq seq)
3537 GIMPLE_CHECK (gs, GIMPLE_BIND);
3538 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
3542 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3543 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3545 static inline tree
3546 gimple_bind_block (const_gimple gs)
3548 GIMPLE_CHECK (gs, GIMPLE_BIND);
3549 return gs->gimple_bind.block;
3553 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3554 statement GS. */
3556 static inline void
3557 gimple_bind_set_block (gimple gs, tree block)
3559 GIMPLE_CHECK (gs, GIMPLE_BIND);
3560 gcc_gimple_checking_assert (block == NULL_TREE
3561 || TREE_CODE (block) == BLOCK);
3562 gs->gimple_bind.block = block;
3566 /* Return the number of input operands for GIMPLE_ASM GS. */
3568 static inline unsigned
3569 gimple_asm_ninputs (const_gimple gs)
3571 GIMPLE_CHECK (gs, GIMPLE_ASM);
3572 return gs->gimple_asm.ni;
3576 /* Return the number of output operands for GIMPLE_ASM GS. */
3578 static inline unsigned
3579 gimple_asm_noutputs (const_gimple gs)
3581 GIMPLE_CHECK (gs, GIMPLE_ASM);
3582 return gs->gimple_asm.no;
3586 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3588 static inline unsigned
3589 gimple_asm_nclobbers (const_gimple gs)
3591 GIMPLE_CHECK (gs, GIMPLE_ASM);
3592 return gs->gimple_asm.nc;
3595 /* Return the number of label operands for GIMPLE_ASM GS. */
3597 static inline unsigned
3598 gimple_asm_nlabels (const_gimple gs)
3600 GIMPLE_CHECK (gs, GIMPLE_ASM);
3601 return gs->gimple_asm.nl;
3604 /* Return input operand INDEX of GIMPLE_ASM GS. */
3606 static inline tree
3607 gimple_asm_input_op (const_gimple gs, unsigned index)
3609 GIMPLE_CHECK (gs, GIMPLE_ASM);
3610 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
3611 return gimple_op (gs, index + gs->gimple_asm.no);
3614 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3616 static inline tree *
3617 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3619 GIMPLE_CHECK (gs, GIMPLE_ASM);
3620 gcc_gimple_checking_assert (index < gs->gimple_asm.ni);
3621 return gimple_op_ptr (gs, index + gs->gimple_asm.no);
3625 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3627 static inline void
3628 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3630 GIMPLE_CHECK (gs, GIMPLE_ASM);
3631 gcc_gimple_checking_assert (index < gs->gimple_asm.ni
3632 && TREE_CODE (in_op) == TREE_LIST);
3633 gimple_set_op (gs, index + gs->gimple_asm.no, in_op);
3637 /* Return output operand INDEX of GIMPLE_ASM GS. */
3639 static inline tree
3640 gimple_asm_output_op (const_gimple gs, unsigned index)
3642 GIMPLE_CHECK (gs, GIMPLE_ASM);
3643 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3644 return gimple_op (gs, index);
3647 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3649 static inline tree *
3650 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3652 GIMPLE_CHECK (gs, GIMPLE_ASM);
3653 gcc_gimple_checking_assert (index < gs->gimple_asm.no);
3654 return gimple_op_ptr (gs, index);
3658 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3660 static inline void
3661 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3663 GIMPLE_CHECK (gs, GIMPLE_ASM);
3664 gcc_gimple_checking_assert (index < gs->gimple_asm.no
3665 && TREE_CODE (out_op) == TREE_LIST);
3666 gimple_set_op (gs, index, out_op);
3670 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3672 static inline tree
3673 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3675 GIMPLE_CHECK (gs, GIMPLE_ASM);
3676 gcc_gimple_checking_assert (index < gs->gimple_asm.nc);
3677 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3681 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3683 static inline void
3684 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3686 GIMPLE_CHECK (gs, GIMPLE_ASM);
3687 gcc_gimple_checking_assert (index < gs->gimple_asm.nc
3688 && TREE_CODE (clobber_op) == TREE_LIST);
3689 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3692 /* Return label operand INDEX of GIMPLE_ASM GS. */
3694 static inline tree
3695 gimple_asm_label_op (const_gimple gs, unsigned index)
3697 GIMPLE_CHECK (gs, GIMPLE_ASM);
3698 gcc_gimple_checking_assert (index < gs->gimple_asm.nl);
3699 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3702 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3704 static inline void
3705 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3707 GIMPLE_CHECK (gs, GIMPLE_ASM);
3708 gcc_gimple_checking_assert (index < gs->gimple_asm.nl
3709 && TREE_CODE (label_op) == TREE_LIST);
3710 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3713 /* Return the string representing the assembly instruction in
3714 GIMPLE_ASM GS. */
3716 static inline const char *
3717 gimple_asm_string (const_gimple gs)
3719 GIMPLE_CHECK (gs, GIMPLE_ASM);
3720 return gs->gimple_asm.string;
3724 /* Return true if GS is an asm statement marked volatile. */
3726 static inline bool
3727 gimple_asm_volatile_p (const_gimple gs)
3729 GIMPLE_CHECK (gs, GIMPLE_ASM);
3730 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3734 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3736 static inline void
3737 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3739 GIMPLE_CHECK (gs, GIMPLE_ASM);
3740 if (volatile_p)
3741 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3742 else
3743 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3747 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3749 static inline void
3750 gimple_asm_set_input (gimple gs, bool input_p)
3752 GIMPLE_CHECK (gs, GIMPLE_ASM);
3753 if (input_p)
3754 gs->gsbase.subcode |= GF_ASM_INPUT;
3755 else
3756 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3760 /* Return true if asm GS is an ASM_INPUT. */
3762 static inline bool
3763 gimple_asm_input_p (const_gimple gs)
3765 GIMPLE_CHECK (gs, GIMPLE_ASM);
3766 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3770 /* Return the types handled by GIMPLE_CATCH statement GS. */
3772 static inline tree
3773 gimple_catch_types (const_gimple gs)
3775 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3776 return gs->gimple_catch.types;
3780 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3782 static inline tree *
3783 gimple_catch_types_ptr (gimple gs)
3785 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3786 return &gs->gimple_catch.types;
3790 /* Return a pointer to the GIMPLE sequence representing the body of
3791 the handler of GIMPLE_CATCH statement GS. */
3793 static inline gimple_seq *
3794 gimple_catch_handler_ptr (gimple gs)
3796 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3797 return &gs->gimple_catch.handler;
3801 /* Return the GIMPLE sequence representing the body of the handler of
3802 GIMPLE_CATCH statement GS. */
3804 static inline gimple_seq
3805 gimple_catch_handler (gimple gs)
3807 return *gimple_catch_handler_ptr (gs);
3811 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3813 static inline void
3814 gimple_catch_set_types (gimple gs, tree t)
3816 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3817 gs->gimple_catch.types = t;
3821 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3823 static inline void
3824 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3826 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3827 gs->gimple_catch.handler = handler;
3831 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3833 static inline tree
3834 gimple_eh_filter_types (const_gimple gs)
3836 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3837 return gs->gimple_eh_filter.types;
3841 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3842 GS. */
3844 static inline tree *
3845 gimple_eh_filter_types_ptr (gimple gs)
3847 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3848 return &gs->gimple_eh_filter.types;
3852 /* Return a pointer to the sequence of statement to execute when
3853 GIMPLE_EH_FILTER statement fails. */
3855 static inline gimple_seq *
3856 gimple_eh_filter_failure_ptr (gimple gs)
3858 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3859 return &gs->gimple_eh_filter.failure;
3863 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3864 statement fails. */
3866 static inline gimple_seq
3867 gimple_eh_filter_failure (gimple gs)
3869 return *gimple_eh_filter_failure_ptr (gs);
3873 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3875 static inline void
3876 gimple_eh_filter_set_types (gimple gs, tree types)
3878 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3879 gs->gimple_eh_filter.types = types;
3883 /* Set FAILURE to be the sequence of statements to execute on failure
3884 for GIMPLE_EH_FILTER GS. */
3886 static inline void
3887 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3889 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3890 gs->gimple_eh_filter.failure = failure;
3893 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3895 static inline tree
3896 gimple_eh_must_not_throw_fndecl (gimple gs)
3898 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3899 return gs->gimple_eh_mnt.fndecl;
3902 /* Set the function decl to be called by GS to DECL. */
3904 static inline void
3905 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3907 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3908 gs->gimple_eh_mnt.fndecl = decl;
3911 /* GIMPLE_EH_ELSE accessors. */
3913 static inline gimple_seq *
3914 gimple_eh_else_n_body_ptr (gimple gs)
3916 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3917 return &gs->gimple_eh_else.n_body;
3920 static inline gimple_seq
3921 gimple_eh_else_n_body (gimple gs)
3923 return *gimple_eh_else_n_body_ptr (gs);
3926 static inline gimple_seq *
3927 gimple_eh_else_e_body_ptr (gimple gs)
3929 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3930 return &gs->gimple_eh_else.e_body;
3933 static inline gimple_seq
3934 gimple_eh_else_e_body (gimple gs)
3936 return *gimple_eh_else_e_body_ptr (gs);
3939 static inline void
3940 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3942 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3943 gs->gimple_eh_else.n_body = seq;
3946 static inline void
3947 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3949 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3950 gs->gimple_eh_else.e_body = seq;
3953 /* GIMPLE_TRY accessors. */
3955 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3956 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3958 static inline enum gimple_try_flags
3959 gimple_try_kind (const_gimple gs)
3961 GIMPLE_CHECK (gs, GIMPLE_TRY);
3962 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3966 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3968 static inline void
3969 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3971 GIMPLE_CHECK (gs, GIMPLE_TRY);
3972 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3973 || kind == GIMPLE_TRY_FINALLY);
3974 if (gimple_try_kind (gs) != kind)
3975 gs->gsbase.subcode = (unsigned int) kind;
3979 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3981 static inline bool
3982 gimple_try_catch_is_cleanup (const_gimple gs)
3984 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3985 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3989 /* Return a pointer to the sequence of statements used as the
3990 body for GIMPLE_TRY GS. */
3992 static inline gimple_seq *
3993 gimple_try_eval_ptr (gimple gs)
3995 GIMPLE_CHECK (gs, GIMPLE_TRY);
3996 return &gs->gimple_try.eval;
4000 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4002 static inline gimple_seq
4003 gimple_try_eval (gimple gs)
4005 return *gimple_try_eval_ptr (gs);
4009 /* Return a pointer to the sequence of statements used as the cleanup body for
4010 GIMPLE_TRY GS. */
4012 static inline gimple_seq *
4013 gimple_try_cleanup_ptr (gimple gs)
4015 GIMPLE_CHECK (gs, GIMPLE_TRY);
4016 return &gs->gimple_try.cleanup;
4020 /* Return the sequence of statements used as the cleanup body for
4021 GIMPLE_TRY GS. */
4023 static inline gimple_seq
4024 gimple_try_cleanup (gimple gs)
4026 return *gimple_try_cleanup_ptr (gs);
4030 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4032 static inline void
4033 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
4035 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4036 if (catch_is_cleanup)
4037 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4038 else
4039 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4043 /* Set EVAL to be the sequence of statements to use as the body for
4044 GIMPLE_TRY GS. */
4046 static inline void
4047 gimple_try_set_eval (gimple gs, gimple_seq eval)
4049 GIMPLE_CHECK (gs, GIMPLE_TRY);
4050 gs->gimple_try.eval = eval;
4054 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4055 body for GIMPLE_TRY GS. */
4057 static inline void
4058 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
4060 GIMPLE_CHECK (gs, GIMPLE_TRY);
4061 gs->gimple_try.cleanup = cleanup;
4065 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4067 static inline gimple_seq *
4068 gimple_wce_cleanup_ptr (gimple gs)
4070 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4071 return &gs->gimple_wce.cleanup;
4075 /* Return the cleanup sequence for cleanup statement GS. */
4077 static inline gimple_seq
4078 gimple_wce_cleanup (gimple gs)
4080 return *gimple_wce_cleanup_ptr (gs);
4084 /* Set CLEANUP to be the cleanup sequence for GS. */
4086 static inline void
4087 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
4089 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4090 gs->gimple_wce.cleanup = cleanup;
4094 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4096 static inline bool
4097 gimple_wce_cleanup_eh_only (const_gimple gs)
4099 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4100 return gs->gsbase.subcode != 0;
4104 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4106 static inline void
4107 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
4109 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4110 gs->gsbase.subcode = (unsigned int) eh_only_p;
4114 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4116 static inline unsigned
4117 gimple_phi_capacity (const_gimple gs)
4119 GIMPLE_CHECK (gs, GIMPLE_PHI);
4120 return gs->gimple_phi.capacity;
4124 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4125 be exactly the number of incoming edges for the basic block holding
4126 GS. */
4128 static inline unsigned
4129 gimple_phi_num_args (const_gimple gs)
4131 GIMPLE_CHECK (gs, GIMPLE_PHI);
4132 return gs->gimple_phi.nargs;
4136 /* Return the SSA name created by GIMPLE_PHI GS. */
4138 static inline tree
4139 gimple_phi_result (const_gimple gs)
4141 GIMPLE_CHECK (gs, GIMPLE_PHI);
4142 return gs->gimple_phi.result;
4145 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4147 static inline tree *
4148 gimple_phi_result_ptr (gimple gs)
4150 GIMPLE_CHECK (gs, GIMPLE_PHI);
4151 return &gs->gimple_phi.result;
4154 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
4156 static inline void
4157 gimple_phi_set_result (gimple gs, tree result)
4159 GIMPLE_CHECK (gs, GIMPLE_PHI);
4160 gs->gimple_phi.result = result;
4161 if (result && TREE_CODE (result) == SSA_NAME)
4162 SSA_NAME_DEF_STMT (result) = gs;
4166 /* Return the PHI argument corresponding to incoming edge INDEX for
4167 GIMPLE_PHI GS. */
4169 static inline struct phi_arg_d *
4170 gimple_phi_arg (gimple gs, unsigned index)
4172 GIMPLE_CHECK (gs, GIMPLE_PHI);
4173 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
4174 return &(gs->gimple_phi.args[index]);
4177 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4178 for GIMPLE_PHI GS. */
4180 static inline void
4181 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
4183 GIMPLE_CHECK (gs, GIMPLE_PHI);
4184 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
4185 gs->gimple_phi.args[index] = *phiarg;
4188 /* Return the region number for GIMPLE_RESX GS. */
4190 static inline int
4191 gimple_resx_region (const_gimple gs)
4193 GIMPLE_CHECK (gs, GIMPLE_RESX);
4194 return gs->gimple_eh_ctrl.region;
4197 /* Set REGION to be the region number for GIMPLE_RESX GS. */
4199 static inline void
4200 gimple_resx_set_region (gimple gs, int region)
4202 GIMPLE_CHECK (gs, GIMPLE_RESX);
4203 gs->gimple_eh_ctrl.region = region;
4206 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
4208 static inline int
4209 gimple_eh_dispatch_region (const_gimple gs)
4211 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
4212 return gs->gimple_eh_ctrl.region;
4215 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
4217 static inline void
4218 gimple_eh_dispatch_set_region (gimple gs, int region)
4220 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
4221 gs->gimple_eh_ctrl.region = region;
4224 /* Return the number of labels associated with the switch statement GS. */
4226 static inline unsigned
4227 gimple_switch_num_labels (const_gimple gs)
4229 unsigned num_ops;
4230 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4231 num_ops = gimple_num_ops (gs);
4232 gcc_gimple_checking_assert (num_ops > 1);
4233 return num_ops - 1;
4237 /* Set NLABELS to be the number of labels for the switch statement GS. */
4239 static inline void
4240 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
4242 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4243 gimple_set_num_ops (g, nlabels + 1);
4247 /* Return the index variable used by the switch statement GS. */
4249 static inline tree
4250 gimple_switch_index (const_gimple gs)
4252 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4253 return gimple_op (gs, 0);
4257 /* Return a pointer to the index variable for the switch statement GS. */
4259 static inline tree *
4260 gimple_switch_index_ptr (const_gimple gs)
4262 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4263 return gimple_op_ptr (gs, 0);
4267 /* Set INDEX to be the index variable for switch statement GS. */
4269 static inline void
4270 gimple_switch_set_index (gimple gs, tree index)
4272 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4273 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4274 gimple_set_op (gs, 0, index);
4278 /* Return the label numbered INDEX. The default label is 0, followed by any
4279 labels in a switch statement. */
4281 static inline tree
4282 gimple_switch_label (const_gimple gs, unsigned index)
4284 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4285 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4286 return gimple_op (gs, index + 1);
4289 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4291 static inline void
4292 gimple_switch_set_label (gimple gs, unsigned index, tree label)
4294 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4295 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4296 && (label == NULL_TREE
4297 || TREE_CODE (label) == CASE_LABEL_EXPR));
4298 gimple_set_op (gs, index + 1, label);
4301 /* Return the default label for a switch statement. */
4303 static inline tree
4304 gimple_switch_default_label (const_gimple gs)
4306 tree label = gimple_switch_label (gs, 0);
4307 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4308 return label;
4311 /* Set the default label for a switch statement. */
4313 static inline void
4314 gimple_switch_set_default_label (gimple gs, tree label)
4316 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4317 gimple_switch_set_label (gs, 0, label);
4320 /* Return true if GS is a GIMPLE_DEBUG statement. */
4322 static inline bool
4323 is_gimple_debug (const_gimple gs)
4325 return gimple_code (gs) == GIMPLE_DEBUG;
4328 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4330 static inline bool
4331 gimple_debug_bind_p (const_gimple s)
4333 if (is_gimple_debug (s))
4334 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
4336 return false;
4339 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4341 static inline tree
4342 gimple_debug_bind_get_var (gimple dbg)
4344 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4345 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4346 return gimple_op (dbg, 0);
4349 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4350 statement. */
4352 static inline tree
4353 gimple_debug_bind_get_value (gimple dbg)
4355 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4356 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4357 return gimple_op (dbg, 1);
4360 /* Return a pointer to the value bound to the variable in a
4361 GIMPLE_DEBUG bind statement. */
4363 static inline tree *
4364 gimple_debug_bind_get_value_ptr (gimple dbg)
4366 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4367 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4368 return gimple_op_ptr (dbg, 1);
4371 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4373 static inline void
4374 gimple_debug_bind_set_var (gimple dbg, tree var)
4376 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4377 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4378 gimple_set_op (dbg, 0, var);
4381 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4382 statement. */
4384 static inline void
4385 gimple_debug_bind_set_value (gimple dbg, tree value)
4387 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4388 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4389 gimple_set_op (dbg, 1, value);
4392 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4393 optimized away. */
4394 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4396 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4397 statement. */
4399 static inline void
4400 gimple_debug_bind_reset_value (gimple dbg)
4402 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4403 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4404 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4407 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4408 value. */
4410 static inline bool
4411 gimple_debug_bind_has_value_p (gimple dbg)
4413 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4414 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4415 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4418 #undef GIMPLE_DEBUG_BIND_NOVALUE
4420 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4422 static inline bool
4423 gimple_debug_source_bind_p (const_gimple s)
4425 if (is_gimple_debug (s))
4426 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
4428 return false;
4431 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4433 static inline tree
4434 gimple_debug_source_bind_get_var (gimple dbg)
4436 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4437 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4438 return gimple_op (dbg, 0);
4441 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4442 statement. */
4444 static inline tree
4445 gimple_debug_source_bind_get_value (gimple dbg)
4447 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4448 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4449 return gimple_op (dbg, 1);
4452 /* Return a pointer to the value bound to the variable in a
4453 GIMPLE_DEBUG source bind statement. */
4455 static inline tree *
4456 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4458 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4459 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4460 return gimple_op_ptr (dbg, 1);
4463 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4465 static inline void
4466 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4468 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4469 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4470 gimple_set_op (dbg, 0, var);
4473 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4474 statement. */
4476 static inline void
4477 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4479 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4480 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4481 gimple_set_op (dbg, 1, value);
4484 /* Return a pointer to the body for the OMP statement GS. */
4486 static inline gimple_seq *
4487 gimple_omp_body_ptr (gimple gs)
4489 return &gs->omp.body;
4492 /* Return the body for the OMP statement GS. */
4494 static inline gimple_seq
4495 gimple_omp_body (gimple gs)
4497 return *gimple_omp_body_ptr (gs);
4500 /* Set BODY to be the body for the OMP statement GS. */
4502 static inline void
4503 gimple_omp_set_body (gimple gs, gimple_seq body)
4505 gs->omp.body = body;
4509 /* Return the name associated with OMP_CRITICAL statement GS. */
4511 static inline tree
4512 gimple_omp_critical_name (const_gimple gs)
4514 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
4515 return gs->gimple_omp_critical.name;
4519 /* Return a pointer to the name associated with OMP critical statement GS. */
4521 static inline tree *
4522 gimple_omp_critical_name_ptr (gimple gs)
4524 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
4525 return &gs->gimple_omp_critical.name;
4529 /* Set NAME to be the name associated with OMP critical statement GS. */
4531 static inline void
4532 gimple_omp_critical_set_name (gimple gs, tree name)
4534 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
4535 gs->gimple_omp_critical.name = name;
4539 /* Return the clauses associated with OMP_FOR GS. */
4541 static inline tree
4542 gimple_omp_for_clauses (const_gimple gs)
4544 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4545 return gs->gimple_omp_for.clauses;
4549 /* Return a pointer to the OMP_FOR GS. */
4551 static inline tree *
4552 gimple_omp_for_clauses_ptr (gimple gs)
4554 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4555 return &gs->gimple_omp_for.clauses;
4559 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4561 static inline void
4562 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4564 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4565 gs->gimple_omp_for.clauses = clauses;
4569 /* Get the collapse count of OMP_FOR GS. */
4571 static inline size_t
4572 gimple_omp_for_collapse (gimple gs)
4574 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4575 return gs->gimple_omp_for.collapse;
4579 /* Return the index variable for OMP_FOR GS. */
4581 static inline tree
4582 gimple_omp_for_index (const_gimple gs, size_t i)
4584 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4585 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4586 return gs->gimple_omp_for.iter[i].index;
4590 /* Return a pointer to the index variable for OMP_FOR GS. */
4592 static inline tree *
4593 gimple_omp_for_index_ptr (gimple gs, size_t i)
4595 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4596 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4597 return &gs->gimple_omp_for.iter[i].index;
4601 /* Set INDEX to be the index variable for OMP_FOR GS. */
4603 static inline void
4604 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4606 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4607 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4608 gs->gimple_omp_for.iter[i].index = index;
4612 /* Return the initial value for OMP_FOR GS. */
4614 static inline tree
4615 gimple_omp_for_initial (const_gimple gs, size_t i)
4617 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4618 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4619 return gs->gimple_omp_for.iter[i].initial;
4623 /* Return a pointer to the initial value for OMP_FOR GS. */
4625 static inline tree *
4626 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4628 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4629 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4630 return &gs->gimple_omp_for.iter[i].initial;
4634 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4636 static inline void
4637 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4639 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4640 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4641 gs->gimple_omp_for.iter[i].initial = initial;
4645 /* Return the final value for OMP_FOR GS. */
4647 static inline tree
4648 gimple_omp_for_final (const_gimple gs, size_t i)
4650 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4651 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4652 return gs->gimple_omp_for.iter[i].final;
4656 /* Return a pointer to the final value for OMP_FOR GS. */
4658 static inline tree *
4659 gimple_omp_for_final_ptr (gimple gs, size_t i)
4661 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4662 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4663 return &gs->gimple_omp_for.iter[i].final;
4667 /* Set FINAL to be the final value for OMP_FOR GS. */
4669 static inline void
4670 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4672 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4673 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4674 gs->gimple_omp_for.iter[i].final = final;
4678 /* Return the increment value for OMP_FOR GS. */
4680 static inline tree
4681 gimple_omp_for_incr (const_gimple gs, size_t i)
4683 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4684 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4685 return gs->gimple_omp_for.iter[i].incr;
4689 /* Return a pointer to the increment value for OMP_FOR GS. */
4691 static inline tree *
4692 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4694 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4695 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4696 return &gs->gimple_omp_for.iter[i].incr;
4700 /* Set INCR to be the increment value for OMP_FOR GS. */
4702 static inline void
4703 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4705 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4706 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4707 gs->gimple_omp_for.iter[i].incr = incr;
4711 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4712 statement GS starts. */
4714 static inline gimple_seq *
4715 gimple_omp_for_pre_body_ptr (gimple gs)
4717 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4718 return &gs->gimple_omp_for.pre_body;
4722 /* Return the sequence of statements to execute before the OMP_FOR
4723 statement GS starts. */
4725 static inline gimple_seq
4726 gimple_omp_for_pre_body (gimple gs)
4728 return *gimple_omp_for_pre_body_ptr (gs);
4732 /* Set PRE_BODY to be the sequence of statements to execute before the
4733 OMP_FOR statement GS starts. */
4735 static inline void
4736 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4738 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4739 gs->gimple_omp_for.pre_body = pre_body;
4743 /* Return the clauses associated with OMP_PARALLEL GS. */
4745 static inline tree
4746 gimple_omp_parallel_clauses (const_gimple gs)
4748 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4749 return gs->gimple_omp_parallel.clauses;
4753 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4755 static inline tree *
4756 gimple_omp_parallel_clauses_ptr (gimple gs)
4758 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4759 return &gs->gimple_omp_parallel.clauses;
4763 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4764 GS. */
4766 static inline void
4767 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4769 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4770 gs->gimple_omp_parallel.clauses = clauses;
4774 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4776 static inline tree
4777 gimple_omp_parallel_child_fn (const_gimple gs)
4779 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4780 return gs->gimple_omp_parallel.child_fn;
4783 /* Return a pointer to the child function used to hold the body of
4784 OMP_PARALLEL GS. */
4786 static inline tree *
4787 gimple_omp_parallel_child_fn_ptr (gimple gs)
4789 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4790 return &gs->gimple_omp_parallel.child_fn;
4794 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4796 static inline void
4797 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4799 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4800 gs->gimple_omp_parallel.child_fn = child_fn;
4804 /* Return the artificial argument used to send variables and values
4805 from the parent to the children threads in OMP_PARALLEL GS. */
4807 static inline tree
4808 gimple_omp_parallel_data_arg (const_gimple gs)
4810 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4811 return gs->gimple_omp_parallel.data_arg;
4815 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4817 static inline tree *
4818 gimple_omp_parallel_data_arg_ptr (gimple gs)
4820 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4821 return &gs->gimple_omp_parallel.data_arg;
4825 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4827 static inline void
4828 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4830 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4831 gs->gimple_omp_parallel.data_arg = data_arg;
4835 /* Return the clauses associated with OMP_TASK GS. */
4837 static inline tree
4838 gimple_omp_task_clauses (const_gimple gs)
4840 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4841 return gs->gimple_omp_parallel.clauses;
4845 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4847 static inline tree *
4848 gimple_omp_task_clauses_ptr (gimple gs)
4850 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4851 return &gs->gimple_omp_parallel.clauses;
4855 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4856 GS. */
4858 static inline void
4859 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4861 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4862 gs->gimple_omp_parallel.clauses = clauses;
4866 /* Return the child function used to hold the body of OMP_TASK GS. */
4868 static inline tree
4869 gimple_omp_task_child_fn (const_gimple gs)
4871 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4872 return gs->gimple_omp_parallel.child_fn;
4875 /* Return a pointer to the child function used to hold the body of
4876 OMP_TASK GS. */
4878 static inline tree *
4879 gimple_omp_task_child_fn_ptr (gimple gs)
4881 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4882 return &gs->gimple_omp_parallel.child_fn;
4886 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4888 static inline void
4889 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4891 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4892 gs->gimple_omp_parallel.child_fn = child_fn;
4896 /* Return the artificial argument used to send variables and values
4897 from the parent to the children threads in OMP_TASK GS. */
4899 static inline tree
4900 gimple_omp_task_data_arg (const_gimple gs)
4902 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4903 return gs->gimple_omp_parallel.data_arg;
4907 /* Return a pointer to the data argument for OMP_TASK GS. */
4909 static inline tree *
4910 gimple_omp_task_data_arg_ptr (gimple gs)
4912 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4913 return &gs->gimple_omp_parallel.data_arg;
4917 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4919 static inline void
4920 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4922 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4923 gs->gimple_omp_parallel.data_arg = data_arg;
4927 /* Return the clauses associated with OMP_TASK GS. */
4929 static inline tree
4930 gimple_omp_taskreg_clauses (const_gimple gs)
4932 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4933 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4934 return gs->gimple_omp_parallel.clauses;
4938 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4940 static inline tree *
4941 gimple_omp_taskreg_clauses_ptr (gimple gs)
4943 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4944 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4945 return &gs->gimple_omp_parallel.clauses;
4949 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4950 GS. */
4952 static inline void
4953 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4955 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4956 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4957 gs->gimple_omp_parallel.clauses = clauses;
4961 /* Return the child function used to hold the body of OMP_TASK GS. */
4963 static inline tree
4964 gimple_omp_taskreg_child_fn (const_gimple gs)
4966 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4967 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4968 return gs->gimple_omp_parallel.child_fn;
4971 /* Return a pointer to the child function used to hold the body of
4972 OMP_TASK GS. */
4974 static inline tree *
4975 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4977 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4978 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4979 return &gs->gimple_omp_parallel.child_fn;
4983 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4985 static inline void
4986 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4988 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4989 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4990 gs->gimple_omp_parallel.child_fn = child_fn;
4994 /* Return the artificial argument used to send variables and values
4995 from the parent to the children threads in OMP_TASK GS. */
4997 static inline tree
4998 gimple_omp_taskreg_data_arg (const_gimple gs)
5000 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
5001 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
5002 return gs->gimple_omp_parallel.data_arg;
5006 /* Return a pointer to the data argument for OMP_TASK GS. */
5008 static inline tree *
5009 gimple_omp_taskreg_data_arg_ptr (gimple gs)
5011 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
5012 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
5013 return &gs->gimple_omp_parallel.data_arg;
5017 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5019 static inline void
5020 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
5022 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
5023 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
5024 gs->gimple_omp_parallel.data_arg = data_arg;
5028 /* Return the copy function used to hold the body of OMP_TASK GS. */
5030 static inline tree
5031 gimple_omp_task_copy_fn (const_gimple gs)
5033 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
5034 return gs->gimple_omp_task.copy_fn;
5037 /* Return a pointer to the copy function used to hold the body of
5038 OMP_TASK GS. */
5040 static inline tree *
5041 gimple_omp_task_copy_fn_ptr (gimple gs)
5043 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
5044 return &gs->gimple_omp_task.copy_fn;
5048 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5050 static inline void
5051 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
5053 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
5054 gs->gimple_omp_task.copy_fn = copy_fn;
5058 /* Return size of the data block in bytes in OMP_TASK GS. */
5060 static inline tree
5061 gimple_omp_task_arg_size (const_gimple gs)
5063 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
5064 return gs->gimple_omp_task.arg_size;
5068 /* Return a pointer to the data block size for OMP_TASK GS. */
5070 static inline tree *
5071 gimple_omp_task_arg_size_ptr (gimple gs)
5073 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
5074 return &gs->gimple_omp_task.arg_size;
5078 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5080 static inline void
5081 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
5083 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
5084 gs->gimple_omp_task.arg_size = arg_size;
5088 /* Return align of the data block in bytes in OMP_TASK GS. */
5090 static inline tree
5091 gimple_omp_task_arg_align (const_gimple gs)
5093 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
5094 return gs->gimple_omp_task.arg_align;
5098 /* Return a pointer to the data block align for OMP_TASK GS. */
5100 static inline tree *
5101 gimple_omp_task_arg_align_ptr (gimple gs)
5103 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
5104 return &gs->gimple_omp_task.arg_align;
5108 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5110 static inline void
5111 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
5113 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
5114 gs->gimple_omp_task.arg_align = arg_align;
5118 /* Return the clauses associated with OMP_SINGLE GS. */
5120 static inline tree
5121 gimple_omp_single_clauses (const_gimple gs)
5123 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
5124 return gs->gimple_omp_single.clauses;
5128 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5130 static inline tree *
5131 gimple_omp_single_clauses_ptr (gimple gs)
5133 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
5134 return &gs->gimple_omp_single.clauses;
5138 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
5140 static inline void
5141 gimple_omp_single_set_clauses (gimple gs, tree clauses)
5143 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
5144 gs->gimple_omp_single.clauses = clauses;
5148 /* Return the clauses associated with OMP_SECTIONS GS. */
5150 static inline tree
5151 gimple_omp_sections_clauses (const_gimple gs)
5153 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
5154 return gs->gimple_omp_sections.clauses;
5158 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5160 static inline tree *
5161 gimple_omp_sections_clauses_ptr (gimple gs)
5163 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
5164 return &gs->gimple_omp_sections.clauses;
5168 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5169 GS. */
5171 static inline void
5172 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5174 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
5175 gs->gimple_omp_sections.clauses = clauses;
5179 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5180 in GS. */
5182 static inline tree
5183 gimple_omp_sections_control (const_gimple gs)
5185 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
5186 return gs->gimple_omp_sections.control;
5190 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5191 GS. */
5193 static inline tree *
5194 gimple_omp_sections_control_ptr (gimple gs)
5196 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
5197 return &gs->gimple_omp_sections.control;
5201 /* Set CONTROL to be the set of clauses associated with the
5202 GIMPLE_OMP_SECTIONS in GS. */
5204 static inline void
5205 gimple_omp_sections_set_control (gimple gs, tree control)
5207 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
5208 gs->gimple_omp_sections.control = control;
5212 /* Set COND to be the condition code for OMP_FOR GS. */
5214 static inline void
5215 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5217 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
5218 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5219 && i < gs->gimple_omp_for.collapse);
5220 gs->gimple_omp_for.iter[i].cond = cond;
5224 /* Return the condition code associated with OMP_FOR GS. */
5226 static inline enum tree_code
5227 gimple_omp_for_cond (const_gimple gs, size_t i)
5229 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
5230 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
5231 return gs->gimple_omp_for.iter[i].cond;
5235 /* Set the value being stored in an atomic store. */
5237 static inline void
5238 gimple_omp_atomic_store_set_val (gimple g, tree val)
5240 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
5241 g->gimple_omp_atomic_store.val = val;
5245 /* Return the value being stored in an atomic store. */
5247 static inline tree
5248 gimple_omp_atomic_store_val (const_gimple g)
5250 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
5251 return g->gimple_omp_atomic_store.val;
5255 /* Return a pointer to the value being stored in an atomic store. */
5257 static inline tree *
5258 gimple_omp_atomic_store_val_ptr (gimple g)
5260 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
5261 return &g->gimple_omp_atomic_store.val;
5265 /* Set the LHS of an atomic load. */
5267 static inline void
5268 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5270 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
5271 g->gimple_omp_atomic_load.lhs = lhs;
5275 /* Get the LHS of an atomic load. */
5277 static inline tree
5278 gimple_omp_atomic_load_lhs (const_gimple g)
5280 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
5281 return g->gimple_omp_atomic_load.lhs;
5285 /* Return a pointer to the LHS of an atomic load. */
5287 static inline tree *
5288 gimple_omp_atomic_load_lhs_ptr (gimple g)
5290 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
5291 return &g->gimple_omp_atomic_load.lhs;
5295 /* Set the RHS of an atomic load. */
5297 static inline void
5298 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5300 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
5301 g->gimple_omp_atomic_load.rhs = rhs;
5305 /* Get the RHS of an atomic load. */
5307 static inline tree
5308 gimple_omp_atomic_load_rhs (const_gimple g)
5310 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
5311 return g->gimple_omp_atomic_load.rhs;
5315 /* Return a pointer to the RHS of an atomic load. */
5317 static inline tree *
5318 gimple_omp_atomic_load_rhs_ptr (gimple g)
5320 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
5321 return &g->gimple_omp_atomic_load.rhs;
5325 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5327 static inline tree
5328 gimple_omp_continue_control_def (const_gimple g)
5330 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
5331 return g->gimple_omp_continue.control_def;
5334 /* The same as above, but return the address. */
5336 static inline tree *
5337 gimple_omp_continue_control_def_ptr (gimple g)
5339 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
5340 return &g->gimple_omp_continue.control_def;
5343 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5345 static inline void
5346 gimple_omp_continue_set_control_def (gimple g, tree def)
5348 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
5349 g->gimple_omp_continue.control_def = def;
5353 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5355 static inline tree
5356 gimple_omp_continue_control_use (const_gimple g)
5358 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
5359 return g->gimple_omp_continue.control_use;
5363 /* The same as above, but return the address. */
5365 static inline tree *
5366 gimple_omp_continue_control_use_ptr (gimple g)
5368 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
5369 return &g->gimple_omp_continue.control_use;
5373 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5375 static inline void
5376 gimple_omp_continue_set_control_use (gimple g, tree use)
5378 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
5379 g->gimple_omp_continue.control_use = use;
5382 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5384 static inline gimple_seq *
5385 gimple_transaction_body_ptr (gimple gs)
5387 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5388 return &gs->gimple_transaction.body;
5391 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5393 static inline gimple_seq
5394 gimple_transaction_body (gimple gs)
5396 return *gimple_transaction_body_ptr (gs);
5399 /* Return the label associated with a GIMPLE_TRANSACTION. */
5401 static inline tree
5402 gimple_transaction_label (const_gimple gs)
5404 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5405 return gs->gimple_transaction.label;
5408 static inline tree *
5409 gimple_transaction_label_ptr (gimple gs)
5411 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5412 return &gs->gimple_transaction.label;
5415 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5417 static inline unsigned int
5418 gimple_transaction_subcode (const_gimple gs)
5420 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5421 return gs->gsbase.subcode;
5424 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5426 static inline void
5427 gimple_transaction_set_body (gimple gs, gimple_seq body)
5429 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5430 gs->gimple_transaction.body = body;
5433 /* Set the label associated with a GIMPLE_TRANSACTION. */
5435 static inline void
5436 gimple_transaction_set_label (gimple gs, tree label)
5438 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5439 gs->gimple_transaction.label = label;
5442 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5444 static inline void
5445 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5447 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5448 gs->gsbase.subcode = subcode;
5452 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5454 static inline tree *
5455 gimple_return_retval_ptr (const_gimple gs)
5457 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5458 return gimple_op_ptr (gs, 0);
5461 /* Return the return value for GIMPLE_RETURN GS. */
5463 static inline tree
5464 gimple_return_retval (const_gimple gs)
5466 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5467 return gimple_op (gs, 0);
5471 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5473 static inline void
5474 gimple_return_set_retval (gimple gs, tree retval)
5476 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5477 gimple_set_op (gs, 0, retval);
5481 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5483 #define CASE_GIMPLE_OMP \
5484 case GIMPLE_OMP_PARALLEL: \
5485 case GIMPLE_OMP_TASK: \
5486 case GIMPLE_OMP_FOR: \
5487 case GIMPLE_OMP_SECTIONS: \
5488 case GIMPLE_OMP_SECTIONS_SWITCH: \
5489 case GIMPLE_OMP_SINGLE: \
5490 case GIMPLE_OMP_SECTION: \
5491 case GIMPLE_OMP_MASTER: \
5492 case GIMPLE_OMP_ORDERED: \
5493 case GIMPLE_OMP_CRITICAL: \
5494 case GIMPLE_OMP_RETURN: \
5495 case GIMPLE_OMP_ATOMIC_LOAD: \
5496 case GIMPLE_OMP_ATOMIC_STORE: \
5497 case GIMPLE_OMP_CONTINUE
5499 static inline bool
5500 is_gimple_omp (const_gimple stmt)
5502 switch (gimple_code (stmt))
5504 CASE_GIMPLE_OMP:
5505 return true;
5506 default:
5507 return false;
5512 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5514 static inline bool
5515 gimple_nop_p (const_gimple g)
5517 return gimple_code (g) == GIMPLE_NOP;
5521 /* Return true if GS is a GIMPLE_RESX. */
5523 static inline bool
5524 is_gimple_resx (const_gimple gs)
5526 return gimple_code (gs) == GIMPLE_RESX;
5529 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5531 static inline enum br_predictor
5532 gimple_predict_predictor (gimple gs)
5534 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5535 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
5539 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5541 static inline void
5542 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5544 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5545 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
5546 | (unsigned) predictor;
5550 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5552 static inline enum prediction
5553 gimple_predict_outcome (gimple gs)
5555 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5556 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5560 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5562 static inline void
5563 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5565 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5566 if (outcome == TAKEN)
5567 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
5568 else
5569 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
5573 /* Return the type of the main expression computed by STMT. Return
5574 void_type_node if the statement computes nothing. */
5576 static inline tree
5577 gimple_expr_type (const_gimple stmt)
5579 enum gimple_code code = gimple_code (stmt);
5581 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5583 tree type;
5584 /* In general we want to pass out a type that can be substituted
5585 for both the RHS and the LHS types if there is a possibly
5586 useless conversion involved. That means returning the
5587 original RHS type as far as we can reconstruct it. */
5588 if (code == GIMPLE_CALL)
5589 type = gimple_call_return_type (stmt);
5590 else
5591 switch (gimple_assign_rhs_code (stmt))
5593 case POINTER_PLUS_EXPR:
5594 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5595 break;
5597 default:
5598 /* As fallback use the type of the LHS. */
5599 type = TREE_TYPE (gimple_get_lhs (stmt));
5600 break;
5602 return type;
5604 else if (code == GIMPLE_COND)
5605 return boolean_type_node;
5606 else
5607 return void_type_node;
5610 /* Return true if TYPE is a suitable type for a scalar register variable. */
5612 static inline bool
5613 is_gimple_reg_type (tree type)
5615 return !AGGREGATE_TYPE_P (type);
5618 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
5620 static inline gimple_stmt_iterator
5621 gsi_start_1 (gimple_seq *seq)
5623 gimple_stmt_iterator i;
5625 i.ptr = gimple_seq_first (*seq);
5626 i.seq = seq;
5627 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5629 return i;
5632 #define gsi_start(x) gsi_start_1(&(x))
5634 static inline gimple_stmt_iterator
5635 gsi_none (void)
5637 gimple_stmt_iterator i;
5638 i.ptr = NULL;
5639 i.seq = NULL;
5640 i.bb = NULL;
5641 return i;
5644 /* Return a new iterator pointing to the first statement in basic block BB. */
5646 static inline gimple_stmt_iterator
5647 gsi_start_bb (basic_block bb)
5649 gimple_stmt_iterator i;
5650 gimple_seq *seq;
5652 seq = bb_seq_addr (bb);
5653 i.ptr = gimple_seq_first (*seq);
5654 i.seq = seq;
5655 i.bb = bb;
5657 return i;
5661 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5663 static inline gimple_stmt_iterator
5664 gsi_last_1 (gimple_seq *seq)
5666 gimple_stmt_iterator i;
5668 i.ptr = gimple_seq_last (*seq);
5669 i.seq = seq;
5670 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5672 return i;
5675 #define gsi_last(x) gsi_last_1(&(x))
5677 /* Return a new iterator pointing to the last statement in basic block BB. */
5679 static inline gimple_stmt_iterator
5680 gsi_last_bb (basic_block bb)
5682 gimple_stmt_iterator i;
5683 gimple_seq *seq;
5685 seq = bb_seq_addr (bb);
5686 i.ptr = gimple_seq_last (*seq);
5687 i.seq = seq;
5688 i.bb = bb;
5690 return i;
5694 /* Return true if I is at the end of its sequence. */
5696 static inline bool
5697 gsi_end_p (gimple_stmt_iterator i)
5699 return i.ptr == NULL;
5703 /* Return true if I is one statement before the end of its sequence. */
5705 static inline bool
5706 gsi_one_before_end_p (gimple_stmt_iterator i)
5708 return i.ptr != NULL && i.ptr->gsbase.next == NULL;
5712 /* Advance the iterator to the next gimple statement. */
5714 static inline void
5715 gsi_next (gimple_stmt_iterator *i)
5717 i->ptr = i->ptr->gsbase.next;
5720 /* Advance the iterator to the previous gimple statement. */
5722 static inline void
5723 gsi_prev (gimple_stmt_iterator *i)
5725 gimple prev = i->ptr->gsbase.prev;
5726 if (prev->gsbase.next)
5727 i->ptr = prev;
5728 else
5729 i->ptr = NULL;
5732 /* Return the current stmt. */
5734 static inline gimple
5735 gsi_stmt (gimple_stmt_iterator i)
5737 return i.ptr;
5740 /* Return a block statement iterator that points to the first non-label
5741 statement in block BB. */
5743 static inline gimple_stmt_iterator
5744 gsi_after_labels (basic_block bb)
5746 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5748 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5749 gsi_next (&gsi);
5751 return gsi;
5754 /* Advance the iterator to the next non-debug gimple statement. */
5756 static inline void
5757 gsi_next_nondebug (gimple_stmt_iterator *i)
5761 gsi_next (i);
5763 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5766 /* Advance the iterator to the next non-debug gimple statement. */
5768 static inline void
5769 gsi_prev_nondebug (gimple_stmt_iterator *i)
5773 gsi_prev (i);
5775 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5778 /* Return a new iterator pointing to the first non-debug statement in
5779 basic block BB. */
5781 static inline gimple_stmt_iterator
5782 gsi_start_nondebug_bb (basic_block bb)
5784 gimple_stmt_iterator i = gsi_start_bb (bb);
5786 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5787 gsi_next_nondebug (&i);
5789 return i;
5792 /* Return a new iterator pointing to the last non-debug statement in
5793 basic block BB. */
5795 static inline gimple_stmt_iterator
5796 gsi_last_nondebug_bb (basic_block bb)
5798 gimple_stmt_iterator i = gsi_last_bb (bb);
5800 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5801 gsi_prev_nondebug (&i);
5803 return i;
5807 /* Return the basic block associated with this iterator. */
5809 static inline basic_block
5810 gsi_bb (gimple_stmt_iterator i)
5812 return i.bb;
5816 /* Return the sequence associated with this iterator. */
5818 static inline gimple_seq
5819 gsi_seq (gimple_stmt_iterator i)
5821 return *i.seq;
5825 enum gsi_iterator_update
5827 GSI_NEW_STMT, /* Only valid when single statement is added, move
5828 iterator to it. */
5829 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5830 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5831 for linking other statements in the same
5832 direction. */
5835 /* In gimple-iterator.c */
5836 gimple_stmt_iterator gsi_start_phis (basic_block);
5837 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5838 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5839 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5840 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5841 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5842 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5843 enum gsi_iterator_update);
5844 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5845 enum gsi_iterator_update);
5846 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5847 enum gsi_iterator_update);
5848 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5849 enum gsi_iterator_update);
5850 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5851 enum gsi_iterator_update);
5852 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5853 enum gsi_iterator_update);
5854 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5855 enum gsi_iterator_update);
5856 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5857 enum gsi_iterator_update);
5858 bool gsi_remove (gimple_stmt_iterator *, bool);
5859 gimple_stmt_iterator gsi_for_stmt (gimple);
5860 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5861 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5862 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5863 void gsi_insert_on_edge (edge, gimple);
5864 void gsi_insert_seq_on_edge (edge, gimple_seq);
5865 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5866 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5867 void gsi_commit_one_edge_insert (edge, basic_block *);
5868 void gsi_commit_edge_inserts (void);
5869 gimple gimple_call_copy_skip_args (gimple, bitmap);
5872 /* Convenience routines to walk all statements of a gimple function.
5873 Note that this is useful exclusively before the code is converted
5874 into SSA form. Once the program is in SSA form, the standard
5875 operand interface should be used to analyze/modify statements. */
5876 struct walk_stmt_info
5878 /* Points to the current statement being walked. */
5879 gimple_stmt_iterator gsi;
5881 /* Additional data that the callback functions may want to carry
5882 through the recursion. */
5883 void *info;
5885 /* Pointer map used to mark visited tree nodes when calling
5886 walk_tree on each operand. If set to NULL, duplicate tree nodes
5887 will be visited more than once. */
5888 struct pointer_set_t *pset;
5890 /* Operand returned by the callbacks. This is set when calling
5891 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5892 returns non-NULL, this field will contain the tree returned by
5893 the last callback. */
5894 tree callback_result;
5896 /* Indicates whether the operand being examined may be replaced
5897 with something that matches is_gimple_val (if true) or something
5898 slightly more complicated (if false). "Something" technically
5899 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5900 but we never try to form anything more complicated than that, so
5901 we don't bother checking.
5903 Also note that CALLBACK should update this flag while walking the
5904 sub-expressions of a statement. For instance, when walking the
5905 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5906 to true, however, when walking &var, the operand of that
5907 ADDR_EXPR does not need to be a GIMPLE value. */
5908 BOOL_BITFIELD val_only : 1;
5910 /* True if we are currently walking the LHS of an assignment. */
5911 BOOL_BITFIELD is_lhs : 1;
5913 /* Optional. Set to true by the callback functions if they made any
5914 changes. */
5915 BOOL_BITFIELD changed : 1;
5917 /* True if we're interested in location information. */
5918 BOOL_BITFIELD want_locations : 1;
5920 /* True if we've removed the statement that was processed. */
5921 BOOL_BITFIELD removed_stmt : 1;
5924 /* Callback for walk_gimple_stmt. Called for every statement found
5925 during traversal. The first argument points to the statement to
5926 walk. The second argument is a flag that the callback sets to
5927 'true' if it the callback handled all the operands and
5928 sub-statements of the statement (the default value of this flag is
5929 'false'). The third argument is an anonymous pointer to data
5930 to be used by the callback. */
5931 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5932 struct walk_stmt_info *);
5934 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5935 struct walk_stmt_info *);
5936 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5937 struct walk_stmt_info *);
5938 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5939 struct walk_stmt_info *);
5940 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5942 /* Enum and arrays used for allocation stats. Keep in sync with
5943 gimple.c:gimple_alloc_kind_names. */
5944 enum gimple_alloc_kind
5946 gimple_alloc_kind_assign, /* Assignments. */
5947 gimple_alloc_kind_phi, /* PHI nodes. */
5948 gimple_alloc_kind_cond, /* Conditionals. */
5949 gimple_alloc_kind_rest, /* Everything else. */
5950 gimple_alloc_kind_all
5953 extern int gimple_alloc_counts[];
5954 extern int gimple_alloc_sizes[];
5956 /* Return the allocation kind for a given stmt CODE. */
5957 static inline enum gimple_alloc_kind
5958 gimple_alloc_kind (enum gimple_code code)
5960 switch (code)
5962 case GIMPLE_ASSIGN:
5963 return gimple_alloc_kind_assign;
5964 case GIMPLE_PHI:
5965 return gimple_alloc_kind_phi;
5966 case GIMPLE_COND:
5967 return gimple_alloc_kind_cond;
5968 default:
5969 return gimple_alloc_kind_rest;
5973 extern void dump_gimple_statistics (void);
5975 /* In gimple-fold.c. */
5976 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5977 tree gimple_fold_builtin (gimple);
5978 bool fold_stmt (gimple_stmt_iterator *);
5979 bool fold_stmt_inplace (gimple_stmt_iterator *);
5980 tree get_symbol_constant_value (tree);
5981 tree canonicalize_constructor_val (tree, tree);
5982 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5983 enum tree_code, tree, tree);
5984 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5985 enum tree_code, tree, tree);
5987 bool gimple_val_nonnegative_real_p (tree);
5988 #endif /* GCC_GIMPLE_H */