Merge branch 'master' r217593-r217725 into gimple-classes-v2-option-3
[official-gcc.git] / gcc / gimple.h
blob704b2dc2cfc391f9937510a81d0a5da552f4eda8
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2014 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 typedef gimple gimple_seq_node;
27 enum gimple_code {
28 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
29 #include "gimple.def"
30 #undef DEFGSCODE
31 LAST_AND_UNUSED_GIMPLE_CODE
34 extern const char *const gimple_code_name[];
35 extern const unsigned char gimple_rhs_class_table[];
37 /* Error out if a gimple tuple is addressed incorrectly. */
38 #if defined ENABLE_GIMPLE_CHECKING
39 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
40 extern void gimple_check_failed (const_gimple, const char *, int, \
41 const char *, enum gimple_code, \
42 enum tree_code) ATTRIBUTE_NORETURN;
44 #define GIMPLE_CHECK(GS, CODE) \
45 do { \
46 const_gimple __gs = (GS); \
47 if (gimple_code (__gs) != (CODE)) \
48 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
49 (CODE), ERROR_MARK); \
50 } while (0)
51 #else /* not ENABLE_GIMPLE_CHECKING */
52 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
53 #define GIMPLE_CHECK(GS, CODE) (void)0
54 #endif
56 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
57 get_gimple_rhs_class. */
58 enum gimple_rhs_class
60 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
61 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
62 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
63 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
64 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
65 name, a _DECL, a _REF, etc. */
68 /* Specific flags for individual GIMPLE statements. These flags are
69 always stored in gimple_statement_base.subcode and they may only be
70 defined for statement codes that do not use subcodes.
72 Values for the masks can overlap as long as the overlapping values
73 are never used in the same statement class.
75 The maximum mask value that can be defined is 1 << 15 (i.e., each
76 statement code can hold up to 16 bitflags).
78 Keep this list sorted. */
79 enum gf_mask {
80 GF_ASM_INPUT = 1 << 0,
81 GF_ASM_VOLATILE = 1 << 1,
82 GF_CALL_FROM_THUNK = 1 << 0,
83 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
84 GF_CALL_TAILCALL = 1 << 2,
85 GF_CALL_VA_ARG_PACK = 1 << 3,
86 GF_CALL_NOTHROW = 1 << 4,
87 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
88 GF_CALL_INTERNAL = 1 << 6,
89 GF_CALL_CTRL_ALTERING = 1 << 7,
90 GF_CALL_WITH_BOUNDS = 1 << 8,
91 GF_OMP_PARALLEL_COMBINED = 1 << 0,
92 GF_OMP_FOR_KIND_MASK = 7 << 0,
93 GF_OMP_FOR_KIND_FOR = 0,
94 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
95 GF_OMP_FOR_KIND_CILKFOR = 2,
96 /* Flag for SIMD variants of OMP_FOR kinds. */
97 GF_OMP_FOR_SIMD = 1 << 2,
98 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
99 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
100 GF_OMP_FOR_COMBINED = 1 << 3,
101 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
102 GF_OMP_TARGET_KIND_MASK = (1 << 2) - 1,
103 GF_OMP_TARGET_KIND_REGION = 0,
104 GF_OMP_TARGET_KIND_DATA = 1,
105 GF_OMP_TARGET_KIND_UPDATE = 2,
107 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
108 a thread synchronization via some sort of barrier. The exact barrier
109 that would otherwise be emitted is dependent on the OMP statement with
110 which this return is associated. */
111 GF_OMP_RETURN_NOWAIT = 1 << 0,
113 GF_OMP_SECTION_LAST = 1 << 0,
114 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
115 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
116 GF_PREDICT_TAKEN = 1 << 15
119 /* Currently, there are only two types of gimple debug stmt. Others are
120 envisioned, for example, to enable the generation of is_stmt notes
121 in line number information, to mark sequence points, etc. This
122 subcode is to be used to tell them apart. */
123 enum gimple_debug_subcode {
124 GIMPLE_DEBUG_BIND = 0,
125 GIMPLE_DEBUG_SOURCE_BIND = 1
128 /* Masks for selecting a pass local flag (PLF) to work on. These
129 masks are used by gimple_set_plf and gimple_plf. */
130 enum plf_mask {
131 GF_PLF_1 = 1 << 0,
132 GF_PLF_2 = 1 << 1
135 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
136 are for 64 bit hosts. */
138 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
139 chain_next ("%h.next"), variable_size))
140 gimple_statement_base
142 /* [ WORD 1 ]
143 Main identifying code for a tuple. */
144 ENUM_BITFIELD(gimple_code) code : 8;
146 /* Nonzero if a warning should not be emitted on this tuple. */
147 unsigned int no_warning : 1;
149 /* Nonzero if this tuple has been visited. Passes are responsible
150 for clearing this bit before using it. */
151 unsigned int visited : 1;
153 /* Nonzero if this tuple represents a non-temporal move. */
154 unsigned int nontemporal_move : 1;
156 /* Pass local flags. These flags are free for any pass to use as
157 they see fit. Passes should not assume that these flags contain
158 any useful value when the pass starts. Any initial state that
159 the pass requires should be set on entry to the pass. See
160 gimple_set_plf and gimple_plf for usage. */
161 unsigned int plf : 2;
163 /* Nonzero if this statement has been modified and needs to have its
164 operands rescanned. */
165 unsigned modified : 1;
167 /* Nonzero if this statement contains volatile operands. */
168 unsigned has_volatile_ops : 1;
170 /* Padding to get subcode to 16 bit alignment. */
171 unsigned pad : 1;
173 /* The SUBCODE field can be used for tuple-specific flags for tuples
174 that do not require subcodes. Note that SUBCODE should be at
175 least as wide as tree codes, as several tuples store tree codes
176 in there. */
177 unsigned int subcode : 16;
179 /* UID of this statement. This is used by passes that want to
180 assign IDs to statements. It must be assigned and used by each
181 pass. By default it should be assumed to contain garbage. */
182 unsigned uid;
184 /* [ WORD 2 ]
185 Locus information for debug info. */
186 location_t location;
188 /* Number of operands in this tuple. */
189 unsigned num_ops;
191 /* [ WORD 3 ]
192 Basic block holding this statement. */
193 basic_block bb;
195 /* [ WORD 4-5 ]
196 Linked lists of gimple statements. The next pointers form
197 a NULL terminated list, the prev pointers are a cyclic list.
198 A gimple statement is hence also a double-ended list of
199 statements, with the pointer itself being the first element,
200 and the prev pointer being the last. */
201 gimple next;
202 gimple GTY((skip)) prev;
207 /* Base structure for tuples with operands. */
209 /* This gimple subclass has no tag value. */
210 struct GTY(())
211 gimple_statement_with_ops_base : public gimple_statement_base
213 /* [ WORD 1-6 ] : base class */
215 /* [ WORD 7 ]
216 SSA operand vectors. NOTE: It should be possible to
217 amalgamate these vectors with the operand vector OP. However,
218 the SSA operand vectors are organized differently and contain
219 more information (like immediate use chaining). */
220 struct use_optype_d GTY((skip (""))) *use_ops;
224 /* Statements that take register operands. */
226 struct GTY((tag("GSS_WITH_OPS")))
227 gimple_statement_with_ops : public gimple_statement_with_ops_base
229 /* [ WORD 1-7 ] : base class */
231 /* [ WORD 8 ]
232 Operand vector. NOTE! This must always be the last field
233 of this structure. In particular, this means that this
234 structure cannot be embedded inside another one. */
235 tree GTY((length ("%h.num_ops"))) op[1];
239 /* Base for statements that take both memory and register operands. */
241 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
242 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
244 /* [ WORD 1-7 ] : base class */
246 /* [ WORD 8-9 ]
247 Virtual operands for this statement. The GC will pick them
248 up via the ssa_names array. */
249 tree GTY((skip (""))) vdef;
250 tree GTY((skip (""))) vuse;
254 /* Statements that take both memory and register operands. */
256 struct GTY((tag("GSS_WITH_MEM_OPS")))
257 gimple_statement_with_memory_ops :
258 public gimple_statement_with_memory_ops_base
260 /* [ WORD 1-9 ] : base class */
262 /* [ WORD 10 ]
263 Operand vector. NOTE! This must always be the last field
264 of this structure. In particular, this means that this
265 structure cannot be embedded inside another one. */
266 tree GTY((length ("%h.num_ops"))) op[1];
270 /* Call statements that take both memory and register operands. */
272 struct GTY((tag("GSS_CALL")))
273 gcall : public gimple_statement_with_memory_ops_base
275 /* [ WORD 1-9 ] : base class */
277 /* [ WORD 10-13 ] */
278 struct pt_solution call_used;
279 struct pt_solution call_clobbered;
281 /* [ WORD 14 ] */
282 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
283 tree GTY ((tag ("0"))) fntype;
284 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
285 } u;
287 /* [ WORD 15 ]
288 Operand vector. NOTE! This must always be the last field
289 of this structure. In particular, this means that this
290 structure cannot be embedded inside another one. */
291 tree GTY((length ("%h.num_ops"))) op[1];
295 /* OpenMP statements (#pragma omp). */
297 struct GTY((tag("GSS_OMP")))
298 gimple_statement_omp : public gimple_statement_base
300 /* [ WORD 1-6 ] : base class */
302 /* [ WORD 7 ] */
303 gimple_seq body;
307 /* GIMPLE_BIND */
309 struct GTY((tag("GSS_BIND")))
310 gbind : public gimple_statement_base
312 /* [ WORD 1-6 ] : base class */
314 /* [ WORD 7 ]
315 Variables declared in this scope. */
316 tree vars;
318 /* [ WORD 8 ]
319 This is different than the BLOCK field in gimple_statement_base,
320 which is analogous to TREE_BLOCK (i.e., the lexical block holding
321 this statement). This field is the equivalent of BIND_EXPR_BLOCK
322 in tree land (i.e., the lexical scope defined by this bind). See
323 gimple-low.c. */
324 tree block;
326 /* [ WORD 9 ] */
327 gimple_seq body;
331 /* GIMPLE_CATCH */
333 struct GTY((tag("GSS_CATCH")))
334 gcatch : public gimple_statement_base
336 /* [ WORD 1-6 ] : base class */
338 /* [ WORD 7 ] */
339 tree types;
341 /* [ WORD 8 ] */
342 gimple_seq handler;
346 /* GIMPLE_EH_FILTER */
348 struct GTY((tag("GSS_EH_FILTER")))
349 geh_filter : public gimple_statement_base
351 /* [ WORD 1-6 ] : base class */
353 /* [ WORD 7 ]
354 Filter types. */
355 tree types;
357 /* [ WORD 8 ]
358 Failure actions. */
359 gimple_seq failure;
362 /* GIMPLE_EH_ELSE */
364 struct GTY((tag("GSS_EH_ELSE")))
365 geh_else : public gimple_statement_base
367 /* [ WORD 1-6 ] : base class */
369 /* [ WORD 7,8 ] */
370 gimple_seq n_body, e_body;
373 /* GIMPLE_EH_MUST_NOT_THROW */
375 struct GTY((tag("GSS_EH_MNT")))
376 geh_mnt : public gimple_statement_base
378 /* [ WORD 1-6 ] : base class */
380 /* [ WORD 7 ] Abort function decl. */
381 tree fndecl;
384 /* GIMPLE_PHI */
386 struct GTY((tag("GSS_PHI")))
387 gphi : public gimple_statement_base
389 /* [ WORD 1-6 ] : base class */
391 /* [ WORD 7 ] */
392 unsigned capacity;
393 unsigned nargs;
395 /* [ WORD 8 ] */
396 tree result;
398 /* [ WORD 9 ] */
399 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
403 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
405 struct GTY((tag("GSS_EH_CTRL")))
406 gimple_statement_eh_ctrl : public gimple_statement_base
408 /* [ WORD 1-6 ] : base class */
410 /* [ WORD 7 ]
411 Exception region number. */
412 int region;
415 struct GTY((tag("GSS_EH_CTRL")))
416 gresx : public gimple_statement_eh_ctrl
418 /* No extra fields; adds invariant:
419 stmt->code == GIMPLE_RESX. */
422 struct GTY((tag("GSS_EH_CTRL")))
423 geh_dispatch : public gimple_statement_eh_ctrl
425 /* No extra fields; adds invariant:
426 stmt->code == GIMPLE_EH_DISPATH. */
430 /* GIMPLE_TRY */
432 struct GTY((tag("GSS_TRY")))
433 gtry : public gimple_statement_base
435 /* [ WORD 1-6 ] : base class */
437 /* [ WORD 7 ]
438 Expression to evaluate. */
439 gimple_seq eval;
441 /* [ WORD 8 ]
442 Cleanup expression. */
443 gimple_seq cleanup;
446 /* Kind of GIMPLE_TRY statements. */
447 enum gimple_try_flags
449 /* A try/catch. */
450 GIMPLE_TRY_CATCH = 1 << 0,
452 /* A try/finally. */
453 GIMPLE_TRY_FINALLY = 1 << 1,
454 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
456 /* Analogous to TRY_CATCH_IS_CLEANUP. */
457 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
460 /* GIMPLE_WITH_CLEANUP_EXPR */
462 struct GTY((tag("GSS_WCE")))
463 gimple_statement_wce : public gimple_statement_base
465 /* [ WORD 1-6 ] : base class */
467 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
468 executed if an exception is thrown, not on normal exit of its
469 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
470 in TARGET_EXPRs. */
472 /* [ WORD 7 ]
473 Cleanup expression. */
474 gimple_seq cleanup;
478 /* GIMPLE_ASM */
480 struct GTY((tag("GSS_ASM")))
481 gasm : public gimple_statement_with_memory_ops_base
483 /* [ WORD 1-9 ] : base class */
485 /* [ WORD 10 ]
486 __asm__ statement. */
487 const char *string;
489 /* [ WORD 11 ]
490 Number of inputs, outputs, clobbers, labels. */
491 unsigned char ni;
492 unsigned char no;
493 unsigned char nc;
494 unsigned char nl;
496 /* [ WORD 12 ]
497 Operand vector. NOTE! This must always be the last field
498 of this structure. In particular, this means that this
499 structure cannot be embedded inside another one. */
500 tree GTY((length ("%h.num_ops"))) op[1];
503 /* GIMPLE_OMP_CRITICAL */
505 struct GTY((tag("GSS_OMP_CRITICAL")))
506 gomp_critical : public gimple_statement_omp
508 /* [ WORD 1-7 ] : base class */
510 /* [ WORD 8 ]
511 Critical section name. */
512 tree name;
516 struct GTY(()) gimple_omp_for_iter {
517 /* Condition code. */
518 enum tree_code cond;
520 /* Index variable. */
521 tree index;
523 /* Initial value. */
524 tree initial;
526 /* Final value. */
527 tree final;
529 /* Increment. */
530 tree incr;
533 /* GIMPLE_OMP_FOR */
535 struct GTY((tag("GSS_OMP_FOR")))
536 gomp_for : public gimple_statement_omp
538 /* [ WORD 1-7 ] : base class */
540 /* [ WORD 8 ] */
541 tree clauses;
543 /* [ WORD 9 ]
544 Number of elements in iter array. */
545 size_t collapse;
547 /* [ WORD 10 ] */
548 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
550 /* [ WORD 11 ]
551 Pre-body evaluated before the loop body begins. */
552 gimple_seq pre_body;
556 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET */
557 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
558 gimple_statement_omp_parallel_layout : public gimple_statement_omp
560 /* [ WORD 1-7 ] : base class */
562 /* [ WORD 8 ]
563 Clauses. */
564 tree clauses;
566 /* [ WORD 9 ]
567 Child function holding the body of the parallel region. */
568 tree child_fn;
570 /* [ WORD 10 ]
571 Shared data argument. */
572 tree data_arg;
575 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
576 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
577 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
579 /* No extra fields; adds invariant:
580 stmt->code == GIMPLE_OMP_PARALLEL
581 || stmt->code == GIMPLE_OMP_TASK. */
585 /* GIMPLE_OMP_PARALLEL */
586 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
587 gomp_parallel : public gimple_statement_omp_taskreg
589 /* No extra fields; adds invariant:
590 stmt->code == GIMPLE_OMP_PARALLEL. */
593 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
594 gomp_target : public gimple_statement_omp_parallel_layout
596 /* No extra fields; adds invariant:
597 stmt->code == GIMPLE_OMP_TARGET. */
600 /* GIMPLE_OMP_TASK */
602 struct GTY((tag("GSS_OMP_TASK")))
603 gomp_task : public gimple_statement_omp_taskreg
605 /* [ WORD 1-10 ] : base class */
607 /* [ WORD 11 ]
608 Child function holding firstprivate initialization if needed. */
609 tree copy_fn;
611 /* [ WORD 12-13 ]
612 Size and alignment in bytes of the argument data block. */
613 tree arg_size;
614 tree arg_align;
618 /* GIMPLE_OMP_SECTION */
619 /* Uses struct gimple_statement_omp. */
622 /* GIMPLE_OMP_SECTIONS */
624 struct GTY((tag("GSS_OMP_SECTIONS")))
625 gomp_sections : public gimple_statement_omp
627 /* [ WORD 1-7 ] : base class */
629 /* [ WORD 8 ] */
630 tree clauses;
632 /* [ WORD 9 ]
633 The control variable used for deciding which of the sections to
634 execute. */
635 tree control;
638 /* GIMPLE_OMP_CONTINUE.
640 Note: This does not inherit from gimple_statement_omp, because we
641 do not need the body field. */
643 struct GTY((tag("GSS_OMP_CONTINUE")))
644 gomp_continue : public gimple_statement_base
646 /* [ WORD 1-6 ] : base class */
648 /* [ WORD 7 ] */
649 tree control_def;
651 /* [ WORD 8 ] */
652 tree control_use;
655 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
657 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
658 gimple_statement_omp_single_layout : public gimple_statement_omp
660 /* [ WORD 1-7 ] : base class */
662 /* [ WORD 7 ] */
663 tree clauses;
666 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
667 gomp_single : public gimple_statement_omp_single_layout
669 /* No extra fields; adds invariant:
670 stmt->code == GIMPLE_OMP_SINGLE. */
673 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
674 gomp_teams : public gimple_statement_omp_single_layout
676 /* No extra fields; adds invariant:
677 stmt->code == GIMPLE_OMP_TEAMS. */
681 /* GIMPLE_OMP_ATOMIC_LOAD.
682 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
683 contains a sequence, which we don't need here. */
685 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
686 gomp_atomic_load : public gimple_statement_base
688 /* [ WORD 1-6 ] : base class */
690 /* [ WORD 7-8 ] */
691 tree rhs, lhs;
694 /* GIMPLE_OMP_ATOMIC_STORE.
695 See note on GIMPLE_OMP_ATOMIC_LOAD. */
697 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
698 gimple_statement_omp_atomic_store_layout : public gimple_statement_base
700 /* [ WORD 1-6 ] : base class */
702 /* [ WORD 7 ] */
703 tree val;
706 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
707 gomp_atomic_store :
708 public gimple_statement_omp_atomic_store_layout
710 /* No extra fields; adds invariant:
711 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
714 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
715 gimple_statement_omp_return :
716 public gimple_statement_omp_atomic_store_layout
718 /* No extra fields; adds invariant:
719 stmt->code == GIMPLE_OMP_RETURN. */
722 /* GIMPLE_TRANSACTION. */
724 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
726 /* The __transaction_atomic was declared [[outer]] or it is
727 __transaction_relaxed. */
728 #define GTMA_IS_OUTER (1u << 0)
729 #define GTMA_IS_RELAXED (1u << 1)
730 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
732 /* The transaction is seen to not have an abort. */
733 #define GTMA_HAVE_ABORT (1u << 2)
734 /* The transaction is seen to have loads or stores. */
735 #define GTMA_HAVE_LOAD (1u << 3)
736 #define GTMA_HAVE_STORE (1u << 4)
737 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
738 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
739 /* The transaction WILL enter serial irrevocable mode.
740 An irrevocable block post-dominates the entire transaction, such
741 that all invocations of the transaction will go serial-irrevocable.
742 In such case, we don't bother instrumenting the transaction, and
743 tell the runtime that it should begin the transaction in
744 serial-irrevocable mode. */
745 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
746 /* The transaction contains no instrumentation code whatsover, most
747 likely because it is guaranteed to go irrevocable upon entry. */
748 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
750 struct GTY((tag("GSS_TRANSACTION")))
751 gtransaction : public gimple_statement_with_memory_ops_base
753 /* [ WORD 1-9 ] : base class */
755 /* [ WORD 10 ] */
756 gimple_seq body;
758 /* [ WORD 11 ] */
759 tree label;
762 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
763 enum gimple_statement_structure_enum {
764 #include "gsstruct.def"
765 LAST_GSS_ENUM
767 #undef DEFGSSTRUCT
769 /* A statement with the invariant that
770 stmt->code == GIMPLE_COND
771 i.e. a conditional jump statement. */
773 struct GTY((tag("GSS_WITH_OPS")))
774 gcond : public gimple_statement_with_ops
776 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
779 /* A statement with the invariant that
780 stmt->code == GIMPLE_DEBUG
781 i.e. a debug statement. */
783 struct GTY((tag("GSS_WITH_OPS")))
784 gdebug : public gimple_statement_with_ops
786 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
789 /* A statement with the invariant that
790 stmt->code == GIMPLE_GOTO
791 i.e. a goto statement. */
793 struct GTY((tag("GSS_WITH_OPS")))
794 ggoto : public gimple_statement_with_ops
796 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
799 /* A statement with the invariant that
800 stmt->code == GIMPLE_LABEL
801 i.e. a label statement. */
803 struct GTY((tag("GSS_WITH_OPS")))
804 glabel : public gimple_statement_with_ops
806 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
809 /* A statement with the invariant that
810 stmt->code == GIMPLE_SWITCH
811 i.e. a switch statement. */
813 struct GTY((tag("GSS_WITH_OPS")))
814 gswitch : public gimple_statement_with_ops
816 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
819 /* A statement with the invariant that
820 stmt->code == GIMPLE_ASSIGN
821 i.e. an assignment statement. */
823 struct GTY((tag("GSS_WITH_MEM_OPS")))
824 gassign : public gimple_statement_with_memory_ops
826 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
829 /* A statement with the invariant that
830 stmt->code == GIMPLE_RETURN
831 i.e. a return statement. */
833 struct GTY((tag("GSS_WITH_MEM_OPS")))
834 greturn : public gimple_statement_with_memory_ops
836 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
839 template <>
840 template <>
841 inline bool
842 is_a_helper <gasm *>::test (gimple gs)
844 return gs->code == GIMPLE_ASM;
847 template <>
848 template <>
849 inline bool
850 is_a_helper <gassign *>::test (gimple gs)
852 return gs->code == GIMPLE_ASSIGN;
855 template <>
856 template <>
857 inline bool
858 is_a_helper <gbind *>::test (gimple gs)
860 return gs->code == GIMPLE_BIND;
863 template <>
864 template <>
865 inline bool
866 is_a_helper <gcall *>::test (gimple gs)
868 return gs->code == GIMPLE_CALL;
871 template <>
872 template <>
873 inline bool
874 is_a_helper <gcatch *>::test (gimple gs)
876 return gs->code == GIMPLE_CATCH;
879 template <>
880 template <>
881 inline bool
882 is_a_helper <gcond *>::test (gimple gs)
884 return gs->code == GIMPLE_COND;
887 template <>
888 template <>
889 inline bool
890 is_a_helper <gdebug *>::test (gimple gs)
892 return gs->code == GIMPLE_DEBUG;
895 template <>
896 template <>
897 inline bool
898 is_a_helper <ggoto *>::test (gimple gs)
900 return gs->code == GIMPLE_GOTO;
903 template <>
904 template <>
905 inline bool
906 is_a_helper <glabel *>::test (gimple gs)
908 return gs->code == GIMPLE_LABEL;
911 template <>
912 template <>
913 inline bool
914 is_a_helper <gresx *>::test (gimple gs)
916 return gs->code == GIMPLE_RESX;
919 template <>
920 template <>
921 inline bool
922 is_a_helper <geh_dispatch *>::test (gimple gs)
924 return gs->code == GIMPLE_EH_DISPATCH;
927 template <>
928 template <>
929 inline bool
930 is_a_helper <geh_else *>::test (gimple gs)
932 return gs->code == GIMPLE_EH_ELSE;
935 template <>
936 template <>
937 inline bool
938 is_a_helper <geh_filter *>::test (gimple gs)
940 return gs->code == GIMPLE_EH_FILTER;
943 template <>
944 template <>
945 inline bool
946 is_a_helper <geh_mnt *>::test (gimple gs)
948 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
951 template <>
952 template <>
953 inline bool
954 is_a_helper <gomp_atomic_load *>::test (gimple gs)
956 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
959 template <>
960 template <>
961 inline bool
962 is_a_helper <gomp_atomic_store *>::test (gimple gs)
964 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
967 template <>
968 template <>
969 inline bool
970 is_a_helper <gimple_statement_omp_return *>::test (gimple gs)
972 return gs->code == GIMPLE_OMP_RETURN;
975 template <>
976 template <>
977 inline bool
978 is_a_helper <gomp_continue *>::test (gimple gs)
980 return gs->code == GIMPLE_OMP_CONTINUE;
983 template <>
984 template <>
985 inline bool
986 is_a_helper <gomp_critical *>::test (gimple gs)
988 return gs->code == GIMPLE_OMP_CRITICAL;
991 template <>
992 template <>
993 inline bool
994 is_a_helper <gomp_for *>::test (gimple gs)
996 return gs->code == GIMPLE_OMP_FOR;
999 template <>
1000 template <>
1001 inline bool
1002 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple gs)
1004 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1007 template <>
1008 template <>
1009 inline bool
1010 is_a_helper <gomp_parallel *>::test (gimple gs)
1012 return gs->code == GIMPLE_OMP_PARALLEL;
1015 template <>
1016 template <>
1017 inline bool
1018 is_a_helper <gomp_target *>::test (gimple gs)
1020 return gs->code == GIMPLE_OMP_TARGET;
1023 template <>
1024 template <>
1025 inline bool
1026 is_a_helper <gomp_sections *>::test (gimple gs)
1028 return gs->code == GIMPLE_OMP_SECTIONS;
1031 template <>
1032 template <>
1033 inline bool
1034 is_a_helper <gomp_single *>::test (gimple gs)
1036 return gs->code == GIMPLE_OMP_SINGLE;
1039 template <>
1040 template <>
1041 inline bool
1042 is_a_helper <gomp_teams *>::test (gimple gs)
1044 return gs->code == GIMPLE_OMP_TEAMS;
1047 template <>
1048 template <>
1049 inline bool
1050 is_a_helper <gomp_task *>::test (gimple gs)
1052 return gs->code == GIMPLE_OMP_TASK;
1055 template <>
1056 template <>
1057 inline bool
1058 is_a_helper <gphi *>::test (gimple gs)
1060 return gs->code == GIMPLE_PHI;
1063 template <>
1064 template <>
1065 inline bool
1066 is_a_helper <greturn *>::test (gimple gs)
1068 return gs->code == GIMPLE_RETURN;
1071 template <>
1072 template <>
1073 inline bool
1074 is_a_helper <gswitch *>::test (gimple gs)
1076 return gs->code == GIMPLE_SWITCH;
1079 template <>
1080 template <>
1081 inline bool
1082 is_a_helper <gtransaction *>::test (gimple gs)
1084 return gs->code == GIMPLE_TRANSACTION;
1087 template <>
1088 template <>
1089 inline bool
1090 is_a_helper <gtry *>::test (gimple gs)
1092 return gs->code == GIMPLE_TRY;
1095 template <>
1096 template <>
1097 inline bool
1098 is_a_helper <gimple_statement_wce *>::test (gimple gs)
1100 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1103 template <>
1104 template <>
1105 inline bool
1106 is_a_helper <const gasm *>::test (const_gimple gs)
1108 return gs->code == GIMPLE_ASM;
1111 template <>
1112 template <>
1113 inline bool
1114 is_a_helper <const gbind *>::test (const_gimple gs)
1116 return gs->code == GIMPLE_BIND;
1119 template <>
1120 template <>
1121 inline bool
1122 is_a_helper <const gcall *>::test (const_gimple gs)
1124 return gs->code == GIMPLE_CALL;
1127 template <>
1128 template <>
1129 inline bool
1130 is_a_helper <const gcatch *>::test (const_gimple gs)
1132 return gs->code == GIMPLE_CATCH;
1135 template <>
1136 template <>
1137 inline bool
1138 is_a_helper <const gresx *>::test (const_gimple gs)
1140 return gs->code == GIMPLE_RESX;
1143 template <>
1144 template <>
1145 inline bool
1146 is_a_helper <const geh_dispatch *>::test (const_gimple gs)
1148 return gs->code == GIMPLE_EH_DISPATCH;
1151 template <>
1152 template <>
1153 inline bool
1154 is_a_helper <const geh_filter *>::test (const_gimple gs)
1156 return gs->code == GIMPLE_EH_FILTER;
1159 template <>
1160 template <>
1161 inline bool
1162 is_a_helper <const gomp_atomic_load *>::test (const_gimple gs)
1164 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1167 template <>
1168 template <>
1169 inline bool
1170 is_a_helper <const gomp_atomic_store *>::test (const_gimple gs)
1172 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1175 template <>
1176 template <>
1177 inline bool
1178 is_a_helper <const gimple_statement_omp_return *>::test (const_gimple gs)
1180 return gs->code == GIMPLE_OMP_RETURN;
1183 template <>
1184 template <>
1185 inline bool
1186 is_a_helper <const gomp_continue *>::test (const_gimple gs)
1188 return gs->code == GIMPLE_OMP_CONTINUE;
1191 template <>
1192 template <>
1193 inline bool
1194 is_a_helper <const gomp_critical *>::test (const_gimple gs)
1196 return gs->code == GIMPLE_OMP_CRITICAL;
1199 template <>
1200 template <>
1201 inline bool
1202 is_a_helper <const gomp_for *>::test (const_gimple gs)
1204 return gs->code == GIMPLE_OMP_FOR;
1207 template <>
1208 template <>
1209 inline bool
1210 is_a_helper <const gimple_statement_omp_taskreg *>::test (const_gimple gs)
1212 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1215 template <>
1216 template <>
1217 inline bool
1218 is_a_helper <const gomp_parallel *>::test (const_gimple gs)
1220 return gs->code == GIMPLE_OMP_PARALLEL;
1223 template <>
1224 template <>
1225 inline bool
1226 is_a_helper <const gomp_target *>::test (const_gimple gs)
1228 return gs->code == GIMPLE_OMP_TARGET;
1231 template <>
1232 template <>
1233 inline bool
1234 is_a_helper <const gomp_sections *>::test (const_gimple gs)
1236 return gs->code == GIMPLE_OMP_SECTIONS;
1239 template <>
1240 template <>
1241 inline bool
1242 is_a_helper <const gomp_single *>::test (const_gimple gs)
1244 return gs->code == GIMPLE_OMP_SINGLE;
1247 template <>
1248 template <>
1249 inline bool
1250 is_a_helper <const gomp_teams *>::test (const_gimple gs)
1252 return gs->code == GIMPLE_OMP_TEAMS;
1255 template <>
1256 template <>
1257 inline bool
1258 is_a_helper <const gomp_task *>::test (const_gimple gs)
1260 return gs->code == GIMPLE_OMP_TASK;
1263 template <>
1264 template <>
1265 inline bool
1266 is_a_helper <const gphi *>::test (const_gimple gs)
1268 return gs->code == GIMPLE_PHI;
1271 template <>
1272 template <>
1273 inline bool
1274 is_a_helper <const gtransaction *>::test (const_gimple gs)
1276 return gs->code == GIMPLE_TRANSACTION;
1279 /* Offset in bytes to the location of the operand vector.
1280 Zero if there is no operand vector for this tuple structure. */
1281 extern size_t const gimple_ops_offset_[];
1283 /* Map GIMPLE codes to GSS codes. */
1284 extern enum gimple_statement_structure_enum const gss_for_code_[];
1286 /* This variable holds the currently expanded gimple statement for purposes
1287 of comminucating the profile info to the builtin expanders. */
1288 extern gimple currently_expanding_gimple_stmt;
1290 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1291 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1292 greturn *gimple_build_return (tree);
1293 void gimple_call_reset_alias_info (gcall *);
1294 gcall *gimple_build_call_vec (tree, vec<tree> );
1295 gcall *gimple_build_call (tree, unsigned, ...);
1296 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1297 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1298 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1299 gcall *gimple_build_call_from_tree (tree);
1300 gassign *gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1301 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1302 gassign *gimple_build_assign_with_ops (enum tree_code, tree,
1303 tree, tree,
1304 tree CXX_MEM_STAT_INFO);
1305 gassign *gimple_build_assign_with_ops (enum tree_code, tree,
1306 tree, tree CXX_MEM_STAT_INFO);
1307 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1308 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1309 void gimple_cond_set_condition_from_tree (gcond *, tree);
1310 glabel *gimple_build_label (tree label);
1311 ggoto *gimple_build_goto (tree dest);
1312 gimple gimple_build_nop (void);
1313 gbind *gimple_build_bind (tree, gimple_seq, tree);
1314 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1315 vec<tree, va_gc> *, vec<tree, va_gc> *,
1316 vec<tree, va_gc> *);
1317 gcatch *gimple_build_catch (tree, gimple_seq);
1318 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1319 geh_mnt *gimple_build_eh_must_not_throw (tree);
1320 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1321 gtry *gimple_build_try (gimple_seq, gimple_seq,
1322 enum gimple_try_flags);
1323 gimple gimple_build_wce (gimple_seq);
1324 gresx *gimple_build_resx (int);
1325 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1326 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1327 geh_dispatch *gimple_build_eh_dispatch (int);
1328 gdebug *gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1329 #define gimple_build_debug_bind(var,val,stmt) \
1330 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1331 gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1332 #define gimple_build_debug_source_bind(var,val,stmt) \
1333 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1334 gomp_critical *gimple_build_omp_critical (gimple_seq, tree);
1335 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1336 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1337 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1338 tree, tree);
1339 gimple gimple_build_omp_section (gimple_seq);
1340 gimple gimple_build_omp_master (gimple_seq);
1341 gimple gimple_build_omp_taskgroup (gimple_seq);
1342 gomp_continue *gimple_build_omp_continue (tree, tree);
1343 gimple gimple_build_omp_ordered (gimple_seq);
1344 gimple gimple_build_omp_return (bool);
1345 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1346 gimple gimple_build_omp_sections_switch (void);
1347 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1348 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1349 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1350 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1351 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1352 gtransaction *gimple_build_transaction (gimple_seq, tree);
1353 gimple gimple_build_predict (enum br_predictor, enum prediction);
1354 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1355 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1356 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1357 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1358 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1359 location_t);
1360 extern void annotate_all_with_location (gimple_seq, location_t);
1361 bool empty_body_p (gimple_seq);
1362 gimple_seq gimple_seq_copy (gimple_seq);
1363 bool gimple_call_same_target_p (const_gimple, const_gimple);
1364 int gimple_call_flags (const_gimple);
1365 int gimple_call_arg_flags (const gcall *, unsigned);
1366 int gimple_call_return_flags (const gcall *);
1367 bool gimple_assign_copy_p (gimple);
1368 bool gimple_assign_ssa_name_copy_p (gimple);
1369 bool gimple_assign_unary_nop_p (gimple);
1370 void gimple_set_bb (gimple, basic_block);
1371 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1372 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1373 tree, tree, tree);
1374 tree gimple_get_lhs (const_gimple);
1375 void gimple_set_lhs (gimple, tree);
1376 gimple gimple_copy (gimple);
1377 bool gimple_has_side_effects (const_gimple);
1378 bool gimple_could_trap_p_1 (gimple, bool, bool);
1379 bool gimple_could_trap_p (gimple);
1380 bool gimple_assign_rhs_could_trap_p (gimple);
1381 extern void dump_gimple_statistics (void);
1382 unsigned get_gimple_rhs_num_ops (enum tree_code);
1383 extern tree canonicalize_cond_expr_cond (tree);
1384 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1385 extern bool gimple_compare_field_offset (tree, tree);
1386 extern tree gimple_unsigned_type (tree);
1387 extern tree gimple_signed_type (tree);
1388 extern alias_set_type gimple_get_alias_set (tree);
1389 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1390 extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
1391 extern bool gimple_call_builtin_p (const_gimple);
1392 extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
1393 extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
1394 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1395 extern void dump_decl_set (FILE *, bitmap);
1396 extern bool nonfreeing_call_p (gimple);
1397 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1398 extern void sort_case_labels (vec<tree>);
1399 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1400 extern void gimple_seq_set_location (gimple_seq, location_t);
1401 extern void gimple_seq_discard (gimple_seq);
1403 /* Formal (expression) temporary table handling: multiple occurrences of
1404 the same scalar expression are evaluated into the same temporary. */
1406 typedef struct gimple_temp_hash_elt
1408 tree val; /* Key */
1409 tree temp; /* Value */
1410 } elt_t;
1412 /* Get the number of the next statement uid to be allocated. */
1413 static inline unsigned int
1414 gimple_stmt_max_uid (struct function *fn)
1416 return fn->last_stmt_uid;
1419 /* Set the number of the next statement uid to be allocated. */
1420 static inline void
1421 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1423 fn->last_stmt_uid = maxid;
1426 /* Set the number of the next statement uid to be allocated. */
1427 static inline unsigned int
1428 inc_gimple_stmt_max_uid (struct function *fn)
1430 return fn->last_stmt_uid++;
1433 /* Return the first node in GIMPLE sequence S. */
1435 static inline gimple_seq_node
1436 gimple_seq_first (gimple_seq s)
1438 return s;
1442 /* Return the first statement in GIMPLE sequence S. */
1444 static inline gimple
1445 gimple_seq_first_stmt (gimple_seq s)
1447 gimple_seq_node n = gimple_seq_first (s);
1448 return n;
1451 /* Return the first statement in GIMPLE sequence S as a gbind *,
1452 verifying that it has code GIMPLE_BIND in a checked build. */
1454 static inline gbind *
1455 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1457 gimple_seq_node n = gimple_seq_first (s);
1458 return as_a <gbind *> (n);
1462 /* Return the last node in GIMPLE sequence S. */
1464 static inline gimple_seq_node
1465 gimple_seq_last (gimple_seq s)
1467 return s ? s->prev : NULL;
1471 /* Return the last statement in GIMPLE sequence S. */
1473 static inline gimple
1474 gimple_seq_last_stmt (gimple_seq s)
1476 gimple_seq_node n = gimple_seq_last (s);
1477 return n;
1481 /* Set the last node in GIMPLE sequence *PS to LAST. */
1483 static inline void
1484 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1486 (*ps)->prev = last;
1490 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1492 static inline void
1493 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1495 *ps = first;
1499 /* Return true if GIMPLE sequence S is empty. */
1501 static inline bool
1502 gimple_seq_empty_p (gimple_seq s)
1504 return s == NULL;
1507 /* Allocate a new sequence and initialize its first element with STMT. */
1509 static inline gimple_seq
1510 gimple_seq_alloc_with_stmt (gimple stmt)
1512 gimple_seq seq = NULL;
1513 gimple_seq_add_stmt (&seq, stmt);
1514 return seq;
1518 /* Returns the sequence of statements in BB. */
1520 static inline gimple_seq
1521 bb_seq (const_basic_block bb)
1523 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1526 static inline gimple_seq *
1527 bb_seq_addr (basic_block bb)
1529 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1532 /* Sets the sequence of statements in BB to SEQ. */
1534 static inline void
1535 set_bb_seq (basic_block bb, gimple_seq seq)
1537 gcc_checking_assert (!(bb->flags & BB_RTL));
1538 bb->il.gimple.seq = seq;
1542 /* Return the code for GIMPLE statement G. */
1544 static inline enum gimple_code
1545 gimple_code (const_gimple g)
1547 return g->code;
1551 /* Return the GSS code used by a GIMPLE code. */
1553 static inline enum gimple_statement_structure_enum
1554 gss_for_code (enum gimple_code code)
1556 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1557 return gss_for_code_[code];
1561 /* Return which GSS code is used by GS. */
1563 static inline enum gimple_statement_structure_enum
1564 gimple_statement_structure (gimple gs)
1566 return gss_for_code (gimple_code (gs));
1570 /* Return true if statement G has sub-statements. This is only true for
1571 High GIMPLE statements. */
1573 static inline bool
1574 gimple_has_substatements (gimple g)
1576 switch (gimple_code (g))
1578 case GIMPLE_BIND:
1579 case GIMPLE_CATCH:
1580 case GIMPLE_EH_FILTER:
1581 case GIMPLE_EH_ELSE:
1582 case GIMPLE_TRY:
1583 case GIMPLE_OMP_FOR:
1584 case GIMPLE_OMP_MASTER:
1585 case GIMPLE_OMP_TASKGROUP:
1586 case GIMPLE_OMP_ORDERED:
1587 case GIMPLE_OMP_SECTION:
1588 case GIMPLE_OMP_PARALLEL:
1589 case GIMPLE_OMP_TASK:
1590 case GIMPLE_OMP_SECTIONS:
1591 case GIMPLE_OMP_SINGLE:
1592 case GIMPLE_OMP_TARGET:
1593 case GIMPLE_OMP_TEAMS:
1594 case GIMPLE_OMP_CRITICAL:
1595 case GIMPLE_WITH_CLEANUP_EXPR:
1596 case GIMPLE_TRANSACTION:
1597 return true;
1599 default:
1600 return false;
1605 /* Return the basic block holding statement G. */
1607 static inline basic_block
1608 gimple_bb (const_gimple g)
1610 return g->bb;
1614 /* Return the lexical scope block holding statement G. */
1616 static inline tree
1617 gimple_block (const_gimple g)
1619 return LOCATION_BLOCK (g->location);
1623 /* Set BLOCK to be the lexical scope block holding statement G. */
1625 static inline void
1626 gimple_set_block (gimple g, tree block)
1628 if (block)
1629 g->location =
1630 COMBINE_LOCATION_DATA (line_table, g->location, block);
1631 else
1632 g->location = LOCATION_LOCUS (g->location);
1636 /* Return location information for statement G. */
1638 static inline location_t
1639 gimple_location (const_gimple g)
1641 return g->location;
1644 /* Return location information for statement G if g is not NULL.
1645 Otherwise, UNKNOWN_LOCATION is returned. */
1647 static inline location_t
1648 gimple_location_safe (const_gimple g)
1650 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1653 /* Return pointer to location information for statement G. */
1655 static inline const location_t *
1656 gimple_location_ptr (const_gimple g)
1658 return &g->location;
1662 /* Set location information for statement G. */
1664 static inline void
1665 gimple_set_location (gimple g, location_t location)
1667 g->location = location;
1671 /* Return true if G contains location information. */
1673 static inline bool
1674 gimple_has_location (const_gimple g)
1676 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1680 /* Return the file name of the location of STMT. */
1682 static inline const char *
1683 gimple_filename (const_gimple stmt)
1685 return LOCATION_FILE (gimple_location (stmt));
1689 /* Return the line number of the location of STMT. */
1691 static inline int
1692 gimple_lineno (const_gimple stmt)
1694 return LOCATION_LINE (gimple_location (stmt));
1698 /* Determine whether SEQ is a singleton. */
1700 static inline bool
1701 gimple_seq_singleton_p (gimple_seq seq)
1703 return ((gimple_seq_first (seq) != NULL)
1704 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1707 /* Return true if no warnings should be emitted for statement STMT. */
1709 static inline bool
1710 gimple_no_warning_p (const_gimple stmt)
1712 return stmt->no_warning;
1715 /* Set the no_warning flag of STMT to NO_WARNING. */
1717 static inline void
1718 gimple_set_no_warning (gimple stmt, bool no_warning)
1720 stmt->no_warning = (unsigned) no_warning;
1723 /* Set the visited status on statement STMT to VISITED_P.
1725 Please note that this 'visited' property of the gimple statement is
1726 supposed to be undefined at pass boundaries. This means that a
1727 given pass should not assume it contains any useful value when the
1728 pass starts and thus can set it to any value it sees fit.
1730 You can learn more about the visited property of the gimple
1731 statement by reading the comments of the 'visited' data member of
1732 struct gimple statement_base.
1735 static inline void
1736 gimple_set_visited (gimple stmt, bool visited_p)
1738 stmt->visited = (unsigned) visited_p;
1742 /* Return the visited status for statement STMT.
1744 Please note that this 'visited' property of the gimple statement is
1745 supposed to be undefined at pass boundaries. This means that a
1746 given pass should not assume it contains any useful value when the
1747 pass starts and thus can set it to any value it sees fit.
1749 You can learn more about the visited property of the gimple
1750 statement by reading the comments of the 'visited' data member of
1751 struct gimple statement_base. */
1753 static inline bool
1754 gimple_visited_p (gimple stmt)
1756 return stmt->visited;
1760 /* Set pass local flag PLF on statement STMT to VAL_P.
1762 Please note that this PLF property of the gimple statement is
1763 supposed to be undefined at pass boundaries. This means that a
1764 given pass should not assume it contains any useful value when the
1765 pass starts and thus can set it to any value it sees fit.
1767 You can learn more about the PLF property by reading the comment of
1768 the 'plf' data member of struct gimple_statement_structure. */
1770 static inline void
1771 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1773 if (val_p)
1774 stmt->plf |= (unsigned int) plf;
1775 else
1776 stmt->plf &= ~((unsigned int) plf);
1780 /* Return the value of pass local flag PLF on statement STMT.
1782 Please note that this 'plf' property of the gimple statement is
1783 supposed to be undefined at pass boundaries. This means that a
1784 given pass should not assume it contains any useful value when the
1785 pass starts and thus can set it to any value it sees fit.
1787 You can learn more about the plf property by reading the comment of
1788 the 'plf' data member of struct gimple_statement_structure. */
1790 static inline unsigned int
1791 gimple_plf (gimple stmt, enum plf_mask plf)
1793 return stmt->plf & ((unsigned int) plf);
1797 /* Set the UID of statement.
1799 Please note that this UID property is supposed to be undefined at
1800 pass boundaries. This means that a given pass should not assume it
1801 contains any useful value when the pass starts and thus can set it
1802 to any value it sees fit. */
1804 static inline void
1805 gimple_set_uid (gimple g, unsigned uid)
1807 g->uid = uid;
1811 /* Return the UID of statement.
1813 Please note that this UID property is supposed to be undefined at
1814 pass boundaries. This means that a given pass should not assume it
1815 contains any useful value when the pass starts and thus can set it
1816 to any value it sees fit. */
1818 static inline unsigned
1819 gimple_uid (const_gimple g)
1821 return g->uid;
1825 /* Make statement G a singleton sequence. */
1827 static inline void
1828 gimple_init_singleton (gimple g)
1830 g->next = NULL;
1831 g->prev = g;
1835 /* Return true if GIMPLE statement G has register or memory operands. */
1837 static inline bool
1838 gimple_has_ops (const_gimple g)
1840 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1843 template <>
1844 template <>
1845 inline bool
1846 is_a_helper <const gimple_statement_with_ops *>::test (const_gimple gs)
1848 return gimple_has_ops (gs);
1851 template <>
1852 template <>
1853 inline bool
1854 is_a_helper <gimple_statement_with_ops *>::test (gimple gs)
1856 return gimple_has_ops (gs);
1859 /* Return true if GIMPLE statement G has memory operands. */
1861 static inline bool
1862 gimple_has_mem_ops (const_gimple g)
1864 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1867 template <>
1868 template <>
1869 inline bool
1870 is_a_helper <const gimple_statement_with_memory_ops *>::test (const_gimple gs)
1872 return gimple_has_mem_ops (gs);
1875 template <>
1876 template <>
1877 inline bool
1878 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple gs)
1880 return gimple_has_mem_ops (gs);
1883 /* Return the set of USE operands for statement G. */
1885 static inline struct use_optype_d *
1886 gimple_use_ops (const_gimple g)
1888 const gimple_statement_with_ops *ops_stmt =
1889 dyn_cast <const gimple_statement_with_ops *> (g);
1890 if (!ops_stmt)
1891 return NULL;
1892 return ops_stmt->use_ops;
1896 /* Set USE to be the set of USE operands for statement G. */
1898 static inline void
1899 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1901 gimple_statement_with_ops *ops_stmt =
1902 as_a <gimple_statement_with_ops *> (g);
1903 ops_stmt->use_ops = use;
1907 /* Return the single VUSE operand of the statement G. */
1909 static inline tree
1910 gimple_vuse (const_gimple g)
1912 const gimple_statement_with_memory_ops *mem_ops_stmt =
1913 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1914 if (!mem_ops_stmt)
1915 return NULL_TREE;
1916 return mem_ops_stmt->vuse;
1919 /* Return the single VDEF operand of the statement G. */
1921 static inline tree
1922 gimple_vdef (const_gimple g)
1924 const gimple_statement_with_memory_ops *mem_ops_stmt =
1925 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1926 if (!mem_ops_stmt)
1927 return NULL_TREE;
1928 return mem_ops_stmt->vdef;
1931 /* Return the single VUSE operand of the statement G. */
1933 static inline tree *
1934 gimple_vuse_ptr (gimple g)
1936 gimple_statement_with_memory_ops *mem_ops_stmt =
1937 dyn_cast <gimple_statement_with_memory_ops *> (g);
1938 if (!mem_ops_stmt)
1939 return NULL;
1940 return &mem_ops_stmt->vuse;
1943 /* Return the single VDEF operand of the statement G. */
1945 static inline tree *
1946 gimple_vdef_ptr (gimple g)
1948 gimple_statement_with_memory_ops *mem_ops_stmt =
1949 dyn_cast <gimple_statement_with_memory_ops *> (g);
1950 if (!mem_ops_stmt)
1951 return NULL;
1952 return &mem_ops_stmt->vdef;
1955 /* Set the single VUSE operand of the statement G. */
1957 static inline void
1958 gimple_set_vuse (gimple g, tree vuse)
1960 gimple_statement_with_memory_ops *mem_ops_stmt =
1961 as_a <gimple_statement_with_memory_ops *> (g);
1962 mem_ops_stmt->vuse = vuse;
1965 /* Set the single VDEF operand of the statement G. */
1967 static inline void
1968 gimple_set_vdef (gimple g, tree vdef)
1970 gimple_statement_with_memory_ops *mem_ops_stmt =
1971 as_a <gimple_statement_with_memory_ops *> (g);
1972 mem_ops_stmt->vdef = vdef;
1976 /* Return true if statement G has operands and the modified field has
1977 been set. */
1979 static inline bool
1980 gimple_modified_p (const_gimple g)
1982 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1986 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1987 a MODIFIED field. */
1989 static inline void
1990 gimple_set_modified (gimple s, bool modifiedp)
1992 if (gimple_has_ops (s))
1993 s->modified = (unsigned) modifiedp;
1997 /* Return the tree code for the expression computed by STMT. This is
1998 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1999 GIMPLE_CALL, return CALL_EXPR as the expression code for
2000 consistency. This is useful when the caller needs to deal with the
2001 three kinds of computation that GIMPLE supports. */
2003 static inline enum tree_code
2004 gimple_expr_code (const_gimple stmt)
2006 enum gimple_code code = gimple_code (stmt);
2007 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2008 return (enum tree_code) stmt->subcode;
2009 else
2011 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2012 return CALL_EXPR;
2017 /* Return true if statement STMT contains volatile operands. */
2019 static inline bool
2020 gimple_has_volatile_ops (const_gimple stmt)
2022 if (gimple_has_mem_ops (stmt))
2023 return stmt->has_volatile_ops;
2024 else
2025 return false;
2029 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2031 static inline void
2032 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
2034 if (gimple_has_mem_ops (stmt))
2035 stmt->has_volatile_ops = (unsigned) volatilep;
2038 /* Return true if STMT is in a transaction. */
2040 static inline bool
2041 gimple_in_transaction (gimple stmt)
2043 return bb_in_transaction (gimple_bb (stmt));
2046 /* Return true if statement STMT may access memory. */
2048 static inline bool
2049 gimple_references_memory_p (gimple stmt)
2051 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2055 /* Return the subcode for OMP statement S. */
2057 static inline unsigned
2058 gimple_omp_subcode (const_gimple s)
2060 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2061 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2062 return s->subcode;
2065 /* Set the subcode for OMP statement S to SUBCODE. */
2067 static inline void
2068 gimple_omp_set_subcode (gimple s, unsigned int subcode)
2070 /* We only have 16 bits for the subcode. Assert that we are not
2071 overflowing it. */
2072 gcc_gimple_checking_assert (subcode < (1 << 16));
2073 s->subcode = subcode;
2076 /* Set the nowait flag on OMP_RETURN statement S. */
2078 static inline void
2079 gimple_omp_return_set_nowait (gimple s)
2081 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2082 s->subcode |= GF_OMP_RETURN_NOWAIT;
2086 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2087 flag set. */
2089 static inline bool
2090 gimple_omp_return_nowait_p (const_gimple g)
2092 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2093 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2097 /* Set the LHS of OMP return. */
2099 static inline void
2100 gimple_omp_return_set_lhs (gimple g, tree lhs)
2102 gimple_statement_omp_return *omp_return_stmt =
2103 as_a <gimple_statement_omp_return *> (g);
2104 omp_return_stmt->val = lhs;
2108 /* Get the LHS of OMP return. */
2110 static inline tree
2111 gimple_omp_return_lhs (const_gimple g)
2113 const gimple_statement_omp_return *omp_return_stmt =
2114 as_a <const gimple_statement_omp_return *> (g);
2115 return omp_return_stmt->val;
2119 /* Return a pointer to the LHS of OMP return. */
2121 static inline tree *
2122 gimple_omp_return_lhs_ptr (gimple g)
2124 gimple_statement_omp_return *omp_return_stmt =
2125 as_a <gimple_statement_omp_return *> (g);
2126 return &omp_return_stmt->val;
2130 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2131 flag set. */
2133 static inline bool
2134 gimple_omp_section_last_p (const_gimple g)
2136 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2137 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2141 /* Set the GF_OMP_SECTION_LAST flag on G. */
2143 static inline void
2144 gimple_omp_section_set_last (gimple g)
2146 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2147 g->subcode |= GF_OMP_SECTION_LAST;
2151 /* Return true if OMP parallel statement G has the
2152 GF_OMP_PARALLEL_COMBINED flag set. */
2154 static inline bool
2155 gimple_omp_parallel_combined_p (const_gimple g)
2157 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2158 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2162 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2163 value of COMBINED_P. */
2165 static inline void
2166 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
2168 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2169 if (combined_p)
2170 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2171 else
2172 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2176 /* Return true if OMP atomic load/store statement G has the
2177 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2179 static inline bool
2180 gimple_omp_atomic_need_value_p (const_gimple g)
2182 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2183 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2184 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2188 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2190 static inline void
2191 gimple_omp_atomic_set_need_value (gimple g)
2193 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2194 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2195 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2199 /* Return true if OMP atomic load/store statement G has the
2200 GF_OMP_ATOMIC_SEQ_CST flag set. */
2202 static inline bool
2203 gimple_omp_atomic_seq_cst_p (const_gimple g)
2205 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2206 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2207 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2211 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2213 static inline void
2214 gimple_omp_atomic_set_seq_cst (gimple g)
2216 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2217 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2218 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2222 /* Return the number of operands for statement GS. */
2224 static inline unsigned
2225 gimple_num_ops (const_gimple gs)
2227 return gs->num_ops;
2231 /* Set the number of operands for statement GS. */
2233 static inline void
2234 gimple_set_num_ops (gimple gs, unsigned num_ops)
2236 gs->num_ops = num_ops;
2240 /* Return the array of operands for statement GS. */
2242 static inline tree *
2243 gimple_ops (gimple gs)
2245 size_t off;
2247 /* All the tuples have their operand vector at the very bottom
2248 of the structure. Note that those structures that do not
2249 have an operand vector have a zero offset. */
2250 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2251 gcc_gimple_checking_assert (off != 0);
2253 return (tree *) ((char *) gs + off);
2257 /* Return operand I for statement GS. */
2259 static inline tree
2260 gimple_op (const_gimple gs, unsigned i)
2262 if (gimple_has_ops (gs))
2264 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2265 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2267 else
2268 return NULL_TREE;
2271 /* Return a pointer to operand I for statement GS. */
2273 static inline tree *
2274 gimple_op_ptr (const_gimple gs, unsigned i)
2276 if (gimple_has_ops (gs))
2278 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2279 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2281 else
2282 return NULL;
2285 /* Set operand I of statement GS to OP. */
2287 static inline void
2288 gimple_set_op (gimple gs, unsigned i, tree op)
2290 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2292 /* Note. It may be tempting to assert that OP matches
2293 is_gimple_operand, but that would be wrong. Different tuples
2294 accept slightly different sets of tree operands. Each caller
2295 should perform its own validation. */
2296 gimple_ops (gs)[i] = op;
2299 /* Return true if GS is a GIMPLE_ASSIGN. */
2301 static inline bool
2302 is_gimple_assign (const_gimple gs)
2304 return gimple_code (gs) == GIMPLE_ASSIGN;
2307 /* Determine if expression CODE is one of the valid expressions that can
2308 be used on the RHS of GIMPLE assignments. */
2310 static inline enum gimple_rhs_class
2311 get_gimple_rhs_class (enum tree_code code)
2313 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2316 /* Return the LHS of assignment statement GS. */
2318 static inline tree
2319 gimple_assign_lhs (const_gimple gs)
2321 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2322 return gimple_op (gs, 0);
2326 /* Return a pointer to the LHS of assignment statement GS. */
2328 static inline tree *
2329 gimple_assign_lhs_ptr (const_gimple gs)
2331 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2332 return gimple_op_ptr (gs, 0);
2336 /* Set LHS to be the LHS operand of assignment statement GS. */
2338 static inline void
2339 gimple_assign_set_lhs (gimple gs, tree lhs)
2341 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2342 gimple_set_op (gs, 0, lhs);
2344 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2345 SSA_NAME_DEF_STMT (lhs) = gs;
2349 /* Return the first operand on the RHS of assignment statement GS. */
2351 static inline tree
2352 gimple_assign_rhs1 (const_gimple gs)
2354 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2355 return gimple_op (gs, 1);
2359 /* Return a pointer to the first operand on the RHS of assignment
2360 statement GS. */
2362 static inline tree *
2363 gimple_assign_rhs1_ptr (const_gimple gs)
2365 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2366 return gimple_op_ptr (gs, 1);
2369 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2371 static inline void
2372 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2374 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2376 gimple_set_op (gs, 1, rhs);
2380 /* Return the second operand on the RHS of assignment statement GS.
2381 If GS does not have two operands, NULL is returned instead. */
2383 static inline tree
2384 gimple_assign_rhs2 (const_gimple gs)
2386 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2388 if (gimple_num_ops (gs) >= 3)
2389 return gimple_op (gs, 2);
2390 else
2391 return NULL_TREE;
2395 /* Return a pointer to the second operand on the RHS of assignment
2396 statement GS. */
2398 static inline tree *
2399 gimple_assign_rhs2_ptr (const_gimple gs)
2401 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2402 return gimple_op_ptr (gs, 2);
2406 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2408 static inline void
2409 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2411 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2413 gimple_set_op (gs, 2, rhs);
2416 /* Return the third operand on the RHS of assignment statement GS.
2417 If GS does not have two operands, NULL is returned instead. */
2419 static inline tree
2420 gimple_assign_rhs3 (const_gimple gs)
2422 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2424 if (gimple_num_ops (gs) >= 4)
2425 return gimple_op (gs, 3);
2426 else
2427 return NULL_TREE;
2430 /* Return a pointer to the third operand on the RHS of assignment
2431 statement GS. */
2433 static inline tree *
2434 gimple_assign_rhs3_ptr (const_gimple gs)
2436 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2437 return gimple_op_ptr (gs, 3);
2441 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2443 static inline void
2444 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2446 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2448 gimple_set_op (gs, 3, rhs);
2451 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2452 to see only a maximum of two operands. */
2454 static inline void
2455 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2456 tree op1, tree op2)
2458 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2461 /* Returns true if GS is a nontemporal move. */
2463 static inline bool
2464 gimple_assign_nontemporal_move_p (const gassign *gs)
2466 return gs->nontemporal_move;
2469 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2471 static inline void
2472 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2474 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2475 gs->nontemporal_move = nontemporal;
2479 /* Return the code of the expression computed on the rhs of assignment
2480 statement GS. In case that the RHS is a single object, returns the
2481 tree code of the object. */
2483 static inline enum tree_code
2484 gimple_assign_rhs_code (const_gimple gs)
2486 enum tree_code code;
2487 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2489 code = (enum tree_code) gs->subcode;
2490 /* While we initially set subcode to the TREE_CODE of the rhs for
2491 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2492 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2493 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2494 code = TREE_CODE (gimple_assign_rhs1 (gs));
2496 return code;
2500 /* Set CODE to be the code for the expression computed on the RHS of
2501 assignment S. */
2503 static inline void
2504 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2506 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2507 s->subcode = code;
2511 /* Return the gimple rhs class of the code of the expression computed on
2512 the rhs of assignment statement GS.
2513 This will never return GIMPLE_INVALID_RHS. */
2515 static inline enum gimple_rhs_class
2516 gimple_assign_rhs_class (const_gimple gs)
2518 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2521 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2522 there is no operator associated with the assignment itself.
2523 Unlike gimple_assign_copy_p, this predicate returns true for
2524 any RHS operand, including those that perform an operation
2525 and do not have the semantics of a copy, such as COND_EXPR. */
2527 static inline bool
2528 gimple_assign_single_p (const_gimple gs)
2530 return (is_gimple_assign (gs)
2531 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2534 /* Return true if GS performs a store to its lhs. */
2536 static inline bool
2537 gimple_store_p (const_gimple gs)
2539 tree lhs = gimple_get_lhs (gs);
2540 return lhs && !is_gimple_reg (lhs);
2543 /* Return true if GS is an assignment that loads from its rhs1. */
2545 static inline bool
2546 gimple_assign_load_p (const_gimple gs)
2548 tree rhs;
2549 if (!gimple_assign_single_p (gs))
2550 return false;
2551 rhs = gimple_assign_rhs1 (gs);
2552 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2553 return true;
2554 rhs = get_base_address (rhs);
2555 return (DECL_P (rhs)
2556 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2560 /* Return true if S is a type-cast assignment. */
2562 static inline bool
2563 gimple_assign_cast_p (const_gimple s)
2565 if (is_gimple_assign (s))
2567 enum tree_code sc = gimple_assign_rhs_code (s);
2568 return CONVERT_EXPR_CODE_P (sc)
2569 || sc == VIEW_CONVERT_EXPR
2570 || sc == FIX_TRUNC_EXPR;
2573 return false;
2576 /* Return true if S is a clobber statement. */
2578 static inline bool
2579 gimple_clobber_p (const_gimple s)
2581 return gimple_assign_single_p (s)
2582 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2585 /* Return true if GS is a GIMPLE_CALL. */
2587 static inline bool
2588 is_gimple_call (const_gimple gs)
2590 return gimple_code (gs) == GIMPLE_CALL;
2593 /* Return the LHS of call statement GS. */
2595 static inline tree
2596 gimple_call_lhs (const_gimple gs)
2598 GIMPLE_CHECK (gs, GIMPLE_CALL);
2599 return gimple_op (gs, 0);
2603 /* Return a pointer to the LHS of call statement GS. */
2605 static inline tree *
2606 gimple_call_lhs_ptr (const_gimple gs)
2608 GIMPLE_CHECK (gs, GIMPLE_CALL);
2609 return gimple_op_ptr (gs, 0);
2613 /* Set LHS to be the LHS operand of call statement GS. */
2615 static inline void
2616 gimple_call_set_lhs (gimple gs, tree lhs)
2618 GIMPLE_CHECK (gs, GIMPLE_CALL);
2619 gimple_set_op (gs, 0, lhs);
2620 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2621 SSA_NAME_DEF_STMT (lhs) = gs;
2625 /* Return true if call GS calls an internal-only function, as enumerated
2626 by internal_fn. */
2628 static inline bool
2629 gimple_call_internal_p (const_gimple gs)
2631 GIMPLE_CHECK (gs, GIMPLE_CALL);
2632 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2636 /* Return true if call GS is marked as instrumented by
2637 Pointer Bounds Checker. */
2639 static inline bool
2640 gimple_call_with_bounds_p (const_gimple gs)
2642 GIMPLE_CHECK (gs, GIMPLE_CALL);
2643 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2647 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2648 Pointer Bounds Checker. */
2650 static inline void
2651 gimple_call_set_with_bounds (gimple gs, bool with_bounds)
2653 GIMPLE_CHECK (gs, GIMPLE_CALL);
2654 if (with_bounds)
2655 gs->subcode |= GF_CALL_WITH_BOUNDS;
2656 else
2657 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2661 /* Return the target of internal call GS. */
2663 static inline enum internal_fn
2664 gimple_call_internal_fn (const_gimple gs)
2666 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2667 return static_cast <const gcall *> (gs)->u.internal_fn;
2670 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2671 that could alter control flow. */
2673 static inline void
2674 gimple_call_set_ctrl_altering (gimple s, bool ctrl_altering_p)
2676 GIMPLE_CHECK (s, GIMPLE_CALL);
2677 if (ctrl_altering_p)
2678 s->subcode |= GF_CALL_CTRL_ALTERING;
2679 else
2680 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2683 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2684 flag is set. Such call could not be a stmt in the middle of a bb. */
2686 static inline bool
2687 gimple_call_ctrl_altering_p (const_gimple gs)
2689 GIMPLE_CHECK (gs, GIMPLE_CALL);
2690 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2694 /* Return the function type of the function called by GS. */
2696 static inline tree
2697 gimple_call_fntype (const_gimple gs)
2699 const gcall *call_stmt =
2700 as_a <const gcall *> (gs);
2701 if (gimple_call_internal_p (gs))
2702 return NULL_TREE;
2703 return call_stmt->u.fntype;
2706 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2708 static inline void
2709 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2711 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2712 call_stmt->u.fntype = fntype;
2716 /* Return the tree node representing the function called by call
2717 statement GS. */
2719 static inline tree
2720 gimple_call_fn (const_gimple gs)
2722 GIMPLE_CHECK (gs, GIMPLE_CALL);
2723 return gimple_op (gs, 1);
2726 /* Return a pointer to the tree node representing the function called by call
2727 statement GS. */
2729 static inline tree *
2730 gimple_call_fn_ptr (const_gimple gs)
2732 GIMPLE_CHECK (gs, GIMPLE_CALL);
2733 return gimple_op_ptr (gs, 1);
2737 /* Set FN to be the function called by call statement GS. */
2739 static inline void
2740 gimple_call_set_fn (gcall *gs, tree fn)
2742 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2743 gimple_set_op (gs, 1, fn);
2747 /* Set FNDECL to be the function called by call statement GS. */
2749 static inline void
2750 gimple_call_set_fndecl (gimple gs, tree decl)
2752 GIMPLE_CHECK (gs, GIMPLE_CALL);
2753 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2754 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2758 /* Set internal function FN to be the function called by call statement CALL_STMT. */
2760 static inline void
2761 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
2763 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
2764 call_stmt->u.internal_fn = fn;
2768 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2769 Otherwise return NULL. This function is analogous to
2770 get_callee_fndecl in tree land. */
2772 static inline tree
2773 gimple_call_fndecl (const_gimple gs)
2775 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2779 /* Return the type returned by call statement GS. */
2781 static inline tree
2782 gimple_call_return_type (const gcall *gs)
2784 tree type = gimple_call_fntype (gs);
2786 if (type == NULL_TREE)
2787 return TREE_TYPE (gimple_call_lhs (gs));
2789 /* The type returned by a function is the type of its
2790 function type. */
2791 return TREE_TYPE (type);
2795 /* Return the static chain for call statement GS. */
2797 static inline tree
2798 gimple_call_chain (const_gimple gs)
2800 GIMPLE_CHECK (gs, GIMPLE_CALL);
2801 return gimple_op (gs, 2);
2805 /* Return a pointer to the static chain for call statement CALL_STMT. */
2807 static inline tree *
2808 gimple_call_chain_ptr (const gcall *call_stmt)
2810 return gimple_op_ptr (call_stmt, 2);
2813 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
2815 static inline void
2816 gimple_call_set_chain (gcall *call_stmt, tree chain)
2818 gimple_set_op (call_stmt, 2, chain);
2822 /* Return the number of arguments used by call statement GS. */
2824 static inline unsigned
2825 gimple_call_num_args (const_gimple gs)
2827 unsigned num_ops;
2828 GIMPLE_CHECK (gs, GIMPLE_CALL);
2829 num_ops = gimple_num_ops (gs);
2830 return num_ops - 3;
2834 /* Return the argument at position INDEX for call statement GS. */
2836 static inline tree
2837 gimple_call_arg (const_gimple gs, unsigned index)
2839 GIMPLE_CHECK (gs, GIMPLE_CALL);
2840 return gimple_op (gs, index + 3);
2844 /* Return a pointer to the argument at position INDEX for call
2845 statement GS. */
2847 static inline tree *
2848 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2850 GIMPLE_CHECK (gs, GIMPLE_CALL);
2851 return gimple_op_ptr (gs, index + 3);
2855 /* Set ARG to be the argument at position INDEX for call statement GS. */
2857 static inline void
2858 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2860 GIMPLE_CHECK (gs, GIMPLE_CALL);
2861 gimple_set_op (gs, index + 3, arg);
2865 /* If TAIL_P is true, mark call statement S as being a tail call
2866 (i.e., a call just before the exit of a function). These calls are
2867 candidate for tail call optimization. */
2869 static inline void
2870 gimple_call_set_tail (gcall *s, bool tail_p)
2872 if (tail_p)
2873 s->subcode |= GF_CALL_TAILCALL;
2874 else
2875 s->subcode &= ~GF_CALL_TAILCALL;
2879 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2881 static inline bool
2882 gimple_call_tail_p (gcall *s)
2884 return (s->subcode & GF_CALL_TAILCALL) != 0;
2888 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2889 slot optimization. This transformation uses the target of the call
2890 expansion as the return slot for calls that return in memory. */
2892 static inline void
2893 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
2895 if (return_slot_opt_p)
2896 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2897 else
2898 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2902 /* Return true if S is marked for return slot optimization. */
2904 static inline bool
2905 gimple_call_return_slot_opt_p (gcall *s)
2907 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2911 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2912 thunk to the thunked-to function. */
2914 static inline void
2915 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
2917 if (from_thunk_p)
2918 s->subcode |= GF_CALL_FROM_THUNK;
2919 else
2920 s->subcode &= ~GF_CALL_FROM_THUNK;
2924 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2926 static inline bool
2927 gimple_call_from_thunk_p (gcall *s)
2929 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2933 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2934 argument pack in its argument list. */
2936 static inline void
2937 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
2939 if (pass_arg_pack_p)
2940 s->subcode |= GF_CALL_VA_ARG_PACK;
2941 else
2942 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2946 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2947 argument pack in its argument list. */
2949 static inline bool
2950 gimple_call_va_arg_pack_p (gcall *s)
2952 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2956 /* Return true if S is a noreturn call. */
2958 static inline bool
2959 gimple_call_noreturn_p (gimple s)
2961 GIMPLE_CHECK (s, GIMPLE_CALL);
2962 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2966 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2967 even if the called function can throw in other cases. */
2969 static inline void
2970 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
2972 if (nothrow_p)
2973 s->subcode |= GF_CALL_NOTHROW;
2974 else
2975 s->subcode &= ~GF_CALL_NOTHROW;
2978 /* Return true if S is a nothrow call. */
2980 static inline bool
2981 gimple_call_nothrow_p (gcall *s)
2983 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2986 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2987 is known to be emitted for VLA objects. Those are wrapped by
2988 stack_save/stack_restore calls and hence can't lead to unbounded
2989 stack growth even when they occur in loops. */
2991 static inline void
2992 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
2994 if (for_var)
2995 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2996 else
2997 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3000 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3002 static inline bool
3003 gimple_call_alloca_for_var_p (gcall *s)
3005 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3008 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3010 static inline void
3011 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3013 dest_call->subcode = orig_call->subcode;
3017 /* Return a pointer to the points-to solution for the set of call-used
3018 variables of the call CALL_STMT. */
3020 static inline struct pt_solution *
3021 gimple_call_use_set (gcall *call_stmt)
3023 return &call_stmt->call_used;
3027 /* Return a pointer to the points-to solution for the set of call-used
3028 variables of the call CALL_STMT. */
3030 static inline struct pt_solution *
3031 gimple_call_clobber_set (gcall *call_stmt)
3033 return &call_stmt->call_clobbered;
3037 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3038 non-NULL lhs. */
3040 static inline bool
3041 gimple_has_lhs (gimple stmt)
3043 return (is_gimple_assign (stmt)
3044 || (is_gimple_call (stmt)
3045 && gimple_call_lhs (stmt) != NULL_TREE));
3049 /* Return the code of the predicate computed by conditional statement GS. */
3051 static inline enum tree_code
3052 gimple_cond_code (const_gimple gs)
3054 GIMPLE_CHECK (gs, GIMPLE_COND);
3055 return (enum tree_code) gs->subcode;
3059 /* Set CODE to be the predicate code for the conditional statement GS. */
3061 static inline void
3062 gimple_cond_set_code (gcond *gs, enum tree_code code)
3064 gs->subcode = code;
3068 /* Return the LHS of the predicate computed by conditional statement GS. */
3070 static inline tree
3071 gimple_cond_lhs (const_gimple gs)
3073 GIMPLE_CHECK (gs, GIMPLE_COND);
3074 return gimple_op (gs, 0);
3077 /* Return the pointer to the LHS of the predicate computed by conditional
3078 statement GS. */
3080 static inline tree *
3081 gimple_cond_lhs_ptr (const gcond *gs)
3083 return gimple_op_ptr (gs, 0);
3086 /* Set LHS to be the LHS operand of the predicate computed by
3087 conditional statement GS. */
3089 static inline void
3090 gimple_cond_set_lhs (gcond *gs, tree lhs)
3092 gimple_set_op (gs, 0, lhs);
3096 /* Return the RHS operand of the predicate computed by conditional GS. */
3098 static inline tree
3099 gimple_cond_rhs (const_gimple gs)
3101 GIMPLE_CHECK (gs, GIMPLE_COND);
3102 return gimple_op (gs, 1);
3105 /* Return the pointer to the RHS operand of the predicate computed by
3106 conditional GS. */
3108 static inline tree *
3109 gimple_cond_rhs_ptr (const gcond *gs)
3111 return gimple_op_ptr (gs, 1);
3115 /* Set RHS to be the RHS operand of the predicate computed by
3116 conditional statement GS. */
3118 static inline void
3119 gimple_cond_set_rhs (gcond *gs, tree rhs)
3121 gimple_set_op (gs, 1, rhs);
3125 /* Return the label used by conditional statement GS when its
3126 predicate evaluates to true. */
3128 static inline tree
3129 gimple_cond_true_label (const gcond *gs)
3131 return gimple_op (gs, 2);
3135 /* Set LABEL to be the label used by conditional statement GS when its
3136 predicate evaluates to true. */
3138 static inline void
3139 gimple_cond_set_true_label (gcond *gs, tree label)
3141 gimple_set_op (gs, 2, label);
3145 /* Set LABEL to be the label used by conditional statement GS when its
3146 predicate evaluates to false. */
3148 static inline void
3149 gimple_cond_set_false_label (gcond *gs, tree label)
3151 gimple_set_op (gs, 3, label);
3155 /* Return the label used by conditional statement GS when its
3156 predicate evaluates to false. */
3158 static inline tree
3159 gimple_cond_false_label (const gcond *gs)
3162 return gimple_op (gs, 3);
3166 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3168 static inline void
3169 gimple_cond_make_false (gcond *gs)
3171 gimple_cond_set_lhs (gs, boolean_true_node);
3172 gimple_cond_set_rhs (gs, boolean_false_node);
3173 gs->subcode = EQ_EXPR;
3177 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3179 static inline void
3180 gimple_cond_make_true (gcond *gs)
3182 gimple_cond_set_lhs (gs, boolean_true_node);
3183 gimple_cond_set_rhs (gs, boolean_true_node);
3184 gs->subcode = EQ_EXPR;
3187 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3188 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3190 static inline bool
3191 gimple_cond_true_p (const gcond *gs)
3193 tree lhs = gimple_cond_lhs (gs);
3194 tree rhs = gimple_cond_rhs (gs);
3195 enum tree_code code = gimple_cond_code (gs);
3197 if (lhs != boolean_true_node && lhs != boolean_false_node)
3198 return false;
3200 if (rhs != boolean_true_node && rhs != boolean_false_node)
3201 return false;
3203 if (code == NE_EXPR && lhs != rhs)
3204 return true;
3206 if (code == EQ_EXPR && lhs == rhs)
3207 return true;
3209 return false;
3212 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3213 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3215 static inline bool
3216 gimple_cond_false_p (const gcond *gs)
3218 tree lhs = gimple_cond_lhs (gs);
3219 tree rhs = gimple_cond_rhs (gs);
3220 enum tree_code code = gimple_cond_code (gs);
3222 if (lhs != boolean_true_node && lhs != boolean_false_node)
3223 return false;
3225 if (rhs != boolean_true_node && rhs != boolean_false_node)
3226 return false;
3228 if (code == NE_EXPR && lhs == rhs)
3229 return true;
3231 if (code == EQ_EXPR && lhs != rhs)
3232 return true;
3234 return false;
3237 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3239 static inline void
3240 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3241 tree rhs)
3243 gimple_cond_set_code (stmt, code);
3244 gimple_cond_set_lhs (stmt, lhs);
3245 gimple_cond_set_rhs (stmt, rhs);
3248 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3250 static inline tree
3251 gimple_label_label (const glabel *gs)
3253 return gimple_op (gs, 0);
3257 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3258 GS. */
3260 static inline void
3261 gimple_label_set_label (glabel *gs, tree label)
3263 gimple_set_op (gs, 0, label);
3267 /* Return the destination of the unconditional jump GS. */
3269 static inline tree
3270 gimple_goto_dest (const_gimple gs)
3272 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3273 return gimple_op (gs, 0);
3277 /* Set DEST to be the destination of the unconditonal jump GS. */
3279 static inline void
3280 gimple_goto_set_dest (ggoto *gs, tree dest)
3282 gimple_set_op (gs, 0, dest);
3286 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3288 static inline tree
3289 gimple_bind_vars (const gbind *bind_stmt)
3291 return bind_stmt->vars;
3295 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3296 statement GS. */
3298 static inline void
3299 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3301 bind_stmt->vars = vars;
3305 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3306 statement GS. */
3308 static inline void
3309 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3311 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3315 static inline gimple_seq *
3316 gimple_bind_body_ptr (gbind *bind_stmt)
3318 return &bind_stmt->body;
3321 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3323 static inline gimple_seq
3324 gimple_bind_body (gbind *gs)
3326 return *gimple_bind_body_ptr (gs);
3330 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3331 statement GS. */
3333 static inline void
3334 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3336 bind_stmt->body = seq;
3340 /* Append a statement to the end of a GIMPLE_BIND's body. */
3342 static inline void
3343 gimple_bind_add_stmt (gbind *bind_stmt, gimple stmt)
3345 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3349 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3351 static inline void
3352 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3354 gimple_seq_add_seq (&bind_stmt->body, seq);
3358 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3359 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3361 static inline tree
3362 gimple_bind_block (const gbind *bind_stmt)
3364 return bind_stmt->block;
3368 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3369 statement GS. */
3371 static inline void
3372 gimple_bind_set_block (gbind *bind_stmt, tree block)
3374 gcc_gimple_checking_assert (block == NULL_TREE
3375 || TREE_CODE (block) == BLOCK);
3376 bind_stmt->block = block;
3380 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3382 static inline unsigned
3383 gimple_asm_ninputs (const gasm *asm_stmt)
3385 return asm_stmt->ni;
3389 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3391 static inline unsigned
3392 gimple_asm_noutputs (const gasm *asm_stmt)
3394 return asm_stmt->no;
3398 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3400 static inline unsigned
3401 gimple_asm_nclobbers (const gasm *asm_stmt)
3403 return asm_stmt->nc;
3406 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3408 static inline unsigned
3409 gimple_asm_nlabels (const gasm *asm_stmt)
3411 return asm_stmt->nl;
3414 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3416 static inline tree
3417 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3419 gcc_gimple_checking_assert (index < asm_stmt->ni);
3420 return gimple_op (asm_stmt, index + asm_stmt->no);
3423 /* Return a pointer to input operand INDEX of GIMPLE_ASM ASM_STMT. */
3425 static inline tree *
3426 gimple_asm_input_op_ptr (const gasm *asm_stmt, unsigned index)
3428 gcc_gimple_checking_assert (index < asm_stmt->ni);
3429 return gimple_op_ptr (asm_stmt, index + asm_stmt->no);
3433 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3435 static inline void
3436 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3438 gcc_gimple_checking_assert (index < asm_stmt->ni
3439 && TREE_CODE (in_op) == TREE_LIST);
3440 gimple_set_op (asm_stmt, index + asm_stmt->no, in_op);
3444 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3446 static inline tree
3447 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3449 gcc_gimple_checking_assert (index < asm_stmt->no);
3450 return gimple_op (asm_stmt, index);
3453 /* Return a pointer to output operand INDEX of GIMPLE_ASM ASM_STMT. */
3455 static inline tree *
3456 gimple_asm_output_op_ptr (const gasm *asm_stmt, unsigned index)
3458 gcc_gimple_checking_assert (index < asm_stmt->no);
3459 return gimple_op_ptr (asm_stmt, index);
3463 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3465 static inline void
3466 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3468 gcc_gimple_checking_assert (index < asm_stmt->no
3469 && TREE_CODE (out_op) == TREE_LIST);
3470 gimple_set_op (asm_stmt, index, out_op);
3474 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3476 static inline tree
3477 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3479 gcc_gimple_checking_assert (index < asm_stmt->nc);
3480 return gimple_op (asm_stmt, index + asm_stmt->ni + asm_stmt->no);
3484 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3486 static inline void
3487 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3489 gcc_gimple_checking_assert (index < asm_stmt->nc
3490 && TREE_CODE (clobber_op) == TREE_LIST);
3491 gimple_set_op (asm_stmt, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3494 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3496 static inline tree
3497 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3499 gcc_gimple_checking_assert (index < asm_stmt->nl);
3500 return gimple_op (asm_stmt, index + asm_stmt->ni + asm_stmt->nc);
3503 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3505 static inline void
3506 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3508 gcc_gimple_checking_assert (index < asm_stmt->nl
3509 && TREE_CODE (label_op) == TREE_LIST);
3510 gimple_set_op (asm_stmt, index + asm_stmt->ni + asm_stmt->nc, label_op);
3513 /* Return the string representing the assembly instruction in
3514 GIMPLE_ASM ASM_STMT. */
3516 static inline const char *
3517 gimple_asm_string (const gasm *asm_stmt)
3519 return asm_stmt->string;
3523 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3525 static inline bool
3526 gimple_asm_volatile_p (const gasm *asm_stmt)
3528 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3532 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3534 static inline void
3535 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3537 if (volatile_p)
3538 asm_stmt->subcode |= GF_ASM_VOLATILE;
3539 else
3540 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3544 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3546 static inline void
3547 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3549 if (input_p)
3550 asm_stmt->subcode |= GF_ASM_INPUT;
3551 else
3552 asm_stmt->subcode &= ~GF_ASM_INPUT;
3556 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3558 static inline bool
3559 gimple_asm_input_p (const gasm *asm_stmt)
3561 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3565 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3567 static inline tree
3568 gimple_catch_types (const gcatch *catch_stmt)
3570 return catch_stmt->types;
3574 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3576 static inline tree *
3577 gimple_catch_types_ptr (gcatch *catch_stmt)
3579 return &catch_stmt->types;
3583 /* Return a pointer to the GIMPLE sequence representing the body of
3584 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3586 static inline gimple_seq *
3587 gimple_catch_handler_ptr (gcatch *catch_stmt)
3589 return &catch_stmt->handler;
3593 /* Return the GIMPLE sequence representing the body of the handler of
3594 GIMPLE_CATCH statement CATCH_STMT. */
3596 static inline gimple_seq
3597 gimple_catch_handler (gcatch *catch_stmt)
3599 return *gimple_catch_handler_ptr (catch_stmt);
3603 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3605 static inline void
3606 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3608 catch_stmt->types = t;
3612 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3614 static inline void
3615 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
3617 catch_stmt->handler = handler;
3621 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3623 static inline tree
3624 gimple_eh_filter_types (const_gimple gs)
3626 const geh_filter *eh_filter_stmt =
3627 as_a <const geh_filter *> (gs);
3628 return eh_filter_stmt->types;
3632 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3633 GS. */
3635 static inline tree *
3636 gimple_eh_filter_types_ptr (gimple gs)
3638 geh_filter *eh_filter_stmt =
3639 as_a <geh_filter *> (gs);
3640 return &eh_filter_stmt->types;
3644 /* Return a pointer to the sequence of statement to execute when
3645 GIMPLE_EH_FILTER statement fails. */
3647 static inline gimple_seq *
3648 gimple_eh_filter_failure_ptr (gimple gs)
3650 geh_filter *eh_filter_stmt =
3651 as_a <geh_filter *> (gs);
3652 return &eh_filter_stmt->failure;
3656 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3657 statement fails. */
3659 static inline gimple_seq
3660 gimple_eh_filter_failure (gimple gs)
3662 return *gimple_eh_filter_failure_ptr (gs);
3666 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
3667 EH_FILTER_STMT. */
3669 static inline void
3670 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
3672 eh_filter_stmt->types = types;
3676 /* Set FAILURE to be the sequence of statements to execute on failure
3677 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
3679 static inline void
3680 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
3681 gimple_seq failure)
3683 eh_filter_stmt->failure = failure;
3686 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3688 static inline tree
3689 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
3691 return eh_mnt_stmt->fndecl;
3694 /* Set the function decl to be called by GS to DECL. */
3696 static inline void
3697 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
3698 tree decl)
3700 eh_mnt_stmt->fndecl = decl;
3703 /* GIMPLE_EH_ELSE accessors. */
3705 static inline gimple_seq *
3706 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
3708 return &eh_else_stmt->n_body;
3711 static inline gimple_seq
3712 gimple_eh_else_n_body (geh_else *eh_else_stmt)
3714 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
3717 static inline gimple_seq *
3718 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
3720 return &eh_else_stmt->e_body;
3723 static inline gimple_seq
3724 gimple_eh_else_e_body (geh_else *eh_else_stmt)
3726 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
3729 static inline void
3730 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
3732 eh_else_stmt->n_body = seq;
3735 static inline void
3736 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
3738 eh_else_stmt->e_body = seq;
3741 /* GIMPLE_TRY accessors. */
3743 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3744 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3746 static inline enum gimple_try_flags
3747 gimple_try_kind (const_gimple gs)
3749 GIMPLE_CHECK (gs, GIMPLE_TRY);
3750 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3754 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3756 static inline void
3757 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
3759 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3760 || kind == GIMPLE_TRY_FINALLY);
3761 if (gimple_try_kind (gs) != kind)
3762 gs->subcode = (unsigned int) kind;
3766 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3768 static inline bool
3769 gimple_try_catch_is_cleanup (const_gimple gs)
3771 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3772 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3776 /* Return a pointer to the sequence of statements used as the
3777 body for GIMPLE_TRY GS. */
3779 static inline gimple_seq *
3780 gimple_try_eval_ptr (gimple gs)
3782 gtry *try_stmt = as_a <gtry *> (gs);
3783 return &try_stmt->eval;
3787 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3789 static inline gimple_seq
3790 gimple_try_eval (gimple gs)
3792 return *gimple_try_eval_ptr (gs);
3796 /* Return a pointer to the sequence of statements used as the cleanup body for
3797 GIMPLE_TRY GS. */
3799 static inline gimple_seq *
3800 gimple_try_cleanup_ptr (gimple gs)
3802 gtry *try_stmt = as_a <gtry *> (gs);
3803 return &try_stmt->cleanup;
3807 /* Return the sequence of statements used as the cleanup body for
3808 GIMPLE_TRY GS. */
3810 static inline gimple_seq
3811 gimple_try_cleanup (gimple gs)
3813 return *gimple_try_cleanup_ptr (gs);
3817 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3819 static inline void
3820 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
3822 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3823 if (catch_is_cleanup)
3824 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3825 else
3826 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3830 /* Set EVAL to be the sequence of statements to use as the body for
3831 GIMPLE_TRY TRY_STMT. */
3833 static inline void
3834 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
3836 try_stmt->eval = eval;
3840 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3841 body for GIMPLE_TRY TRY_STMT. */
3843 static inline void
3844 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
3846 try_stmt->cleanup = cleanup;
3850 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3852 static inline gimple_seq *
3853 gimple_wce_cleanup_ptr (gimple gs)
3855 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3856 return &wce_stmt->cleanup;
3860 /* Return the cleanup sequence for cleanup statement GS. */
3862 static inline gimple_seq
3863 gimple_wce_cleanup (gimple gs)
3865 return *gimple_wce_cleanup_ptr (gs);
3869 /* Set CLEANUP to be the cleanup sequence for GS. */
3871 static inline void
3872 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3874 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3875 wce_stmt->cleanup = cleanup;
3879 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3881 static inline bool
3882 gimple_wce_cleanup_eh_only (const_gimple gs)
3884 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3885 return gs->subcode != 0;
3889 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3891 static inline void
3892 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3894 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3895 gs->subcode = (unsigned int) eh_only_p;
3899 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3901 static inline unsigned
3902 gimple_phi_capacity (const_gimple gs)
3904 const gphi *phi_stmt =
3905 as_a <const gphi *> (gs);
3906 return phi_stmt->capacity;
3910 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3911 be exactly the number of incoming edges for the basic block holding
3912 GS. */
3914 static inline unsigned
3915 gimple_phi_num_args (const_gimple gs)
3917 const gphi *phi_stmt =
3918 as_a <const gphi *> (gs);
3919 return phi_stmt->nargs;
3923 /* Return the SSA name created by GIMPLE_PHI GS. */
3925 static inline tree
3926 gimple_phi_result (const_gimple gs)
3928 const gphi *phi_stmt =
3929 as_a <const gphi *> (gs);
3930 return phi_stmt->result;
3933 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3935 static inline tree *
3936 gimple_phi_result_ptr (gimple gs)
3938 gphi *phi_stmt = as_a <gphi *> (gs);
3939 return &phi_stmt->result;
3942 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
3944 static inline void
3945 gimple_phi_set_result (gphi *phi, tree result)
3947 phi->result = result;
3948 if (result && TREE_CODE (result) == SSA_NAME)
3949 SSA_NAME_DEF_STMT (result) = phi;
3953 /* Return the PHI argument corresponding to incoming edge INDEX for
3954 GIMPLE_PHI GS. */
3956 static inline struct phi_arg_d *
3957 gimple_phi_arg (gimple gs, unsigned index)
3959 gphi *phi_stmt = as_a <gphi *> (gs);
3960 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3961 return &(phi_stmt->args[index]);
3964 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3965 for GIMPLE_PHI PHI. */
3967 static inline void
3968 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
3970 gcc_gimple_checking_assert (index <= phi->nargs);
3971 phi->args[index] = *phiarg;
3974 /* Return the PHI nodes for basic block BB, or NULL if there are no
3975 PHI nodes. */
3977 static inline gimple_seq
3978 phi_nodes (const_basic_block bb)
3980 gcc_checking_assert (!(bb->flags & BB_RTL));
3981 return bb->il.gimple.phi_nodes;
3984 /* Return a pointer to the PHI nodes for basic block BB. */
3986 static inline gimple_seq *
3987 phi_nodes_ptr (basic_block bb)
3989 gcc_checking_assert (!(bb->flags & BB_RTL));
3990 return &bb->il.gimple.phi_nodes;
3993 /* Return the tree operand for argument I of PHI node GS. */
3995 static inline tree
3996 gimple_phi_arg_def (gimple gs, size_t index)
3998 return gimple_phi_arg (gs, index)->def;
4002 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4004 static inline tree *
4005 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4007 return &gimple_phi_arg (phi, index)->def;
4010 /* Return the edge associated with argument I of phi node PHI. */
4012 static inline edge
4013 gimple_phi_arg_edge (gphi *phi, size_t i)
4015 return EDGE_PRED (gimple_bb (phi), i);
4018 /* Return the source location of gimple argument I of phi node PHI. */
4020 static inline source_location
4021 gimple_phi_arg_location (gphi *phi, size_t i)
4023 return gimple_phi_arg (phi, i)->locus;
4026 /* Return the source location of the argument on edge E of phi node PHI. */
4028 static inline source_location
4029 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4031 return gimple_phi_arg (phi, e->dest_idx)->locus;
4034 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4036 static inline void
4037 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4039 gimple_phi_arg (phi, i)->locus = loc;
4042 /* Return TRUE if argument I of phi node PHI has a location record. */
4044 static inline bool
4045 gimple_phi_arg_has_location (gphi *phi, size_t i)
4047 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4051 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4053 static inline int
4054 gimple_resx_region (const gresx *resx_stmt)
4056 return resx_stmt->region;
4059 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4061 static inline void
4062 gimple_resx_set_region (gresx *resx_stmt, int region)
4064 resx_stmt->region = region;
4067 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4069 static inline int
4070 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4072 return eh_dispatch_stmt->region;
4075 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4076 EH_DISPATCH_STMT. */
4078 static inline void
4079 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4081 eh_dispatch_stmt->region = region;
4084 /* Return the number of labels associated with the switch statement GS. */
4086 static inline unsigned
4087 gimple_switch_num_labels (const gswitch *gs)
4089 unsigned num_ops;
4090 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4091 num_ops = gimple_num_ops (gs);
4092 gcc_gimple_checking_assert (num_ops > 1);
4093 return num_ops - 1;
4097 /* Set NLABELS to be the number of labels for the switch statement GS. */
4099 static inline void
4100 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4102 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4103 gimple_set_num_ops (g, nlabels + 1);
4107 /* Return the index variable used by the switch statement GS. */
4109 static inline tree
4110 gimple_switch_index (const gswitch *gs)
4112 return gimple_op (gs, 0);
4116 /* Return a pointer to the index variable for the switch statement GS. */
4118 static inline tree *
4119 gimple_switch_index_ptr (const gswitch *gs)
4121 return gimple_op_ptr (gs, 0);
4125 /* Set INDEX to be the index variable for switch statement GS. */
4127 static inline void
4128 gimple_switch_set_index (gswitch *gs, tree index)
4130 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4131 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4132 gimple_set_op (gs, 0, index);
4136 /* Return the label numbered INDEX. The default label is 0, followed by any
4137 labels in a switch statement. */
4139 static inline tree
4140 gimple_switch_label (const gswitch *gs, unsigned index)
4142 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4143 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4144 return gimple_op (gs, index + 1);
4147 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4149 static inline void
4150 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4152 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4153 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4154 && (label == NULL_TREE
4155 || TREE_CODE (label) == CASE_LABEL_EXPR));
4156 gimple_set_op (gs, index + 1, label);
4159 /* Return the default label for a switch statement. */
4161 static inline tree
4162 gimple_switch_default_label (const gswitch *gs)
4164 tree label = gimple_switch_label (gs, 0);
4165 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4166 return label;
4169 /* Set the default label for a switch statement. */
4171 static inline void
4172 gimple_switch_set_default_label (gswitch *gs, tree label)
4174 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4175 gimple_switch_set_label (gs, 0, label);
4178 /* Return true if GS is a GIMPLE_DEBUG statement. */
4180 static inline bool
4181 is_gimple_debug (const_gimple gs)
4183 return gimple_code (gs) == GIMPLE_DEBUG;
4186 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4188 static inline bool
4189 gimple_debug_bind_p (const_gimple s)
4191 if (is_gimple_debug (s))
4192 return s->subcode == GIMPLE_DEBUG_BIND;
4194 return false;
4197 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4199 static inline tree
4200 gimple_debug_bind_get_var (gimple dbg)
4202 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4203 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4204 return gimple_op (dbg, 0);
4207 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4208 statement. */
4210 static inline tree
4211 gimple_debug_bind_get_value (gimple dbg)
4213 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4214 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4215 return gimple_op (dbg, 1);
4218 /* Return a pointer to the value bound to the variable in a
4219 GIMPLE_DEBUG bind statement. */
4221 static inline tree *
4222 gimple_debug_bind_get_value_ptr (gimple dbg)
4224 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4225 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4226 return gimple_op_ptr (dbg, 1);
4229 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4231 static inline void
4232 gimple_debug_bind_set_var (gimple dbg, tree var)
4234 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4235 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4236 gimple_set_op (dbg, 0, var);
4239 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4240 statement. */
4242 static inline void
4243 gimple_debug_bind_set_value (gimple dbg, tree value)
4245 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4246 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4247 gimple_set_op (dbg, 1, value);
4250 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4251 optimized away. */
4252 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4254 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4255 statement. */
4257 static inline void
4258 gimple_debug_bind_reset_value (gimple dbg)
4260 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4261 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4262 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4265 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4266 value. */
4268 static inline bool
4269 gimple_debug_bind_has_value_p (gimple dbg)
4271 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4272 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4273 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4276 #undef GIMPLE_DEBUG_BIND_NOVALUE
4278 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4280 static inline bool
4281 gimple_debug_source_bind_p (const_gimple s)
4283 if (is_gimple_debug (s))
4284 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4286 return false;
4289 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4291 static inline tree
4292 gimple_debug_source_bind_get_var (gimple dbg)
4294 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4295 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4296 return gimple_op (dbg, 0);
4299 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4300 statement. */
4302 static inline tree
4303 gimple_debug_source_bind_get_value (gimple dbg)
4305 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4306 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4307 return gimple_op (dbg, 1);
4310 /* Return a pointer to the value bound to the variable in a
4311 GIMPLE_DEBUG source bind statement. */
4313 static inline tree *
4314 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4316 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4317 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4318 return gimple_op_ptr (dbg, 1);
4321 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4323 static inline void
4324 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4326 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4327 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4328 gimple_set_op (dbg, 0, var);
4331 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4332 statement. */
4334 static inline void
4335 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4337 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4338 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4339 gimple_set_op (dbg, 1, value);
4342 /* Return the line number for EXPR, or return -1 if we have no line
4343 number information for it. */
4344 static inline int
4345 get_lineno (const_gimple stmt)
4347 location_t loc;
4349 if (!stmt)
4350 return -1;
4352 loc = gimple_location (stmt);
4353 if (loc == UNKNOWN_LOCATION)
4354 return -1;
4356 return LOCATION_LINE (loc);
4359 /* Return a pointer to the body for the OMP statement GS. */
4361 static inline gimple_seq *
4362 gimple_omp_body_ptr (gimple gs)
4364 return &static_cast <gimple_statement_omp *> (gs)->body;
4367 /* Return the body for the OMP statement GS. */
4369 static inline gimple_seq
4370 gimple_omp_body (gimple gs)
4372 return *gimple_omp_body_ptr (gs);
4375 /* Set BODY to be the body for the OMP statement GS. */
4377 static inline void
4378 gimple_omp_set_body (gimple gs, gimple_seq body)
4380 static_cast <gimple_statement_omp *> (gs)->body = body;
4384 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4386 static inline tree
4387 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4389 return crit_stmt->name;
4393 /* Return a pointer to the name associated with OMP critical statement GS. */
4395 static inline tree *
4396 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4398 return &crit_stmt->name;
4402 /* Set NAME to be the name associated with OMP critical statement GS. */
4404 static inline void
4405 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4407 crit_stmt->name = name;
4411 /* Return the kind of OMP for statemement. */
4413 static inline int
4414 gimple_omp_for_kind (const_gimple g)
4416 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4417 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4421 /* Set the OMP for kind. */
4423 static inline void
4424 gimple_omp_for_set_kind (gomp_for *g, int kind)
4426 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4427 | (kind & GF_OMP_FOR_KIND_MASK);
4431 /* Return true if OMP for statement G has the
4432 GF_OMP_FOR_COMBINED flag set. */
4434 static inline bool
4435 gimple_omp_for_combined_p (const_gimple g)
4437 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4438 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4442 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4443 value of COMBINED_P. */
4445 static inline void
4446 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4448 if (combined_p)
4449 g->subcode |= GF_OMP_FOR_COMBINED;
4450 else
4451 g->subcode &= ~GF_OMP_FOR_COMBINED;
4455 /* Return true if OMP for statement G has the
4456 GF_OMP_FOR_COMBINED_INTO flag set. */
4458 static inline bool
4459 gimple_omp_for_combined_into_p (const_gimple g)
4461 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4462 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4466 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4467 value of COMBINED_P. */
4469 static inline void
4470 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4472 if (combined_p)
4473 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4474 else
4475 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4479 /* Return the clauses associated with OMP_FOR GS. */
4481 static inline tree
4482 gimple_omp_for_clauses (const_gimple gs)
4484 const gomp_for *omp_for_stmt =
4485 as_a <const gomp_for *> (gs);
4486 return omp_for_stmt->clauses;
4490 /* Return a pointer to the OMP_FOR GS. */
4492 static inline tree *
4493 gimple_omp_for_clauses_ptr (gimple gs)
4495 gomp_for *omp_for_stmt =
4496 as_a <gomp_for *> (gs);
4497 return &omp_for_stmt->clauses;
4501 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4503 static inline void
4504 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4506 gomp_for *omp_for_stmt =
4507 as_a <gomp_for *> (gs);
4508 omp_for_stmt->clauses = clauses;
4512 /* Get the collapse count of OMP_FOR GS. */
4514 static inline size_t
4515 gimple_omp_for_collapse (gimple gs)
4517 gomp_for *omp_for_stmt =
4518 as_a <gomp_for *> (gs);
4519 return omp_for_stmt->collapse;
4523 /* Return the index variable for OMP_FOR GS. */
4525 static inline tree
4526 gimple_omp_for_index (const_gimple gs, size_t i)
4528 const gomp_for *omp_for_stmt =
4529 as_a <const gomp_for *> (gs);
4530 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4531 return omp_for_stmt->iter[i].index;
4535 /* Return a pointer to the index variable for OMP_FOR GS. */
4537 static inline tree *
4538 gimple_omp_for_index_ptr (gimple gs, size_t i)
4540 gomp_for *omp_for_stmt =
4541 as_a <gomp_for *> (gs);
4542 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4543 return &omp_for_stmt->iter[i].index;
4547 /* Set INDEX to be the index variable for OMP_FOR GS. */
4549 static inline void
4550 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4552 gomp_for *omp_for_stmt =
4553 as_a <gomp_for *> (gs);
4554 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4555 omp_for_stmt->iter[i].index = index;
4559 /* Return the initial value for OMP_FOR GS. */
4561 static inline tree
4562 gimple_omp_for_initial (const_gimple gs, size_t i)
4564 const gomp_for *omp_for_stmt =
4565 as_a <const gomp_for *> (gs);
4566 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4567 return omp_for_stmt->iter[i].initial;
4571 /* Return a pointer to the initial value for OMP_FOR GS. */
4573 static inline tree *
4574 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4576 gomp_for *omp_for_stmt =
4577 as_a <gomp_for *> (gs);
4578 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4579 return &omp_for_stmt->iter[i].initial;
4583 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4585 static inline void
4586 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4588 gomp_for *omp_for_stmt =
4589 as_a <gomp_for *> (gs);
4590 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4591 omp_for_stmt->iter[i].initial = initial;
4595 /* Return the final value for OMP_FOR GS. */
4597 static inline tree
4598 gimple_omp_for_final (const_gimple gs, size_t i)
4600 const gomp_for *omp_for_stmt =
4601 as_a <const gomp_for *> (gs);
4602 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4603 return omp_for_stmt->iter[i].final;
4607 /* Return a pointer to the final value for OMP_FOR GS. */
4609 static inline tree *
4610 gimple_omp_for_final_ptr (gimple gs, size_t i)
4612 gomp_for *omp_for_stmt =
4613 as_a <gomp_for *> (gs);
4614 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4615 return &omp_for_stmt->iter[i].final;
4619 /* Set FINAL to be the final value for OMP_FOR GS. */
4621 static inline void
4622 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4624 gomp_for *omp_for_stmt =
4625 as_a <gomp_for *> (gs);
4626 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4627 omp_for_stmt->iter[i].final = final;
4631 /* Return the increment value for OMP_FOR GS. */
4633 static inline tree
4634 gimple_omp_for_incr (const_gimple gs, size_t i)
4636 const gomp_for *omp_for_stmt =
4637 as_a <const gomp_for *> (gs);
4638 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4639 return omp_for_stmt->iter[i].incr;
4643 /* Return a pointer to the increment value for OMP_FOR GS. */
4645 static inline tree *
4646 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4648 gomp_for *omp_for_stmt =
4649 as_a <gomp_for *> (gs);
4650 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4651 return &omp_for_stmt->iter[i].incr;
4655 /* Set INCR to be the increment value for OMP_FOR GS. */
4657 static inline void
4658 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4660 gomp_for *omp_for_stmt =
4661 as_a <gomp_for *> (gs);
4662 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4663 omp_for_stmt->iter[i].incr = incr;
4667 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4668 statement GS starts. */
4670 static inline gimple_seq *
4671 gimple_omp_for_pre_body_ptr (gimple gs)
4673 gomp_for *omp_for_stmt =
4674 as_a <gomp_for *> (gs);
4675 return &omp_for_stmt->pre_body;
4679 /* Return the sequence of statements to execute before the OMP_FOR
4680 statement GS starts. */
4682 static inline gimple_seq
4683 gimple_omp_for_pre_body (gimple gs)
4685 return *gimple_omp_for_pre_body_ptr (gs);
4689 /* Set PRE_BODY to be the sequence of statements to execute before the
4690 OMP_FOR statement GS starts. */
4692 static inline void
4693 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4695 gomp_for *omp_for_stmt =
4696 as_a <gomp_for *> (gs);
4697 omp_for_stmt->pre_body = pre_body;
4701 /* Return the clauses associated with OMP_PARALLEL GS. */
4703 static inline tree
4704 gimple_omp_parallel_clauses (const_gimple gs)
4706 const gomp_parallel *omp_parallel_stmt =
4707 as_a <const gomp_parallel *> (gs);
4708 return omp_parallel_stmt->clauses;
4712 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
4714 static inline tree *
4715 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
4717 return &omp_parallel_stmt->clauses;
4721 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
4723 static inline void
4724 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
4725 tree clauses)
4727 omp_parallel_stmt->clauses = clauses;
4731 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
4733 static inline tree
4734 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
4736 return omp_parallel_stmt->child_fn;
4739 /* Return a pointer to the child function used to hold the body of
4740 OMP_PARALLEL_STMT. */
4742 static inline tree *
4743 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
4745 return &omp_parallel_stmt->child_fn;
4749 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
4751 static inline void
4752 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
4753 tree child_fn)
4755 omp_parallel_stmt->child_fn = child_fn;
4759 /* Return the artificial argument used to send variables and values
4760 from the parent to the children threads in OMP_PARALLEL_STMT. */
4762 static inline tree
4763 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
4765 return omp_parallel_stmt->data_arg;
4769 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
4771 static inline tree *
4772 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
4774 return &omp_parallel_stmt->data_arg;
4778 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
4780 static inline void
4781 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
4782 tree data_arg)
4784 omp_parallel_stmt->data_arg = data_arg;
4788 /* Return the clauses associated with OMP_TASK GS. */
4790 static inline tree
4791 gimple_omp_task_clauses (const_gimple gs)
4793 const gomp_task *omp_task_stmt =
4794 as_a <const gomp_task *> (gs);
4795 return omp_task_stmt->clauses;
4799 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4801 static inline tree *
4802 gimple_omp_task_clauses_ptr (gimple gs)
4804 gomp_task *omp_task_stmt =
4805 as_a <gomp_task *> (gs);
4806 return &omp_task_stmt->clauses;
4810 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4811 GS. */
4813 static inline void
4814 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4816 gomp_task *omp_task_stmt =
4817 as_a <gomp_task *> (gs);
4818 omp_task_stmt->clauses = clauses;
4822 /* Return the child function used to hold the body of OMP_TASK GS. */
4824 static inline tree
4825 gimple_omp_task_child_fn (const_gimple gs)
4827 const gomp_task *omp_task_stmt =
4828 as_a <const gomp_task *> (gs);
4829 return omp_task_stmt->child_fn;
4832 /* Return a pointer to the child function used to hold the body of
4833 OMP_TASK GS. */
4835 static inline tree *
4836 gimple_omp_task_child_fn_ptr (gimple gs)
4838 gomp_task *omp_task_stmt =
4839 as_a <gomp_task *> (gs);
4840 return &omp_task_stmt->child_fn;
4844 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4846 static inline void
4847 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4849 gomp_task *omp_task_stmt =
4850 as_a <gomp_task *> (gs);
4851 omp_task_stmt->child_fn = child_fn;
4855 /* Return the artificial argument used to send variables and values
4856 from the parent to the children threads in OMP_TASK GS. */
4858 static inline tree
4859 gimple_omp_task_data_arg (const_gimple gs)
4861 const gomp_task *omp_task_stmt =
4862 as_a <const gomp_task *> (gs);
4863 return omp_task_stmt->data_arg;
4867 /* Return a pointer to the data argument for OMP_TASK GS. */
4869 static inline tree *
4870 gimple_omp_task_data_arg_ptr (gimple gs)
4872 gomp_task *omp_task_stmt =
4873 as_a <gomp_task *> (gs);
4874 return &omp_task_stmt->data_arg;
4878 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4880 static inline void
4881 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4883 gomp_task *omp_task_stmt =
4884 as_a <gomp_task *> (gs);
4885 omp_task_stmt->data_arg = data_arg;
4889 /* Return the clauses associated with OMP_TASK GS. */
4891 static inline tree
4892 gimple_omp_taskreg_clauses (const_gimple gs)
4894 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4895 as_a <const gimple_statement_omp_taskreg *> (gs);
4896 return omp_taskreg_stmt->clauses;
4900 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4902 static inline tree *
4903 gimple_omp_taskreg_clauses_ptr (gimple gs)
4905 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4906 as_a <gimple_statement_omp_taskreg *> (gs);
4907 return &omp_taskreg_stmt->clauses;
4911 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4912 GS. */
4914 static inline void
4915 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4917 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4918 as_a <gimple_statement_omp_taskreg *> (gs);
4919 omp_taskreg_stmt->clauses = clauses;
4923 /* Return the child function used to hold the body of OMP_TASK GS. */
4925 static inline tree
4926 gimple_omp_taskreg_child_fn (const_gimple gs)
4928 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4929 as_a <const gimple_statement_omp_taskreg *> (gs);
4930 return omp_taskreg_stmt->child_fn;
4933 /* Return a pointer to the child function used to hold the body of
4934 OMP_TASK GS. */
4936 static inline tree *
4937 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4939 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4940 as_a <gimple_statement_omp_taskreg *> (gs);
4941 return &omp_taskreg_stmt->child_fn;
4945 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4947 static inline void
4948 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4950 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4951 as_a <gimple_statement_omp_taskreg *> (gs);
4952 omp_taskreg_stmt->child_fn = child_fn;
4956 /* Return the artificial argument used to send variables and values
4957 from the parent to the children threads in OMP_TASK GS. */
4959 static inline tree
4960 gimple_omp_taskreg_data_arg (const_gimple gs)
4962 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4963 as_a <const gimple_statement_omp_taskreg *> (gs);
4964 return omp_taskreg_stmt->data_arg;
4968 /* Return a pointer to the data argument for OMP_TASK GS. */
4970 static inline tree *
4971 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4973 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4974 as_a <gimple_statement_omp_taskreg *> (gs);
4975 return &omp_taskreg_stmt->data_arg;
4979 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4981 static inline void
4982 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4984 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4985 as_a <gimple_statement_omp_taskreg *> (gs);
4986 omp_taskreg_stmt->data_arg = data_arg;
4990 /* Return the copy function used to hold the body of OMP_TASK GS. */
4992 static inline tree
4993 gimple_omp_task_copy_fn (const_gimple gs)
4995 const gomp_task *omp_task_stmt =
4996 as_a <const gomp_task *> (gs);
4997 return omp_task_stmt->copy_fn;
5000 /* Return a pointer to the copy function used to hold the body of
5001 OMP_TASK GS. */
5003 static inline tree *
5004 gimple_omp_task_copy_fn_ptr (gimple gs)
5006 gomp_task *omp_task_stmt =
5007 as_a <gomp_task *> (gs);
5008 return &omp_task_stmt->copy_fn;
5012 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5014 static inline void
5015 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
5017 gomp_task *omp_task_stmt =
5018 as_a <gomp_task *> (gs);
5019 omp_task_stmt->copy_fn = copy_fn;
5023 /* Return size of the data block in bytes in OMP_TASK GS. */
5025 static inline tree
5026 gimple_omp_task_arg_size (const_gimple gs)
5028 const gomp_task *omp_task_stmt =
5029 as_a <const gomp_task *> (gs);
5030 return omp_task_stmt->arg_size;
5034 /* Return a pointer to the data block size for OMP_TASK GS. */
5036 static inline tree *
5037 gimple_omp_task_arg_size_ptr (gimple gs)
5039 gomp_task *omp_task_stmt =
5040 as_a <gomp_task *> (gs);
5041 return &omp_task_stmt->arg_size;
5045 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5047 static inline void
5048 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
5050 gomp_task *omp_task_stmt =
5051 as_a <gomp_task *> (gs);
5052 omp_task_stmt->arg_size = arg_size;
5056 /* Return align of the data block in bytes in OMP_TASK GS. */
5058 static inline tree
5059 gimple_omp_task_arg_align (const_gimple gs)
5061 const gomp_task *omp_task_stmt =
5062 as_a <const gomp_task *> (gs);
5063 return omp_task_stmt->arg_align;
5067 /* Return a pointer to the data block align for OMP_TASK GS. */
5069 static inline tree *
5070 gimple_omp_task_arg_align_ptr (gimple gs)
5072 gomp_task *omp_task_stmt =
5073 as_a <gomp_task *> (gs);
5074 return &omp_task_stmt->arg_align;
5078 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5080 static inline void
5081 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
5083 gomp_task *omp_task_stmt =
5084 as_a <gomp_task *> (gs);
5085 omp_task_stmt->arg_align = arg_align;
5089 /* Return the clauses associated with OMP_SINGLE GS. */
5091 static inline tree
5092 gimple_omp_single_clauses (const_gimple gs)
5094 const gomp_single *omp_single_stmt =
5095 as_a <const gomp_single *> (gs);
5096 return omp_single_stmt->clauses;
5100 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5102 static inline tree *
5103 gimple_omp_single_clauses_ptr (gimple gs)
5105 gomp_single *omp_single_stmt =
5106 as_a <gomp_single *> (gs);
5107 return &omp_single_stmt->clauses;
5111 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5113 static inline void
5114 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5116 omp_single_stmt->clauses = clauses;
5120 /* Return the clauses associated with OMP_TARGET GS. */
5122 static inline tree
5123 gimple_omp_target_clauses (const_gimple gs)
5125 const gomp_target *omp_target_stmt =
5126 as_a <const gomp_target *> (gs);
5127 return omp_target_stmt->clauses;
5131 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5133 static inline tree *
5134 gimple_omp_target_clauses_ptr (gimple gs)
5136 gomp_target *omp_target_stmt =
5137 as_a <gomp_target *> (gs);
5138 return &omp_target_stmt->clauses;
5142 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5144 static inline void
5145 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5146 tree clauses)
5148 omp_target_stmt->clauses = clauses;
5152 /* Return the kind of OMP target statemement. */
5154 static inline int
5155 gimple_omp_target_kind (const_gimple g)
5157 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5158 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5162 /* Set the OMP target kind. */
5164 static inline void
5165 gimple_omp_target_set_kind (gomp_target *g, int kind)
5167 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5168 | (kind & GF_OMP_TARGET_KIND_MASK);
5172 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5174 static inline tree
5175 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5177 return omp_target_stmt->child_fn;
5180 /* Return a pointer to the child function used to hold the body of
5181 OMP_TARGET_STMT. */
5183 static inline tree *
5184 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5186 return &omp_target_stmt->child_fn;
5190 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5192 static inline void
5193 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5194 tree child_fn)
5196 omp_target_stmt->child_fn = child_fn;
5200 /* Return the artificial argument used to send variables and values
5201 from the parent to the children threads in OMP_TARGET_STMT. */
5203 static inline tree
5204 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5206 return omp_target_stmt->data_arg;
5210 /* Return a pointer to the data argument for OMP_TARGET GS. */
5212 static inline tree *
5213 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5215 return &omp_target_stmt->data_arg;
5219 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5221 static inline void
5222 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5223 tree data_arg)
5225 omp_target_stmt->data_arg = data_arg;
5229 /* Return the clauses associated with OMP_TEAMS GS. */
5231 static inline tree
5232 gimple_omp_teams_clauses (const_gimple gs)
5234 const gomp_teams *omp_teams_stmt =
5235 as_a <const gomp_teams *> (gs);
5236 return omp_teams_stmt->clauses;
5240 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5242 static inline tree *
5243 gimple_omp_teams_clauses_ptr (gimple gs)
5245 gomp_teams *omp_teams_stmt =
5246 as_a <gomp_teams *> (gs);
5247 return &omp_teams_stmt->clauses;
5251 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5253 static inline void
5254 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5256 omp_teams_stmt->clauses = clauses;
5260 /* Return the clauses associated with OMP_SECTIONS GS. */
5262 static inline tree
5263 gimple_omp_sections_clauses (const_gimple gs)
5265 const gomp_sections *omp_sections_stmt =
5266 as_a <const gomp_sections *> (gs);
5267 return omp_sections_stmt->clauses;
5271 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5273 static inline tree *
5274 gimple_omp_sections_clauses_ptr (gimple gs)
5276 gomp_sections *omp_sections_stmt =
5277 as_a <gomp_sections *> (gs);
5278 return &omp_sections_stmt->clauses;
5282 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5283 GS. */
5285 static inline void
5286 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5288 gomp_sections *omp_sections_stmt =
5289 as_a <gomp_sections *> (gs);
5290 omp_sections_stmt->clauses = clauses;
5294 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5295 in GS. */
5297 static inline tree
5298 gimple_omp_sections_control (const_gimple gs)
5300 const gomp_sections *omp_sections_stmt =
5301 as_a <const gomp_sections *> (gs);
5302 return omp_sections_stmt->control;
5306 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5307 GS. */
5309 static inline tree *
5310 gimple_omp_sections_control_ptr (gimple gs)
5312 gomp_sections *omp_sections_stmt =
5313 as_a <gomp_sections *> (gs);
5314 return &omp_sections_stmt->control;
5318 /* Set CONTROL to be the set of clauses associated with the
5319 GIMPLE_OMP_SECTIONS in GS. */
5321 static inline void
5322 gimple_omp_sections_set_control (gimple gs, tree control)
5324 gomp_sections *omp_sections_stmt =
5325 as_a <gomp_sections *> (gs);
5326 omp_sections_stmt->control = control;
5330 /* Set COND to be the condition code for OMP_FOR GS. */
5332 static inline void
5333 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5335 gomp_for *omp_for_stmt =
5336 as_a <gomp_for *> (gs);
5337 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5338 && i < omp_for_stmt->collapse);
5339 omp_for_stmt->iter[i].cond = cond;
5343 /* Return the condition code associated with OMP_FOR GS. */
5345 static inline enum tree_code
5346 gimple_omp_for_cond (const_gimple gs, size_t i)
5348 const gomp_for *omp_for_stmt =
5349 as_a <const gomp_for *> (gs);
5350 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5351 return omp_for_stmt->iter[i].cond;
5355 /* Set the value being stored in an atomic store. */
5357 static inline void
5358 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5360 store_stmt->val = val;
5364 /* Return the value being stored in an atomic store. */
5366 static inline tree
5367 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5369 return store_stmt->val;
5373 /* Return a pointer to the value being stored in an atomic store. */
5375 static inline tree *
5376 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5378 return &store_stmt->val;
5382 /* Set the LHS of an atomic load. */
5384 static inline void
5385 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5387 load_stmt->lhs = lhs;
5391 /* Get the LHS of an atomic load. */
5393 static inline tree
5394 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5396 return load_stmt->lhs;
5400 /* Return a pointer to the LHS of an atomic load. */
5402 static inline tree *
5403 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5405 return &load_stmt->lhs;
5409 /* Set the RHS of an atomic load. */
5411 static inline void
5412 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5414 load_stmt->rhs = rhs;
5418 /* Get the RHS of an atomic load. */
5420 static inline tree
5421 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5423 return load_stmt->rhs;
5427 /* Return a pointer to the RHS of an atomic load. */
5429 static inline tree *
5430 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5432 return &load_stmt->rhs;
5436 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5438 static inline tree
5439 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5441 return cont_stmt->control_def;
5444 /* The same as above, but return the address. */
5446 static inline tree *
5447 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5449 return &cont_stmt->control_def;
5452 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5454 static inline void
5455 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
5457 cont_stmt->control_def = def;
5461 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5463 static inline tree
5464 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
5466 return cont_stmt->control_use;
5470 /* The same as above, but return the address. */
5472 static inline tree *
5473 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
5475 return &cont_stmt->control_use;
5479 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5481 static inline void
5482 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
5484 cont_stmt->control_use = use;
5487 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5488 TRANSACTION_STMT. */
5490 static inline gimple_seq *
5491 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
5493 return &transaction_stmt->body;
5496 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5498 static inline gimple_seq
5499 gimple_transaction_body (gtransaction *transaction_stmt)
5501 return *gimple_transaction_body_ptr (transaction_stmt);
5504 /* Return the label associated with a GIMPLE_TRANSACTION. */
5506 static inline tree
5507 gimple_transaction_label (const gtransaction *transaction_stmt)
5509 return transaction_stmt->label;
5512 static inline tree *
5513 gimple_transaction_label_ptr (gtransaction *transaction_stmt)
5515 return &transaction_stmt->label;
5518 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5520 static inline unsigned int
5521 gimple_transaction_subcode (const gtransaction *transaction_stmt)
5523 return transaction_stmt->subcode;
5526 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5527 TRANSACTION_STMT. */
5529 static inline void
5530 gimple_transaction_set_body (gtransaction *transaction_stmt,
5531 gimple_seq body)
5533 transaction_stmt->body = body;
5536 /* Set the label associated with a GIMPLE_TRANSACTION. */
5538 static inline void
5539 gimple_transaction_set_label (gtransaction *transaction_stmt, tree label)
5541 transaction_stmt->label = label;
5544 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5546 static inline void
5547 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
5548 unsigned int subcode)
5550 transaction_stmt->subcode = subcode;
5554 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5556 static inline tree *
5557 gimple_return_retval_ptr (const greturn *gs)
5559 return gimple_op_ptr (gs, 0);
5562 /* Return the return value for GIMPLE_RETURN GS. */
5564 static inline tree
5565 gimple_return_retval (const greturn *gs)
5567 return gimple_op (gs, 0);
5571 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5573 static inline void
5574 gimple_return_set_retval (greturn *gs, tree retval)
5576 gimple_set_op (gs, 0, retval);
5580 /* Return the return bounds for GIMPLE_RETURN GS. */
5582 static inline tree
5583 gimple_return_retbnd (const_gimple gs)
5585 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5586 return gimple_op (gs, 1);
5590 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
5592 static inline void
5593 gimple_return_set_retbnd (gimple gs, tree retval)
5595 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5596 gimple_set_op (gs, 1, retval);
5600 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5602 #define CASE_GIMPLE_OMP \
5603 case GIMPLE_OMP_PARALLEL: \
5604 case GIMPLE_OMP_TASK: \
5605 case GIMPLE_OMP_FOR: \
5606 case GIMPLE_OMP_SECTIONS: \
5607 case GIMPLE_OMP_SECTIONS_SWITCH: \
5608 case GIMPLE_OMP_SINGLE: \
5609 case GIMPLE_OMP_TARGET: \
5610 case GIMPLE_OMP_TEAMS: \
5611 case GIMPLE_OMP_SECTION: \
5612 case GIMPLE_OMP_MASTER: \
5613 case GIMPLE_OMP_TASKGROUP: \
5614 case GIMPLE_OMP_ORDERED: \
5615 case GIMPLE_OMP_CRITICAL: \
5616 case GIMPLE_OMP_RETURN: \
5617 case GIMPLE_OMP_ATOMIC_LOAD: \
5618 case GIMPLE_OMP_ATOMIC_STORE: \
5619 case GIMPLE_OMP_CONTINUE
5621 static inline bool
5622 is_gimple_omp (const_gimple stmt)
5624 switch (gimple_code (stmt))
5626 CASE_GIMPLE_OMP:
5627 return true;
5628 default:
5629 return false;
5634 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5636 static inline bool
5637 gimple_nop_p (const_gimple g)
5639 return gimple_code (g) == GIMPLE_NOP;
5643 /* Return true if GS is a GIMPLE_RESX. */
5645 static inline bool
5646 is_gimple_resx (const_gimple gs)
5648 return gimple_code (gs) == GIMPLE_RESX;
5651 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5653 static inline enum br_predictor
5654 gimple_predict_predictor (gimple gs)
5656 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5657 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5661 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5663 static inline void
5664 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5666 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5667 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5668 | (unsigned) predictor;
5672 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5674 static inline enum prediction
5675 gimple_predict_outcome (gimple gs)
5677 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5678 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5682 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5684 static inline void
5685 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5687 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5688 if (outcome == TAKEN)
5689 gs->subcode |= GF_PREDICT_TAKEN;
5690 else
5691 gs->subcode &= ~GF_PREDICT_TAKEN;
5695 /* Return the type of the main expression computed by STMT. Return
5696 void_type_node if the statement computes nothing. */
5698 static inline tree
5699 gimple_expr_type (const_gimple stmt)
5701 enum gimple_code code = gimple_code (stmt);
5703 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5705 tree type;
5706 /* In general we want to pass out a type that can be substituted
5707 for both the RHS and the LHS types if there is a possibly
5708 useless conversion involved. That means returning the
5709 original RHS type as far as we can reconstruct it. */
5710 if (code == GIMPLE_CALL)
5712 const gcall *call_stmt = as_a <const gcall *> (stmt);
5713 if (gimple_call_internal_p (call_stmt)
5714 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
5715 type = TREE_TYPE (gimple_call_arg (call_stmt, 3));
5716 else
5717 type = gimple_call_return_type (call_stmt);
5719 else
5720 switch (gimple_assign_rhs_code (stmt))
5722 case POINTER_PLUS_EXPR:
5723 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5724 break;
5726 default:
5727 /* As fallback use the type of the LHS. */
5728 type = TREE_TYPE (gimple_get_lhs (stmt));
5729 break;
5731 return type;
5733 else if (code == GIMPLE_COND)
5734 return boolean_type_node;
5735 else
5736 return void_type_node;
5739 /* Enum and arrays used for allocation stats. Keep in sync with
5740 gimple.c:gimple_alloc_kind_names. */
5741 enum gimple_alloc_kind
5743 gimple_alloc_kind_assign, /* Assignments. */
5744 gimple_alloc_kind_phi, /* PHI nodes. */
5745 gimple_alloc_kind_cond, /* Conditionals. */
5746 gimple_alloc_kind_rest, /* Everything else. */
5747 gimple_alloc_kind_all
5750 extern int gimple_alloc_counts[];
5751 extern int gimple_alloc_sizes[];
5753 /* Return the allocation kind for a given stmt CODE. */
5754 static inline enum gimple_alloc_kind
5755 gimple_alloc_kind (enum gimple_code code)
5757 switch (code)
5759 case GIMPLE_ASSIGN:
5760 return gimple_alloc_kind_assign;
5761 case GIMPLE_PHI:
5762 return gimple_alloc_kind_phi;
5763 case GIMPLE_COND:
5764 return gimple_alloc_kind_cond;
5765 default:
5766 return gimple_alloc_kind_rest;
5770 /* Return true if a location should not be emitted for this statement
5771 by annotate_all_with_location. */
5773 static inline bool
5774 gimple_do_not_emit_location_p (gimple g)
5776 return gimple_plf (g, GF_PLF_1);
5779 /* Mark statement G so a location will not be emitted by
5780 annotate_one_with_location. */
5782 static inline void
5783 gimple_set_do_not_emit_location (gimple g)
5785 /* The PLF flags are initialized to 0 when a new tuple is created,
5786 so no need to initialize it anywhere. */
5787 gimple_set_plf (g, GF_PLF_1, true);
5791 /* Macros for showing usage statistics. */
5792 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5793 ? (x) \
5794 : ((x) < 1024*1024*10 \
5795 ? (x) / 1024 \
5796 : (x) / (1024*1024))))
5798 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5800 #endif /* GCC_GIMPLE_H */