libgomp: Use pthread mutexes in the nvptx plugin.
[official-gcc.git] / gcc / gimple.h
blob769bad01181253ec794da89100c428db45c1a19a
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2015 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 = (1 << 3) - 1,
93 GF_OMP_FOR_KIND_FOR = 0,
94 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
95 GF_OMP_FOR_KIND_CILKFOR = 2,
96 GF_OMP_FOR_KIND_OACC_LOOP = 3,
97 /* Flag for SIMD variants of OMP_FOR kinds. */
98 GF_OMP_FOR_SIMD = 1 << 2,
99 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
100 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
101 GF_OMP_FOR_COMBINED = 1 << 3,
102 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
103 GF_OMP_TARGET_KIND_MASK = (1 << 3) - 1,
104 GF_OMP_TARGET_KIND_REGION = 0,
105 GF_OMP_TARGET_KIND_DATA = 1,
106 GF_OMP_TARGET_KIND_UPDATE = 2,
107 GF_OMP_TARGET_KIND_OACC_PARALLEL = 3,
108 GF_OMP_TARGET_KIND_OACC_KERNELS = 4,
109 GF_OMP_TARGET_KIND_OACC_DATA = 5,
110 GF_OMP_TARGET_KIND_OACC_UPDATE = 6,
111 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 7,
113 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
114 a thread synchronization via some sort of barrier. The exact barrier
115 that would otherwise be emitted is dependent on the OMP statement with
116 which this return is associated. */
117 GF_OMP_RETURN_NOWAIT = 1 << 0,
119 GF_OMP_SECTION_LAST = 1 << 0,
120 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
121 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
122 GF_PREDICT_TAKEN = 1 << 15
125 /* Currently, there are only two types of gimple debug stmt. Others are
126 envisioned, for example, to enable the generation of is_stmt notes
127 in line number information, to mark sequence points, etc. This
128 subcode is to be used to tell them apart. */
129 enum gimple_debug_subcode {
130 GIMPLE_DEBUG_BIND = 0,
131 GIMPLE_DEBUG_SOURCE_BIND = 1
134 /* Masks for selecting a pass local flag (PLF) to work on. These
135 masks are used by gimple_set_plf and gimple_plf. */
136 enum plf_mask {
137 GF_PLF_1 = 1 << 0,
138 GF_PLF_2 = 1 << 1
141 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
142 are for 64 bit hosts. */
144 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
145 chain_next ("%h.next"), variable_size))
146 gimple_statement_base
148 /* [ WORD 1 ]
149 Main identifying code for a tuple. */
150 ENUM_BITFIELD(gimple_code) code : 8;
152 /* Nonzero if a warning should not be emitted on this tuple. */
153 unsigned int no_warning : 1;
155 /* Nonzero if this tuple has been visited. Passes are responsible
156 for clearing this bit before using it. */
157 unsigned int visited : 1;
159 /* Nonzero if this tuple represents a non-temporal move. */
160 unsigned int nontemporal_move : 1;
162 /* Pass local flags. These flags are free for any pass to use as
163 they see fit. Passes should not assume that these flags contain
164 any useful value when the pass starts. Any initial state that
165 the pass requires should be set on entry to the pass. See
166 gimple_set_plf and gimple_plf for usage. */
167 unsigned int plf : 2;
169 /* Nonzero if this statement has been modified and needs to have its
170 operands rescanned. */
171 unsigned modified : 1;
173 /* Nonzero if this statement contains volatile operands. */
174 unsigned has_volatile_ops : 1;
176 /* Padding to get subcode to 16 bit alignment. */
177 unsigned pad : 1;
179 /* The SUBCODE field can be used for tuple-specific flags for tuples
180 that do not require subcodes. Note that SUBCODE should be at
181 least as wide as tree codes, as several tuples store tree codes
182 in there. */
183 unsigned int subcode : 16;
185 /* UID of this statement. This is used by passes that want to
186 assign IDs to statements. It must be assigned and used by each
187 pass. By default it should be assumed to contain garbage. */
188 unsigned uid;
190 /* [ WORD 2 ]
191 Locus information for debug info. */
192 location_t location;
194 /* Number of operands in this tuple. */
195 unsigned num_ops;
197 /* [ WORD 3 ]
198 Basic block holding this statement. */
199 basic_block bb;
201 /* [ WORD 4-5 ]
202 Linked lists of gimple statements. The next pointers form
203 a NULL terminated list, the prev pointers are a cyclic list.
204 A gimple statement is hence also a double-ended list of
205 statements, with the pointer itself being the first element,
206 and the prev pointer being the last. */
207 gimple next;
208 gimple GTY((skip)) prev;
212 /* Base structure for tuples with operands. */
214 /* This gimple subclass has no tag value. */
215 struct GTY(())
216 gimple_statement_with_ops_base : public gimple_statement_base
218 /* [ WORD 1-6 ] : base class */
220 /* [ WORD 7 ]
221 SSA operand vectors. NOTE: It should be possible to
222 amalgamate these vectors with the operand vector OP. However,
223 the SSA operand vectors are organized differently and contain
224 more information (like immediate use chaining). */
225 struct use_optype_d GTY((skip (""))) *use_ops;
229 /* Statements that take register operands. */
231 struct GTY((tag("GSS_WITH_OPS")))
232 gimple_statement_with_ops : public gimple_statement_with_ops_base
234 /* [ WORD 1-7 ] : base class */
236 /* [ WORD 8 ]
237 Operand vector. NOTE! This must always be the last field
238 of this structure. In particular, this means that this
239 structure cannot be embedded inside another one. */
240 tree GTY((length ("%h.num_ops"))) op[1];
244 /* Base for statements that take both memory and register operands. */
246 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
247 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
249 /* [ WORD 1-7 ] : base class */
251 /* [ WORD 8-9 ]
252 Virtual operands for this statement. The GC will pick them
253 up via the ssa_names array. */
254 tree GTY((skip (""))) vdef;
255 tree GTY((skip (""))) vuse;
259 /* Statements that take both memory and register operands. */
261 struct GTY((tag("GSS_WITH_MEM_OPS")))
262 gimple_statement_with_memory_ops :
263 public gimple_statement_with_memory_ops_base
265 /* [ WORD 1-9 ] : base class */
267 /* [ WORD 10 ]
268 Operand vector. NOTE! This must always be the last field
269 of this structure. In particular, this means that this
270 structure cannot be embedded inside another one. */
271 tree GTY((length ("%h.num_ops"))) op[1];
275 /* Call statements that take both memory and register operands. */
277 struct GTY((tag("GSS_CALL")))
278 gcall : public gimple_statement_with_memory_ops_base
280 /* [ WORD 1-9 ] : base class */
282 /* [ WORD 10-13 ] */
283 struct pt_solution call_used;
284 struct pt_solution call_clobbered;
286 /* [ WORD 14 ] */
287 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
288 tree GTY ((tag ("0"))) fntype;
289 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
290 } u;
292 /* [ WORD 15 ]
293 Operand vector. NOTE! This must always be the last field
294 of this structure. In particular, this means that this
295 structure cannot be embedded inside another one. */
296 tree GTY((length ("%h.num_ops"))) op[1];
300 /* OMP statements. */
302 struct GTY((tag("GSS_OMP")))
303 gimple_statement_omp : public gimple_statement_base
305 /* [ WORD 1-6 ] : base class */
307 /* [ WORD 7 ] */
308 gimple_seq body;
312 /* GIMPLE_BIND */
314 struct GTY((tag("GSS_BIND")))
315 gbind : public gimple_statement_base
317 /* [ WORD 1-6 ] : base class */
319 /* [ WORD 7 ]
320 Variables declared in this scope. */
321 tree vars;
323 /* [ WORD 8 ]
324 This is different than the BLOCK field in gimple_statement_base,
325 which is analogous to TREE_BLOCK (i.e., the lexical block holding
326 this statement). This field is the equivalent of BIND_EXPR_BLOCK
327 in tree land (i.e., the lexical scope defined by this bind). See
328 gimple-low.c. */
329 tree block;
331 /* [ WORD 9 ] */
332 gimple_seq body;
336 /* GIMPLE_CATCH */
338 struct GTY((tag("GSS_CATCH")))
339 gcatch : public gimple_statement_base
341 /* [ WORD 1-6 ] : base class */
343 /* [ WORD 7 ] */
344 tree types;
346 /* [ WORD 8 ] */
347 gimple_seq handler;
351 /* GIMPLE_EH_FILTER */
353 struct GTY((tag("GSS_EH_FILTER")))
354 geh_filter : public gimple_statement_base
356 /* [ WORD 1-6 ] : base class */
358 /* [ WORD 7 ]
359 Filter types. */
360 tree types;
362 /* [ WORD 8 ]
363 Failure actions. */
364 gimple_seq failure;
367 /* GIMPLE_EH_ELSE */
369 struct GTY((tag("GSS_EH_ELSE")))
370 geh_else : public gimple_statement_base
372 /* [ WORD 1-6 ] : base class */
374 /* [ WORD 7,8 ] */
375 gimple_seq n_body, e_body;
378 /* GIMPLE_EH_MUST_NOT_THROW */
380 struct GTY((tag("GSS_EH_MNT")))
381 geh_mnt : public gimple_statement_base
383 /* [ WORD 1-6 ] : base class */
385 /* [ WORD 7 ] Abort function decl. */
386 tree fndecl;
389 /* GIMPLE_PHI */
391 struct GTY((tag("GSS_PHI")))
392 gphi : public gimple_statement_base
394 /* [ WORD 1-6 ] : base class */
396 /* [ WORD 7 ] */
397 unsigned capacity;
398 unsigned nargs;
400 /* [ WORD 8 ] */
401 tree result;
403 /* [ WORD 9 ] */
404 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
408 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
410 struct GTY((tag("GSS_EH_CTRL")))
411 gimple_statement_eh_ctrl : public gimple_statement_base
413 /* [ WORD 1-6 ] : base class */
415 /* [ WORD 7 ]
416 Exception region number. */
417 int region;
420 struct GTY((tag("GSS_EH_CTRL")))
421 gresx : public gimple_statement_eh_ctrl
423 /* No extra fields; adds invariant:
424 stmt->code == GIMPLE_RESX. */
427 struct GTY((tag("GSS_EH_CTRL")))
428 geh_dispatch : public gimple_statement_eh_ctrl
430 /* No extra fields; adds invariant:
431 stmt->code == GIMPLE_EH_DISPATH. */
435 /* GIMPLE_TRY */
437 struct GTY((tag("GSS_TRY")))
438 gtry : public gimple_statement_base
440 /* [ WORD 1-6 ] : base class */
442 /* [ WORD 7 ]
443 Expression to evaluate. */
444 gimple_seq eval;
446 /* [ WORD 8 ]
447 Cleanup expression. */
448 gimple_seq cleanup;
451 /* Kind of GIMPLE_TRY statements. */
452 enum gimple_try_flags
454 /* A try/catch. */
455 GIMPLE_TRY_CATCH = 1 << 0,
457 /* A try/finally. */
458 GIMPLE_TRY_FINALLY = 1 << 1,
459 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
461 /* Analogous to TRY_CATCH_IS_CLEANUP. */
462 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
465 /* GIMPLE_WITH_CLEANUP_EXPR */
467 struct GTY((tag("GSS_WCE")))
468 gimple_statement_wce : public gimple_statement_base
470 /* [ WORD 1-6 ] : base class */
472 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
473 executed if an exception is thrown, not on normal exit of its
474 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
475 in TARGET_EXPRs. */
477 /* [ WORD 7 ]
478 Cleanup expression. */
479 gimple_seq cleanup;
483 /* GIMPLE_ASM */
485 struct GTY((tag("GSS_ASM")))
486 gasm : public gimple_statement_with_memory_ops_base
488 /* [ WORD 1-9 ] : base class */
490 /* [ WORD 10 ]
491 __asm__ statement. */
492 const char *string;
494 /* [ WORD 11 ]
495 Number of inputs, outputs, clobbers, labels. */
496 unsigned char ni;
497 unsigned char no;
498 unsigned char nc;
499 unsigned char nl;
501 /* [ WORD 12 ]
502 Operand vector. NOTE! This must always be the last field
503 of this structure. In particular, this means that this
504 structure cannot be embedded inside another one. */
505 tree GTY((length ("%h.num_ops"))) op[1];
508 /* GIMPLE_OMP_CRITICAL */
510 struct GTY((tag("GSS_OMP_CRITICAL")))
511 gomp_critical : public gimple_statement_omp
513 /* [ WORD 1-7 ] : base class */
515 /* [ WORD 8 ]
516 Critical section name. */
517 tree name;
521 struct GTY(()) gimple_omp_for_iter {
522 /* Condition code. */
523 enum tree_code cond;
525 /* Index variable. */
526 tree index;
528 /* Initial value. */
529 tree initial;
531 /* Final value. */
532 tree final;
534 /* Increment. */
535 tree incr;
538 /* GIMPLE_OMP_FOR */
540 struct GTY((tag("GSS_OMP_FOR")))
541 gomp_for : public gimple_statement_omp
543 /* [ WORD 1-7 ] : base class */
545 /* [ WORD 8 ] */
546 tree clauses;
548 /* [ WORD 9 ]
549 Number of elements in iter array. */
550 size_t collapse;
552 /* [ WORD 10 ] */
553 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
555 /* [ WORD 11 ]
556 Pre-body evaluated before the loop body begins. */
557 gimple_seq pre_body;
561 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
563 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
564 gimple_statement_omp_parallel_layout : public gimple_statement_omp
566 /* [ WORD 1-7 ] : base class */
568 /* [ WORD 8 ]
569 Clauses. */
570 tree clauses;
572 /* [ WORD 9 ]
573 Child function holding the body of the parallel region. */
574 tree child_fn;
576 /* [ WORD 10 ]
577 Shared data argument. */
578 tree data_arg;
581 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
582 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
583 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
585 /* No extra fields; adds invariant:
586 stmt->code == GIMPLE_OMP_PARALLEL
587 || stmt->code == GIMPLE_OMP_TASK. */
590 /* GIMPLE_OMP_PARALLEL */
591 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
592 gomp_parallel : public gimple_statement_omp_taskreg
594 /* No extra fields; adds invariant:
595 stmt->code == GIMPLE_OMP_PARALLEL. */
598 /* GIMPLE_OMP_TARGET */
599 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
600 gomp_target : public gimple_statement_omp_parallel_layout
602 /* No extra fields; adds invariant:
603 stmt->code == GIMPLE_OMP_TARGET. */
606 /* GIMPLE_OMP_TASK */
608 struct GTY((tag("GSS_OMP_TASK")))
609 gomp_task : public gimple_statement_omp_taskreg
611 /* [ WORD 1-10 ] : base class */
613 /* [ WORD 11 ]
614 Child function holding firstprivate initialization if needed. */
615 tree copy_fn;
617 /* [ WORD 12-13 ]
618 Size and alignment in bytes of the argument data block. */
619 tree arg_size;
620 tree arg_align;
624 /* GIMPLE_OMP_SECTION */
625 /* Uses struct gimple_statement_omp. */
628 /* GIMPLE_OMP_SECTIONS */
630 struct GTY((tag("GSS_OMP_SECTIONS")))
631 gomp_sections : public gimple_statement_omp
633 /* [ WORD 1-7 ] : base class */
635 /* [ WORD 8 ] */
636 tree clauses;
638 /* [ WORD 9 ]
639 The control variable used for deciding which of the sections to
640 execute. */
641 tree control;
644 /* GIMPLE_OMP_CONTINUE.
646 Note: This does not inherit from gimple_statement_omp, because we
647 do not need the body field. */
649 struct GTY((tag("GSS_OMP_CONTINUE")))
650 gomp_continue : public gimple_statement_base
652 /* [ WORD 1-6 ] : base class */
654 /* [ WORD 7 ] */
655 tree control_def;
657 /* [ WORD 8 ] */
658 tree control_use;
661 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
663 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
664 gimple_statement_omp_single_layout : public gimple_statement_omp
666 /* [ WORD 1-7 ] : base class */
668 /* [ WORD 7 ] */
669 tree clauses;
672 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
673 gomp_single : public gimple_statement_omp_single_layout
675 /* No extra fields; adds invariant:
676 stmt->code == GIMPLE_OMP_SINGLE. */
679 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
680 gomp_teams : public gimple_statement_omp_single_layout
682 /* No extra fields; adds invariant:
683 stmt->code == GIMPLE_OMP_TEAMS. */
687 /* GIMPLE_OMP_ATOMIC_LOAD.
688 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
689 contains a sequence, which we don't need here. */
691 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
692 gomp_atomic_load : public gimple_statement_base
694 /* [ WORD 1-6 ] : base class */
696 /* [ WORD 7-8 ] */
697 tree rhs, lhs;
700 /* GIMPLE_OMP_ATOMIC_STORE.
701 See note on GIMPLE_OMP_ATOMIC_LOAD. */
703 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
704 gimple_statement_omp_atomic_store_layout : public gimple_statement_base
706 /* [ WORD 1-6 ] : base class */
708 /* [ WORD 7 ] */
709 tree val;
712 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
713 gomp_atomic_store :
714 public gimple_statement_omp_atomic_store_layout
716 /* No extra fields; adds invariant:
717 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
720 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
721 gimple_statement_omp_return :
722 public gimple_statement_omp_atomic_store_layout
724 /* No extra fields; adds invariant:
725 stmt->code == GIMPLE_OMP_RETURN. */
728 /* GIMPLE_TRANSACTION. */
730 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
732 /* The __transaction_atomic was declared [[outer]] or it is
733 __transaction_relaxed. */
734 #define GTMA_IS_OUTER (1u << 0)
735 #define GTMA_IS_RELAXED (1u << 1)
736 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
738 /* The transaction is seen to not have an abort. */
739 #define GTMA_HAVE_ABORT (1u << 2)
740 /* The transaction is seen to have loads or stores. */
741 #define GTMA_HAVE_LOAD (1u << 3)
742 #define GTMA_HAVE_STORE (1u << 4)
743 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
744 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
745 /* The transaction WILL enter serial irrevocable mode.
746 An irrevocable block post-dominates the entire transaction, such
747 that all invocations of the transaction will go serial-irrevocable.
748 In such case, we don't bother instrumenting the transaction, and
749 tell the runtime that it should begin the transaction in
750 serial-irrevocable mode. */
751 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
752 /* The transaction contains no instrumentation code whatsover, most
753 likely because it is guaranteed to go irrevocable upon entry. */
754 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
756 struct GTY((tag("GSS_TRANSACTION")))
757 gtransaction : public gimple_statement_with_memory_ops_base
759 /* [ WORD 1-9 ] : base class */
761 /* [ WORD 10 ] */
762 gimple_seq body;
764 /* [ WORD 11 ] */
765 tree label;
768 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
769 enum gimple_statement_structure_enum {
770 #include "gsstruct.def"
771 LAST_GSS_ENUM
773 #undef DEFGSSTRUCT
775 /* A statement with the invariant that
776 stmt->code == GIMPLE_COND
777 i.e. a conditional jump statement. */
779 struct GTY((tag("GSS_WITH_OPS")))
780 gcond : public gimple_statement_with_ops
782 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
785 /* A statement with the invariant that
786 stmt->code == GIMPLE_DEBUG
787 i.e. a debug statement. */
789 struct GTY((tag("GSS_WITH_OPS")))
790 gdebug : public gimple_statement_with_ops
792 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
795 /* A statement with the invariant that
796 stmt->code == GIMPLE_GOTO
797 i.e. a goto statement. */
799 struct GTY((tag("GSS_WITH_OPS")))
800 ggoto : public gimple_statement_with_ops
802 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
805 /* A statement with the invariant that
806 stmt->code == GIMPLE_LABEL
807 i.e. a label statement. */
809 struct GTY((tag("GSS_WITH_OPS")))
810 glabel : public gimple_statement_with_ops
812 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
815 /* A statement with the invariant that
816 stmt->code == GIMPLE_SWITCH
817 i.e. a switch statement. */
819 struct GTY((tag("GSS_WITH_OPS")))
820 gswitch : public gimple_statement_with_ops
822 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
825 /* A statement with the invariant that
826 stmt->code == GIMPLE_ASSIGN
827 i.e. an assignment statement. */
829 struct GTY((tag("GSS_WITH_MEM_OPS")))
830 gassign : public gimple_statement_with_memory_ops
832 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
835 /* A statement with the invariant that
836 stmt->code == GIMPLE_RETURN
837 i.e. a return statement. */
839 struct GTY((tag("GSS_WITH_MEM_OPS")))
840 greturn : public gimple_statement_with_memory_ops
842 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
845 template <>
846 template <>
847 inline bool
848 is_a_helper <gasm *>::test (gimple gs)
850 return gs->code == GIMPLE_ASM;
853 template <>
854 template <>
855 inline bool
856 is_a_helper <gassign *>::test (gimple gs)
858 return gs->code == GIMPLE_ASSIGN;
861 template <>
862 template <>
863 inline bool
864 is_a_helper <gbind *>::test (gimple gs)
866 return gs->code == GIMPLE_BIND;
869 template <>
870 template <>
871 inline bool
872 is_a_helper <gcall *>::test (gimple gs)
874 return gs->code == GIMPLE_CALL;
877 template <>
878 template <>
879 inline bool
880 is_a_helper <gcatch *>::test (gimple gs)
882 return gs->code == GIMPLE_CATCH;
885 template <>
886 template <>
887 inline bool
888 is_a_helper <gcond *>::test (gimple gs)
890 return gs->code == GIMPLE_COND;
893 template <>
894 template <>
895 inline bool
896 is_a_helper <gdebug *>::test (gimple gs)
898 return gs->code == GIMPLE_DEBUG;
901 template <>
902 template <>
903 inline bool
904 is_a_helper <ggoto *>::test (gimple gs)
906 return gs->code == GIMPLE_GOTO;
909 template <>
910 template <>
911 inline bool
912 is_a_helper <glabel *>::test (gimple gs)
914 return gs->code == GIMPLE_LABEL;
917 template <>
918 template <>
919 inline bool
920 is_a_helper <gresx *>::test (gimple gs)
922 return gs->code == GIMPLE_RESX;
925 template <>
926 template <>
927 inline bool
928 is_a_helper <geh_dispatch *>::test (gimple gs)
930 return gs->code == GIMPLE_EH_DISPATCH;
933 template <>
934 template <>
935 inline bool
936 is_a_helper <geh_else *>::test (gimple gs)
938 return gs->code == GIMPLE_EH_ELSE;
941 template <>
942 template <>
943 inline bool
944 is_a_helper <geh_filter *>::test (gimple gs)
946 return gs->code == GIMPLE_EH_FILTER;
949 template <>
950 template <>
951 inline bool
952 is_a_helper <geh_mnt *>::test (gimple gs)
954 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
957 template <>
958 template <>
959 inline bool
960 is_a_helper <gomp_atomic_load *>::test (gimple gs)
962 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
965 template <>
966 template <>
967 inline bool
968 is_a_helper <gomp_atomic_store *>::test (gimple gs)
970 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
973 template <>
974 template <>
975 inline bool
976 is_a_helper <gimple_statement_omp_return *>::test (gimple gs)
978 return gs->code == GIMPLE_OMP_RETURN;
981 template <>
982 template <>
983 inline bool
984 is_a_helper <gomp_continue *>::test (gimple gs)
986 return gs->code == GIMPLE_OMP_CONTINUE;
989 template <>
990 template <>
991 inline bool
992 is_a_helper <gomp_critical *>::test (gimple gs)
994 return gs->code == GIMPLE_OMP_CRITICAL;
997 template <>
998 template <>
999 inline bool
1000 is_a_helper <gomp_for *>::test (gimple gs)
1002 return gs->code == GIMPLE_OMP_FOR;
1005 template <>
1006 template <>
1007 inline bool
1008 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple gs)
1010 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1013 template <>
1014 template <>
1015 inline bool
1016 is_a_helper <gomp_parallel *>::test (gimple gs)
1018 return gs->code == GIMPLE_OMP_PARALLEL;
1021 template <>
1022 template <>
1023 inline bool
1024 is_a_helper <gomp_target *>::test (gimple gs)
1026 return gs->code == GIMPLE_OMP_TARGET;
1029 template <>
1030 template <>
1031 inline bool
1032 is_a_helper <gomp_sections *>::test (gimple gs)
1034 return gs->code == GIMPLE_OMP_SECTIONS;
1037 template <>
1038 template <>
1039 inline bool
1040 is_a_helper <gomp_single *>::test (gimple gs)
1042 return gs->code == GIMPLE_OMP_SINGLE;
1045 template <>
1046 template <>
1047 inline bool
1048 is_a_helper <gomp_teams *>::test (gimple gs)
1050 return gs->code == GIMPLE_OMP_TEAMS;
1053 template <>
1054 template <>
1055 inline bool
1056 is_a_helper <gomp_task *>::test (gimple gs)
1058 return gs->code == GIMPLE_OMP_TASK;
1061 template <>
1062 template <>
1063 inline bool
1064 is_a_helper <gphi *>::test (gimple gs)
1066 return gs->code == GIMPLE_PHI;
1069 template <>
1070 template <>
1071 inline bool
1072 is_a_helper <greturn *>::test (gimple gs)
1074 return gs->code == GIMPLE_RETURN;
1077 template <>
1078 template <>
1079 inline bool
1080 is_a_helper <gswitch *>::test (gimple gs)
1082 return gs->code == GIMPLE_SWITCH;
1085 template <>
1086 template <>
1087 inline bool
1088 is_a_helper <gtransaction *>::test (gimple gs)
1090 return gs->code == GIMPLE_TRANSACTION;
1093 template <>
1094 template <>
1095 inline bool
1096 is_a_helper <gtry *>::test (gimple gs)
1098 return gs->code == GIMPLE_TRY;
1101 template <>
1102 template <>
1103 inline bool
1104 is_a_helper <gimple_statement_wce *>::test (gimple gs)
1106 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1109 template <>
1110 template <>
1111 inline bool
1112 is_a_helper <const gasm *>::test (const_gimple gs)
1114 return gs->code == GIMPLE_ASM;
1117 template <>
1118 template <>
1119 inline bool
1120 is_a_helper <const gbind *>::test (const_gimple gs)
1122 return gs->code == GIMPLE_BIND;
1125 template <>
1126 template <>
1127 inline bool
1128 is_a_helper <const gcall *>::test (const_gimple gs)
1130 return gs->code == GIMPLE_CALL;
1133 template <>
1134 template <>
1135 inline bool
1136 is_a_helper <const gcatch *>::test (const_gimple gs)
1138 return gs->code == GIMPLE_CATCH;
1141 template <>
1142 template <>
1143 inline bool
1144 is_a_helper <const gresx *>::test (const_gimple gs)
1146 return gs->code == GIMPLE_RESX;
1149 template <>
1150 template <>
1151 inline bool
1152 is_a_helper <const geh_dispatch *>::test (const_gimple gs)
1154 return gs->code == GIMPLE_EH_DISPATCH;
1157 template <>
1158 template <>
1159 inline bool
1160 is_a_helper <const geh_filter *>::test (const_gimple gs)
1162 return gs->code == GIMPLE_EH_FILTER;
1165 template <>
1166 template <>
1167 inline bool
1168 is_a_helper <const gomp_atomic_load *>::test (const_gimple gs)
1170 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1173 template <>
1174 template <>
1175 inline bool
1176 is_a_helper <const gomp_atomic_store *>::test (const_gimple gs)
1178 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1181 template <>
1182 template <>
1183 inline bool
1184 is_a_helper <const gimple_statement_omp_return *>::test (const_gimple gs)
1186 return gs->code == GIMPLE_OMP_RETURN;
1189 template <>
1190 template <>
1191 inline bool
1192 is_a_helper <const gomp_continue *>::test (const_gimple gs)
1194 return gs->code == GIMPLE_OMP_CONTINUE;
1197 template <>
1198 template <>
1199 inline bool
1200 is_a_helper <const gomp_critical *>::test (const_gimple gs)
1202 return gs->code == GIMPLE_OMP_CRITICAL;
1205 template <>
1206 template <>
1207 inline bool
1208 is_a_helper <const gomp_for *>::test (const_gimple gs)
1210 return gs->code == GIMPLE_OMP_FOR;
1213 template <>
1214 template <>
1215 inline bool
1216 is_a_helper <const gimple_statement_omp_taskreg *>::test (const_gimple gs)
1218 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1221 template <>
1222 template <>
1223 inline bool
1224 is_a_helper <const gomp_parallel *>::test (const_gimple gs)
1226 return gs->code == GIMPLE_OMP_PARALLEL;
1229 template <>
1230 template <>
1231 inline bool
1232 is_a_helper <const gomp_target *>::test (const_gimple gs)
1234 return gs->code == GIMPLE_OMP_TARGET;
1237 template <>
1238 template <>
1239 inline bool
1240 is_a_helper <const gomp_sections *>::test (const_gimple gs)
1242 return gs->code == GIMPLE_OMP_SECTIONS;
1245 template <>
1246 template <>
1247 inline bool
1248 is_a_helper <const gomp_single *>::test (const_gimple gs)
1250 return gs->code == GIMPLE_OMP_SINGLE;
1253 template <>
1254 template <>
1255 inline bool
1256 is_a_helper <const gomp_teams *>::test (const_gimple gs)
1258 return gs->code == GIMPLE_OMP_TEAMS;
1261 template <>
1262 template <>
1263 inline bool
1264 is_a_helper <const gomp_task *>::test (const_gimple gs)
1266 return gs->code == GIMPLE_OMP_TASK;
1269 template <>
1270 template <>
1271 inline bool
1272 is_a_helper <const gphi *>::test (const_gimple gs)
1274 return gs->code == GIMPLE_PHI;
1277 template <>
1278 template <>
1279 inline bool
1280 is_a_helper <const gtransaction *>::test (const_gimple gs)
1282 return gs->code == GIMPLE_TRANSACTION;
1285 /* Offset in bytes to the location of the operand vector.
1286 Zero if there is no operand vector for this tuple structure. */
1287 extern size_t const gimple_ops_offset_[];
1289 /* Map GIMPLE codes to GSS codes. */
1290 extern enum gimple_statement_structure_enum const gss_for_code_[];
1292 /* This variable holds the currently expanded gimple statement for purposes
1293 of comminucating the profile info to the builtin expanders. */
1294 extern gimple currently_expanding_gimple_stmt;
1296 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1297 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1298 greturn *gimple_build_return (tree);
1299 void gimple_call_reset_alias_info (gcall *);
1300 gcall *gimple_build_call_vec (tree, vec<tree> );
1301 gcall *gimple_build_call (tree, unsigned, ...);
1302 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1303 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1304 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1305 gcall *gimple_build_call_from_tree (tree);
1306 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_DECL);
1307 gassign *gimple_build_assign (tree, enum tree_code,
1308 tree, tree, tree CXX_MEM_STAT_INFO);
1309 gassign *gimple_build_assign (tree, enum tree_code,
1310 tree, tree CXX_MEM_STAT_INFO);
1311 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1312 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1313 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1314 void gimple_cond_set_condition_from_tree (gcond *, tree);
1315 glabel *gimple_build_label (tree label);
1316 ggoto *gimple_build_goto (tree dest);
1317 gimple gimple_build_nop (void);
1318 gbind *gimple_build_bind (tree, gimple_seq, tree);
1319 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1320 vec<tree, va_gc> *, vec<tree, va_gc> *,
1321 vec<tree, va_gc> *);
1322 gcatch *gimple_build_catch (tree, gimple_seq);
1323 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1324 geh_mnt *gimple_build_eh_must_not_throw (tree);
1325 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1326 gtry *gimple_build_try (gimple_seq, gimple_seq,
1327 enum gimple_try_flags);
1328 gimple gimple_build_wce (gimple_seq);
1329 gresx *gimple_build_resx (int);
1330 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1331 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1332 geh_dispatch *gimple_build_eh_dispatch (int);
1333 gdebug *gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1334 #define gimple_build_debug_bind(var,val,stmt) \
1335 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1336 gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1337 #define gimple_build_debug_source_bind(var,val,stmt) \
1338 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1339 gomp_critical *gimple_build_omp_critical (gimple_seq, tree);
1340 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1341 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1342 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1343 tree, tree);
1344 gimple gimple_build_omp_section (gimple_seq);
1345 gimple gimple_build_omp_master (gimple_seq);
1346 gimple gimple_build_omp_taskgroup (gimple_seq);
1347 gomp_continue *gimple_build_omp_continue (tree, tree);
1348 gimple gimple_build_omp_ordered (gimple_seq);
1349 gimple gimple_build_omp_return (bool);
1350 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1351 gimple gimple_build_omp_sections_switch (void);
1352 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1353 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1354 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1355 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1356 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1357 gtransaction *gimple_build_transaction (gimple_seq, tree);
1358 gimple gimple_build_predict (enum br_predictor, enum prediction);
1359 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1360 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1361 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1362 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1363 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1364 location_t);
1365 extern void annotate_all_with_location (gimple_seq, location_t);
1366 bool empty_body_p (gimple_seq);
1367 gimple_seq gimple_seq_copy (gimple_seq);
1368 bool gimple_call_same_target_p (const_gimple, const_gimple);
1369 int gimple_call_flags (const_gimple);
1370 int gimple_call_arg_flags (const gcall *, unsigned);
1371 int gimple_call_return_flags (const gcall *);
1372 bool gimple_assign_copy_p (gimple);
1373 bool gimple_assign_ssa_name_copy_p (gimple);
1374 bool gimple_assign_unary_nop_p (gimple);
1375 void gimple_set_bb (gimple, basic_block);
1376 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1377 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1378 tree, tree, tree);
1379 tree gimple_get_lhs (const_gimple);
1380 void gimple_set_lhs (gimple, tree);
1381 gimple gimple_copy (gimple);
1382 bool gimple_has_side_effects (const_gimple);
1383 bool gimple_could_trap_p_1 (gimple, bool, bool);
1384 bool gimple_could_trap_p (gimple);
1385 bool gimple_assign_rhs_could_trap_p (gimple);
1386 extern void dump_gimple_statistics (void);
1387 unsigned get_gimple_rhs_num_ops (enum tree_code);
1388 extern tree canonicalize_cond_expr_cond (tree);
1389 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1390 extern bool gimple_compare_field_offset (tree, tree);
1391 extern tree gimple_unsigned_type (tree);
1392 extern tree gimple_signed_type (tree);
1393 extern alias_set_type gimple_get_alias_set (tree);
1394 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1395 extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
1396 extern bool gimple_call_builtin_p (const_gimple);
1397 extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
1398 extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
1399 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1400 extern void dump_decl_set (FILE *, bitmap);
1401 extern bool nonfreeing_call_p (gimple);
1402 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1403 extern void sort_case_labels (vec<tree>);
1404 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1405 extern void gimple_seq_set_location (gimple_seq, location_t);
1406 extern void gimple_seq_discard (gimple_seq);
1408 /* Formal (expression) temporary table handling: multiple occurrences of
1409 the same scalar expression are evaluated into the same temporary. */
1411 typedef struct gimple_temp_hash_elt
1413 tree val; /* Key */
1414 tree temp; /* Value */
1415 } elt_t;
1417 /* Get the number of the next statement uid to be allocated. */
1418 static inline unsigned int
1419 gimple_stmt_max_uid (struct function *fn)
1421 return fn->last_stmt_uid;
1424 /* Set the number of the next statement uid to be allocated. */
1425 static inline void
1426 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1428 fn->last_stmt_uid = maxid;
1431 /* Set the number of the next statement uid to be allocated. */
1432 static inline unsigned int
1433 inc_gimple_stmt_max_uid (struct function *fn)
1435 return fn->last_stmt_uid++;
1438 /* Return the first node in GIMPLE sequence S. */
1440 static inline gimple_seq_node
1441 gimple_seq_first (gimple_seq s)
1443 return s;
1447 /* Return the first statement in GIMPLE sequence S. */
1449 static inline gimple
1450 gimple_seq_first_stmt (gimple_seq s)
1452 gimple_seq_node n = gimple_seq_first (s);
1453 return n;
1456 /* Return the first statement in GIMPLE sequence S as a gbind *,
1457 verifying that it has code GIMPLE_BIND in a checked build. */
1459 static inline gbind *
1460 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1462 gimple_seq_node n = gimple_seq_first (s);
1463 return as_a <gbind *> (n);
1467 /* Return the last node in GIMPLE sequence S. */
1469 static inline gimple_seq_node
1470 gimple_seq_last (gimple_seq s)
1472 return s ? s->prev : NULL;
1476 /* Return the last statement in GIMPLE sequence S. */
1478 static inline gimple
1479 gimple_seq_last_stmt (gimple_seq s)
1481 gimple_seq_node n = gimple_seq_last (s);
1482 return n;
1486 /* Set the last node in GIMPLE sequence *PS to LAST. */
1488 static inline void
1489 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1491 (*ps)->prev = last;
1495 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1497 static inline void
1498 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1500 *ps = first;
1504 /* Return true if GIMPLE sequence S is empty. */
1506 static inline bool
1507 gimple_seq_empty_p (gimple_seq s)
1509 return s == NULL;
1512 /* Allocate a new sequence and initialize its first element with STMT. */
1514 static inline gimple_seq
1515 gimple_seq_alloc_with_stmt (gimple stmt)
1517 gimple_seq seq = NULL;
1518 gimple_seq_add_stmt (&seq, stmt);
1519 return seq;
1523 /* Returns the sequence of statements in BB. */
1525 static inline gimple_seq
1526 bb_seq (const_basic_block bb)
1528 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1531 static inline gimple_seq *
1532 bb_seq_addr (basic_block bb)
1534 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1537 /* Sets the sequence of statements in BB to SEQ. */
1539 static inline void
1540 set_bb_seq (basic_block bb, gimple_seq seq)
1542 gcc_checking_assert (!(bb->flags & BB_RTL));
1543 bb->il.gimple.seq = seq;
1547 /* Return the code for GIMPLE statement G. */
1549 static inline enum gimple_code
1550 gimple_code (const_gimple g)
1552 return g->code;
1556 /* Return the GSS code used by a GIMPLE code. */
1558 static inline enum gimple_statement_structure_enum
1559 gss_for_code (enum gimple_code code)
1561 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1562 return gss_for_code_[code];
1566 /* Return which GSS code is used by GS. */
1568 static inline enum gimple_statement_structure_enum
1569 gimple_statement_structure (gimple gs)
1571 return gss_for_code (gimple_code (gs));
1575 /* Return true if statement G has sub-statements. This is only true for
1576 High GIMPLE statements. */
1578 static inline bool
1579 gimple_has_substatements (gimple g)
1581 switch (gimple_code (g))
1583 case GIMPLE_BIND:
1584 case GIMPLE_CATCH:
1585 case GIMPLE_EH_FILTER:
1586 case GIMPLE_EH_ELSE:
1587 case GIMPLE_TRY:
1588 case GIMPLE_OMP_FOR:
1589 case GIMPLE_OMP_MASTER:
1590 case GIMPLE_OMP_TASKGROUP:
1591 case GIMPLE_OMP_ORDERED:
1592 case GIMPLE_OMP_SECTION:
1593 case GIMPLE_OMP_PARALLEL:
1594 case GIMPLE_OMP_TASK:
1595 case GIMPLE_OMP_SECTIONS:
1596 case GIMPLE_OMP_SINGLE:
1597 case GIMPLE_OMP_TARGET:
1598 case GIMPLE_OMP_TEAMS:
1599 case GIMPLE_OMP_CRITICAL:
1600 case GIMPLE_WITH_CLEANUP_EXPR:
1601 case GIMPLE_TRANSACTION:
1602 return true;
1604 default:
1605 return false;
1610 /* Return the basic block holding statement G. */
1612 static inline basic_block
1613 gimple_bb (const_gimple g)
1615 return g->bb;
1619 /* Return the lexical scope block holding statement G. */
1621 static inline tree
1622 gimple_block (const_gimple g)
1624 return LOCATION_BLOCK (g->location);
1628 /* Set BLOCK to be the lexical scope block holding statement G. */
1630 static inline void
1631 gimple_set_block (gimple g, tree block)
1633 if (block)
1634 g->location =
1635 COMBINE_LOCATION_DATA (line_table, g->location, block);
1636 else
1637 g->location = LOCATION_LOCUS (g->location);
1641 /* Return location information for statement G. */
1643 static inline location_t
1644 gimple_location (const_gimple g)
1646 return g->location;
1649 /* Return location information for statement G if g is not NULL.
1650 Otherwise, UNKNOWN_LOCATION is returned. */
1652 static inline location_t
1653 gimple_location_safe (const_gimple g)
1655 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1658 /* Return pointer to location information for statement G. */
1660 static inline const location_t *
1661 gimple_location_ptr (const_gimple g)
1663 return &g->location;
1667 /* Set location information for statement G. */
1669 static inline void
1670 gimple_set_location (gimple g, location_t location)
1672 g->location = location;
1676 /* Return true if G contains location information. */
1678 static inline bool
1679 gimple_has_location (const_gimple g)
1681 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1685 /* Return the file name of the location of STMT. */
1687 static inline const char *
1688 gimple_filename (const_gimple stmt)
1690 return LOCATION_FILE (gimple_location (stmt));
1694 /* Return the line number of the location of STMT. */
1696 static inline int
1697 gimple_lineno (const_gimple stmt)
1699 return LOCATION_LINE (gimple_location (stmt));
1703 /* Determine whether SEQ is a singleton. */
1705 static inline bool
1706 gimple_seq_singleton_p (gimple_seq seq)
1708 return ((gimple_seq_first (seq) != NULL)
1709 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1712 /* Return true if no warnings should be emitted for statement STMT. */
1714 static inline bool
1715 gimple_no_warning_p (const_gimple stmt)
1717 return stmt->no_warning;
1720 /* Set the no_warning flag of STMT to NO_WARNING. */
1722 static inline void
1723 gimple_set_no_warning (gimple stmt, bool no_warning)
1725 stmt->no_warning = (unsigned) no_warning;
1728 /* Set the visited status on statement STMT to VISITED_P.
1730 Please note that this 'visited' property of the gimple statement is
1731 supposed to be undefined at pass boundaries. This means that a
1732 given pass should not assume it contains any useful value when the
1733 pass starts and thus can set it to any value it sees fit.
1735 You can learn more about the visited property of the gimple
1736 statement by reading the comments of the 'visited' data member of
1737 struct gimple statement_base.
1740 static inline void
1741 gimple_set_visited (gimple stmt, bool visited_p)
1743 stmt->visited = (unsigned) visited_p;
1747 /* Return the visited status for statement STMT.
1749 Please note that this 'visited' property of the gimple statement is
1750 supposed to be undefined at pass boundaries. This means that a
1751 given pass should not assume it contains any useful value when the
1752 pass starts and thus can set it to any value it sees fit.
1754 You can learn more about the visited property of the gimple
1755 statement by reading the comments of the 'visited' data member of
1756 struct gimple statement_base. */
1758 static inline bool
1759 gimple_visited_p (gimple stmt)
1761 return stmt->visited;
1765 /* Set pass local flag PLF on statement STMT to VAL_P.
1767 Please note that this PLF property of the gimple statement is
1768 supposed to be undefined at pass boundaries. This means that a
1769 given pass should not assume it contains any useful value when the
1770 pass starts and thus can set it to any value it sees fit.
1772 You can learn more about the PLF property by reading the comment of
1773 the 'plf' data member of struct gimple_statement_structure. */
1775 static inline void
1776 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1778 if (val_p)
1779 stmt->plf |= (unsigned int) plf;
1780 else
1781 stmt->plf &= ~((unsigned int) plf);
1785 /* Return the value of pass local flag PLF on statement STMT.
1787 Please note that this 'plf' property of the gimple statement is
1788 supposed to be undefined at pass boundaries. This means that a
1789 given pass should not assume it contains any useful value when the
1790 pass starts and thus can set it to any value it sees fit.
1792 You can learn more about the plf property by reading the comment of
1793 the 'plf' data member of struct gimple_statement_structure. */
1795 static inline unsigned int
1796 gimple_plf (gimple stmt, enum plf_mask plf)
1798 return stmt->plf & ((unsigned int) plf);
1802 /* Set the UID of statement.
1804 Please note that this UID property is supposed to be undefined at
1805 pass boundaries. This means that a given pass should not assume it
1806 contains any useful value when the pass starts and thus can set it
1807 to any value it sees fit. */
1809 static inline void
1810 gimple_set_uid (gimple g, unsigned uid)
1812 g->uid = uid;
1816 /* Return the UID of statement.
1818 Please note that this UID property is supposed to be undefined at
1819 pass boundaries. This means that a given pass should not assume it
1820 contains any useful value when the pass starts and thus can set it
1821 to any value it sees fit. */
1823 static inline unsigned
1824 gimple_uid (const_gimple g)
1826 return g->uid;
1830 /* Make statement G a singleton sequence. */
1832 static inline void
1833 gimple_init_singleton (gimple g)
1835 g->next = NULL;
1836 g->prev = g;
1840 /* Return true if GIMPLE statement G has register or memory operands. */
1842 static inline bool
1843 gimple_has_ops (const_gimple g)
1845 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1848 template <>
1849 template <>
1850 inline bool
1851 is_a_helper <const gimple_statement_with_ops *>::test (const_gimple gs)
1853 return gimple_has_ops (gs);
1856 template <>
1857 template <>
1858 inline bool
1859 is_a_helper <gimple_statement_with_ops *>::test (gimple gs)
1861 return gimple_has_ops (gs);
1864 /* Return true if GIMPLE statement G has memory operands. */
1866 static inline bool
1867 gimple_has_mem_ops (const_gimple g)
1869 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1872 template <>
1873 template <>
1874 inline bool
1875 is_a_helper <const gimple_statement_with_memory_ops *>::test (const_gimple gs)
1877 return gimple_has_mem_ops (gs);
1880 template <>
1881 template <>
1882 inline bool
1883 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple gs)
1885 return gimple_has_mem_ops (gs);
1888 /* Return the set of USE operands for statement G. */
1890 static inline struct use_optype_d *
1891 gimple_use_ops (const_gimple g)
1893 const gimple_statement_with_ops *ops_stmt =
1894 dyn_cast <const gimple_statement_with_ops *> (g);
1895 if (!ops_stmt)
1896 return NULL;
1897 return ops_stmt->use_ops;
1901 /* Set USE to be the set of USE operands for statement G. */
1903 static inline void
1904 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1906 gimple_statement_with_ops *ops_stmt =
1907 as_a <gimple_statement_with_ops *> (g);
1908 ops_stmt->use_ops = use;
1912 /* Return the single VUSE operand of the statement G. */
1914 static inline tree
1915 gimple_vuse (const_gimple g)
1917 const gimple_statement_with_memory_ops *mem_ops_stmt =
1918 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1919 if (!mem_ops_stmt)
1920 return NULL_TREE;
1921 return mem_ops_stmt->vuse;
1924 /* Return the single VDEF operand of the statement G. */
1926 static inline tree
1927 gimple_vdef (const_gimple g)
1929 const gimple_statement_with_memory_ops *mem_ops_stmt =
1930 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1931 if (!mem_ops_stmt)
1932 return NULL_TREE;
1933 return mem_ops_stmt->vdef;
1936 /* Return the single VUSE operand of the statement G. */
1938 static inline tree *
1939 gimple_vuse_ptr (gimple g)
1941 gimple_statement_with_memory_ops *mem_ops_stmt =
1942 dyn_cast <gimple_statement_with_memory_ops *> (g);
1943 if (!mem_ops_stmt)
1944 return NULL;
1945 return &mem_ops_stmt->vuse;
1948 /* Return the single VDEF operand of the statement G. */
1950 static inline tree *
1951 gimple_vdef_ptr (gimple g)
1953 gimple_statement_with_memory_ops *mem_ops_stmt =
1954 dyn_cast <gimple_statement_with_memory_ops *> (g);
1955 if (!mem_ops_stmt)
1956 return NULL;
1957 return &mem_ops_stmt->vdef;
1960 /* Set the single VUSE operand of the statement G. */
1962 static inline void
1963 gimple_set_vuse (gimple g, tree vuse)
1965 gimple_statement_with_memory_ops *mem_ops_stmt =
1966 as_a <gimple_statement_with_memory_ops *> (g);
1967 mem_ops_stmt->vuse = vuse;
1970 /* Set the single VDEF operand of the statement G. */
1972 static inline void
1973 gimple_set_vdef (gimple g, tree vdef)
1975 gimple_statement_with_memory_ops *mem_ops_stmt =
1976 as_a <gimple_statement_with_memory_ops *> (g);
1977 mem_ops_stmt->vdef = vdef;
1981 /* Return true if statement G has operands and the modified field has
1982 been set. */
1984 static inline bool
1985 gimple_modified_p (const_gimple g)
1987 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1991 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1992 a MODIFIED field. */
1994 static inline void
1995 gimple_set_modified (gimple s, bool modifiedp)
1997 if (gimple_has_ops (s))
1998 s->modified = (unsigned) modifiedp;
2002 /* Return the tree code for the expression computed by STMT. This is
2003 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2004 GIMPLE_CALL, return CALL_EXPR as the expression code for
2005 consistency. This is useful when the caller needs to deal with the
2006 three kinds of computation that GIMPLE supports. */
2008 static inline enum tree_code
2009 gimple_expr_code (const_gimple stmt)
2011 enum gimple_code code = gimple_code (stmt);
2012 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2013 return (enum tree_code) stmt->subcode;
2014 else
2016 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2017 return CALL_EXPR;
2022 /* Return true if statement STMT contains volatile operands. */
2024 static inline bool
2025 gimple_has_volatile_ops (const_gimple stmt)
2027 if (gimple_has_mem_ops (stmt))
2028 return stmt->has_volatile_ops;
2029 else
2030 return false;
2034 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2036 static inline void
2037 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
2039 if (gimple_has_mem_ops (stmt))
2040 stmt->has_volatile_ops = (unsigned) volatilep;
2043 /* Return true if STMT is in a transaction. */
2045 static inline bool
2046 gimple_in_transaction (gimple stmt)
2048 return bb_in_transaction (gimple_bb (stmt));
2051 /* Return true if statement STMT may access memory. */
2053 static inline bool
2054 gimple_references_memory_p (gimple stmt)
2056 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2060 /* Return the subcode for OMP statement S. */
2062 static inline unsigned
2063 gimple_omp_subcode (const_gimple s)
2065 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2066 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2067 return s->subcode;
2070 /* Set the subcode for OMP statement S to SUBCODE. */
2072 static inline void
2073 gimple_omp_set_subcode (gimple s, unsigned int subcode)
2075 /* We only have 16 bits for the subcode. Assert that we are not
2076 overflowing it. */
2077 gcc_gimple_checking_assert (subcode < (1 << 16));
2078 s->subcode = subcode;
2081 /* Set the nowait flag on OMP_RETURN statement S. */
2083 static inline void
2084 gimple_omp_return_set_nowait (gimple s)
2086 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2087 s->subcode |= GF_OMP_RETURN_NOWAIT;
2091 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2092 flag set. */
2094 static inline bool
2095 gimple_omp_return_nowait_p (const_gimple g)
2097 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2098 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2102 /* Set the LHS of OMP return. */
2104 static inline void
2105 gimple_omp_return_set_lhs (gimple g, tree lhs)
2107 gimple_statement_omp_return *omp_return_stmt =
2108 as_a <gimple_statement_omp_return *> (g);
2109 omp_return_stmt->val = lhs;
2113 /* Get the LHS of OMP return. */
2115 static inline tree
2116 gimple_omp_return_lhs (const_gimple g)
2118 const gimple_statement_omp_return *omp_return_stmt =
2119 as_a <const gimple_statement_omp_return *> (g);
2120 return omp_return_stmt->val;
2124 /* Return a pointer to the LHS of OMP return. */
2126 static inline tree *
2127 gimple_omp_return_lhs_ptr (gimple g)
2129 gimple_statement_omp_return *omp_return_stmt =
2130 as_a <gimple_statement_omp_return *> (g);
2131 return &omp_return_stmt->val;
2135 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2136 flag set. */
2138 static inline bool
2139 gimple_omp_section_last_p (const_gimple g)
2141 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2142 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2146 /* Set the GF_OMP_SECTION_LAST flag on G. */
2148 static inline void
2149 gimple_omp_section_set_last (gimple g)
2151 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2152 g->subcode |= GF_OMP_SECTION_LAST;
2156 /* Return true if OMP parallel statement G has the
2157 GF_OMP_PARALLEL_COMBINED flag set. */
2159 static inline bool
2160 gimple_omp_parallel_combined_p (const_gimple g)
2162 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2163 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2167 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2168 value of COMBINED_P. */
2170 static inline void
2171 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
2173 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2174 if (combined_p)
2175 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2176 else
2177 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2181 /* Return true if OMP atomic load/store statement G has the
2182 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2184 static inline bool
2185 gimple_omp_atomic_need_value_p (const_gimple g)
2187 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2188 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2189 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2193 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2195 static inline void
2196 gimple_omp_atomic_set_need_value (gimple g)
2198 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2199 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2200 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2204 /* Return true if OMP atomic load/store statement G has the
2205 GF_OMP_ATOMIC_SEQ_CST flag set. */
2207 static inline bool
2208 gimple_omp_atomic_seq_cst_p (const_gimple g)
2210 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2211 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2212 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2216 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2218 static inline void
2219 gimple_omp_atomic_set_seq_cst (gimple g)
2221 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2222 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2223 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2227 /* Return the number of operands for statement GS. */
2229 static inline unsigned
2230 gimple_num_ops (const_gimple gs)
2232 return gs->num_ops;
2236 /* Set the number of operands for statement GS. */
2238 static inline void
2239 gimple_set_num_ops (gimple gs, unsigned num_ops)
2241 gs->num_ops = num_ops;
2245 /* Return the array of operands for statement GS. */
2247 static inline tree *
2248 gimple_ops (gimple gs)
2250 size_t off;
2252 /* All the tuples have their operand vector at the very bottom
2253 of the structure. Note that those structures that do not
2254 have an operand vector have a zero offset. */
2255 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2256 gcc_gimple_checking_assert (off != 0);
2258 return (tree *) ((char *) gs + off);
2262 /* Return operand I for statement GS. */
2264 static inline tree
2265 gimple_op (const_gimple gs, unsigned i)
2267 if (gimple_has_ops (gs))
2269 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2270 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2272 else
2273 return NULL_TREE;
2276 /* Return a pointer to operand I for statement GS. */
2278 static inline tree *
2279 gimple_op_ptr (const_gimple gs, unsigned i)
2281 if (gimple_has_ops (gs))
2283 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2284 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2286 else
2287 return NULL;
2290 /* Set operand I of statement GS to OP. */
2292 static inline void
2293 gimple_set_op (gimple gs, unsigned i, tree op)
2295 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2297 /* Note. It may be tempting to assert that OP matches
2298 is_gimple_operand, but that would be wrong. Different tuples
2299 accept slightly different sets of tree operands. Each caller
2300 should perform its own validation. */
2301 gimple_ops (gs)[i] = op;
2304 /* Return true if GS is a GIMPLE_ASSIGN. */
2306 static inline bool
2307 is_gimple_assign (const_gimple gs)
2309 return gimple_code (gs) == GIMPLE_ASSIGN;
2312 /* Determine if expression CODE is one of the valid expressions that can
2313 be used on the RHS of GIMPLE assignments. */
2315 static inline enum gimple_rhs_class
2316 get_gimple_rhs_class (enum tree_code code)
2318 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2321 /* Return the LHS of assignment statement GS. */
2323 static inline tree
2324 gimple_assign_lhs (const_gimple gs)
2326 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2327 return gimple_op (gs, 0);
2331 /* Return a pointer to the LHS of assignment statement GS. */
2333 static inline tree *
2334 gimple_assign_lhs_ptr (const_gimple gs)
2336 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2337 return gimple_op_ptr (gs, 0);
2341 /* Set LHS to be the LHS operand of assignment statement GS. */
2343 static inline void
2344 gimple_assign_set_lhs (gimple gs, tree lhs)
2346 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2347 gimple_set_op (gs, 0, lhs);
2349 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2350 SSA_NAME_DEF_STMT (lhs) = gs;
2354 /* Return the first operand on the RHS of assignment statement GS. */
2356 static inline tree
2357 gimple_assign_rhs1 (const_gimple gs)
2359 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2360 return gimple_op (gs, 1);
2364 /* Return a pointer to the first operand on the RHS of assignment
2365 statement GS. */
2367 static inline tree *
2368 gimple_assign_rhs1_ptr (const_gimple gs)
2370 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2371 return gimple_op_ptr (gs, 1);
2374 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2376 static inline void
2377 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2379 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2381 gimple_set_op (gs, 1, rhs);
2385 /* Return the second operand on the RHS of assignment statement GS.
2386 If GS does not have two operands, NULL is returned instead. */
2388 static inline tree
2389 gimple_assign_rhs2 (const_gimple gs)
2391 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2393 if (gimple_num_ops (gs) >= 3)
2394 return gimple_op (gs, 2);
2395 else
2396 return NULL_TREE;
2400 /* Return a pointer to the second operand on the RHS of assignment
2401 statement GS. */
2403 static inline tree *
2404 gimple_assign_rhs2_ptr (const_gimple gs)
2406 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2407 return gimple_op_ptr (gs, 2);
2411 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2413 static inline void
2414 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2416 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2418 gimple_set_op (gs, 2, rhs);
2421 /* Return the third operand on the RHS of assignment statement GS.
2422 If GS does not have two operands, NULL is returned instead. */
2424 static inline tree
2425 gimple_assign_rhs3 (const_gimple gs)
2427 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2429 if (gimple_num_ops (gs) >= 4)
2430 return gimple_op (gs, 3);
2431 else
2432 return NULL_TREE;
2435 /* Return a pointer to the third operand on the RHS of assignment
2436 statement GS. */
2438 static inline tree *
2439 gimple_assign_rhs3_ptr (const_gimple gs)
2441 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2442 return gimple_op_ptr (gs, 3);
2446 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2448 static inline void
2449 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2451 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2453 gimple_set_op (gs, 3, rhs);
2456 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2457 which expect to see only two operands. */
2459 static inline void
2460 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2461 tree op1, tree op2)
2463 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2466 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2467 which expect to see only one operands. */
2469 static inline void
2470 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2471 tree op1)
2473 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2476 /* Returns true if GS is a nontemporal move. */
2478 static inline bool
2479 gimple_assign_nontemporal_move_p (const gassign *gs)
2481 return gs->nontemporal_move;
2484 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2486 static inline void
2487 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2489 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2490 gs->nontemporal_move = nontemporal;
2494 /* Return the code of the expression computed on the rhs of assignment
2495 statement GS. In case that the RHS is a single object, returns the
2496 tree code of the object. */
2498 static inline enum tree_code
2499 gimple_assign_rhs_code (const_gimple gs)
2501 enum tree_code code;
2502 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2504 code = (enum tree_code) gs->subcode;
2505 /* While we initially set subcode to the TREE_CODE of the rhs for
2506 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2507 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2508 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2509 code = TREE_CODE (gimple_assign_rhs1 (gs));
2511 return code;
2515 /* Set CODE to be the code for the expression computed on the RHS of
2516 assignment S. */
2518 static inline void
2519 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2521 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2522 s->subcode = code;
2526 /* Return the gimple rhs class of the code of the expression computed on
2527 the rhs of assignment statement GS.
2528 This will never return GIMPLE_INVALID_RHS. */
2530 static inline enum gimple_rhs_class
2531 gimple_assign_rhs_class (const_gimple gs)
2533 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2536 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2537 there is no operator associated with the assignment itself.
2538 Unlike gimple_assign_copy_p, this predicate returns true for
2539 any RHS operand, including those that perform an operation
2540 and do not have the semantics of a copy, such as COND_EXPR. */
2542 static inline bool
2543 gimple_assign_single_p (const_gimple gs)
2545 return (is_gimple_assign (gs)
2546 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2549 /* Return true if GS performs a store to its lhs. */
2551 static inline bool
2552 gimple_store_p (const_gimple gs)
2554 tree lhs = gimple_get_lhs (gs);
2555 return lhs && !is_gimple_reg (lhs);
2558 /* Return true if GS is an assignment that loads from its rhs1. */
2560 static inline bool
2561 gimple_assign_load_p (const_gimple gs)
2563 tree rhs;
2564 if (!gimple_assign_single_p (gs))
2565 return false;
2566 rhs = gimple_assign_rhs1 (gs);
2567 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2568 return true;
2569 rhs = get_base_address (rhs);
2570 return (DECL_P (rhs)
2571 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2575 /* Return true if S is a type-cast assignment. */
2577 static inline bool
2578 gimple_assign_cast_p (const_gimple s)
2580 if (is_gimple_assign (s))
2582 enum tree_code sc = gimple_assign_rhs_code (s);
2583 return CONVERT_EXPR_CODE_P (sc)
2584 || sc == VIEW_CONVERT_EXPR
2585 || sc == FIX_TRUNC_EXPR;
2588 return false;
2591 /* Return true if S is a clobber statement. */
2593 static inline bool
2594 gimple_clobber_p (const_gimple s)
2596 return gimple_assign_single_p (s)
2597 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2600 /* Return true if GS is a GIMPLE_CALL. */
2602 static inline bool
2603 is_gimple_call (const_gimple gs)
2605 return gimple_code (gs) == GIMPLE_CALL;
2608 /* Return the LHS of call statement GS. */
2610 static inline tree
2611 gimple_call_lhs (const_gimple gs)
2613 GIMPLE_CHECK (gs, GIMPLE_CALL);
2614 return gimple_op (gs, 0);
2618 /* Return a pointer to the LHS of call statement GS. */
2620 static inline tree *
2621 gimple_call_lhs_ptr (const_gimple gs)
2623 GIMPLE_CHECK (gs, GIMPLE_CALL);
2624 return gimple_op_ptr (gs, 0);
2628 /* Set LHS to be the LHS operand of call statement GS. */
2630 static inline void
2631 gimple_call_set_lhs (gimple gs, tree lhs)
2633 GIMPLE_CHECK (gs, GIMPLE_CALL);
2634 gimple_set_op (gs, 0, lhs);
2635 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2636 SSA_NAME_DEF_STMT (lhs) = gs;
2640 /* Return true if call GS calls an internal-only function, as enumerated
2641 by internal_fn. */
2643 static inline bool
2644 gimple_call_internal_p (const_gimple gs)
2646 GIMPLE_CHECK (gs, GIMPLE_CALL);
2647 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2651 /* Return true if call GS is marked as instrumented by
2652 Pointer Bounds Checker. */
2654 static inline bool
2655 gimple_call_with_bounds_p (const_gimple gs)
2657 GIMPLE_CHECK (gs, GIMPLE_CALL);
2658 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2662 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2663 Pointer Bounds Checker. */
2665 static inline void
2666 gimple_call_set_with_bounds (gimple gs, bool with_bounds)
2668 GIMPLE_CHECK (gs, GIMPLE_CALL);
2669 if (with_bounds)
2670 gs->subcode |= GF_CALL_WITH_BOUNDS;
2671 else
2672 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2676 /* Return the target of internal call GS. */
2678 static inline enum internal_fn
2679 gimple_call_internal_fn (const_gimple gs)
2681 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2682 return static_cast <const gcall *> (gs)->u.internal_fn;
2685 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2686 that could alter control flow. */
2688 static inline void
2689 gimple_call_set_ctrl_altering (gimple s, bool ctrl_altering_p)
2691 GIMPLE_CHECK (s, GIMPLE_CALL);
2692 if (ctrl_altering_p)
2693 s->subcode |= GF_CALL_CTRL_ALTERING;
2694 else
2695 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2698 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2699 flag is set. Such call could not be a stmt in the middle of a bb. */
2701 static inline bool
2702 gimple_call_ctrl_altering_p (const_gimple gs)
2704 GIMPLE_CHECK (gs, GIMPLE_CALL);
2705 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2709 /* Return the function type of the function called by GS. */
2711 static inline tree
2712 gimple_call_fntype (const_gimple gs)
2714 const gcall *call_stmt = as_a <const gcall *> (gs);
2715 if (gimple_call_internal_p (gs))
2716 return NULL_TREE;
2717 return call_stmt->u.fntype;
2720 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2722 static inline void
2723 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2725 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2726 call_stmt->u.fntype = fntype;
2730 /* Return the tree node representing the function called by call
2731 statement GS. */
2733 static inline tree
2734 gimple_call_fn (const_gimple gs)
2736 GIMPLE_CHECK (gs, GIMPLE_CALL);
2737 return gimple_op (gs, 1);
2740 /* Return a pointer to the tree node representing the function called by call
2741 statement GS. */
2743 static inline tree *
2744 gimple_call_fn_ptr (const_gimple gs)
2746 GIMPLE_CHECK (gs, GIMPLE_CALL);
2747 return gimple_op_ptr (gs, 1);
2751 /* Set FN to be the function called by call statement GS. */
2753 static inline void
2754 gimple_call_set_fn (gcall *gs, tree fn)
2756 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2757 gimple_set_op (gs, 1, fn);
2761 /* Set FNDECL to be the function called by call statement GS. */
2763 static inline void
2764 gimple_call_set_fndecl (gimple gs, tree decl)
2766 GIMPLE_CHECK (gs, GIMPLE_CALL);
2767 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2768 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2772 /* Set internal function FN to be the function called by call statement CALL_STMT. */
2774 static inline void
2775 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
2777 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
2778 call_stmt->u.internal_fn = fn;
2782 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2783 Otherwise return NULL. This function is analogous to
2784 get_callee_fndecl in tree land. */
2786 static inline tree
2787 gimple_call_fndecl (const_gimple gs)
2789 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2793 /* Return the type returned by call statement GS. */
2795 static inline tree
2796 gimple_call_return_type (const gcall *gs)
2798 tree type = gimple_call_fntype (gs);
2800 if (type == NULL_TREE)
2801 return TREE_TYPE (gimple_call_lhs (gs));
2803 /* The type returned by a function is the type of its
2804 function type. */
2805 return TREE_TYPE (type);
2809 /* Return the static chain for call statement GS. */
2811 static inline tree
2812 gimple_call_chain (const_gimple gs)
2814 GIMPLE_CHECK (gs, GIMPLE_CALL);
2815 return gimple_op (gs, 2);
2819 /* Return a pointer to the static chain for call statement CALL_STMT. */
2821 static inline tree *
2822 gimple_call_chain_ptr (const gcall *call_stmt)
2824 return gimple_op_ptr (call_stmt, 2);
2827 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
2829 static inline void
2830 gimple_call_set_chain (gcall *call_stmt, tree chain)
2832 gimple_set_op (call_stmt, 2, chain);
2836 /* Return the number of arguments used by call statement GS. */
2838 static inline unsigned
2839 gimple_call_num_args (const_gimple gs)
2841 unsigned num_ops;
2842 GIMPLE_CHECK (gs, GIMPLE_CALL);
2843 num_ops = gimple_num_ops (gs);
2844 return num_ops - 3;
2848 /* Return the argument at position INDEX for call statement GS. */
2850 static inline tree
2851 gimple_call_arg (const_gimple gs, unsigned index)
2853 GIMPLE_CHECK (gs, GIMPLE_CALL);
2854 return gimple_op (gs, index + 3);
2858 /* Return a pointer to the argument at position INDEX for call
2859 statement GS. */
2861 static inline tree *
2862 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2864 GIMPLE_CHECK (gs, GIMPLE_CALL);
2865 return gimple_op_ptr (gs, index + 3);
2869 /* Set ARG to be the argument at position INDEX for call statement GS. */
2871 static inline void
2872 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2874 GIMPLE_CHECK (gs, GIMPLE_CALL);
2875 gimple_set_op (gs, index + 3, arg);
2879 /* If TAIL_P is true, mark call statement S as being a tail call
2880 (i.e., a call just before the exit of a function). These calls are
2881 candidate for tail call optimization. */
2883 static inline void
2884 gimple_call_set_tail (gcall *s, bool tail_p)
2886 if (tail_p)
2887 s->subcode |= GF_CALL_TAILCALL;
2888 else
2889 s->subcode &= ~GF_CALL_TAILCALL;
2893 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2895 static inline bool
2896 gimple_call_tail_p (gcall *s)
2898 return (s->subcode & GF_CALL_TAILCALL) != 0;
2902 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2903 slot optimization. This transformation uses the target of the call
2904 expansion as the return slot for calls that return in memory. */
2906 static inline void
2907 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
2909 if (return_slot_opt_p)
2910 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2911 else
2912 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2916 /* Return true if S is marked for return slot optimization. */
2918 static inline bool
2919 gimple_call_return_slot_opt_p (gcall *s)
2921 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2925 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2926 thunk to the thunked-to function. */
2928 static inline void
2929 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
2931 if (from_thunk_p)
2932 s->subcode |= GF_CALL_FROM_THUNK;
2933 else
2934 s->subcode &= ~GF_CALL_FROM_THUNK;
2938 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2940 static inline bool
2941 gimple_call_from_thunk_p (gcall *s)
2943 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2947 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2948 argument pack in its argument list. */
2950 static inline void
2951 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
2953 if (pass_arg_pack_p)
2954 s->subcode |= GF_CALL_VA_ARG_PACK;
2955 else
2956 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2960 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2961 argument pack in its argument list. */
2963 static inline bool
2964 gimple_call_va_arg_pack_p (gcall *s)
2966 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2970 /* Return true if S is a noreturn call. */
2972 static inline bool
2973 gimple_call_noreturn_p (gimple s)
2975 GIMPLE_CHECK (s, GIMPLE_CALL);
2976 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2980 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2981 even if the called function can throw in other cases. */
2983 static inline void
2984 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
2986 if (nothrow_p)
2987 s->subcode |= GF_CALL_NOTHROW;
2988 else
2989 s->subcode &= ~GF_CALL_NOTHROW;
2992 /* Return true if S is a nothrow call. */
2994 static inline bool
2995 gimple_call_nothrow_p (gcall *s)
2997 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3000 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3001 is known to be emitted for VLA objects. Those are wrapped by
3002 stack_save/stack_restore calls and hence can't lead to unbounded
3003 stack growth even when they occur in loops. */
3005 static inline void
3006 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3008 if (for_var)
3009 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3010 else
3011 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3014 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3016 static inline bool
3017 gimple_call_alloca_for_var_p (gcall *s)
3019 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3022 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3024 static inline void
3025 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3027 dest_call->subcode = orig_call->subcode;
3031 /* Return a pointer to the points-to solution for the set of call-used
3032 variables of the call CALL_STMT. */
3034 static inline struct pt_solution *
3035 gimple_call_use_set (gcall *call_stmt)
3037 return &call_stmt->call_used;
3041 /* Return a pointer to the points-to solution for the set of call-used
3042 variables of the call CALL_STMT. */
3044 static inline struct pt_solution *
3045 gimple_call_clobber_set (gcall *call_stmt)
3047 return &call_stmt->call_clobbered;
3051 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3052 non-NULL lhs. */
3054 static inline bool
3055 gimple_has_lhs (gimple stmt)
3057 return (is_gimple_assign (stmt)
3058 || (is_gimple_call (stmt)
3059 && gimple_call_lhs (stmt) != NULL_TREE));
3063 /* Return the code of the predicate computed by conditional statement GS. */
3065 static inline enum tree_code
3066 gimple_cond_code (const_gimple gs)
3068 GIMPLE_CHECK (gs, GIMPLE_COND);
3069 return (enum tree_code) gs->subcode;
3073 /* Set CODE to be the predicate code for the conditional statement GS. */
3075 static inline void
3076 gimple_cond_set_code (gcond *gs, enum tree_code code)
3078 gs->subcode = code;
3082 /* Return the LHS of the predicate computed by conditional statement GS. */
3084 static inline tree
3085 gimple_cond_lhs (const_gimple gs)
3087 GIMPLE_CHECK (gs, GIMPLE_COND);
3088 return gimple_op (gs, 0);
3091 /* Return the pointer to the LHS of the predicate computed by conditional
3092 statement GS. */
3094 static inline tree *
3095 gimple_cond_lhs_ptr (const gcond *gs)
3097 return gimple_op_ptr (gs, 0);
3100 /* Set LHS to be the LHS operand of the predicate computed by
3101 conditional statement GS. */
3103 static inline void
3104 gimple_cond_set_lhs (gcond *gs, tree lhs)
3106 gimple_set_op (gs, 0, lhs);
3110 /* Return the RHS operand of the predicate computed by conditional GS. */
3112 static inline tree
3113 gimple_cond_rhs (const_gimple gs)
3115 GIMPLE_CHECK (gs, GIMPLE_COND);
3116 return gimple_op (gs, 1);
3119 /* Return the pointer to the RHS operand of the predicate computed by
3120 conditional GS. */
3122 static inline tree *
3123 gimple_cond_rhs_ptr (const gcond *gs)
3125 return gimple_op_ptr (gs, 1);
3129 /* Set RHS to be the RHS operand of the predicate computed by
3130 conditional statement GS. */
3132 static inline void
3133 gimple_cond_set_rhs (gcond *gs, tree rhs)
3135 gimple_set_op (gs, 1, rhs);
3139 /* Return the label used by conditional statement GS when its
3140 predicate evaluates to true. */
3142 static inline tree
3143 gimple_cond_true_label (const gcond *gs)
3145 return gimple_op (gs, 2);
3149 /* Set LABEL to be the label used by conditional statement GS when its
3150 predicate evaluates to true. */
3152 static inline void
3153 gimple_cond_set_true_label (gcond *gs, tree label)
3155 gimple_set_op (gs, 2, label);
3159 /* Set LABEL to be the label used by conditional statement GS when its
3160 predicate evaluates to false. */
3162 static inline void
3163 gimple_cond_set_false_label (gcond *gs, tree label)
3165 gimple_set_op (gs, 3, label);
3169 /* Return the label used by conditional statement GS when its
3170 predicate evaluates to false. */
3172 static inline tree
3173 gimple_cond_false_label (const gcond *gs)
3176 return gimple_op (gs, 3);
3180 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3182 static inline void
3183 gimple_cond_make_false (gcond *gs)
3185 gimple_cond_set_lhs (gs, boolean_true_node);
3186 gimple_cond_set_rhs (gs, boolean_false_node);
3187 gs->subcode = EQ_EXPR;
3191 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3193 static inline void
3194 gimple_cond_make_true (gcond *gs)
3196 gimple_cond_set_lhs (gs, boolean_true_node);
3197 gimple_cond_set_rhs (gs, boolean_true_node);
3198 gs->subcode = EQ_EXPR;
3201 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3202 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3204 static inline bool
3205 gimple_cond_true_p (const gcond *gs)
3207 tree lhs = gimple_cond_lhs (gs);
3208 tree rhs = gimple_cond_rhs (gs);
3209 enum tree_code code = gimple_cond_code (gs);
3211 if (lhs != boolean_true_node && lhs != boolean_false_node)
3212 return false;
3214 if (rhs != boolean_true_node && rhs != boolean_false_node)
3215 return false;
3217 if (code == NE_EXPR && lhs != rhs)
3218 return true;
3220 if (code == EQ_EXPR && lhs == rhs)
3221 return true;
3223 return false;
3226 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3227 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3229 static inline bool
3230 gimple_cond_false_p (const gcond *gs)
3232 tree lhs = gimple_cond_lhs (gs);
3233 tree rhs = gimple_cond_rhs (gs);
3234 enum tree_code code = gimple_cond_code (gs);
3236 if (lhs != boolean_true_node && lhs != boolean_false_node)
3237 return false;
3239 if (rhs != boolean_true_node && rhs != boolean_false_node)
3240 return false;
3242 if (code == NE_EXPR && lhs == rhs)
3243 return true;
3245 if (code == EQ_EXPR && lhs != rhs)
3246 return true;
3248 return false;
3251 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3253 static inline void
3254 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3255 tree rhs)
3257 gimple_cond_set_code (stmt, code);
3258 gimple_cond_set_lhs (stmt, lhs);
3259 gimple_cond_set_rhs (stmt, rhs);
3262 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3264 static inline tree
3265 gimple_label_label (const glabel *gs)
3267 return gimple_op (gs, 0);
3271 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3272 GS. */
3274 static inline void
3275 gimple_label_set_label (glabel *gs, tree label)
3277 gimple_set_op (gs, 0, label);
3281 /* Return the destination of the unconditional jump GS. */
3283 static inline tree
3284 gimple_goto_dest (const_gimple gs)
3286 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3287 return gimple_op (gs, 0);
3291 /* Set DEST to be the destination of the unconditonal jump GS. */
3293 static inline void
3294 gimple_goto_set_dest (ggoto *gs, tree dest)
3296 gimple_set_op (gs, 0, dest);
3300 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3302 static inline tree
3303 gimple_bind_vars (const gbind *bind_stmt)
3305 return bind_stmt->vars;
3309 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3310 statement GS. */
3312 static inline void
3313 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3315 bind_stmt->vars = vars;
3319 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3320 statement GS. */
3322 static inline void
3323 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3325 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3329 static inline gimple_seq *
3330 gimple_bind_body_ptr (gbind *bind_stmt)
3332 return &bind_stmt->body;
3335 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3337 static inline gimple_seq
3338 gimple_bind_body (gbind *gs)
3340 return *gimple_bind_body_ptr (gs);
3344 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3345 statement GS. */
3347 static inline void
3348 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3350 bind_stmt->body = seq;
3354 /* Append a statement to the end of a GIMPLE_BIND's body. */
3356 static inline void
3357 gimple_bind_add_stmt (gbind *bind_stmt, gimple stmt)
3359 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3363 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3365 static inline void
3366 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3368 gimple_seq_add_seq (&bind_stmt->body, seq);
3372 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3373 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3375 static inline tree
3376 gimple_bind_block (const gbind *bind_stmt)
3378 return bind_stmt->block;
3382 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3383 statement GS. */
3385 static inline void
3386 gimple_bind_set_block (gbind *bind_stmt, tree block)
3388 gcc_gimple_checking_assert (block == NULL_TREE
3389 || TREE_CODE (block) == BLOCK);
3390 bind_stmt->block = block;
3394 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3396 static inline unsigned
3397 gimple_asm_ninputs (const gasm *asm_stmt)
3399 return asm_stmt->ni;
3403 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3405 static inline unsigned
3406 gimple_asm_noutputs (const gasm *asm_stmt)
3408 return asm_stmt->no;
3412 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3414 static inline unsigned
3415 gimple_asm_nclobbers (const gasm *asm_stmt)
3417 return asm_stmt->nc;
3420 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3422 static inline unsigned
3423 gimple_asm_nlabels (const gasm *asm_stmt)
3425 return asm_stmt->nl;
3428 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3430 static inline tree
3431 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3433 gcc_gimple_checking_assert (index < asm_stmt->ni);
3434 return gimple_op (asm_stmt, index + asm_stmt->no);
3437 /* Return a pointer to input operand INDEX of GIMPLE_ASM ASM_STMT. */
3439 static inline tree *
3440 gimple_asm_input_op_ptr (const gasm *asm_stmt, unsigned index)
3442 gcc_gimple_checking_assert (index < asm_stmt->ni);
3443 return gimple_op_ptr (asm_stmt, index + asm_stmt->no);
3447 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3449 static inline void
3450 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3452 gcc_gimple_checking_assert (index < asm_stmt->ni
3453 && TREE_CODE (in_op) == TREE_LIST);
3454 gimple_set_op (asm_stmt, index + asm_stmt->no, in_op);
3458 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3460 static inline tree
3461 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3463 gcc_gimple_checking_assert (index < asm_stmt->no);
3464 return gimple_op (asm_stmt, index);
3467 /* Return a pointer to output operand INDEX of GIMPLE_ASM ASM_STMT. */
3469 static inline tree *
3470 gimple_asm_output_op_ptr (const gasm *asm_stmt, unsigned index)
3472 gcc_gimple_checking_assert (index < asm_stmt->no);
3473 return gimple_op_ptr (asm_stmt, index);
3477 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3479 static inline void
3480 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3482 gcc_gimple_checking_assert (index < asm_stmt->no
3483 && TREE_CODE (out_op) == TREE_LIST);
3484 gimple_set_op (asm_stmt, index, out_op);
3488 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3490 static inline tree
3491 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3493 gcc_gimple_checking_assert (index < asm_stmt->nc);
3494 return gimple_op (asm_stmt, index + asm_stmt->ni + asm_stmt->no);
3498 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3500 static inline void
3501 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3503 gcc_gimple_checking_assert (index < asm_stmt->nc
3504 && TREE_CODE (clobber_op) == TREE_LIST);
3505 gimple_set_op (asm_stmt, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3508 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3510 static inline tree
3511 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3513 gcc_gimple_checking_assert (index < asm_stmt->nl);
3514 return gimple_op (asm_stmt, index + asm_stmt->ni + asm_stmt->nc);
3517 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3519 static inline void
3520 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3522 gcc_gimple_checking_assert (index < asm_stmt->nl
3523 && TREE_CODE (label_op) == TREE_LIST);
3524 gimple_set_op (asm_stmt, index + asm_stmt->ni + asm_stmt->nc, label_op);
3527 /* Return the string representing the assembly instruction in
3528 GIMPLE_ASM ASM_STMT. */
3530 static inline const char *
3531 gimple_asm_string (const gasm *asm_stmt)
3533 return asm_stmt->string;
3537 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3539 static inline bool
3540 gimple_asm_volatile_p (const gasm *asm_stmt)
3542 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3546 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3548 static inline void
3549 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3551 if (volatile_p)
3552 asm_stmt->subcode |= GF_ASM_VOLATILE;
3553 else
3554 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3558 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3560 static inline void
3561 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3563 if (input_p)
3564 asm_stmt->subcode |= GF_ASM_INPUT;
3565 else
3566 asm_stmt->subcode &= ~GF_ASM_INPUT;
3570 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3572 static inline bool
3573 gimple_asm_input_p (const gasm *asm_stmt)
3575 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3579 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3581 static inline tree
3582 gimple_catch_types (const gcatch *catch_stmt)
3584 return catch_stmt->types;
3588 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3590 static inline tree *
3591 gimple_catch_types_ptr (gcatch *catch_stmt)
3593 return &catch_stmt->types;
3597 /* Return a pointer to the GIMPLE sequence representing the body of
3598 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3600 static inline gimple_seq *
3601 gimple_catch_handler_ptr (gcatch *catch_stmt)
3603 return &catch_stmt->handler;
3607 /* Return the GIMPLE sequence representing the body of the handler of
3608 GIMPLE_CATCH statement CATCH_STMT. */
3610 static inline gimple_seq
3611 gimple_catch_handler (gcatch *catch_stmt)
3613 return *gimple_catch_handler_ptr (catch_stmt);
3617 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3619 static inline void
3620 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3622 catch_stmt->types = t;
3626 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3628 static inline void
3629 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
3631 catch_stmt->handler = handler;
3635 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3637 static inline tree
3638 gimple_eh_filter_types (const_gimple gs)
3640 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
3641 return eh_filter_stmt->types;
3645 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3646 GS. */
3648 static inline tree *
3649 gimple_eh_filter_types_ptr (gimple gs)
3651 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3652 return &eh_filter_stmt->types;
3656 /* Return a pointer to the sequence of statement to execute when
3657 GIMPLE_EH_FILTER statement fails. */
3659 static inline gimple_seq *
3660 gimple_eh_filter_failure_ptr (gimple gs)
3662 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3663 return &eh_filter_stmt->failure;
3667 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3668 statement fails. */
3670 static inline gimple_seq
3671 gimple_eh_filter_failure (gimple gs)
3673 return *gimple_eh_filter_failure_ptr (gs);
3677 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
3678 EH_FILTER_STMT. */
3680 static inline void
3681 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
3683 eh_filter_stmt->types = types;
3687 /* Set FAILURE to be the sequence of statements to execute on failure
3688 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
3690 static inline void
3691 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
3692 gimple_seq failure)
3694 eh_filter_stmt->failure = failure;
3697 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3699 static inline tree
3700 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
3702 return eh_mnt_stmt->fndecl;
3705 /* Set the function decl to be called by GS to DECL. */
3707 static inline void
3708 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
3709 tree decl)
3711 eh_mnt_stmt->fndecl = decl;
3714 /* GIMPLE_EH_ELSE accessors. */
3716 static inline gimple_seq *
3717 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
3719 return &eh_else_stmt->n_body;
3722 static inline gimple_seq
3723 gimple_eh_else_n_body (geh_else *eh_else_stmt)
3725 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
3728 static inline gimple_seq *
3729 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
3731 return &eh_else_stmt->e_body;
3734 static inline gimple_seq
3735 gimple_eh_else_e_body (geh_else *eh_else_stmt)
3737 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
3740 static inline void
3741 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
3743 eh_else_stmt->n_body = seq;
3746 static inline void
3747 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
3749 eh_else_stmt->e_body = seq;
3752 /* GIMPLE_TRY accessors. */
3754 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3755 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3757 static inline enum gimple_try_flags
3758 gimple_try_kind (const_gimple gs)
3760 GIMPLE_CHECK (gs, GIMPLE_TRY);
3761 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3765 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3767 static inline void
3768 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
3770 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3771 || kind == GIMPLE_TRY_FINALLY);
3772 if (gimple_try_kind (gs) != kind)
3773 gs->subcode = (unsigned int) kind;
3777 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3779 static inline bool
3780 gimple_try_catch_is_cleanup (const_gimple gs)
3782 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3783 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3787 /* Return a pointer to the sequence of statements used as the
3788 body for GIMPLE_TRY GS. */
3790 static inline gimple_seq *
3791 gimple_try_eval_ptr (gimple gs)
3793 gtry *try_stmt = as_a <gtry *> (gs);
3794 return &try_stmt->eval;
3798 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3800 static inline gimple_seq
3801 gimple_try_eval (gimple gs)
3803 return *gimple_try_eval_ptr (gs);
3807 /* Return a pointer to the sequence of statements used as the cleanup body for
3808 GIMPLE_TRY GS. */
3810 static inline gimple_seq *
3811 gimple_try_cleanup_ptr (gimple gs)
3813 gtry *try_stmt = as_a <gtry *> (gs);
3814 return &try_stmt->cleanup;
3818 /* Return the sequence of statements used as the cleanup body for
3819 GIMPLE_TRY GS. */
3821 static inline gimple_seq
3822 gimple_try_cleanup (gimple gs)
3824 return *gimple_try_cleanup_ptr (gs);
3828 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3830 static inline void
3831 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
3833 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3834 if (catch_is_cleanup)
3835 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3836 else
3837 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3841 /* Set EVAL to be the sequence of statements to use as the body for
3842 GIMPLE_TRY TRY_STMT. */
3844 static inline void
3845 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
3847 try_stmt->eval = eval;
3851 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3852 body for GIMPLE_TRY TRY_STMT. */
3854 static inline void
3855 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
3857 try_stmt->cleanup = cleanup;
3861 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3863 static inline gimple_seq *
3864 gimple_wce_cleanup_ptr (gimple gs)
3866 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3867 return &wce_stmt->cleanup;
3871 /* Return the cleanup sequence for cleanup statement GS. */
3873 static inline gimple_seq
3874 gimple_wce_cleanup (gimple gs)
3876 return *gimple_wce_cleanup_ptr (gs);
3880 /* Set CLEANUP to be the cleanup sequence for GS. */
3882 static inline void
3883 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3885 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3886 wce_stmt->cleanup = cleanup;
3890 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3892 static inline bool
3893 gimple_wce_cleanup_eh_only (const_gimple gs)
3895 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3896 return gs->subcode != 0;
3900 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3902 static inline void
3903 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3905 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3906 gs->subcode = (unsigned int) eh_only_p;
3910 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3912 static inline unsigned
3913 gimple_phi_capacity (const_gimple gs)
3915 const gphi *phi_stmt = as_a <const gphi *> (gs);
3916 return phi_stmt->capacity;
3920 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3921 be exactly the number of incoming edges for the basic block holding
3922 GS. */
3924 static inline unsigned
3925 gimple_phi_num_args (const_gimple gs)
3927 const gphi *phi_stmt = as_a <const gphi *> (gs);
3928 return phi_stmt->nargs;
3932 /* Return the SSA name created by GIMPLE_PHI GS. */
3934 static inline tree
3935 gimple_phi_result (const_gimple gs)
3937 const gphi *phi_stmt = as_a <const gphi *> (gs);
3938 return phi_stmt->result;
3941 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3943 static inline tree *
3944 gimple_phi_result_ptr (gimple gs)
3946 gphi *phi_stmt = as_a <gphi *> (gs);
3947 return &phi_stmt->result;
3950 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
3952 static inline void
3953 gimple_phi_set_result (gphi *phi, tree result)
3955 phi->result = result;
3956 if (result && TREE_CODE (result) == SSA_NAME)
3957 SSA_NAME_DEF_STMT (result) = phi;
3961 /* Return the PHI argument corresponding to incoming edge INDEX for
3962 GIMPLE_PHI GS. */
3964 static inline struct phi_arg_d *
3965 gimple_phi_arg (gimple gs, unsigned index)
3967 gphi *phi_stmt = as_a <gphi *> (gs);
3968 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3969 return &(phi_stmt->args[index]);
3972 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3973 for GIMPLE_PHI PHI. */
3975 static inline void
3976 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
3978 gcc_gimple_checking_assert (index <= phi->nargs);
3979 phi->args[index] = *phiarg;
3982 /* Return the PHI nodes for basic block BB, or NULL if there are no
3983 PHI nodes. */
3985 static inline gimple_seq
3986 phi_nodes (const_basic_block bb)
3988 gcc_checking_assert (!(bb->flags & BB_RTL));
3989 return bb->il.gimple.phi_nodes;
3992 /* Return a pointer to the PHI nodes for basic block BB. */
3994 static inline gimple_seq *
3995 phi_nodes_ptr (basic_block bb)
3997 gcc_checking_assert (!(bb->flags & BB_RTL));
3998 return &bb->il.gimple.phi_nodes;
4001 /* Return the tree operand for argument I of PHI node GS. */
4003 static inline tree
4004 gimple_phi_arg_def (gimple gs, size_t index)
4006 return gimple_phi_arg (gs, index)->def;
4010 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4012 static inline tree *
4013 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4015 return &gimple_phi_arg (phi, index)->def;
4018 /* Return the edge associated with argument I of phi node PHI. */
4020 static inline edge
4021 gimple_phi_arg_edge (gphi *phi, size_t i)
4023 return EDGE_PRED (gimple_bb (phi), i);
4026 /* Return the source location of gimple argument I of phi node PHI. */
4028 static inline source_location
4029 gimple_phi_arg_location (gphi *phi, size_t i)
4031 return gimple_phi_arg (phi, i)->locus;
4034 /* Return the source location of the argument on edge E of phi node PHI. */
4036 static inline source_location
4037 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4039 return gimple_phi_arg (phi, e->dest_idx)->locus;
4042 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4044 static inline void
4045 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4047 gimple_phi_arg (phi, i)->locus = loc;
4050 /* Return TRUE if argument I of phi node PHI has a location record. */
4052 static inline bool
4053 gimple_phi_arg_has_location (gphi *phi, size_t i)
4055 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4059 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4061 static inline int
4062 gimple_resx_region (const gresx *resx_stmt)
4064 return resx_stmt->region;
4067 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4069 static inline void
4070 gimple_resx_set_region (gresx *resx_stmt, int region)
4072 resx_stmt->region = region;
4075 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4077 static inline int
4078 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4080 return eh_dispatch_stmt->region;
4083 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4084 EH_DISPATCH_STMT. */
4086 static inline void
4087 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4089 eh_dispatch_stmt->region = region;
4092 /* Return the number of labels associated with the switch statement GS. */
4094 static inline unsigned
4095 gimple_switch_num_labels (const gswitch *gs)
4097 unsigned num_ops;
4098 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4099 num_ops = gimple_num_ops (gs);
4100 gcc_gimple_checking_assert (num_ops > 1);
4101 return num_ops - 1;
4105 /* Set NLABELS to be the number of labels for the switch statement GS. */
4107 static inline void
4108 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4110 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4111 gimple_set_num_ops (g, nlabels + 1);
4115 /* Return the index variable used by the switch statement GS. */
4117 static inline tree
4118 gimple_switch_index (const gswitch *gs)
4120 return gimple_op (gs, 0);
4124 /* Return a pointer to the index variable for the switch statement GS. */
4126 static inline tree *
4127 gimple_switch_index_ptr (const gswitch *gs)
4129 return gimple_op_ptr (gs, 0);
4133 /* Set INDEX to be the index variable for switch statement GS. */
4135 static inline void
4136 gimple_switch_set_index (gswitch *gs, tree index)
4138 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4139 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4140 gimple_set_op (gs, 0, index);
4144 /* Return the label numbered INDEX. The default label is 0, followed by any
4145 labels in a switch statement. */
4147 static inline tree
4148 gimple_switch_label (const gswitch *gs, unsigned index)
4150 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4151 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4152 return gimple_op (gs, index + 1);
4155 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4157 static inline void
4158 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4160 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4161 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4162 && (label == NULL_TREE
4163 || TREE_CODE (label) == CASE_LABEL_EXPR));
4164 gimple_set_op (gs, index + 1, label);
4167 /* Return the default label for a switch statement. */
4169 static inline tree
4170 gimple_switch_default_label (const gswitch *gs)
4172 tree label = gimple_switch_label (gs, 0);
4173 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4174 return label;
4177 /* Set the default label for a switch statement. */
4179 static inline void
4180 gimple_switch_set_default_label (gswitch *gs, tree label)
4182 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4183 gimple_switch_set_label (gs, 0, label);
4186 /* Return true if GS is a GIMPLE_DEBUG statement. */
4188 static inline bool
4189 is_gimple_debug (const_gimple gs)
4191 return gimple_code (gs) == GIMPLE_DEBUG;
4194 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4196 static inline bool
4197 gimple_debug_bind_p (const_gimple s)
4199 if (is_gimple_debug (s))
4200 return s->subcode == GIMPLE_DEBUG_BIND;
4202 return false;
4205 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4207 static inline tree
4208 gimple_debug_bind_get_var (gimple dbg)
4210 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4211 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4212 return gimple_op (dbg, 0);
4215 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4216 statement. */
4218 static inline tree
4219 gimple_debug_bind_get_value (gimple dbg)
4221 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4222 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4223 return gimple_op (dbg, 1);
4226 /* Return a pointer to the value bound to the variable in a
4227 GIMPLE_DEBUG bind statement. */
4229 static inline tree *
4230 gimple_debug_bind_get_value_ptr (gimple dbg)
4232 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4233 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4234 return gimple_op_ptr (dbg, 1);
4237 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4239 static inline void
4240 gimple_debug_bind_set_var (gimple dbg, tree var)
4242 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4243 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4244 gimple_set_op (dbg, 0, var);
4247 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4248 statement. */
4250 static inline void
4251 gimple_debug_bind_set_value (gimple dbg, tree value)
4253 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4254 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4255 gimple_set_op (dbg, 1, value);
4258 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4259 optimized away. */
4260 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4262 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4263 statement. */
4265 static inline void
4266 gimple_debug_bind_reset_value (gimple dbg)
4268 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4269 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4270 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4273 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4274 value. */
4276 static inline bool
4277 gimple_debug_bind_has_value_p (gimple dbg)
4279 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4280 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4281 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4284 #undef GIMPLE_DEBUG_BIND_NOVALUE
4286 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4288 static inline bool
4289 gimple_debug_source_bind_p (const_gimple s)
4291 if (is_gimple_debug (s))
4292 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4294 return false;
4297 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4299 static inline tree
4300 gimple_debug_source_bind_get_var (gimple dbg)
4302 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4303 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4304 return gimple_op (dbg, 0);
4307 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4308 statement. */
4310 static inline tree
4311 gimple_debug_source_bind_get_value (gimple dbg)
4313 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4314 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4315 return gimple_op (dbg, 1);
4318 /* Return a pointer to the value bound to the variable in a
4319 GIMPLE_DEBUG source bind statement. */
4321 static inline tree *
4322 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4324 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4325 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4326 return gimple_op_ptr (dbg, 1);
4329 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4331 static inline void
4332 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4334 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4335 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4336 gimple_set_op (dbg, 0, var);
4339 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4340 statement. */
4342 static inline void
4343 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4345 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4346 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4347 gimple_set_op (dbg, 1, value);
4350 /* Return the line number for EXPR, or return -1 if we have no line
4351 number information for it. */
4352 static inline int
4353 get_lineno (const_gimple stmt)
4355 location_t loc;
4357 if (!stmt)
4358 return -1;
4360 loc = gimple_location (stmt);
4361 if (loc == UNKNOWN_LOCATION)
4362 return -1;
4364 return LOCATION_LINE (loc);
4367 /* Return a pointer to the body for the OMP statement GS. */
4369 static inline gimple_seq *
4370 gimple_omp_body_ptr (gimple gs)
4372 return &static_cast <gimple_statement_omp *> (gs)->body;
4375 /* Return the body for the OMP statement GS. */
4377 static inline gimple_seq
4378 gimple_omp_body (gimple gs)
4380 return *gimple_omp_body_ptr (gs);
4383 /* Set BODY to be the body for the OMP statement GS. */
4385 static inline void
4386 gimple_omp_set_body (gimple gs, gimple_seq body)
4388 static_cast <gimple_statement_omp *> (gs)->body = body;
4392 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4394 static inline tree
4395 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4397 return crit_stmt->name;
4401 /* Return a pointer to the name associated with OMP critical statement GS. */
4403 static inline tree *
4404 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4406 return &crit_stmt->name;
4410 /* Set NAME to be the name associated with OMP critical statement GS. */
4412 static inline void
4413 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4415 crit_stmt->name = name;
4419 /* Return the kind of the OMP_FOR statemement G. */
4421 static inline int
4422 gimple_omp_for_kind (const_gimple g)
4424 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4425 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4429 /* Set the kind of the OMP_FOR statement G. */
4431 static inline void
4432 gimple_omp_for_set_kind (gomp_for *g, int kind)
4434 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4435 | (kind & GF_OMP_FOR_KIND_MASK);
4439 /* Return true if OMP_FOR statement G has the
4440 GF_OMP_FOR_COMBINED flag set. */
4442 static inline bool
4443 gimple_omp_for_combined_p (const_gimple g)
4445 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4446 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4450 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4451 the boolean value of COMBINED_P. */
4453 static inline void
4454 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4456 if (combined_p)
4457 g->subcode |= GF_OMP_FOR_COMBINED;
4458 else
4459 g->subcode &= ~GF_OMP_FOR_COMBINED;
4463 /* Return true if the OMP_FOR statement G has the
4464 GF_OMP_FOR_COMBINED_INTO flag set. */
4466 static inline bool
4467 gimple_omp_for_combined_into_p (const_gimple g)
4469 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4470 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4474 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4475 on the boolean value of COMBINED_P. */
4477 static inline void
4478 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4480 if (combined_p)
4481 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4482 else
4483 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4487 /* Return the clauses associated with the OMP_FOR statement GS. */
4489 static inline tree
4490 gimple_omp_for_clauses (const_gimple gs)
4492 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4493 return omp_for_stmt->clauses;
4497 /* Return a pointer to the clauses associated with the OMP_FOR statement
4498 GS. */
4500 static inline tree *
4501 gimple_omp_for_clauses_ptr (gimple gs)
4503 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4504 return &omp_for_stmt->clauses;
4508 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4509 GS. */
4511 static inline void
4512 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4514 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4515 omp_for_stmt->clauses = clauses;
4519 /* Get the collapse count of the OMP_FOR statement GS. */
4521 static inline size_t
4522 gimple_omp_for_collapse (gimple gs)
4524 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4525 return omp_for_stmt->collapse;
4529 /* Return the condition code associated with the OMP_FOR statement GS. */
4531 static inline enum tree_code
4532 gimple_omp_for_cond (const_gimple gs, size_t i)
4534 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4535 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4536 return omp_for_stmt->iter[i].cond;
4540 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4542 static inline void
4543 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4545 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4546 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4547 && i < omp_for_stmt->collapse);
4548 omp_for_stmt->iter[i].cond = cond;
4552 /* Return the index variable for the OMP_FOR statement GS. */
4554 static inline tree
4555 gimple_omp_for_index (const_gimple gs, size_t i)
4557 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4558 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4559 return omp_for_stmt->iter[i].index;
4563 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4565 static inline tree *
4566 gimple_omp_for_index_ptr (gimple gs, size_t i)
4568 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4569 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4570 return &omp_for_stmt->iter[i].index;
4574 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4576 static inline void
4577 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4579 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4580 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4581 omp_for_stmt->iter[i].index = index;
4585 /* Return the initial value for the OMP_FOR statement GS. */
4587 static inline tree
4588 gimple_omp_for_initial (const_gimple gs, size_t i)
4590 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4591 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4592 return omp_for_stmt->iter[i].initial;
4596 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
4598 static inline tree *
4599 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4601 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4602 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4603 return &omp_for_stmt->iter[i].initial;
4607 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
4609 static inline void
4610 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4612 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4613 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4614 omp_for_stmt->iter[i].initial = initial;
4618 /* Return the final value for the OMP_FOR statement GS. */
4620 static inline tree
4621 gimple_omp_for_final (const_gimple gs, size_t i)
4623 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4624 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4625 return omp_for_stmt->iter[i].final;
4629 /* Return a pointer to the final value for the OMP_FOR statement GS. */
4631 static inline tree *
4632 gimple_omp_for_final_ptr (gimple gs, size_t i)
4634 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4635 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4636 return &omp_for_stmt->iter[i].final;
4640 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
4642 static inline void
4643 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4645 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4646 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4647 omp_for_stmt->iter[i].final = final;
4651 /* Return the increment value for the OMP_FOR statement GS. */
4653 static inline tree
4654 gimple_omp_for_incr (const_gimple gs, size_t i)
4656 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4657 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4658 return omp_for_stmt->iter[i].incr;
4662 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
4664 static inline tree *
4665 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4667 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4668 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4669 return &omp_for_stmt->iter[i].incr;
4673 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
4675 static inline void
4676 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4678 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4679 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4680 omp_for_stmt->iter[i].incr = incr;
4684 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4685 statement GS starts. */
4687 static inline gimple_seq *
4688 gimple_omp_for_pre_body_ptr (gimple gs)
4690 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4691 return &omp_for_stmt->pre_body;
4695 /* Return the sequence of statements to execute before the OMP_FOR
4696 statement GS starts. */
4698 static inline gimple_seq
4699 gimple_omp_for_pre_body (gimple gs)
4701 return *gimple_omp_for_pre_body_ptr (gs);
4705 /* Set PRE_BODY to be the sequence of statements to execute before the
4706 OMP_FOR statement GS starts. */
4708 static inline void
4709 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4711 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4712 omp_for_stmt->pre_body = pre_body;
4716 /* Return the clauses associated with OMP_PARALLEL GS. */
4718 static inline tree
4719 gimple_omp_parallel_clauses (const_gimple gs)
4721 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
4722 return omp_parallel_stmt->clauses;
4726 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
4728 static inline tree *
4729 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
4731 return &omp_parallel_stmt->clauses;
4735 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
4737 static inline void
4738 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
4739 tree clauses)
4741 omp_parallel_stmt->clauses = clauses;
4745 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
4747 static inline tree
4748 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
4750 return omp_parallel_stmt->child_fn;
4753 /* Return a pointer to the child function used to hold the body of
4754 OMP_PARALLEL_STMT. */
4756 static inline tree *
4757 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
4759 return &omp_parallel_stmt->child_fn;
4763 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
4765 static inline void
4766 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
4767 tree child_fn)
4769 omp_parallel_stmt->child_fn = child_fn;
4773 /* Return the artificial argument used to send variables and values
4774 from the parent to the children threads in OMP_PARALLEL_STMT. */
4776 static inline tree
4777 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
4779 return omp_parallel_stmt->data_arg;
4783 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
4785 static inline tree *
4786 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
4788 return &omp_parallel_stmt->data_arg;
4792 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
4794 static inline void
4795 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
4796 tree data_arg)
4798 omp_parallel_stmt->data_arg = data_arg;
4802 /* Return the clauses associated with OMP_TASK GS. */
4804 static inline tree
4805 gimple_omp_task_clauses (const_gimple gs)
4807 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
4808 return omp_task_stmt->clauses;
4812 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4814 static inline tree *
4815 gimple_omp_task_clauses_ptr (gimple gs)
4817 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
4818 return &omp_task_stmt->clauses;
4822 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4823 GS. */
4825 static inline void
4826 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4828 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
4829 omp_task_stmt->clauses = clauses;
4833 /* Return the child function used to hold the body of OMP_TASK GS. */
4835 static inline tree
4836 gimple_omp_task_child_fn (const_gimple gs)
4838 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
4839 return omp_task_stmt->child_fn;
4842 /* Return a pointer to the child function used to hold the body of
4843 OMP_TASK GS. */
4845 static inline tree *
4846 gimple_omp_task_child_fn_ptr (gimple gs)
4848 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
4849 return &omp_task_stmt->child_fn;
4853 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4855 static inline void
4856 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4858 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
4859 omp_task_stmt->child_fn = child_fn;
4863 /* Return the artificial argument used to send variables and values
4864 from the parent to the children threads in OMP_TASK GS. */
4866 static inline tree
4867 gimple_omp_task_data_arg (const_gimple gs)
4869 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
4870 return omp_task_stmt->data_arg;
4874 /* Return a pointer to the data argument for OMP_TASK GS. */
4876 static inline tree *
4877 gimple_omp_task_data_arg_ptr (gimple gs)
4879 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
4880 return &omp_task_stmt->data_arg;
4884 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4886 static inline void
4887 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4889 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
4890 omp_task_stmt->data_arg = data_arg;
4894 /* Return the clauses associated with OMP_TASK GS. */
4896 static inline tree
4897 gimple_omp_taskreg_clauses (const_gimple gs)
4899 const gimple_statement_omp_taskreg *omp_taskreg_stmt
4900 = as_a <const gimple_statement_omp_taskreg *> (gs);
4901 return omp_taskreg_stmt->clauses;
4905 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4907 static inline tree *
4908 gimple_omp_taskreg_clauses_ptr (gimple gs)
4910 gimple_statement_omp_taskreg *omp_taskreg_stmt
4911 = as_a <gimple_statement_omp_taskreg *> (gs);
4912 return &omp_taskreg_stmt->clauses;
4916 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4917 GS. */
4919 static inline void
4920 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4922 gimple_statement_omp_taskreg *omp_taskreg_stmt
4923 = as_a <gimple_statement_omp_taskreg *> (gs);
4924 omp_taskreg_stmt->clauses = clauses;
4928 /* Return the child function used to hold the body of OMP_TASK GS. */
4930 static inline tree
4931 gimple_omp_taskreg_child_fn (const_gimple gs)
4933 const gimple_statement_omp_taskreg *omp_taskreg_stmt
4934 = as_a <const gimple_statement_omp_taskreg *> (gs);
4935 return omp_taskreg_stmt->child_fn;
4938 /* Return a pointer to the child function used to hold the body of
4939 OMP_TASK GS. */
4941 static inline tree *
4942 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4944 gimple_statement_omp_taskreg *omp_taskreg_stmt
4945 = as_a <gimple_statement_omp_taskreg *> (gs);
4946 return &omp_taskreg_stmt->child_fn;
4950 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4952 static inline void
4953 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4955 gimple_statement_omp_taskreg *omp_taskreg_stmt
4956 = as_a <gimple_statement_omp_taskreg *> (gs);
4957 omp_taskreg_stmt->child_fn = child_fn;
4961 /* Return the artificial argument used to send variables and values
4962 from the parent to the children threads in OMP_TASK GS. */
4964 static inline tree
4965 gimple_omp_taskreg_data_arg (const_gimple gs)
4967 const gimple_statement_omp_taskreg *omp_taskreg_stmt
4968 = as_a <const gimple_statement_omp_taskreg *> (gs);
4969 return omp_taskreg_stmt->data_arg;
4973 /* Return a pointer to the data argument for OMP_TASK GS. */
4975 static inline tree *
4976 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4978 gimple_statement_omp_taskreg *omp_taskreg_stmt
4979 = as_a <gimple_statement_omp_taskreg *> (gs);
4980 return &omp_taskreg_stmt->data_arg;
4984 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4986 static inline void
4987 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4989 gimple_statement_omp_taskreg *omp_taskreg_stmt
4990 = as_a <gimple_statement_omp_taskreg *> (gs);
4991 omp_taskreg_stmt->data_arg = data_arg;
4995 /* Return the copy function used to hold the body of OMP_TASK GS. */
4997 static inline tree
4998 gimple_omp_task_copy_fn (const_gimple gs)
5000 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5001 return omp_task_stmt->copy_fn;
5004 /* Return a pointer to the copy function used to hold the body of
5005 OMP_TASK GS. */
5007 static inline tree *
5008 gimple_omp_task_copy_fn_ptr (gimple gs)
5010 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5011 return &omp_task_stmt->copy_fn;
5015 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5017 static inline void
5018 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
5020 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5021 omp_task_stmt->copy_fn = copy_fn;
5025 /* Return size of the data block in bytes in OMP_TASK GS. */
5027 static inline tree
5028 gimple_omp_task_arg_size (const_gimple gs)
5030 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5031 return omp_task_stmt->arg_size;
5035 /* Return a pointer to the data block size for OMP_TASK GS. */
5037 static inline tree *
5038 gimple_omp_task_arg_size_ptr (gimple gs)
5040 gomp_task *omp_task_stmt = 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 = as_a <gomp_task *> (gs);
5051 omp_task_stmt->arg_size = arg_size;
5055 /* Return align of the data block in bytes in OMP_TASK GS. */
5057 static inline tree
5058 gimple_omp_task_arg_align (const_gimple gs)
5060 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5061 return omp_task_stmt->arg_align;
5065 /* Return a pointer to the data block align for OMP_TASK GS. */
5067 static inline tree *
5068 gimple_omp_task_arg_align_ptr (gimple gs)
5070 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5071 return &omp_task_stmt->arg_align;
5075 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5077 static inline void
5078 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
5080 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5081 omp_task_stmt->arg_align = arg_align;
5085 /* Return the clauses associated with OMP_SINGLE GS. */
5087 static inline tree
5088 gimple_omp_single_clauses (const_gimple gs)
5090 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5091 return omp_single_stmt->clauses;
5095 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5097 static inline tree *
5098 gimple_omp_single_clauses_ptr (gimple gs)
5100 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5101 return &omp_single_stmt->clauses;
5105 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5107 static inline void
5108 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5110 omp_single_stmt->clauses = clauses;
5114 /* Return the clauses associated with OMP_TARGET GS. */
5116 static inline tree
5117 gimple_omp_target_clauses (const_gimple gs)
5119 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5120 return omp_target_stmt->clauses;
5124 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5126 static inline tree *
5127 gimple_omp_target_clauses_ptr (gimple gs)
5129 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5130 return &omp_target_stmt->clauses;
5134 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5136 static inline void
5137 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5138 tree clauses)
5140 omp_target_stmt->clauses = clauses;
5144 /* Return the kind of the OMP_TARGET G. */
5146 static inline int
5147 gimple_omp_target_kind (const_gimple g)
5149 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5150 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5154 /* Set the kind of the OMP_TARGET G. */
5156 static inline void
5157 gimple_omp_target_set_kind (gomp_target *g, int kind)
5159 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5160 | (kind & GF_OMP_TARGET_KIND_MASK);
5164 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5166 static inline tree
5167 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5169 return omp_target_stmt->child_fn;
5172 /* Return a pointer to the child function used to hold the body of
5173 OMP_TARGET_STMT. */
5175 static inline tree *
5176 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5178 return &omp_target_stmt->child_fn;
5182 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5184 static inline void
5185 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5186 tree child_fn)
5188 omp_target_stmt->child_fn = child_fn;
5192 /* Return the artificial argument used to send variables and values
5193 from the parent to the children threads in OMP_TARGET_STMT. */
5195 static inline tree
5196 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5198 return omp_target_stmt->data_arg;
5202 /* Return a pointer to the data argument for OMP_TARGET GS. */
5204 static inline tree *
5205 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5207 return &omp_target_stmt->data_arg;
5211 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5213 static inline void
5214 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5215 tree data_arg)
5217 omp_target_stmt->data_arg = data_arg;
5221 /* Return the clauses associated with OMP_TEAMS GS. */
5223 static inline tree
5224 gimple_omp_teams_clauses (const_gimple gs)
5226 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5227 return omp_teams_stmt->clauses;
5231 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5233 static inline tree *
5234 gimple_omp_teams_clauses_ptr (gimple gs)
5236 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5237 return &omp_teams_stmt->clauses;
5241 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5243 static inline void
5244 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5246 omp_teams_stmt->clauses = clauses;
5250 /* Return the clauses associated with OMP_SECTIONS GS. */
5252 static inline tree
5253 gimple_omp_sections_clauses (const_gimple gs)
5255 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5256 return omp_sections_stmt->clauses;
5260 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5262 static inline tree *
5263 gimple_omp_sections_clauses_ptr (gimple gs)
5265 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5266 return &omp_sections_stmt->clauses;
5270 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5271 GS. */
5273 static inline void
5274 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5276 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5277 omp_sections_stmt->clauses = clauses;
5281 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5282 in GS. */
5284 static inline tree
5285 gimple_omp_sections_control (const_gimple gs)
5287 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5288 return omp_sections_stmt->control;
5292 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5293 GS. */
5295 static inline tree *
5296 gimple_omp_sections_control_ptr (gimple gs)
5298 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5299 return &omp_sections_stmt->control;
5303 /* Set CONTROL to be the set of clauses associated with the
5304 GIMPLE_OMP_SECTIONS in GS. */
5306 static inline void
5307 gimple_omp_sections_set_control (gimple gs, tree control)
5309 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5310 omp_sections_stmt->control = control;
5314 /* Set the value being stored in an atomic store. */
5316 static inline void
5317 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5319 store_stmt->val = val;
5323 /* Return the value being stored in an atomic store. */
5325 static inline tree
5326 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5328 return store_stmt->val;
5332 /* Return a pointer to the value being stored in an atomic store. */
5334 static inline tree *
5335 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5337 return &store_stmt->val;
5341 /* Set the LHS of an atomic load. */
5343 static inline void
5344 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5346 load_stmt->lhs = lhs;
5350 /* Get the LHS of an atomic load. */
5352 static inline tree
5353 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5355 return load_stmt->lhs;
5359 /* Return a pointer to the LHS of an atomic load. */
5361 static inline tree *
5362 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5364 return &load_stmt->lhs;
5368 /* Set the RHS of an atomic load. */
5370 static inline void
5371 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5373 load_stmt->rhs = rhs;
5377 /* Get the RHS of an atomic load. */
5379 static inline tree
5380 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5382 return load_stmt->rhs;
5386 /* Return a pointer to the RHS of an atomic load. */
5388 static inline tree *
5389 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5391 return &load_stmt->rhs;
5395 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5397 static inline tree
5398 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5400 return cont_stmt->control_def;
5403 /* The same as above, but return the address. */
5405 static inline tree *
5406 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5408 return &cont_stmt->control_def;
5411 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5413 static inline void
5414 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
5416 cont_stmt->control_def = def;
5420 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5422 static inline tree
5423 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
5425 return cont_stmt->control_use;
5429 /* The same as above, but return the address. */
5431 static inline tree *
5432 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
5434 return &cont_stmt->control_use;
5438 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5440 static inline void
5441 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
5443 cont_stmt->control_use = use;
5446 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5447 TRANSACTION_STMT. */
5449 static inline gimple_seq *
5450 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
5452 return &transaction_stmt->body;
5455 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5457 static inline gimple_seq
5458 gimple_transaction_body (gtransaction *transaction_stmt)
5460 return *gimple_transaction_body_ptr (transaction_stmt);
5463 /* Return the label associated with a GIMPLE_TRANSACTION. */
5465 static inline tree
5466 gimple_transaction_label (const gtransaction *transaction_stmt)
5468 return transaction_stmt->label;
5471 static inline tree *
5472 gimple_transaction_label_ptr (gtransaction *transaction_stmt)
5474 return &transaction_stmt->label;
5477 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5479 static inline unsigned int
5480 gimple_transaction_subcode (const gtransaction *transaction_stmt)
5482 return transaction_stmt->subcode;
5485 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5486 TRANSACTION_STMT. */
5488 static inline void
5489 gimple_transaction_set_body (gtransaction *transaction_stmt,
5490 gimple_seq body)
5492 transaction_stmt->body = body;
5495 /* Set the label associated with a GIMPLE_TRANSACTION. */
5497 static inline void
5498 gimple_transaction_set_label (gtransaction *transaction_stmt, tree label)
5500 transaction_stmt->label = label;
5503 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5505 static inline void
5506 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
5507 unsigned int subcode)
5509 transaction_stmt->subcode = subcode;
5513 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5515 static inline tree *
5516 gimple_return_retval_ptr (const greturn *gs)
5518 return gimple_op_ptr (gs, 0);
5521 /* Return the return value for GIMPLE_RETURN GS. */
5523 static inline tree
5524 gimple_return_retval (const greturn *gs)
5526 return gimple_op (gs, 0);
5530 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5532 static inline void
5533 gimple_return_set_retval (greturn *gs, tree retval)
5535 gimple_set_op (gs, 0, retval);
5539 /* Return the return bounds for GIMPLE_RETURN GS. */
5541 static inline tree
5542 gimple_return_retbnd (const_gimple gs)
5544 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5545 return gimple_op (gs, 1);
5549 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
5551 static inline void
5552 gimple_return_set_retbnd (gimple gs, tree retval)
5554 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5555 gimple_set_op (gs, 1, retval);
5559 /* Returns true when the gimple statement STMT is any of the OMP types. */
5561 #define CASE_GIMPLE_OMP \
5562 case GIMPLE_OMP_PARALLEL: \
5563 case GIMPLE_OMP_TASK: \
5564 case GIMPLE_OMP_FOR: \
5565 case GIMPLE_OMP_SECTIONS: \
5566 case GIMPLE_OMP_SECTIONS_SWITCH: \
5567 case GIMPLE_OMP_SINGLE: \
5568 case GIMPLE_OMP_TARGET: \
5569 case GIMPLE_OMP_TEAMS: \
5570 case GIMPLE_OMP_SECTION: \
5571 case GIMPLE_OMP_MASTER: \
5572 case GIMPLE_OMP_TASKGROUP: \
5573 case GIMPLE_OMP_ORDERED: \
5574 case GIMPLE_OMP_CRITICAL: \
5575 case GIMPLE_OMP_RETURN: \
5576 case GIMPLE_OMP_ATOMIC_LOAD: \
5577 case GIMPLE_OMP_ATOMIC_STORE: \
5578 case GIMPLE_OMP_CONTINUE
5580 static inline bool
5581 is_gimple_omp (const_gimple stmt)
5583 switch (gimple_code (stmt))
5585 CASE_GIMPLE_OMP:
5586 return true;
5587 default:
5588 return false;
5592 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
5593 specifically. */
5595 static inline bool
5596 is_gimple_omp_oacc (const_gimple stmt)
5598 gcc_assert (is_gimple_omp (stmt));
5599 switch (gimple_code (stmt))
5601 case GIMPLE_OMP_FOR:
5602 switch (gimple_omp_for_kind (stmt))
5604 case GF_OMP_FOR_KIND_OACC_LOOP:
5605 return true;
5606 default:
5607 return false;
5609 case GIMPLE_OMP_TARGET:
5610 switch (gimple_omp_target_kind (stmt))
5612 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
5613 case GF_OMP_TARGET_KIND_OACC_KERNELS:
5614 case GF_OMP_TARGET_KIND_OACC_DATA:
5615 case GF_OMP_TARGET_KIND_OACC_UPDATE:
5616 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
5617 return true;
5618 default:
5619 return false;
5621 default:
5622 return false;
5627 /* Return true if the OMP gimple statement STMT is offloaded. */
5629 static inline bool
5630 is_gimple_omp_offloaded (const_gimple stmt)
5632 gcc_assert (is_gimple_omp (stmt));
5633 switch (gimple_code (stmt))
5635 case GIMPLE_OMP_TARGET:
5636 switch (gimple_omp_target_kind (stmt))
5638 case GF_OMP_TARGET_KIND_REGION:
5639 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
5640 case GF_OMP_TARGET_KIND_OACC_KERNELS:
5641 return true;
5642 default:
5643 return false;
5645 default:
5646 return false;
5651 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5653 static inline bool
5654 gimple_nop_p (const_gimple g)
5656 return gimple_code (g) == GIMPLE_NOP;
5660 /* Return true if GS is a GIMPLE_RESX. */
5662 static inline bool
5663 is_gimple_resx (const_gimple gs)
5665 return gimple_code (gs) == GIMPLE_RESX;
5668 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5670 static inline enum br_predictor
5671 gimple_predict_predictor (gimple gs)
5673 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5674 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5678 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5680 static inline void
5681 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5683 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5684 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5685 | (unsigned) predictor;
5689 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5691 static inline enum prediction
5692 gimple_predict_outcome (gimple gs)
5694 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5695 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5699 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5701 static inline void
5702 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5704 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5705 if (outcome == TAKEN)
5706 gs->subcode |= GF_PREDICT_TAKEN;
5707 else
5708 gs->subcode &= ~GF_PREDICT_TAKEN;
5712 /* Return the type of the main expression computed by STMT. Return
5713 void_type_node if the statement computes nothing. */
5715 static inline tree
5716 gimple_expr_type (const_gimple stmt)
5718 enum gimple_code code = gimple_code (stmt);
5720 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5722 tree type;
5723 /* In general we want to pass out a type that can be substituted
5724 for both the RHS and the LHS types if there is a possibly
5725 useless conversion involved. That means returning the
5726 original RHS type as far as we can reconstruct it. */
5727 if (code == GIMPLE_CALL)
5729 const gcall *call_stmt = as_a <const gcall *> (stmt);
5730 if (gimple_call_internal_p (call_stmt)
5731 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
5732 type = TREE_TYPE (gimple_call_arg (call_stmt, 3));
5733 else
5734 type = gimple_call_return_type (call_stmt);
5736 else
5737 switch (gimple_assign_rhs_code (stmt))
5739 case POINTER_PLUS_EXPR:
5740 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5741 break;
5743 default:
5744 /* As fallback use the type of the LHS. */
5745 type = TREE_TYPE (gimple_get_lhs (stmt));
5746 break;
5748 return type;
5750 else if (code == GIMPLE_COND)
5751 return boolean_type_node;
5752 else
5753 return void_type_node;
5756 /* Enum and arrays used for allocation stats. Keep in sync with
5757 gimple.c:gimple_alloc_kind_names. */
5758 enum gimple_alloc_kind
5760 gimple_alloc_kind_assign, /* Assignments. */
5761 gimple_alloc_kind_phi, /* PHI nodes. */
5762 gimple_alloc_kind_cond, /* Conditionals. */
5763 gimple_alloc_kind_rest, /* Everything else. */
5764 gimple_alloc_kind_all
5767 extern int gimple_alloc_counts[];
5768 extern int gimple_alloc_sizes[];
5770 /* Return the allocation kind for a given stmt CODE. */
5771 static inline enum gimple_alloc_kind
5772 gimple_alloc_kind (enum gimple_code code)
5774 switch (code)
5776 case GIMPLE_ASSIGN:
5777 return gimple_alloc_kind_assign;
5778 case GIMPLE_PHI:
5779 return gimple_alloc_kind_phi;
5780 case GIMPLE_COND:
5781 return gimple_alloc_kind_cond;
5782 default:
5783 return gimple_alloc_kind_rest;
5787 /* Return true if a location should not be emitted for this statement
5788 by annotate_all_with_location. */
5790 static inline bool
5791 gimple_do_not_emit_location_p (gimple g)
5793 return gimple_plf (g, GF_PLF_1);
5796 /* Mark statement G so a location will not be emitted by
5797 annotate_one_with_location. */
5799 static inline void
5800 gimple_set_do_not_emit_location (gimple g)
5802 /* The PLF flags are initialized to 0 when a new tuple is created,
5803 so no need to initialize it anywhere. */
5804 gimple_set_plf (g, GF_PLF_1, true);
5808 /* Macros for showing usage statistics. */
5809 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5810 ? (x) \
5811 : ((x) < 1024*1024*10 \
5812 ? (x) / 1024 \
5813 : (x) / (1024*1024))))
5815 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5817 #endif /* GCC_GIMPLE_H */