1/* Gimple IR definitions.
2
3 Copyright (C) 2007-2026 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 3, or (at your option) any later
11version.
12
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16for more details.
17
18You should have received a copy of the GNU General Public License
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
21
22#ifndef GCC_GIMPLE_H
23#define GCC_GIMPLE_H
24
25#include "tree-ssa-alias.h"
26#include "gimple-expr.h"
27
28typedef gimple *gimple_seq_node;
29
30enum gimple_code {
31#define DEFGSCODE(SYM, STRING, STRUCT) SYM,
32#include "gimple.def"
33#undef DEFGSCODE
34 LAST_AND_UNUSED_GIMPLE_CODE
35};
36
37extern const char *const gimple_code_name[];
38extern const unsigned char gimple_rhs_class_table[];
39
40/* Error out if a gimple tuple is addressed incorrectly. */
41#if defined ENABLE_GIMPLE_CHECKING
42#define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
43extern void gimple_check_failed (const gimple *, const char *, int, \
44 const char *, enum gimple_code, \
45 enum tree_code) ATTRIBUTE_NORETURN \
46 ATTRIBUTE_COLD;
47
48#define GIMPLE_CHECK(GS, CODE) \
49 do { \
50 const gimple *__gs = (GS); \
51 if (gimple_code (__gs) != (CODE)) \
52 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
53 (CODE), ERROR_MARK); \
54 } while (0)
55template <typename T>
56inline T
57GIMPLE_CHECK2(const gimple *gs,
58#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
59 const char *file = __builtin_FILE (),
60 int line = __builtin_LINE (),
61 const char *fun = __builtin_FUNCTION ())
62#else
63 const char *file = __FILE__,
64 int line = __LINE__,
65 const char *fun = NULL)
66#endif
67{
68 T ret = dyn_cast <T> (gs);
69 if (!ret)
70 gimple_check_failed (gs, file, line, fun,
71 std::remove_pointer<T>::type::code_, ERROR_MARK);
72 return ret;
73}
74template <typename T>
75inline T
76GIMPLE_CHECK2(gimple *gs,
77#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
78 const char *file = __builtin_FILE (),
79 int line = __builtin_LINE (),
80 const char *fun = __builtin_FUNCTION ())
81#else
82 const char *file = __FILE__,
83 int line = __LINE__,
84 const char *fun = NULL)
85#endif
86{
87 T ret = dyn_cast <T> (gs);
88 if (!ret)
89 gimple_check_failed (gs, file, line, fun,
90 std::remove_pointer<T>::type::code_, ERROR_MARK);
91 return ret;
92}
93#else /* not ENABLE_GIMPLE_CHECKING */
94#define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
95#define GIMPLE_CHECK(GS, CODE) (void)0
96template <typename T>
97inline T
98GIMPLE_CHECK2(gimple *gs)
99{
100 return as_a <T> (gs);
101}
102template <typename T>
103inline T
104GIMPLE_CHECK2(const gimple *gs)
105{
106 return as_a <T> (gs);
107}
108#endif
109
110/* Class of GIMPLE expressions suitable for the RHS of assignments. See
111 get_gimple_rhs_class. */
112enum gimple_rhs_class
113{
114 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
115 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
116 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
117 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
118 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
119 name, a _DECL, a _REF, etc. */
120};
121
122/* Specific flags for individual GIMPLE statements. These flags are
123 always stored in gimple.subcode and they may only be
124 defined for statement codes that do not use subcodes.
125
126 Values for the masks can overlap as long as the overlapping values
127 are never used in the same statement class.
128
129 The maximum mask value that can be defined is 1 << 15 (i.e., each
130 statement code can hold up to 16 bitflags).
131
132 Keep this list sorted. */
133enum gf_mask {
134 GF_ASM_BASIC = 1 << 0,
135 GF_ASM_VOLATILE = 1 << 1,
136 GF_ASM_INLINE = 1 << 2,
137 GF_CALL_FROM_THUNK = 1 << 0,
138 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
139 GF_CALL_TAILCALL = 1 << 2,
140 GF_CALL_VA_ARG_PACK = 1 << 3,
141 GF_CALL_NOTHROW = 1 << 4,
142 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
143 GF_CALL_INTERNAL = 1 << 6,
144 GF_CALL_CTRL_ALTERING = 1 << 7,
145 GF_CALL_MUST_TAIL_CALL = 1 << 9,
146 GF_CALL_BY_DESCRIPTOR = 1 << 10,
147 GF_CALL_NOCF_CHECK = 1 << 11,
148 GF_CALL_FROM_NEW_OR_DELETE = 1 << 12,
149 GF_CALL_XTHROW = 1 << 13,
150 GF_OMP_PARALLEL_COMBINED = 1 << 0,
151 GF_OMP_TASK_TASKLOOP = 1 << 0,
152 GF_OMP_TASK_TASKWAIT = 1 << 1,
153 GF_OMP_FOR_KIND_MASK = (1 << 3) - 1,
154 GF_OMP_FOR_KIND_FOR = 0,
155 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
156 GF_OMP_FOR_KIND_TASKLOOP = 2,
157 GF_OMP_FOR_KIND_OACC_LOOP = 4,
158 GF_OMP_FOR_KIND_SIMD = 5,
159 GF_OMP_FOR_COMBINED = 1 << 3,
160 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
161 GF_OMP_TARGET_KIND_MASK = (1 << 5) - 1,
162 GF_OMP_TARGET_KIND_REGION = 0,
163 GF_OMP_TARGET_KIND_DATA = 1,
164 GF_OMP_TARGET_KIND_UPDATE = 2,
165 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
166 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
167 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
168 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
169 GF_OMP_TARGET_KIND_OACC_SERIAL = 7,
170 GF_OMP_TARGET_KIND_OACC_DATA = 8,
171 GF_OMP_TARGET_KIND_OACC_UPDATE = 9,
172 GF_OMP_TARGET_KIND_OACC_ENTER_DATA = 10,
173 GF_OMP_TARGET_KIND_OACC_EXIT_DATA = 11,
174 GF_OMP_TARGET_KIND_OACC_DECLARE = 12,
175 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 13,
176 /* A 'GF_OMP_TARGET_KIND_OACC_PARALLEL' representing an OpenACC 'kernels'
177 decomposed part, parallelized. */
178 GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED = 14,
179 /* A 'GF_OMP_TARGET_KIND_OACC_PARALLEL' representing an OpenACC 'kernels'
180 decomposed part, "gang-single". */
181 GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE = 15,
182 /* A 'GF_OMP_TARGET_KIND_OACC_DATA' representing an OpenACC 'kernels'
183 decomposed parts' 'data' construct. */
184 GF_OMP_TARGET_KIND_OACC_DATA_KERNELS = 16,
185 GF_OMP_TEAMS_HOST = 1 << 0,
186
187 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
188 a thread synchronization via some sort of barrier. The exact barrier
189 that would otherwise be emitted is dependent on the OMP statement with
190 which this return is associated. */
191 GF_OMP_RETURN_NOWAIT = 1 << 0,
192
193 GF_OMP_SECTION_LAST = 1 << 0,
194 GF_OMP_ORDERED_STANDALONE = 1 << 0,
195 GF_OMP_ATOMIC_MEMORY_ORDER = (1 << 6) - 1,
196 GF_OMP_ATOMIC_NEED_VALUE = 1 << 6,
197 GF_OMP_ATOMIC_WEAK = 1 << 7,
198 GF_PREDICT_TAKEN = 1 << 15
199};
200
201/* This subcode tells apart different kinds of stmts that are not used
202 for codegen, but rather to retain debug information. */
203enum gimple_debug_subcode {
204 GIMPLE_DEBUG_BIND = 0,
205 GIMPLE_DEBUG_SOURCE_BIND = 1,
206 GIMPLE_DEBUG_BEGIN_STMT = 2,
207 GIMPLE_DEBUG_INLINE_ENTRY = 3
208};
209
210/* Masks for selecting a pass local flag (PLF) to work on. These
211 masks are used by gimple_set_plf and gimple_plf. */
212enum plf_mask {
213 GF_PLF_1 = 1 << 0,
214 GF_PLF_2 = 1 << 1
215};
216
217/* Data structure definitions for GIMPLE tuples. NOTE: word markers
218 are for 64 bit hosts. */
219
220struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
221 chain_next ("%h.next"), variable_size))
222 gimple
223{
224 /* [ WORD 1 ]
225 Main identifying code for a tuple. */
226 ENUM_BITFIELD(gimple_code) code : 8;
227
228 /* Nonzero if a warning should not be emitted on this tuple. */
229 unsigned int no_warning : 1;
230
231 /* Nonzero if this tuple has been visited. Passes are responsible
232 for clearing this bit before using it. */
233 unsigned int visited : 1;
234
235 /* Nonzero if this tuple represents a non-temporal move; currently
236 only stores are supported. */
237 unsigned int nontemporal_move : 1;
238
239 /* Pass local flags. These flags are free for any pass to use as
240 they see fit. Passes should not assume that these flags contain
241 any useful value when the pass starts. Any initial state that
242 the pass requires should be set on entry to the pass. See
243 gimple_set_plf and gimple_plf for usage. */
244 unsigned int plf : 2;
245
246 /* Nonzero if this statement has been modified and needs to have its
247 operands rescanned. */
248 unsigned modified : 1;
249
250 /* Nonzero if this statement contains volatile operands. */
251 unsigned has_volatile_ops : 1;
252
253 /* Infrastructure local flag. Always clear. */
254 unsigned ilf : 1;
255
256 /* The SUBCODE field can be used for tuple-specific flags for tuples
257 that do not require subcodes. Note that SUBCODE should be at
258 least as wide as tree codes, as several tuples store tree codes
259 in there. */
260 unsigned int subcode : 16;
261
262 /* UID of this statement. This is used by passes that want to assign IDs
263 to statements. It must be assigned and used by each pass. By default
264 it should be assumed to contain garbage. */
265 unsigned uid;
266
267 /* [ WORD 2 ]
268 Number of operands in this tuple. */
269 unsigned num_ops;
270
271 /* Unused 32 bits padding on 64-bit hosts. */
272
273 /* [ WORD 3 ]
274 Locus information for debug info. */
275 location_t location;
276
277 /* [ WORD 4 ]
278 Basic block holding this statement. */
279 basic_block bb;
280
281 /* [ WORD 5-6 ]
282 Linked lists of gimple statements. The next pointers form
283 a NULL terminated list, the prev pointers are a cyclic list.
284 A gimple statement is hence also a double-ended list of
285 statements, with the pointer itself being the first element,
286 and the prev pointer being the last. */
287 gimple *next;
288 gimple *GTY((skip)) prev;
289};
290
291
292/* Base structure for tuples with operands. */
293
294/* This gimple subclass has no tag value. */
295struct GTY(())
296 gimple_statement_with_ops_base : public gimple
297{
298 /* [ WORD 1-6 ] : base class */
299
300 /* [ WORD 7 ]
301 SSA operand vectors. NOTE: It should be possible to
302 amalgamate these vectors with the operand vector OP. However,
303 the SSA operand vectors are organized differently and contain
304 more information (like immediate use chaining). */
305 struct use_optype_d GTY((skip (""))) *use_ops;
306};
307
308
309/* Statements that take register operands. */
310
311struct GTY((tag("GSS_WITH_OPS")))
312 gimple_statement_with_ops : public gimple_statement_with_ops_base
313{
314 /* [ WORD 1-7 ] : base class */
315
316 /* [ WORD 8 ]
317 Operand vector. NOTE! This must always be the last field
318 of this structure. In particular, this means that this
319 structure cannot be embedded inside another one. */
320 tree GTY((length ("%h.num_ops"))) op[1];
321};
322
323
324/* Base for statements that take both memory and register operands. */
325
326struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
327 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
328{
329 /* [ WORD 1-7 ] : base class */
330
331 /* [ WORD 8-9 ]
332 Virtual operands for this statement. The GC will pick them
333 up via the ssa_names array. */
334 tree GTY((skip (""))) vdef;
335 tree GTY((skip (""))) vuse;
336};
337
338
339/* Statements that take both memory and register operands. */
340
341struct GTY((tag("GSS_WITH_MEM_OPS")))
342 gimple_statement_with_memory_ops :
343 public gimple_statement_with_memory_ops_base
344{
345 /* [ WORD 1-9 ] : base class */
346
347 /* [ WORD 10 ]
348 Operand vector. NOTE! This must always be the last field
349 of this structure. In particular, this means that this
350 structure cannot be embedded inside another one. */
351 tree GTY((length ("%h.num_ops"))) op[1];
352};
353
354
355/* Call statements that take both memory and register operands. */
356
357struct GTY((tag("GSS_CALL")))
358 gcall : public gimple_statement_with_memory_ops_base
359{
360 /* [ WORD 1-9 ] : base class */
361
362 /* [ WORD 10-13 ] */
363 struct pt_solution call_used;
364 struct pt_solution call_clobbered;
365
366 /* [ WORD 14 ] */
367 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
368 tree GTY ((tag ("0"))) fntype;
369 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
370 } u;
371
372 /* [ WORD 15 ]
373 Operand vector. NOTE! This must always be the last field
374 of this structure. In particular, this means that this
375 structure cannot be embedded inside another one. */
376 tree GTY((length ("%h.num_ops"))) op[1];
377
378 static const enum gimple_code code_ = GIMPLE_CALL;
379};
380
381
382/* OMP statements. */
383
384struct GTY((tag("GSS_OMP")))
385 gimple_statement_omp : public gimple
386{
387 /* [ WORD 1-6 ] : base class */
388
389 /* [ WORD 7 ] */
390 gimple_seq body;
391};
392
393
394/* GIMPLE_BIND */
395
396struct GTY((tag("GSS_BIND")))
397 gbind : public gimple
398{
399 /* [ WORD 1-6 ] : base class */
400
401 /* [ WORD 7 ]
402 Variables declared in this scope. */
403 tree vars;
404
405 /* [ WORD 8 ]
406 This is different than the BLOCK field in gimple,
407 which is analogous to TREE_BLOCK (i.e., the lexical block holding
408 this statement). This field is the equivalent of BIND_EXPR_BLOCK
409 in tree land (i.e., the lexical scope defined by this bind). See
410 gimple-low.cc. */
411 tree block;
412
413 /* [ WORD 9 ] */
414 gimple_seq body;
415};
416
417
418/* GIMPLE_CATCH */
419
420struct GTY((tag("GSS_CATCH")))
421 gcatch : public gimple
422{
423 /* [ WORD 1-6 ] : base class */
424
425 /* [ WORD 7 ] */
426 tree types;
427
428 /* [ WORD 8 ] */
429 gimple_seq handler;
430};
431
432
433/* GIMPLE_EH_FILTER */
434
435struct GTY((tag("GSS_EH_FILTER")))
436 geh_filter : public gimple
437{
438 /* [ WORD 1-6 ] : base class */
439
440 /* [ WORD 7 ]
441 Filter types. */
442 tree types;
443
444 /* [ WORD 8 ]
445 Failure actions. */
446 gimple_seq failure;
447};
448
449/* GIMPLE_EH_ELSE */
450
451struct GTY((tag("GSS_EH_ELSE")))
452 geh_else : public gimple
453{
454 /* [ WORD 1-6 ] : base class */
455
456 /* [ WORD 7,8 ] */
457 gimple_seq n_body, e_body;
458};
459
460/* GIMPLE_EH_MUST_NOT_THROW */
461
462struct GTY((tag("GSS_EH_MNT")))
463 geh_mnt : public gimple
464{
465 /* [ WORD 1-6 ] : base class */
466
467 /* [ WORD 7 ] Abort function decl. */
468 tree fndecl;
469};
470
471/* GIMPLE_PHI */
472
473struct GTY((tag("GSS_PHI")))
474 gphi : public gimple
475{
476 /* [ WORD 1-6 ] : base class */
477
478 /* [ WORD 7 ] */
479 unsigned capacity;
480 unsigned nargs;
481
482 /* [ WORD 8 ] */
483 tree result;
484
485 /* [ WORD 9-14 ] */
486 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
487};
488
489
490/* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
491
492struct GTY((tag("GSS_EH_CTRL")))
493 gimple_statement_eh_ctrl : public gimple
494{
495 /* [ WORD 1-6 ] : base class */
496
497 /* [ WORD 7 ]
498 Exception region number. */
499 int region;
500};
501
502struct GTY((tag("GSS_EH_CTRL")))
503 gresx : public gimple_statement_eh_ctrl
504{
505 /* No extra fields; adds invariant:
506 stmt->code == GIMPLE_RESX. */
507};
508
509struct GTY((tag("GSS_EH_CTRL")))
510 geh_dispatch : public gimple_statement_eh_ctrl
511{
512 /* No extra fields; adds invariant:
513 stmt->code == GIMPLE_EH_DISPATH. */
514};
515
516
517/* GIMPLE_TRY */
518
519struct GTY((tag("GSS_TRY")))
520 gtry : public gimple
521{
522 /* [ WORD 1-6 ] : base class */
523
524 /* [ WORD 7 ]
525 Expression to evaluate. */
526 gimple_seq eval;
527
528 /* [ WORD 8 ]
529 Cleanup expression. */
530 gimple_seq cleanup;
531};
532
533/* Kind of GIMPLE_TRY statements. */
534enum gimple_try_flags
535{
536 /* A try/catch. */
537 GIMPLE_TRY_CATCH = 1 << 0,
538
539 /* A try/finally. */
540 GIMPLE_TRY_FINALLY = 1 << 1,
541 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
542
543 /* Analogous to TRY_CATCH_IS_CLEANUP. */
544 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
545};
546
547/* GIMPLE_WITH_CLEANUP_EXPR */
548
549struct GTY((tag("GSS_WCE")))
550 gimple_statement_wce : public gimple
551{
552 /* [ WORD 1-6 ] : base class */
553
554 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
555 executed if an exception is thrown, not on normal exit of its
556 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
557 in TARGET_EXPRs. */
558
559 /* [ WORD 7 ]
560 Cleanup expression. */
561 gimple_seq cleanup;
562};
563
564
565/* GIMPLE_ASM */
566
567struct GTY((tag("GSS_ASM")))
568 gasm : public gimple_statement_with_memory_ops_base
569{
570 /* [ WORD 1-9 ] : base class */
571
572 /* [ WORD 10 ]
573 __asm__ statement. */
574 const char *string;
575
576 /* [ WORD 11 ]
577 Number of inputs, outputs, clobbers, labels. */
578 unsigned char ni;
579 unsigned char no;
580 unsigned char nc;
581 unsigned char nl;
582
583 /* [ WORD 12 ]
584 Operand vector. NOTE! This must always be the last field
585 of this structure. In particular, this means that this
586 structure cannot be embedded inside another one. */
587 tree GTY((length ("%h.num_ops"))) op[1];
588};
589
590/* GIMPLE_OMP_CRITICAL */
591
592struct GTY((tag("GSS_OMP_CRITICAL")))
593 gomp_critical : public gimple_statement_omp
594{
595 /* [ WORD 1-7 ] : base class */
596
597 /* [ WORD 8 ] */
598 tree clauses;
599
600 /* [ WORD 9 ]
601 Critical section name. */
602 tree name;
603};
604
605
606struct GTY(()) gimple_omp_for_iter {
607 /* Condition code. */
608 enum tree_code cond;
609
610 /* Index variable. */
611 tree index;
612
613 /* Initial value. */
614 tree initial;
615
616 /* Final value. */
617 tree final;
618
619 /* Increment. */
620 tree incr;
621};
622
623/* GIMPLE_OMP_FOR */
624
625struct GTY((tag("GSS_OMP_FOR")))
626 gomp_for : public gimple_statement_omp
627{
628 /* [ WORD 1-7 ] : base class */
629
630 /* [ WORD 8 ] */
631 tree clauses;
632
633 /* [ WORD 9 ]
634 Number of elements in iter array. */
635 size_t collapse;
636
637 /* [ WORD 10 ] */
638 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
639
640 /* [ WORD 11 ]
641 Pre-body evaluated before the loop body begins. */
642 gimple_seq pre_body;
643};
644
645
646/* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
647
648struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
649 gimple_statement_omp_parallel_layout : public gimple_statement_omp
650{
651 /* [ WORD 1-7 ] : base class */
652
653 /* [ WORD 8 ]
654 Clauses. */
655 tree clauses;
656
657 /* [ WORD 9 ]
658 Child function holding the body of the parallel region. */
659 tree child_fn;
660
661 /* [ WORD 10 ]
662 Shared data argument. */
663 tree data_arg;
664};
665
666/* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
667struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
668 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
669{
670 /* No extra fields; adds invariant:
671 stmt->code == GIMPLE_OMP_PARALLEL
672 || stmt->code == GIMPLE_OMP_TASK
673 || stmt->code == GIMPLE_OMP_TEAMS. */
674};
675
676/* GIMPLE_OMP_PARALLEL */
677struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
678 gomp_parallel : public gimple_statement_omp_taskreg
679{
680 /* No extra fields; adds invariant:
681 stmt->code == GIMPLE_OMP_PARALLEL. */
682};
683
684/* GIMPLE_OMP_TARGET */
685struct GTY((tag("GSS_OMP_TARGET")))
686 gomp_target : public gimple_statement_omp_parallel_layout
687{
688 /* [ WORD 1-10 ] : base class */
689
690 /* [ WORD 11 ]
691 Iterator loops. */
692 gimple_seq iterator_loops;
693};
694
695/* GIMPLE_OMP_TASK */
696
697struct GTY((tag("GSS_OMP_TASK")))
698 gomp_task : public gimple_statement_omp_taskreg
699{
700 /* [ WORD 1-10 ] : base class */
701
702 /* [ WORD 11 ]
703 Child function holding firstprivate initialization if needed. */
704 tree copy_fn;
705
706 /* [ WORD 12-13 ]
707 Size and alignment in bytes of the argument data block. */
708 tree arg_size;
709 tree arg_align;
710};
711
712
713/* GIMPLE_OMP_SECTION */
714/* Uses struct gimple_statement_omp. */
715
716
717/* GIMPLE_OMP_SECTIONS */
718
719struct GTY((tag("GSS_OMP_SECTIONS")))
720 gomp_sections : public gimple_statement_omp
721{
722 /* [ WORD 1-7 ] : base class */
723
724 /* [ WORD 8 ] */
725 tree clauses;
726
727 /* [ WORD 9 ]
728 The control variable used for deciding which of the sections to
729 execute. */
730 tree control;
731};
732
733/* GIMPLE_OMP_CONTINUE.
734
735 Note: This does not inherit from gimple_statement_omp, because we
736 do not need the body field. */
737
738struct GTY((tag("GSS_OMP_CONTINUE")))
739 gomp_continue : public gimple
740{
741 /* [ WORD 1-6 ] : base class */
742
743 /* [ WORD 7 ] */
744 tree control_def;
745
746 /* [ WORD 8 ] */
747 tree control_use;
748};
749
750/* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
751 GIMPLE_OMP_SCAN, GIMPLE_OMP_MASKED, GIMPLE_OMP_SCOPE, GIMPLE_OMP_DISPATCH,
752 GIMPLE_OMP_INTEROP. */
753
754struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
755 gimple_statement_omp_single_layout : public gimple_statement_omp
756{
757 /* [ WORD 1-7 ] : base class */
758
759 /* [ WORD 8 ] */
760 tree clauses;
761};
762
763struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
764 gomp_single : public gimple_statement_omp_single_layout
765{
766 /* No extra fields; adds invariant:
767 stmt->code == GIMPLE_OMP_SINGLE. */
768};
769
770struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
771 gomp_teams : public gimple_statement_omp_taskreg
772{
773 /* No extra fields; adds invariant:
774 stmt->code == GIMPLE_OMP_TEAMS. */
775};
776
777struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
778 gomp_ordered : public gimple_statement_omp_single_layout
779{
780 /* No extra fields; adds invariant:
781 stmt->code == GIMPLE_OMP_ORDERED. */
782};
783
784struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
785 gomp_scan : public gimple_statement_omp_single_layout
786{
787 /* No extra fields; adds invariant:
788 stmt->code == GIMPLE_OMP_SCAN. */
789};
790
791
792/* GIMPLE_OMP_ATOMIC_LOAD.
793 Note: This is based on gimple, not g_s_omp, because g_s_omp
794 contains a sequence, which we don't need here. */
795
796struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
797 gomp_atomic_load : public gimple
798{
799 /* [ WORD 1-6 ] : base class */
800
801 /* [ WORD 7-8 ] */
802 tree rhs, lhs;
803};
804
805/* GIMPLE_OMP_ATOMIC_STORE.
806 See note on GIMPLE_OMP_ATOMIC_LOAD. */
807
808struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
809 gimple_statement_omp_atomic_store_layout : public gimple
810{
811 /* [ WORD 1-6 ] : base class */
812
813 /* [ WORD 7 ] */
814 tree val;
815};
816
817struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
818 gomp_atomic_store :
819 public gimple_statement_omp_atomic_store_layout
820{
821 /* No extra fields; adds invariant:
822 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
823};
824
825struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
826 gimple_statement_omp_return :
827 public gimple_statement_omp_atomic_store_layout
828{
829 /* No extra fields; adds invariant:
830 stmt->code == GIMPLE_OMP_RETURN. */
831};
832
833/* Assumptions. */
834
835struct GTY((tag("GSS_ASSUME")))
836 gimple_statement_assume : public gimple
837{
838 /* [ WORD 1-6 ] : base class */
839
840 /* [ WORD 7 ] */
841 tree guard;
842
843 /* [ WORD 8 ] */
844 gimple_seq body;
845};
846
847/* GIMPLE_TRANSACTION. */
848
849/* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
850
851/* The __transaction_atomic was declared [[outer]] or it is
852 __transaction_relaxed. */
853#define GTMA_IS_OUTER (1u << 0)
854#define GTMA_IS_RELAXED (1u << 1)
855#define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
856
857/* The transaction is seen to not have an abort. */
858#define GTMA_HAVE_ABORT (1u << 2)
859/* The transaction is seen to have loads or stores. */
860#define GTMA_HAVE_LOAD (1u << 3)
861#define GTMA_HAVE_STORE (1u << 4)
862/* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
863#define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
864/* The transaction WILL enter serial irrevocable mode.
865 An irrevocable block post-dominates the entire transaction, such
866 that all invocations of the transaction will go serial-irrevocable.
867 In such case, we don't bother instrumenting the transaction, and
868 tell the runtime that it should begin the transaction in
869 serial-irrevocable mode. */
870#define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
871/* The transaction contains no instrumentation code whatsoever, most
872 likely because it is guaranteed to go irrevocable upon entry. */
873#define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
874
875struct GTY((tag("GSS_TRANSACTION")))
876 gtransaction : public gimple_statement_with_memory_ops_base
877{
878 /* [ WORD 1-9 ] : base class */
879
880 /* [ WORD 10 ] */
881 gimple_seq body;
882
883 /* [ WORD 11-13 ] */
884 tree label_norm;
885 tree label_uninst;
886 tree label_over;
887};
888
889#define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
890enum gimple_statement_structure_enum {
891#include "gsstruct.def"
892 LAST_GSS_ENUM
893};
894#undef DEFGSSTRUCT
895
896/* A statement with the invariant that
897 stmt->code == GIMPLE_COND
898 i.e. a conditional jump statement. */
899
900struct GTY((tag("GSS_WITH_OPS")))
901 gcond : public gimple_statement_with_ops
902{
903 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
904 static const enum gimple_code code_ = GIMPLE_COND;
905};
906
907/* A statement with the invariant that
908 stmt->code == GIMPLE_DEBUG
909 i.e. a debug statement. */
910
911struct GTY((tag("GSS_WITH_OPS")))
912 gdebug : public gimple_statement_with_ops
913{
914 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
915};
916
917/* A statement with the invariant that
918 stmt->code == GIMPLE_GOTO
919 i.e. a goto statement. */
920
921struct GTY((tag("GSS_WITH_OPS")))
922 ggoto : public gimple_statement_with_ops
923{
924 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
925};
926
927/* A statement with the invariant that
928 stmt->code == GIMPLE_LABEL
929 i.e. a label statement. */
930
931struct GTY((tag("GSS_WITH_OPS")))
932 glabel : public gimple_statement_with_ops
933{
934 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
935};
936
937/* A statement with the invariant that
938 stmt->code == GIMPLE_SWITCH
939 i.e. a switch statement. */
940
941struct GTY((tag("GSS_WITH_OPS")))
942 gswitch : public gimple_statement_with_ops
943{
944 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
945};
946
947/* A statement with the invariant that
948 stmt->code == GIMPLE_ASSIGN
949 i.e. an assignment statement. */
950
951struct GTY((tag("GSS_WITH_MEM_OPS")))
952 gassign : public gimple_statement_with_memory_ops
953{
954 static const enum gimple_code code_ = GIMPLE_ASSIGN;
955 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
956};
957
958/* A statement with the invariant that
959 stmt->code == GIMPLE_RETURN
960 i.e. a return statement. */
961
962struct GTY((tag("GSS_WITH_MEM_OPS")))
963 greturn : public gimple_statement_with_memory_ops
964{
965 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
966};
967
968template <>
969template <>
970inline bool
971is_a_helper <gasm *>::test (gimple *gs)
972{
973 return gs->code == GIMPLE_ASM;
974}
975
976template <>
977template <>
978inline bool
979is_a_helper <gassign *>::test (gimple *gs)
980{
981 return gs->code == GIMPLE_ASSIGN;
982}
983
984template <>
985template <>
986inline bool
987is_a_helper <const gassign *>::test (const gimple *gs)
988{
989 return gs->code == GIMPLE_ASSIGN;
990}
991
992template <>
993template <>
994inline bool
995is_a_helper <gbind *>::test (gimple *gs)
996{
997 return gs->code == GIMPLE_BIND;
998}
999
1000template <>
1001template <>
1002inline bool
1003is_a_helper <gcall *>::test (gimple *gs)
1004{
1005 return gs->code == GIMPLE_CALL;
1006}
1007
1008template <>
1009template <>
1010inline bool
1011is_a_helper <gcatch *>::test (gimple *gs)
1012{
1013 return gs->code == GIMPLE_CATCH;
1014}
1015
1016template <>
1017template <>
1018inline bool
1019is_a_helper <gcond *>::test (gimple *gs)
1020{
1021 return gs->code == GIMPLE_COND;
1022}
1023
1024template <>
1025template <>
1026inline bool
1027is_a_helper <const gcond *>::test (const gimple *gs)
1028{
1029 return gs->code == GIMPLE_COND;
1030}
1031
1032template <>
1033template <>
1034inline bool
1035is_a_helper <gdebug *>::test (gimple *gs)
1036{
1037 return gs->code == GIMPLE_DEBUG;
1038}
1039
1040template <>
1041template <>
1042inline bool
1043is_a_helper <const gdebug *>::test (const gimple *gs)
1044{
1045 return gs->code == GIMPLE_DEBUG;
1046}
1047
1048template <>
1049template <>
1050inline bool
1051is_a_helper <ggoto *>::test (gimple *gs)
1052{
1053 return gs->code == GIMPLE_GOTO;
1054}
1055
1056template <>
1057template <>
1058inline bool
1059is_a_helper <const ggoto *>::test (const gimple *gs)
1060{
1061 return gs->code == GIMPLE_GOTO;
1062}
1063
1064template <>
1065template <>
1066inline bool
1067is_a_helper <glabel *>::test (gimple *gs)
1068{
1069 return gs->code == GIMPLE_LABEL;
1070}
1071
1072template <>
1073template <>
1074inline bool
1075is_a_helper <const glabel *>::test (const gimple *gs)
1076{
1077 return gs->code == GIMPLE_LABEL;
1078}
1079
1080template <>
1081template <>
1082inline bool
1083is_a_helper <gresx *>::test (gimple *gs)
1084{
1085 return gs->code == GIMPLE_RESX;
1086}
1087
1088template <>
1089template <>
1090inline bool
1091is_a_helper <geh_dispatch *>::test (gimple *gs)
1092{
1093 return gs->code == GIMPLE_EH_DISPATCH;
1094}
1095
1096template <>
1097template <>
1098inline bool
1099is_a_helper <geh_else *>::test (gimple *gs)
1100{
1101 return gs->code == GIMPLE_EH_ELSE;
1102}
1103
1104template <>
1105template <>
1106inline bool
1107is_a_helper <const geh_else *>::test (const gimple *gs)
1108{
1109 return gs->code == GIMPLE_EH_ELSE;
1110}
1111
1112template <>
1113template <>
1114inline bool
1115is_a_helper <geh_filter *>::test (gimple *gs)
1116{
1117 return gs->code == GIMPLE_EH_FILTER;
1118}
1119
1120template <>
1121template <>
1122inline bool
1123is_a_helper <geh_mnt *>::test (gimple *gs)
1124{
1125 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1126}
1127
1128template <>
1129template <>
1130inline bool
1131is_a_helper <const geh_mnt *>::test (const gimple *gs)
1132{
1133 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1134}
1135
1136template <>
1137template <>
1138inline bool
1139is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1140{
1141 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1142}
1143
1144template <>
1145template <>
1146inline bool
1147is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1148{
1149 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1150}
1151
1152template <>
1153template <>
1154inline bool
1155is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1156{
1157 return gs->code == GIMPLE_OMP_RETURN;
1158}
1159
1160template <>
1161template <>
1162inline bool
1163is_a_helper <gomp_continue *>::test (gimple *gs)
1164{
1165 return gs->code == GIMPLE_OMP_CONTINUE;
1166}
1167
1168template <>
1169template <>
1170inline bool
1171is_a_helper <gomp_critical *>::test (gimple *gs)
1172{
1173 return gs->code == GIMPLE_OMP_CRITICAL;
1174}
1175
1176template <>
1177template <>
1178inline bool
1179is_a_helper <gomp_ordered *>::test (gimple *gs)
1180{
1181 return gs->code == GIMPLE_OMP_ORDERED;
1182}
1183
1184template <>
1185template <>
1186inline bool
1187is_a_helper <gomp_scan *>::test (gimple *gs)
1188{
1189 return gs->code == GIMPLE_OMP_SCAN;
1190}
1191
1192template <>
1193template <>
1194inline bool
1195is_a_helper <gomp_for *>::test (gimple *gs)
1196{
1197 return gs->code == GIMPLE_OMP_FOR;
1198}
1199
1200template <>
1201template <>
1202inline bool
1203is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1204{
1205 return (gs->code == GIMPLE_OMP_PARALLEL
1206 || gs->code == GIMPLE_OMP_TASK
1207 || gs->code == GIMPLE_OMP_TEAMS);
1208}
1209
1210template <>
1211template <>
1212inline bool
1213is_a_helper <gomp_parallel *>::test (gimple *gs)
1214{
1215 return gs->code == GIMPLE_OMP_PARALLEL;
1216}
1217
1218template <>
1219template <>
1220inline bool
1221is_a_helper <gomp_target *>::test (gimple *gs)
1222{
1223 return gs->code == GIMPLE_OMP_TARGET;
1224}
1225
1226template <>
1227template <>
1228inline bool
1229is_a_helper <gomp_sections *>::test (gimple *gs)
1230{
1231 return gs->code == GIMPLE_OMP_SECTIONS;
1232}
1233
1234template <>
1235template <>
1236inline bool
1237is_a_helper <gomp_single *>::test (gimple *gs)
1238{
1239 return gs->code == GIMPLE_OMP_SINGLE;
1240}
1241
1242template <>
1243template <>
1244inline bool
1245is_a_helper <gomp_teams *>::test (gimple *gs)
1246{
1247 return gs->code == GIMPLE_OMP_TEAMS;
1248}
1249
1250template <>
1251template <>
1252inline bool
1253is_a_helper <gomp_task *>::test (gimple *gs)
1254{
1255 return gs->code == GIMPLE_OMP_TASK;
1256}
1257
1258template <>
1259template <>
1260inline bool
1261is_a_helper <gphi *>::test (gimple *gs)
1262{
1263 return gs->code == GIMPLE_PHI;
1264}
1265
1266template <>
1267template <>
1268inline bool
1269is_a_helper <greturn *>::test (gimple *gs)
1270{
1271 return gs->code == GIMPLE_RETURN;
1272}
1273
1274template <>
1275template <>
1276inline bool
1277is_a_helper <gswitch *>::test (gimple *gs)
1278{
1279 return gs->code == GIMPLE_SWITCH;
1280}
1281
1282template <>
1283template <>
1284inline bool
1285is_a_helper <const gswitch *>::test (const gimple *gs)
1286{
1287 return gs->code == GIMPLE_SWITCH;
1288}
1289
1290template <>
1291template <>
1292inline bool
1293is_a_helper <gimple_statement_assume *>::test (gimple *gs)
1294{
1295 return gs->code == GIMPLE_ASSUME;
1296}
1297
1298template <>
1299template <>
1300inline bool
1301is_a_helper <gtransaction *>::test (gimple *gs)
1302{
1303 return gs->code == GIMPLE_TRANSACTION;
1304}
1305
1306template <>
1307template <>
1308inline bool
1309is_a_helper <gtry *>::test (gimple *gs)
1310{
1311 return gs->code == GIMPLE_TRY;
1312}
1313
1314template <>
1315template <>
1316inline bool
1317is_a_helper <const gtry *>::test (const gimple *gs)
1318{
1319 return gs->code == GIMPLE_TRY;
1320}
1321
1322template <>
1323template <>
1324inline bool
1325is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1326{
1327 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1328}
1329
1330template <>
1331template <>
1332inline bool
1333is_a_helper <const gasm *>::test (const gimple *gs)
1334{
1335 return gs->code == GIMPLE_ASM;
1336}
1337
1338template <>
1339template <>
1340inline bool
1341is_a_helper <const gbind *>::test (const gimple *gs)
1342{
1343 return gs->code == GIMPLE_BIND;
1344}
1345
1346template <>
1347template <>
1348inline bool
1349is_a_helper <const gcall *>::test (const gimple *gs)
1350{
1351 return gs->code == GIMPLE_CALL;
1352}
1353
1354template <>
1355template <>
1356inline bool
1357is_a_helper <const gcatch *>::test (const gimple *gs)
1358{
1359 return gs->code == GIMPLE_CATCH;
1360}
1361
1362template <>
1363template <>
1364inline bool
1365is_a_helper <const gresx *>::test (const gimple *gs)
1366{
1367 return gs->code == GIMPLE_RESX;
1368}
1369
1370template <>
1371template <>
1372inline bool
1373is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1374{
1375 return gs->code == GIMPLE_EH_DISPATCH;
1376}
1377
1378template <>
1379template <>
1380inline bool
1381is_a_helper <const geh_filter *>::test (const gimple *gs)
1382{
1383 return gs->code == GIMPLE_EH_FILTER;
1384}
1385
1386template <>
1387template <>
1388inline bool
1389is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1390{
1391 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1392}
1393
1394template <>
1395template <>
1396inline bool
1397is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1398{
1399 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1400}
1401
1402template <>
1403template <>
1404inline bool
1405is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1406{
1407 return gs->code == GIMPLE_OMP_RETURN;
1408}
1409
1410template <>
1411template <>
1412inline bool
1413is_a_helper <const gomp_continue *>::test (const gimple *gs)
1414{
1415 return gs->code == GIMPLE_OMP_CONTINUE;
1416}
1417
1418template <>
1419template <>
1420inline bool
1421is_a_helper <const gomp_critical *>::test (const gimple *gs)
1422{
1423 return gs->code == GIMPLE_OMP_CRITICAL;
1424}
1425
1426template <>
1427template <>
1428inline bool
1429is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1430{
1431 return gs->code == GIMPLE_OMP_ORDERED;
1432}
1433
1434template <>
1435template <>
1436inline bool
1437is_a_helper <const gomp_scan *>::test (const gimple *gs)
1438{
1439 return gs->code == GIMPLE_OMP_SCAN;
1440}
1441
1442template <>
1443template <>
1444inline bool
1445is_a_helper <const gomp_for *>::test (const gimple *gs)
1446{
1447 return gs->code == GIMPLE_OMP_FOR;
1448}
1449
1450template <>
1451template <>
1452inline bool
1453is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1454{
1455 return (gs->code == GIMPLE_OMP_PARALLEL
1456 || gs->code == GIMPLE_OMP_TASK
1457 || gs->code == GIMPLE_OMP_TEAMS);
1458}
1459
1460template <>
1461template <>
1462inline bool
1463is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1464{
1465 return gs->code == GIMPLE_OMP_PARALLEL;
1466}
1467
1468template <>
1469template <>
1470inline bool
1471is_a_helper <const gomp_target *>::test (const gimple *gs)
1472{
1473 return gs->code == GIMPLE_OMP_TARGET;
1474}
1475
1476template <>
1477template <>
1478inline bool
1479is_a_helper <const gomp_sections *>::test (const gimple *gs)
1480{
1481 return gs->code == GIMPLE_OMP_SECTIONS;
1482}
1483
1484template <>
1485template <>
1486inline bool
1487is_a_helper <const gomp_single *>::test (const gimple *gs)
1488{
1489 return gs->code == GIMPLE_OMP_SINGLE;
1490}
1491
1492template <>
1493template <>
1494inline bool
1495is_a_helper <const gomp_teams *>::test (const gimple *gs)
1496{
1497 return gs->code == GIMPLE_OMP_TEAMS;
1498}
1499
1500template <>
1501template <>
1502inline bool
1503is_a_helper <const gomp_task *>::test (const gimple *gs)
1504{
1505 return gs->code == GIMPLE_OMP_TASK;
1506}
1507
1508template <>
1509template <>
1510inline bool
1511is_a_helper <const gphi *>::test (const gimple *gs)
1512{
1513 return gs->code == GIMPLE_PHI;
1514}
1515
1516template <>
1517template <>
1518inline bool
1519is_a_helper <const greturn *>::test (const gimple *gs)
1520{
1521 return gs->code == GIMPLE_RETURN;
1522}
1523
1524template <>
1525template <>
1526inline bool
1527is_a_helper <const gimple_statement_assume *>::test (const gimple *gs)
1528{
1529 return gs->code == GIMPLE_ASSUME;
1530}
1531
1532template <>
1533template <>
1534inline bool
1535is_a_helper <const gtransaction *>::test (const gimple *gs)
1536{
1537 return gs->code == GIMPLE_TRANSACTION;
1538}
1539
1540/* Offset in bytes to the location of the operand vector.
1541 Zero if there is no operand vector for this tuple structure. */
1542extern size_t const gimple_ops_offset_[];
1543
1544/* Map GIMPLE codes to GSS codes. */
1545extern enum gimple_statement_structure_enum const gss_for_code_[];
1546
1547/* This variable holds the currently expanded gimple statement for purposes
1548 of communicating the profile info to the builtin expanders. */
1549extern gimple *currently_expanding_gimple_stmt;
1550
1551size_t gimple_size (enum gimple_code code, unsigned num_ops = 0);
1552void gimple_init (gimple *g, enum gimple_code code, unsigned num_ops);
1553gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
1554greturn *gimple_build_return (tree);
1555void gimple_call_reset_alias_info (gcall *);
1556gcall *gimple_build_call_vec (tree, const vec<tree> &);
1557gcall *gimple_build_call (tree, unsigned, ...);
1558gcall *gimple_build_call_valist (tree, unsigned, va_list);
1559gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1560gcall *gimple_build_call_internal_vec (enum internal_fn, const vec<tree> &);
1561gcall *gimple_build_call_from_tree (tree, tree);
1562gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1563gassign *gimple_build_assign (tree, enum tree_code,
1564 tree, tree, tree CXX_MEM_STAT_INFO);
1565gassign *gimple_build_assign (tree, enum tree_code,
1566 tree, tree CXX_MEM_STAT_INFO);
1567gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1568gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1569gcond *gimple_build_cond_from_tree (tree, tree, tree);
1570void gimple_cond_set_condition_from_tree (gcond *, tree);
1571glabel *gimple_build_label (tree label);
1572ggoto *gimple_build_goto (tree dest);
1573gimple *gimple_build_nop (void);
1574gbind *gimple_build_bind (tree, gimple_seq, tree);
1575gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1576 vec<tree, va_gc> *, vec<tree, va_gc> *,
1577 vec<tree, va_gc> *);
1578gcatch *gimple_build_catch (tree, gimple_seq);
1579geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1580geh_mnt *gimple_build_eh_must_not_throw (tree);
1581geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1582gtry *gimple_build_try (gimple_seq, gimple_seq,
1583 enum gimple_try_flags);
1584gimple *gimple_build_wce (gimple_seq);
1585gresx *gimple_build_resx (int);
1586gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1587gswitch *gimple_build_switch (tree, tree, const vec<tree> &);
1588geh_dispatch *gimple_build_eh_dispatch (int);
1589gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1590gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1591gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO);
1592gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO);
1593gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1594gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1595gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1596gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1597 tree, tree);
1598gimple *gimple_build_omp_section (gimple_seq);
1599gimple *gimple_build_omp_structured_block (gimple_seq);
1600gimple *gimple_build_omp_scope (gimple_seq, tree);
1601gimple *gimple_build_omp_dispatch (gimple_seq, tree);
1602gimple *gimple_build_omp_interop (tree);
1603gimple *gimple_build_omp_master (gimple_seq);
1604gimple *gimple_build_omp_masked (gimple_seq, tree);
1605gimple *gimple_build_omp_taskgroup (gimple_seq, tree);
1606gomp_continue *gimple_build_omp_continue (tree, tree);
1607gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1608gimple *gimple_build_omp_return (bool);
1609gomp_scan *gimple_build_omp_scan (gimple_seq, tree);
1610gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1611gimple *gimple_build_omp_sections_switch (void);
1612gomp_single *gimple_build_omp_single (gimple_seq, tree);
1613gomp_target *gimple_build_omp_target (gimple_seq, int, tree, gimple_seq = NULL);
1614gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1615gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree,
1616 enum omp_memory_order);
1617gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order);
1618gimple *gimple_build_assume (tree, gimple_seq);
1619gtransaction *gimple_build_transaction (gimple_seq);
1620extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1621extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1622void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1623void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1624extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1625 location_t);
1626extern void annotate_all_with_location (gimple_seq, location_t);
1627bool empty_body_p (gimple_seq);
1628gimple_seq gimple_seq_copy (gimple_seq);
1629bool gimple_call_same_target_p (const gimple *, const gimple *);
1630int gimple_call_flags (const gimple *);
1631int gimple_call_arg_flags (const gcall *, unsigned);
1632int gimple_call_retslot_flags (const gcall *);
1633int gimple_call_static_chain_flags (const gcall *);
1634int gimple_call_return_flags (const gcall *);
1635bool gimple_call_nonnull_result_p (gcall *);
1636tree gimple_call_nonnull_arg (gcall *);
1637bool gimple_assign_copy_p (gimple *);
1638bool gimple_assign_ssa_name_copy_p (gimple *);
1639bool gimple_assign_unary_nop_p (gimple *);
1640bool gimple_assign_load_p (const gimple *);
1641void gimple_set_bb (gimple *, basic_block);
1642void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1643void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1644 tree, tree, tree);
1645tree gimple_get_lhs (const gimple *);
1646void gimple_set_lhs (gimple *, tree);
1647gimple *gimple_copy (gimple *);
1648void gimple_move_vops (gimple *, gimple *);
1649bool gimple_has_side_effects (const gimple *);
1650bool gimple_could_trap_p_1 (const gimple *, bool, bool);
1651bool gimple_could_trap_p (const gimple *);
1652bool gimple_assign_rhs_could_trap_p (gimple *);
1653extern void dump_gimple_statistics (void);
1654unsigned get_gimple_rhs_num_ops (enum tree_code);
1655gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1656extern bool gimple_compare_field_offset (tree, tree);
1657extern tree gimple_unsigned_type (tree);
1658extern tree gimple_signed_type (tree);
1659extern alias_set_type gimple_get_alias_set (tree);
1660extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1661extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1662extern combined_fn gimple_call_combined_fn (const gimple *);
1663extern bool gimple_call_operator_delete_p (const gcall *);
1664extern bool gimple_call_builtin_p (const gimple *);
1665extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1666extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1667extern bool gimple_asm_clobbers_memory_p (const gasm *);
1668extern void dump_decl_set (FILE *, bitmap);
1669extern bool nonfreeing_call_p (gimple *);
1670extern bool nonbarrier_call_p (gimple *);
1671extern bool infer_nonnull_range (gimple *, tree);
1672extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1673extern bool infer_nonnull_range_by_attribute (gimple *, tree, tree * = NULL,
1674 tree * = NULL);
1675extern void sort_case_labels (vec<tree> &);
1676extern void preprocess_case_label_vec_for_gimple (vec<tree> &, tree, tree *);
1677extern void gimple_seq_set_location (gimple_seq, location_t);
1678extern void gimple_seq_discard (gimple_seq);
1679extern void maybe_remove_unused_call_args (struct function *, gimple *);
1680extern bool gimple_inexpensive_call_p (gcall *);
1681extern bool stmt_can_terminate_bb_p (gimple *);
1682extern location_t gimple_or_expr_nonartificial_location (gimple *, tree);
1683gcall *gimple_build_builtin_unreachable (location_t);
1684
1685/* Return the disposition for a warning (or all warnings by default)
1686 for a statement. */
1687extern bool warning_suppressed_p (const gimple *, opt_code = all_warnings)
1688 ATTRIBUTE_NONNULL (1);
1689/* Set the disposition for a warning (or all warnings by default)
1690 at a location to enabled by default. */
1691extern void suppress_warning (gimple *, opt_code = all_warnings,
1692 bool = true) ATTRIBUTE_NONNULL (1);
1693
1694/* Copy the warning disposition mapping from one statement to another. */
1695extern void copy_warning (gimple *, const gimple *)
1696 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1697/* Copy the warning disposition mapping from an expression to a statement. */
1698extern void copy_warning (gimple *, const_tree)
1699 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1700/* Copy the warning disposition mapping from a statement to an expression. */
1701extern void copy_warning (tree, const gimple *)
1702 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1703
1704/* Formal (expression) temporary table handling: multiple occurrences of
1705 the same scalar expression are evaluated into the same temporary. */
1706
1707typedef struct gimple_temp_hash_elt
1708{
1709 tree val; /* Key */
1710 tree temp; /* Value */
1711} elt_t;
1712
1713/* Get the number of the next statement uid to be allocated. */
1714inline unsigned int
1715gimple_stmt_max_uid (struct function *fn)
1716{
1717 return fn->last_stmt_uid;
1718}
1719
1720/* Set the number of the next statement uid to be allocated. */
1721inline void
1722set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1723{
1724 fn->last_stmt_uid = maxid;
1725}
1726
1727/* Set the number of the next statement uid to be allocated. */
1728inline unsigned int
1729inc_gimple_stmt_max_uid (struct function *fn)
1730{
1731 return fn->last_stmt_uid++;
1732}
1733
1734/* Return the first node in GIMPLE sequence S. */
1735
1736inline gimple_seq_node
1737gimple_seq_first (gimple_seq s)
1738{
1739 return s;
1740}
1741
1742
1743/* Return the first statement in GIMPLE sequence S. */
1744
1745inline gimple *
1746gimple_seq_first_stmt (gimple_seq s)
1747{
1748 gimple_seq_node n = gimple_seq_first (s);
1749 return n;
1750}
1751
1752/* Return the first statement in GIMPLE sequence S as a gbind *,
1753 verifying that it has code GIMPLE_BIND in a checked build. */
1754
1755inline gbind *
1756gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1757{
1758 gimple_seq_node n = gimple_seq_first (s);
1759 return as_a <gbind *> (p: n);
1760}
1761
1762
1763/* Return the last node in GIMPLE sequence S. */
1764
1765inline gimple_seq_node
1766gimple_seq_last (gimple_seq s)
1767{
1768 return s ? s->prev : NULL;
1769}
1770
1771
1772/* Return the last statement in GIMPLE sequence S. */
1773
1774inline gimple *
1775gimple_seq_last_stmt (gimple_seq s)
1776{
1777 gimple_seq_node n = gimple_seq_last (s);
1778 return n;
1779}
1780
1781
1782/* Set the last node in GIMPLE sequence *PS to LAST. */
1783
1784inline void
1785gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1786{
1787 (*ps)->prev = last;
1788}
1789
1790
1791/* Set the first node in GIMPLE sequence *PS to FIRST. */
1792
1793inline void
1794gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1795{
1796 *ps = first;
1797}
1798
1799
1800/* Return true if GIMPLE sequence S is empty. */
1801
1802inline bool
1803gimple_seq_empty_p (gimple_seq s)
1804{
1805 return s == NULL;
1806}
1807
1808/* Allocate a new sequence and initialize its first element with STMT. */
1809
1810inline gimple_seq
1811gimple_seq_alloc_with_stmt (gimple *stmt)
1812{
1813 gimple_seq seq = NULL;
1814 gimple_seq_add_stmt (&seq, stmt);
1815 return seq;
1816}
1817
1818
1819/* Returns the sequence of statements in BB. */
1820
1821inline gimple_seq
1822bb_seq (const_basic_block bb)
1823{
1824 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1825}
1826
1827inline gimple_seq *
1828bb_seq_addr (basic_block bb)
1829{
1830 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1831}
1832
1833/* Sets the sequence of statements in BB to SEQ. */
1834
1835inline void
1836set_bb_seq (basic_block bb, gimple_seq seq)
1837{
1838 gcc_checking_assert (!(bb->flags & BB_RTL));
1839 bb->il.gimple.seq = seq;
1840}
1841
1842
1843/* Return the code for GIMPLE statement G. */
1844
1845inline enum gimple_code
1846gimple_code (const gimple *g)
1847{
1848 return g->code;
1849}
1850
1851
1852/* Return the GSS code used by a GIMPLE code. */
1853
1854inline enum gimple_statement_structure_enum
1855gss_for_code (enum gimple_code code)
1856{
1857 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1858 return gss_for_code_[code];
1859}
1860
1861
1862/* Return which GSS code is used by GS. */
1863
1864inline enum gimple_statement_structure_enum
1865gimple_statement_structure (gimple *gs)
1866{
1867 return gss_for_code (code: gimple_code (g: gs));
1868}
1869
1870
1871/* Return true if statement G has sub-statements. This is only true for
1872 High GIMPLE statements. */
1873
1874inline bool
1875gimple_has_substatements (gimple *g)
1876{
1877 switch (gimple_code (g))
1878 {
1879 case GIMPLE_ASSUME:
1880 case GIMPLE_BIND:
1881 case GIMPLE_CATCH:
1882 case GIMPLE_EH_FILTER:
1883 case GIMPLE_EH_ELSE:
1884 case GIMPLE_TRY:
1885 case GIMPLE_OMP_FOR:
1886 case GIMPLE_OMP_MASTER:
1887 case GIMPLE_OMP_MASKED:
1888 case GIMPLE_OMP_TASKGROUP:
1889 case GIMPLE_OMP_ORDERED:
1890 case GIMPLE_OMP_SECTION:
1891 case GIMPLE_OMP_STRUCTURED_BLOCK:
1892 case GIMPLE_OMP_PARALLEL:
1893 case GIMPLE_OMP_TASK:
1894 case GIMPLE_OMP_SCOPE:
1895 case GIMPLE_OMP_DISPATCH:
1896 case GIMPLE_OMP_SECTIONS:
1897 case GIMPLE_OMP_SINGLE:
1898 case GIMPLE_OMP_TARGET:
1899 case GIMPLE_OMP_TEAMS:
1900 case GIMPLE_OMP_CRITICAL:
1901 case GIMPLE_WITH_CLEANUP_EXPR:
1902 case GIMPLE_TRANSACTION:
1903 return true;
1904
1905 default:
1906 return false;
1907 }
1908}
1909
1910
1911/* Return the basic block holding statement G. */
1912
1913inline basic_block
1914gimple_bb (const gimple *g)
1915{
1916 return g->bb;
1917}
1918
1919
1920/* Return the lexical scope block holding statement G. */
1921
1922inline tree
1923gimple_block (const gimple *g)
1924{
1925 return LOCATION_BLOCK (g->location);
1926}
1927
1928/* Forward declare. */
1929inline void gimple_set_location (gimple *, location_t);
1930
1931/* Set BLOCK to be the lexical scope block holding statement G. */
1932
1933inline void
1934gimple_set_block (gimple *g, tree block)
1935{
1936 gimple_set_location (g, set_block (loc: g->location, block));
1937}
1938
1939/* Return location information for statement G. */
1940
1941inline location_t
1942gimple_location (const gimple *g)
1943{
1944 return g->location;
1945}
1946
1947/* Return location information for statement G if g is not NULL.
1948 Otherwise, UNKNOWN_LOCATION is returned. */
1949
1950inline location_t
1951gimple_location_safe (const gimple *g)
1952{
1953 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1954}
1955
1956/* Set location information for statement G. */
1957
1958inline void
1959gimple_set_location (gimple *g, location_t location)
1960{
1961 /* Copy the no-warning data to the statement location. */
1962 if (g->location != UNKNOWN_LOCATION)
1963 copy_warning (location, g->location);
1964 g->location = location;
1965}
1966
1967/* Return address of the location information for statement G. */
1968
1969inline location_t *
1970gimple_location_ptr (gimple *g)
1971{
1972 return &g->location;
1973}
1974
1975
1976/* Return true if G contains location information. */
1977
1978inline bool
1979gimple_has_location (const gimple *g)
1980{
1981 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1982}
1983
1984
1985/* Return non-artificial location information for statement G. */
1986
1987inline location_t
1988gimple_nonartificial_location (const gimple *g)
1989{
1990 location_t *ploc = NULL;
1991
1992 if (tree block = gimple_block (g))
1993 ploc = block_nonartificial_location (block);
1994
1995 return ploc ? *ploc : gimple_location (g);
1996}
1997
1998
1999/* Return the file name of the location of STMT. */
2000
2001inline const char *
2002gimple_filename (const gimple *stmt)
2003{
2004 return LOCATION_FILE (gimple_location (stmt));
2005}
2006
2007
2008/* Return the line number of the location of STMT. */
2009
2010inline int
2011gimple_lineno (const gimple *stmt)
2012{
2013 return LOCATION_LINE (gimple_location (stmt));
2014}
2015
2016
2017/* Determine whether SEQ is a singleton. */
2018
2019inline bool
2020gimple_seq_singleton_p (gimple_seq seq)
2021{
2022 return ((gimple_seq_first (s: seq) != NULL)
2023 && (gimple_seq_first (s: seq) == gimple_seq_last (s: seq)));
2024}
2025
2026/* Return true if no warnings should be emitted for statement STMT. */
2027
2028inline bool
2029gimple_no_warning_p (const gimple *stmt)
2030{
2031 return stmt->no_warning;
2032}
2033
2034/* Set the no_warning flag of STMT to NO_WARNING. */
2035
2036inline void
2037gimple_set_no_warning (gimple *stmt, bool no_warning)
2038{
2039 stmt->no_warning = (unsigned) no_warning;
2040}
2041
2042/* Set the visited status on statement STMT to VISITED_P.
2043
2044 Please note that this 'visited' property of the gimple statement is
2045 supposed to be undefined at pass boundaries. This means that a
2046 given pass should not assume it contains any useful value when the
2047 pass starts and thus can set it to any value it sees fit.
2048
2049 You can learn more about the visited property of the gimple
2050 statement by reading the comments of the 'visited' data member of
2051 struct gimple.
2052 */
2053
2054inline void
2055gimple_set_visited (gimple *stmt, bool visited_p)
2056{
2057 stmt->visited = (unsigned) visited_p;
2058}
2059
2060
2061/* Return the visited status for statement STMT.
2062
2063 Please note that this 'visited' property of the gimple statement is
2064 supposed to be undefined at pass boundaries. This means that a
2065 given pass should not assume it contains any useful value when the
2066 pass starts and thus can set it to any value it sees fit.
2067
2068 You can learn more about the visited property of the gimple
2069 statement by reading the comments of the 'visited' data member of
2070 struct gimple. */
2071
2072inline bool
2073gimple_visited_p (gimple *stmt)
2074{
2075 return stmt->visited;
2076}
2077
2078
2079/* Set pass local flag PLF on statement STMT to VAL_P.
2080
2081 Please note that this PLF property of the gimple statement is
2082 supposed to be undefined at pass boundaries. This means that a
2083 given pass should not assume it contains any useful value when the
2084 pass starts and thus can set it to any value it sees fit.
2085
2086 You can learn more about the PLF property by reading the comment of
2087 the 'plf' data member of struct gimple_statement_structure. */
2088
2089inline void
2090gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
2091{
2092 if (val_p)
2093 stmt->plf |= (unsigned int) plf;
2094 else
2095 stmt->plf &= ~((unsigned int) plf);
2096}
2097
2098
2099/* Return the value of pass local flag PLF on statement STMT.
2100
2101 Please note that this 'plf' property of the gimple statement is
2102 supposed to be undefined at pass boundaries. This means that a
2103 given pass should not assume it contains any useful value when the
2104 pass starts and thus can set it to any value it sees fit.
2105
2106 You can learn more about the plf property by reading the comment of
2107 the 'plf' data member of struct gimple_statement_structure. */
2108
2109inline unsigned int
2110gimple_plf (gimple *stmt, enum plf_mask plf)
2111{
2112 return stmt->plf & ((unsigned int) plf);
2113}
2114
2115
2116/* Set the UID of statement.
2117
2118 Please note that this UID property is supposed to be undefined at
2119 pass boundaries. This means that a given pass should not assume it
2120 contains any useful value when the pass starts and thus can set it
2121 to any value it sees fit. */
2122
2123inline void
2124gimple_set_uid (gimple *g, unsigned uid)
2125{
2126 g->uid = uid;
2127}
2128
2129
2130/* Return the UID of statement.
2131
2132 Please note that this UID property is supposed to be undefined at
2133 pass boundaries. This means that a given pass should not assume it
2134 contains any useful value when the pass starts and thus can set it
2135 to any value it sees fit. */
2136
2137inline unsigned
2138gimple_uid (const gimple *g)
2139{
2140 return g->uid;
2141}
2142
2143
2144/* Make statement G a singleton sequence. */
2145
2146inline void
2147gimple_init_singleton (gimple *g)
2148{
2149 g->next = NULL;
2150 g->prev = g;
2151}
2152
2153
2154/* Return true if GIMPLE statement G has register or memory operands. */
2155
2156inline bool
2157gimple_has_ops (const gimple *g)
2158{
2159 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
2160}
2161
2162template <>
2163template <>
2164inline bool
2165is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
2166{
2167 return gimple_has_ops (g: gs);
2168}
2169
2170template <>
2171template <>
2172inline bool
2173is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
2174{
2175 return gimple_has_ops (g: gs);
2176}
2177
2178/* Return true if GIMPLE statement G has memory operands. */
2179
2180inline bool
2181gimple_has_mem_ops (const gimple *g)
2182{
2183 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
2184}
2185
2186template <>
2187template <>
2188inline bool
2189is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
2190{
2191 return gimple_has_mem_ops (g: gs);
2192}
2193
2194template <>
2195template <>
2196inline bool
2197is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
2198{
2199 return gimple_has_mem_ops (g: gs);
2200}
2201
2202/* Return the set of USE operands for statement G. */
2203
2204inline struct use_optype_d *
2205gimple_use_ops (const gimple *g)
2206{
2207 const gimple_statement_with_ops *ops_stmt =
2208 dyn_cast <const gimple_statement_with_ops *> (p: g);
2209 if (!ops_stmt)
2210 return NULL;
2211 return ops_stmt->use_ops;
2212}
2213
2214
2215/* Set USE to be the set of USE operands for statement G. */
2216
2217inline void
2218gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2219{
2220 gimple_statement_with_ops *ops_stmt =
2221 as_a <gimple_statement_with_ops *> (p: g);
2222 ops_stmt->use_ops = use;
2223}
2224
2225
2226/* Return the single VUSE operand of the statement G. */
2227
2228inline tree
2229gimple_vuse (const gimple *g)
2230{
2231 const gimple_statement_with_memory_ops *mem_ops_stmt =
2232 dyn_cast <const gimple_statement_with_memory_ops *> (p: g);
2233 if (!mem_ops_stmt)
2234 return NULL_TREE;
2235 return mem_ops_stmt->vuse;
2236}
2237
2238/* Return the single VDEF operand of the statement G. */
2239
2240inline tree
2241gimple_vdef (const gimple *g)
2242{
2243 const gimple_statement_with_memory_ops *mem_ops_stmt =
2244 dyn_cast <const gimple_statement_with_memory_ops *> (p: g);
2245 if (!mem_ops_stmt)
2246 return NULL_TREE;
2247 return mem_ops_stmt->vdef;
2248}
2249
2250/* Return the single VUSE operand of the statement G. */
2251
2252inline tree *
2253gimple_vuse_ptr (gimple *g)
2254{
2255 gimple_statement_with_memory_ops *mem_ops_stmt =
2256 dyn_cast <gimple_statement_with_memory_ops *> (p: g);
2257 if (!mem_ops_stmt)
2258 return NULL;
2259 return &mem_ops_stmt->vuse;
2260}
2261
2262/* Return the single VDEF operand of the statement G. */
2263
2264inline tree *
2265gimple_vdef_ptr (gimple *g)
2266{
2267 gimple_statement_with_memory_ops *mem_ops_stmt =
2268 dyn_cast <gimple_statement_with_memory_ops *> (p: g);
2269 if (!mem_ops_stmt)
2270 return NULL;
2271 return &mem_ops_stmt->vdef;
2272}
2273
2274/* Set the single VUSE operand of the statement G. */
2275
2276inline void
2277gimple_set_vuse (gimple *g, tree vuse)
2278{
2279 gimple_statement_with_memory_ops *mem_ops_stmt =
2280 as_a <gimple_statement_with_memory_ops *> (p: g);
2281 mem_ops_stmt->vuse = vuse;
2282}
2283
2284/* Set the single VDEF operand of the statement G. */
2285
2286inline void
2287gimple_set_vdef (gimple *g, tree vdef)
2288{
2289 gimple_statement_with_memory_ops *mem_ops_stmt =
2290 as_a <gimple_statement_with_memory_ops *> (p: g);
2291 mem_ops_stmt->vdef = vdef;
2292}
2293
2294
2295/* Return true if statement G has operands and the modified field has
2296 been set. */
2297
2298inline bool
2299gimple_modified_p (const gimple *g)
2300{
2301 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2302}
2303
2304
2305/* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2306 a MODIFIED field. */
2307
2308inline void
2309gimple_set_modified (gimple *s, bool modifiedp)
2310{
2311 if (gimple_has_ops (g: s))
2312 s->modified = (unsigned) modifiedp;
2313}
2314
2315
2316/* Return true if statement STMT contains volatile operands. */
2317
2318inline bool
2319gimple_has_volatile_ops (const gimple *stmt)
2320{
2321 if (gimple_has_mem_ops (g: stmt))
2322 return stmt->has_volatile_ops;
2323 else
2324 return false;
2325}
2326
2327
2328/* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2329
2330inline void
2331gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2332{
2333 if (gimple_has_mem_ops (g: stmt))
2334 stmt->has_volatile_ops = (unsigned) volatilep;
2335}
2336
2337/* Return true if STMT is in a transaction. */
2338
2339inline bool
2340gimple_in_transaction (const gimple *stmt)
2341{
2342 return bb_in_transaction (bb: gimple_bb (g: stmt));
2343}
2344
2345/* Return true if statement STMT may access memory. */
2346
2347inline bool
2348gimple_references_memory_p (gimple *stmt)
2349{
2350 return gimple_has_mem_ops (g: stmt) && gimple_vuse (g: stmt);
2351}
2352
2353
2354/* Return the subcode for OMP statement S. */
2355
2356inline unsigned
2357gimple_omp_subcode (const gimple *s)
2358{
2359 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2360 && gimple_code (s) <= GIMPLE_OMP_ORDERED);
2361 return s->subcode;
2362}
2363
2364/* Set the subcode for OMP statement S to SUBCODE. */
2365
2366inline void
2367gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2368{
2369 /* We only have 16 bits for the subcode. Assert that we are not
2370 overflowing it. */
2371 gcc_gimple_checking_assert (subcode < (1 << 16));
2372 s->subcode = subcode;
2373}
2374
2375/* Set the nowait flag on OMP_RETURN statement S. */
2376
2377inline void
2378gimple_omp_return_set_nowait (gimple *s)
2379{
2380 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2381 s->subcode |= GF_OMP_RETURN_NOWAIT;
2382}
2383
2384
2385/* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2386 flag set. */
2387
2388inline bool
2389gimple_omp_return_nowait_p (const gimple *g)
2390{
2391 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2392 return (gimple_omp_subcode (s: g) & GF_OMP_RETURN_NOWAIT) != 0;
2393}
2394
2395
2396/* Set the LHS of OMP return. */
2397
2398inline void
2399gimple_omp_return_set_lhs (gimple *g, tree lhs)
2400{
2401 gimple_statement_omp_return *omp_return_stmt =
2402 as_a <gimple_statement_omp_return *> (p: g);
2403 omp_return_stmt->val = lhs;
2404}
2405
2406
2407/* Get the LHS of OMP return. */
2408
2409inline tree
2410gimple_omp_return_lhs (const gimple *g)
2411{
2412 const gimple_statement_omp_return *omp_return_stmt =
2413 as_a <const gimple_statement_omp_return *> (p: g);
2414 return omp_return_stmt->val;
2415}
2416
2417
2418/* Return a pointer to the LHS of OMP return. */
2419
2420inline tree *
2421gimple_omp_return_lhs_ptr (gimple *g)
2422{
2423 gimple_statement_omp_return *omp_return_stmt =
2424 as_a <gimple_statement_omp_return *> (p: g);
2425 return &omp_return_stmt->val;
2426}
2427
2428
2429/* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2430 flag set. */
2431
2432inline bool
2433gimple_omp_section_last_p (const gimple *g)
2434{
2435 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2436 return (gimple_omp_subcode (s: g) & GF_OMP_SECTION_LAST) != 0;
2437}
2438
2439
2440/* Set the GF_OMP_SECTION_LAST flag on G. */
2441
2442inline void
2443gimple_omp_section_set_last (gimple *g)
2444{
2445 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2446 g->subcode |= GF_OMP_SECTION_LAST;
2447}
2448
2449
2450/* Return true if OMP ordered construct is stand-alone
2451 (G has the GF_OMP_ORDERED_STANDALONE flag set). */
2452
2453inline bool
2454gimple_omp_ordered_standalone_p (const gimple *g)
2455{
2456 GIMPLE_CHECK (g, GIMPLE_OMP_ORDERED);
2457 return (gimple_omp_subcode (s: g) & GF_OMP_ORDERED_STANDALONE) != 0;
2458}
2459
2460
2461/* Set the GF_OMP_ORDERED_STANDALONE flag on G. */
2462
2463inline void
2464gimple_omp_ordered_standalone (gimple *g)
2465{
2466 GIMPLE_CHECK (g, GIMPLE_OMP_ORDERED);
2467 g->subcode |= GF_OMP_ORDERED_STANDALONE;
2468}
2469
2470
2471/* Return true if OMP parallel statement G has the
2472 GF_OMP_PARALLEL_COMBINED flag set. */
2473
2474inline bool
2475gimple_omp_parallel_combined_p (const gimple *g)
2476{
2477 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2478 return (gimple_omp_subcode (s: g) & GF_OMP_PARALLEL_COMBINED) != 0;
2479}
2480
2481
2482/* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2483 value of COMBINED_P. */
2484
2485inline void
2486gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2487{
2488 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2489 if (combined_p)
2490 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2491 else
2492 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2493}
2494
2495
2496/* Return true if OMP atomic load/store statement G has the
2497 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2498
2499inline bool
2500gimple_omp_atomic_need_value_p (const gimple *g)
2501{
2502 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2503 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2504 return (gimple_omp_subcode (s: g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2505}
2506
2507
2508/* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2509
2510inline void
2511gimple_omp_atomic_set_need_value (gimple *g)
2512{
2513 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2514 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2515 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2516}
2517
2518
2519/* Return true if OMP atomic load/store statement G has the
2520 GF_OMP_ATOMIC_WEAK flag set. */
2521
2522inline bool
2523gimple_omp_atomic_weak_p (const gimple *g)
2524{
2525 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2526 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2527 return (gimple_omp_subcode (s: g) & GF_OMP_ATOMIC_WEAK) != 0;
2528}
2529
2530
2531/* Set the GF_OMP_ATOMIC_WEAK flag on G. */
2532
2533inline void
2534gimple_omp_atomic_set_weak (gimple *g)
2535{
2536 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2537 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2538 g->subcode |= GF_OMP_ATOMIC_WEAK;
2539}
2540
2541
2542/* Return the memory order of the OMP atomic load/store statement G. */
2543
2544inline enum omp_memory_order
2545gimple_omp_atomic_memory_order (const gimple *g)
2546{
2547 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2548 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2549 return (enum omp_memory_order)
2550 (gimple_omp_subcode (s: g) & GF_OMP_ATOMIC_MEMORY_ORDER);
2551}
2552
2553
2554/* Set the memory order on G. */
2555
2556inline void
2557gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo)
2558{
2559 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2560 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2561 g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
2562 | (int (mo) & GF_OMP_ATOMIC_MEMORY_ORDER));
2563}
2564
2565
2566/* Return the number of operands for statement GS. */
2567
2568inline unsigned
2569gimple_num_ops (const gimple *gs)
2570{
2571 return gs->num_ops;
2572}
2573
2574
2575/* Set the number of operands for statement GS. */
2576
2577inline void
2578gimple_set_num_ops (gimple *gs, unsigned num_ops)
2579{
2580 gs->num_ops = num_ops;
2581}
2582
2583
2584/* Return the array of operands for statement GS. */
2585
2586inline tree *
2587gimple_ops (gimple *gs)
2588{
2589 size_t off;
2590
2591 /* All the tuples have their operand vector at the very bottom
2592 of the structure. Note that those structures that do not
2593 have an operand vector have a zero offset. */
2594 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2595 gcc_gimple_checking_assert (off != 0);
2596
2597 return (tree *) ((char *) gs + off);
2598}
2599
2600
2601/* Return operand I for statement GS. */
2602
2603inline tree
2604gimple_op (const gimple *gs, unsigned i)
2605{
2606 if (gimple_has_ops (g: gs))
2607 {
2608 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2609 return gimple_ops (gs: const_cast<gimple *> (gs))[i];
2610 }
2611 else
2612 return NULL_TREE;
2613}
2614
2615/* Return a pointer to operand I for statement GS. */
2616
2617inline tree *
2618gimple_op_ptr (gimple *gs, unsigned i)
2619{
2620 if (gimple_has_ops (g: gs))
2621 {
2622 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2623 return gimple_ops (gs) + i;
2624 }
2625 else
2626 return NULL;
2627}
2628
2629/* Set operand I of statement GS to OP. */
2630
2631inline void
2632gimple_set_op (gimple *gs, unsigned i, tree op)
2633{
2634 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2635
2636 /* Note. It may be tempting to assert that OP matches
2637 is_gimple_operand, but that would be wrong. Different tuples
2638 accept slightly different sets of tree operands. Each caller
2639 should perform its own validation. */
2640 gimple_ops (gs)[i] = op;
2641}
2642
2643/* Return true if GS is a GIMPLE_ASSIGN. */
2644
2645inline bool
2646is_gimple_assign (const gimple *gs)
2647{
2648 return gimple_code (g: gs) == GIMPLE_ASSIGN;
2649}
2650
2651/* Determine if expression CODE is one of the valid expressions that can
2652 be used on the RHS of GIMPLE assignments. */
2653
2654inline enum gimple_rhs_class
2655get_gimple_rhs_class (enum tree_code code)
2656{
2657 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2658}
2659
2660/* Return the LHS of assignment statement GS. */
2661
2662inline tree
2663gimple_assign_lhs (const gassign *gs)
2664{
2665 return gs->op[0];
2666}
2667
2668inline tree
2669gimple_assign_lhs (const gimple *gs)
2670{
2671 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2672 return gimple_assign_lhs (gs: ass);
2673}
2674
2675
2676/* Return a pointer to the LHS of assignment statement GS. */
2677
2678inline tree *
2679gimple_assign_lhs_ptr (gassign *gs)
2680{
2681 return &gs->op[0];
2682}
2683
2684inline tree *
2685gimple_assign_lhs_ptr (gimple *gs)
2686{
2687 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2688 return gimple_assign_lhs_ptr (gs: ass);
2689}
2690
2691
2692/* Set LHS to be the LHS operand of assignment statement GS. */
2693
2694inline void
2695gimple_assign_set_lhs (gassign *gs, tree lhs)
2696{
2697 gs->op[0] = lhs;
2698
2699 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2700 SSA_NAME_DEF_STMT (lhs) = gs;
2701}
2702
2703inline void
2704gimple_assign_set_lhs (gimple *gs, tree lhs)
2705{
2706 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2707 gimple_assign_set_lhs (gs: ass, lhs);
2708}
2709
2710
2711/* Return the first operand on the RHS of assignment statement GS. */
2712
2713inline tree
2714gimple_assign_rhs1 (const gassign *gs)
2715{
2716 return gs->op[1];
2717}
2718
2719inline tree
2720gimple_assign_rhs1 (const gimple *gs)
2721{
2722 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2723 return gimple_assign_rhs1 (gs: ass);
2724}
2725
2726
2727/* Return a pointer to the first operand on the RHS of assignment
2728 statement GS. */
2729
2730inline tree *
2731gimple_assign_rhs1_ptr (gassign *gs)
2732{
2733 return &gs->op[1];
2734}
2735
2736inline tree *
2737gimple_assign_rhs1_ptr (gimple *gs)
2738{
2739 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2740 return gimple_assign_rhs1_ptr (gs: ass);
2741}
2742
2743/* Set RHS to be the first operand on the RHS of assignment statement GS. */
2744
2745inline void
2746gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2747{
2748 gs->op[1] = rhs;
2749}
2750
2751inline void
2752gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2753{
2754 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2755 gimple_assign_set_rhs1 (gs: ass, rhs);
2756}
2757
2758
2759/* Return the second operand on the RHS of assignment statement GS.
2760 If GS does not have two operands, NULL is returned instead. */
2761
2762inline tree
2763gimple_assign_rhs2 (const gassign *gs)
2764{
2765 if (gimple_num_ops (gs) >= 3)
2766 return gs->op[2];
2767 else
2768 return NULL_TREE;
2769}
2770
2771inline tree
2772gimple_assign_rhs2 (const gimple *gs)
2773{
2774 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2775 return gimple_assign_rhs2 (gs: ass);
2776}
2777
2778
2779/* Return a pointer to the second operand on the RHS of assignment
2780 statement GS. */
2781
2782inline tree *
2783gimple_assign_rhs2_ptr (gassign *gs)
2784{
2785 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2786 return &gs->op[2];
2787}
2788
2789inline tree *
2790gimple_assign_rhs2_ptr (gimple *gs)
2791{
2792 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2793 return gimple_assign_rhs2_ptr (gs: ass);
2794}
2795
2796
2797/* Set RHS to be the second operand on the RHS of assignment statement GS. */
2798
2799inline void
2800gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2801{
2802 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2803 gs->op[2] = rhs;
2804}
2805
2806inline void
2807gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2808{
2809 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2810 return gimple_assign_set_rhs2 (gs: ass, rhs);
2811}
2812
2813/* Return the third operand on the RHS of assignment statement GS.
2814 If GS does not have two operands, NULL is returned instead. */
2815
2816inline tree
2817gimple_assign_rhs3 (const gassign *gs)
2818{
2819 if (gimple_num_ops (gs) >= 4)
2820 return gs->op[3];
2821 else
2822 return NULL_TREE;
2823}
2824
2825inline tree
2826gimple_assign_rhs3 (const gimple *gs)
2827{
2828 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2829 return gimple_assign_rhs3 (gs: ass);
2830}
2831
2832/* Return a pointer to the third operand on the RHS of assignment
2833 statement GS. */
2834
2835inline tree *
2836gimple_assign_rhs3_ptr (gimple *gs)
2837{
2838 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2839 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2840 return &ass->op[3];
2841}
2842
2843
2844/* Set RHS to be the third operand on the RHS of assignment statement GS. */
2845
2846inline void
2847gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2848{
2849 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2850 gs->op[3] = rhs;
2851}
2852
2853inline void
2854gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2855{
2856 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2857 gimple_assign_set_rhs3 (gs: ass, rhs);
2858}
2859
2860
2861/* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2862 which expect to see only two operands. */
2863
2864inline void
2865gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2866 tree op1, tree op2)
2867{
2868 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2869}
2870
2871/* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2872 which expect to see only one operands. */
2873
2874inline void
2875gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2876 tree op1)
2877{
2878 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2879}
2880
2881/* Returns true if GS is a nontemporal move. */
2882
2883inline bool
2884gimple_assign_nontemporal_move_p (const gassign *gs)
2885{
2886 return gs->nontemporal_move;
2887}
2888
2889/* Sets nontemporal move flag of GS to NONTEMPORAL. */
2890
2891inline void
2892gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2893{
2894 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2895 gs->nontemporal_move = nontemporal;
2896}
2897
2898
2899/* Return the code of the expression computed on the rhs of assignment
2900 statement GS. In case that the RHS is a single object, returns the
2901 tree code of the object. */
2902
2903inline enum tree_code
2904gimple_assign_rhs_code (const gassign *gs)
2905{
2906 enum tree_code code = (enum tree_code) gs->subcode;
2907 /* While we initially set subcode to the TREE_CODE of the rhs for
2908 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2909 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2910 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2911 code = TREE_CODE (gs->op[1]);
2912
2913 return code;
2914}
2915
2916inline enum tree_code
2917gimple_assign_rhs_code (const gimple *gs)
2918{
2919 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2920 return gimple_assign_rhs_code (gs: ass);
2921}
2922
2923
2924/* Set CODE to be the code for the expression computed on the RHS of
2925 assignment S. */
2926
2927inline void
2928gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2929{
2930 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2931 s->subcode = code;
2932}
2933
2934
2935/* Return the gimple rhs class of the code of the expression computed on
2936 the rhs of assignment statement GS.
2937 This will never return GIMPLE_INVALID_RHS. */
2938
2939inline enum gimple_rhs_class
2940gimple_assign_rhs_class (const gimple *gs)
2941{
2942 return get_gimple_rhs_class (code: gimple_assign_rhs_code (gs));
2943}
2944
2945/* Return true if GS is an assignment with a singleton RHS, i.e.,
2946 there is no operator associated with the assignment itself.
2947 Unlike gimple_assign_copy_p, this predicate returns true for
2948 any RHS operand, including those that perform an operation
2949 and do not have the semantics of a copy, such as COND_EXPR. */
2950
2951inline bool
2952gimple_assign_single_p (const gimple *gs)
2953{
2954 return (is_gimple_assign (gs)
2955 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2956}
2957
2958/* Return true if GS performs a store to its lhs. */
2959
2960inline bool
2961gimple_store_p (const gimple *gs)
2962{
2963 tree lhs = gimple_get_lhs (gs);
2964 return lhs && !is_gimple_reg (lhs);
2965}
2966
2967/* Return true if S is a type-cast assignment. */
2968
2969inline bool
2970gimple_assign_cast_p (const gimple *s)
2971{
2972 if (is_gimple_assign (gs: s))
2973 {
2974 enum tree_code sc = gimple_assign_rhs_code (gs: s);
2975 return CONVERT_EXPR_CODE_P (sc)
2976 || sc == VIEW_CONVERT_EXPR
2977 || sc == FIX_TRUNC_EXPR;
2978 }
2979
2980 return false;
2981}
2982
2983/* Return true if S is a clobber statement. */
2984
2985inline bool
2986gimple_clobber_p (const gimple *s)
2987{
2988 return gimple_assign_single_p (gs: s)
2989 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2990}
2991
2992/* Return true if S is a clobber statement. */
2993
2994inline bool
2995gimple_clobber_p (const gimple *s, enum clobber_kind kind)
2996{
2997 return gimple_clobber_p (s)
2998 && CLOBBER_KIND (gimple_assign_rhs1 (s)) == kind;
2999}
3000
3001/* Return true if GS is a GIMPLE_CALL. */
3002
3003inline bool
3004is_gimple_call (const gimple *gs)
3005{
3006 return gimple_code (g: gs) == GIMPLE_CALL;
3007}
3008
3009/* Return the LHS of call statement GS. */
3010
3011inline tree
3012gimple_call_lhs (const gcall *gs)
3013{
3014 return gs->op[0];
3015}
3016
3017inline tree
3018gimple_call_lhs (const gimple *gs)
3019{
3020 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3021 return gimple_call_lhs (gs: gc);
3022}
3023
3024
3025/* Return a pointer to the LHS of call statement GS. */
3026
3027inline tree *
3028gimple_call_lhs_ptr (gcall *gs)
3029{
3030 return &gs->op[0];
3031}
3032
3033inline tree *
3034gimple_call_lhs_ptr (gimple *gs)
3035{
3036 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3037 return gimple_call_lhs_ptr (gs: gc);
3038}
3039
3040
3041/* Set LHS to be the LHS operand of call statement GS. */
3042
3043inline void
3044gimple_call_set_lhs (gcall *gs, tree lhs)
3045{
3046 gs->op[0] = lhs;
3047 if (lhs && TREE_CODE (lhs) == SSA_NAME)
3048 SSA_NAME_DEF_STMT (lhs) = gs;
3049}
3050
3051inline void
3052gimple_call_set_lhs (gimple *gs, tree lhs)
3053{
3054 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3055 gimple_call_set_lhs (gs: gc, lhs);
3056}
3057
3058
3059/* Return true if call GS calls an internal-only function, as enumerated
3060 by internal_fn. */
3061
3062inline bool
3063gimple_call_internal_p (const gcall *gs)
3064{
3065 return (gs->subcode & GF_CALL_INTERNAL) != 0;
3066}
3067
3068inline bool
3069gimple_call_internal_p (const gimple *gs)
3070{
3071 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3072 return gimple_call_internal_p (gs: gc);
3073}
3074
3075/* Return true if call GS is marked as nocf_check. */
3076
3077inline bool
3078gimple_call_nocf_check_p (const gcall *gs)
3079{
3080 return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
3081}
3082
3083/* Mark statement GS as nocf_check call. */
3084
3085inline void
3086gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
3087{
3088 if (nocf_check)
3089 gs->subcode |= GF_CALL_NOCF_CHECK;
3090 else
3091 gs->subcode &= ~GF_CALL_NOCF_CHECK;
3092}
3093
3094/* Return the target of internal call GS. */
3095
3096inline enum internal_fn
3097gimple_call_internal_fn (const gcall *gs)
3098{
3099 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
3100 return gs->u.internal_fn;
3101}
3102
3103inline enum internal_fn
3104gimple_call_internal_fn (const gimple *gs)
3105{
3106 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3107 return gimple_call_internal_fn (gs: gc);
3108}
3109
3110/* Return true, if this internal gimple call is unique. */
3111
3112inline bool
3113gimple_call_internal_unique_p (const gcall *gs)
3114{
3115 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
3116}
3117
3118inline bool
3119gimple_call_internal_unique_p (const gimple *gs)
3120{
3121 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3122 return gimple_call_internal_unique_p (gs: gc);
3123}
3124
3125/* Return true if GS is an internal function FN. */
3126
3127inline bool
3128gimple_call_internal_p (const gimple *gs, internal_fn fn)
3129{
3130 return (is_gimple_call (gs)
3131 && gimple_call_internal_p (gs)
3132 && gimple_call_internal_fn (gs) == fn);
3133}
3134
3135/* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
3136 that could alter control flow. */
3137
3138inline void
3139gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
3140{
3141 if (ctrl_altering_p)
3142 s->subcode |= GF_CALL_CTRL_ALTERING;
3143 else
3144 s->subcode &= ~GF_CALL_CTRL_ALTERING;
3145}
3146
3147inline void
3148gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
3149{
3150 gcall *gc = GIMPLE_CHECK2<gcall *> (gs: s);
3151 gimple_call_set_ctrl_altering (s: gc, ctrl_altering_p);
3152}
3153
3154/* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
3155 flag is set. Such call could not be a stmt in the middle of a bb. */
3156
3157inline bool
3158gimple_call_ctrl_altering_p (const gcall *gs)
3159{
3160 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
3161}
3162
3163inline bool
3164gimple_call_ctrl_altering_p (const gimple *gs)
3165{
3166 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3167 return gimple_call_ctrl_altering_p (gs: gc);
3168}
3169
3170
3171/* Return the function type of the function called by GS. */
3172
3173inline tree
3174gimple_call_fntype (const gcall *gs)
3175{
3176 if (gimple_call_internal_p (gs))
3177 return NULL_TREE;
3178 return gs->u.fntype;
3179}
3180
3181inline tree
3182gimple_call_fntype (const gimple *gs)
3183{
3184 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
3185 return gimple_call_fntype (gs: call_stmt);
3186}
3187
3188/* Set the type of the function called by CALL_STMT to FNTYPE. */
3189
3190inline void
3191gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3192{
3193 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
3194 call_stmt->u.fntype = fntype;
3195}
3196
3197
3198/* Return the tree node representing the function called by call
3199 statement GS. */
3200
3201inline tree
3202gimple_call_fn (const gcall *gs)
3203{
3204 return gs->op[1];
3205}
3206
3207inline tree
3208gimple_call_fn (const gimple *gs)
3209{
3210 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3211 return gimple_call_fn (gs: gc);
3212}
3213
3214/* Return a pointer to the tree node representing the function called by call
3215 statement GS. */
3216
3217inline tree *
3218gimple_call_fn_ptr (gcall *gs)
3219{
3220 return &gs->op[1];
3221}
3222
3223inline tree *
3224gimple_call_fn_ptr (gimple *gs)
3225{
3226 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3227 return gimple_call_fn_ptr (gs: gc);
3228}
3229
3230
3231/* Set FN to be the function called by call statement GS. */
3232
3233inline void
3234gimple_call_set_fn (gcall *gs, tree fn)
3235{
3236 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3237 gs->op[1] = fn;
3238}
3239
3240
3241/* Set FNDECL to be the function called by call statement GS. */
3242
3243inline void
3244gimple_call_set_fndecl (gcall *gs, tree decl)
3245{
3246 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3247 gs->op[1] = build1_loc (loc: gimple_location (g: gs), code: ADDR_EXPR,
3248 type: build_pointer_type (TREE_TYPE (decl)), arg1: decl);
3249}
3250
3251inline void
3252gimple_call_set_fndecl (gimple *gs, tree decl)
3253{
3254 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3255 gimple_call_set_fndecl (gs: gc, decl);
3256}
3257
3258
3259/* Set internal function FN to be the function called by call statement CALL_STMT. */
3260
3261inline void
3262gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3263{
3264 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3265 call_stmt->u.internal_fn = fn;
3266}
3267
3268
3269/* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3270 Otherwise return NULL. This function is analogous to
3271 get_callee_fndecl in tree land. */
3272
3273inline tree
3274gimple_call_fndecl (const gcall *gs)
3275{
3276 return gimple_call_addr_fndecl (fn: gimple_call_fn (gs));
3277}
3278
3279inline tree
3280gimple_call_fndecl (const gimple *gs)
3281{
3282 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3283 return gimple_call_fndecl (gs: gc);
3284}
3285
3286
3287/* Return the type returned by call statement GS. */
3288
3289inline tree
3290gimple_call_return_type (const gcall *gs)
3291{
3292 tree type = gimple_call_fntype (gs);
3293
3294 if (type == NULL_TREE)
3295 return TREE_TYPE (gimple_call_lhs (gs));
3296
3297 /* The type returned by a function is the type of its
3298 function type. */
3299 return TREE_TYPE (type);
3300}
3301
3302
3303/* Return the static chain for call statement GS. */
3304
3305inline tree
3306gimple_call_chain (const gcall *gs)
3307{
3308 return gs->op[2];
3309}
3310
3311inline tree
3312gimple_call_chain (const gimple *gs)
3313{
3314 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3315 return gimple_call_chain (gs: gc);
3316}
3317
3318
3319/* Return a pointer to the static chain for call statement CALL_STMT. */
3320
3321inline tree *
3322gimple_call_chain_ptr (gcall *call_stmt)
3323{
3324 return &call_stmt->op[2];
3325}
3326
3327/* Set CHAIN to be the static chain for call statement CALL_STMT. */
3328
3329inline void
3330gimple_call_set_chain (gcall *call_stmt, tree chain)
3331{
3332 call_stmt->op[2] = chain;
3333}
3334
3335
3336/* Return the number of arguments used by call statement GS. */
3337
3338inline unsigned
3339gimple_call_num_args (const gcall *gs)
3340{
3341 return gimple_num_ops (gs) - 3;
3342}
3343
3344inline unsigned
3345gimple_call_num_args (const gimple *gs)
3346{
3347 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3348 return gimple_call_num_args (gs: gc);
3349}
3350
3351
3352/* Return the argument at position INDEX for call statement GS. */
3353
3354inline tree
3355gimple_call_arg (const gcall *gs, unsigned index)
3356{
3357 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3358 return gs->op[index + 3];
3359}
3360
3361inline tree
3362gimple_call_arg (const gimple *gs, unsigned index)
3363{
3364 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3365 return gimple_call_arg (gs: gc, index);
3366}
3367
3368
3369/* Return a pointer to the argument at position INDEX for call
3370 statement GS. */
3371
3372inline tree *
3373gimple_call_arg_ptr (gcall *gs, unsigned index)
3374{
3375 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3376 return &gs->op[index + 3];
3377}
3378
3379inline tree *
3380gimple_call_arg_ptr (gimple *gs, unsigned index)
3381{
3382 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3383 return gimple_call_arg_ptr (gs: gc, index);
3384}
3385
3386
3387/* Set ARG to be the argument at position INDEX for call statement GS. */
3388
3389inline void
3390gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3391{
3392 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3393 gs->op[index + 3] = arg;
3394}
3395
3396inline void
3397gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3398{
3399 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3400 gimple_call_set_arg (gs: gc, index, arg);
3401}
3402
3403
3404/* If TAIL_P is true, mark call statement S as being a tail call
3405 (i.e., a call just before the exit of a function). These calls are
3406 candidate for tail call optimization. */
3407
3408inline void
3409gimple_call_set_tail (gcall *s, bool tail_p)
3410{
3411 if (tail_p)
3412 s->subcode |= GF_CALL_TAILCALL;
3413 else
3414 s->subcode &= ~GF_CALL_TAILCALL;
3415}
3416
3417
3418/* Return true if GIMPLE_CALL S is marked as a tail call. */
3419
3420inline bool
3421gimple_call_tail_p (const gcall *s)
3422{
3423 return (s->subcode & GF_CALL_TAILCALL) != 0;
3424}
3425
3426/* Mark (or clear) call statement S as requiring tail call optimization. */
3427
3428inline void
3429gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3430{
3431 if (must_tail_p)
3432 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3433 else
3434 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3435}
3436
3437/* Return true if call statement has been marked as requiring
3438 tail call optimization. */
3439
3440inline bool
3441gimple_call_must_tail_p (const gcall *s)
3442{
3443 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3444}
3445
3446/* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3447 slot optimization. This transformation uses the target of the call
3448 expansion as the return slot for calls that return in memory. */
3449
3450inline void
3451gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3452{
3453 if (return_slot_opt_p)
3454 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3455 else
3456 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3457}
3458
3459
3460/* Return true if S is marked for return slot optimization. */
3461
3462inline bool
3463gimple_call_return_slot_opt_p (const gcall *s)
3464{
3465 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3466}
3467
3468
3469/* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3470 thunk to the thunked-to function. */
3471
3472inline void
3473gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3474{
3475 if (from_thunk_p)
3476 s->subcode |= GF_CALL_FROM_THUNK;
3477 else
3478 s->subcode &= ~GF_CALL_FROM_THUNK;
3479}
3480
3481
3482/* Return true if GIMPLE_CALL S is a jump from a thunk. */
3483
3484inline bool
3485gimple_call_from_thunk_p (gcall *s)
3486{
3487 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3488}
3489
3490
3491/* If FROM_NEW_OR_DELETE_P is true, mark GIMPLE_CALL S as being a call
3492 to operator new or delete created from a new or delete expression. */
3493
3494inline void
3495gimple_call_set_from_new_or_delete (gcall *s, bool from_new_or_delete_p)
3496{
3497 if (from_new_or_delete_p)
3498 s->subcode |= GF_CALL_FROM_NEW_OR_DELETE;
3499 else
3500 s->subcode &= ~GF_CALL_FROM_NEW_OR_DELETE;
3501}
3502
3503
3504/* Return true if GIMPLE_CALL S is a call to operator new or delete from
3505 from a new or delete expression. */
3506
3507inline bool
3508gimple_call_from_new_or_delete (const gcall *s)
3509{
3510 return (s->subcode & GF_CALL_FROM_NEW_OR_DELETE) != 0;
3511}
3512
3513
3514/* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3515 argument pack in its argument list. */
3516
3517inline void
3518gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3519{
3520 if (pass_arg_pack_p)
3521 s->subcode |= GF_CALL_VA_ARG_PACK;
3522 else
3523 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3524}
3525
3526
3527/* Return true if GIMPLE_CALL S is a stdarg call that needs the
3528 argument pack in its argument list. */
3529
3530inline bool
3531gimple_call_va_arg_pack_p (const gcall *s)
3532{
3533 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3534}
3535
3536
3537/* Return true if S is a noreturn call. */
3538
3539inline bool
3540gimple_call_noreturn_p (const gcall *s)
3541{
3542 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3543}
3544
3545inline bool
3546gimple_call_noreturn_p (const gimple *s)
3547{
3548 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs: s);
3549 return gimple_call_noreturn_p (s: gc);
3550}
3551
3552
3553/* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3554 even if the called function can throw in other cases. */
3555
3556inline void
3557gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3558{
3559 if (nothrow_p)
3560 s->subcode |= GF_CALL_NOTHROW;
3561 else
3562 s->subcode &= ~GF_CALL_NOTHROW;
3563}
3564
3565/* Return true if S is a nothrow call. */
3566
3567inline bool
3568gimple_call_nothrow_p (const gcall *s)
3569{
3570 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3571}
3572
3573/* If EXPECTED_THROW_P is true, GIMPLE_CALL S is a call that is known
3574 to be more likely to throw than to run forever, terminate the
3575 program or return by other means. */
3576
3577static inline void
3578gimple_call_set_expected_throw (gcall *s, bool expected_throw_p)
3579{
3580 if (expected_throw_p)
3581 s->subcode |= GF_CALL_XTHROW;
3582 else
3583 s->subcode &= ~GF_CALL_XTHROW;
3584}
3585
3586/* Return true if S is a call that is more likely to end by
3587 propagating an exception than by other means. */
3588
3589static inline bool
3590gimple_call_expected_throw_p (gcall *s)
3591{
3592 return (gimple_call_flags (s) & ECF_XTHROW) != 0;
3593}
3594
3595/* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3596 is known to be emitted for VLA objects. Those are wrapped by
3597 stack_save/stack_restore calls and hence can't lead to unbounded
3598 stack growth even when they occur in loops. */
3599
3600inline void
3601gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3602{
3603 if (for_var)
3604 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3605 else
3606 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3607}
3608
3609/* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3610
3611inline bool
3612gimple_call_alloca_for_var_p (gcall *s)
3613{
3614 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3615}
3616
3617inline bool
3618gimple_call_alloca_for_var_p (gimple *s)
3619{
3620 const gcall *gc = GIMPLE_CHECK2<gcall *> (gs: s);
3621 return (gc->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3622}
3623
3624/* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3625 pointers to nested function are descriptors instead of trampolines. */
3626
3627inline void
3628gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3629{
3630 if (by_descriptor_p)
3631 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3632 else
3633 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3634}
3635
3636/* Return true if S is a by-descriptor call. */
3637
3638inline bool
3639gimple_call_by_descriptor_p (gcall *s)
3640{
3641 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3642}
3643
3644/* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3645
3646inline void
3647gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3648{
3649 dest_call->subcode = orig_call->subcode;
3650}
3651
3652
3653/* Return a pointer to the points-to solution for the set of call-used
3654 variables of the call CALL_STMT. */
3655
3656inline struct pt_solution *
3657gimple_call_use_set (gcall *call_stmt)
3658{
3659 return &call_stmt->call_used;
3660}
3661
3662/* As above, but const. */
3663
3664inline const pt_solution *
3665gimple_call_use_set (const gcall *call_stmt)
3666{
3667 return &call_stmt->call_used;
3668}
3669
3670/* Return a pointer to the points-to solution for the set of call-used
3671 variables of the call CALL_STMT. */
3672
3673inline struct pt_solution *
3674gimple_call_clobber_set (gcall *call_stmt)
3675{
3676 return &call_stmt->call_clobbered;
3677}
3678
3679/* As above, but const. */
3680
3681inline const pt_solution *
3682gimple_call_clobber_set (const gcall *call_stmt)
3683{
3684 return &call_stmt->call_clobbered;
3685}
3686
3687
3688/* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3689 non-NULL lhs. */
3690
3691inline bool
3692gimple_has_lhs (const gimple *stmt)
3693{
3694 if (is_gimple_assign (gs: stmt))
3695 return true;
3696 if (const gcall *call = dyn_cast <const gcall *> (p: stmt))
3697 return gimple_call_lhs (gs: call) != NULL_TREE;
3698 return false;
3699}
3700
3701
3702/* Return the code of the predicate computed by conditional statement GS. */
3703
3704inline enum tree_code
3705gimple_cond_code (const gcond *gs)
3706{
3707 return (enum tree_code) gs->subcode;
3708}
3709
3710inline enum tree_code
3711gimple_cond_code (const gimple *gs)
3712{
3713 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3714 return gimple_cond_code (gs: gc);
3715}
3716
3717
3718/* Set CODE to be the predicate code for the conditional statement GS. */
3719
3720inline void
3721gimple_cond_set_code (gcond *gs, enum tree_code code)
3722{
3723 gcc_gimple_checking_assert (TREE_CODE_CLASS (code) == tcc_comparison);
3724 gs->subcode = code;
3725}
3726
3727
3728/* Return the LHS of the predicate computed by conditional statement GS. */
3729
3730inline tree
3731gimple_cond_lhs (const gcond *gs)
3732{
3733 return gs->op[0];
3734}
3735
3736inline tree
3737gimple_cond_lhs (const gimple *gs)
3738{
3739 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3740 return gimple_cond_lhs (gs: gc);
3741}
3742
3743/* Return the pointer to the LHS of the predicate computed by conditional
3744 statement GS. */
3745
3746inline tree *
3747gimple_cond_lhs_ptr (gcond *gs)
3748{
3749 return &gs->op[0];
3750}
3751
3752/* Set LHS to be the LHS operand of the predicate computed by
3753 conditional statement GS. */
3754
3755inline void
3756gimple_cond_set_lhs (gcond *gs, tree lhs)
3757{
3758 gs->op[0] = lhs;
3759}
3760
3761
3762/* Return the RHS operand of the predicate computed by conditional GS. */
3763
3764inline tree
3765gimple_cond_rhs (const gcond *gs)
3766{
3767 return gs->op[1];
3768}
3769
3770inline tree
3771gimple_cond_rhs (const gimple *gs)
3772{
3773 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3774 return gimple_cond_rhs (gs: gc);
3775}
3776
3777/* Return the pointer to the RHS operand of the predicate computed by
3778 conditional GS. */
3779
3780inline tree *
3781gimple_cond_rhs_ptr (gcond *gs)
3782{
3783 return &gs->op[1];
3784}
3785
3786
3787/* Set RHS to be the RHS operand of the predicate computed by
3788 conditional statement GS. */
3789
3790inline void
3791gimple_cond_set_rhs (gcond *gs, tree rhs)
3792{
3793 gs->op[1] = rhs;
3794}
3795
3796
3797/* Return the label used by conditional statement GS when its
3798 predicate evaluates to true. */
3799
3800inline tree
3801gimple_cond_true_label (const gcond *gs)
3802{
3803 return gs->op[2];
3804}
3805
3806
3807/* Set LABEL to be the label used by conditional statement GS when its
3808 predicate evaluates to true. */
3809
3810inline void
3811gimple_cond_set_true_label (gcond *gs, tree label)
3812{
3813 gs->op[2] = label;
3814}
3815
3816
3817/* Set LABEL to be the label used by conditional statement GS when its
3818 predicate evaluates to false. */
3819
3820inline void
3821gimple_cond_set_false_label (gcond *gs, tree label)
3822{
3823 gs->op[3] = label;
3824}
3825
3826
3827/* Return the label used by conditional statement GS when its
3828 predicate evaluates to false. */
3829
3830inline tree
3831gimple_cond_false_label (const gcond *gs)
3832{
3833 return gs->op[3];
3834}
3835
3836
3837/* Set the conditional COND_STMT to be of the form 'if (0 != 0)'. */
3838
3839inline void
3840gimple_cond_make_false (gcond *gs)
3841{
3842 gimple_cond_set_lhs (gs, boolean_false_node);
3843 gimple_cond_set_rhs (gs, boolean_false_node);
3844 gs->subcode = NE_EXPR;
3845}
3846
3847
3848/* Set the conditional COND_STMT to be of the form 'if (1 != 0)'. */
3849
3850inline void
3851gimple_cond_make_true (gcond *gs)
3852{
3853 gimple_cond_set_lhs (gs, boolean_true_node);
3854 gimple_cond_set_rhs (gs, boolean_false_node);
3855 gs->subcode = NE_EXPR;
3856}
3857
3858/* Check if conditional statement GS is of the form 'if (1 == 1)',
3859 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3860
3861inline bool
3862gimple_cond_true_p (const gcond *gs)
3863{
3864 tree lhs = gimple_cond_lhs (gs);
3865 tree rhs = gimple_cond_rhs (gs);
3866 enum tree_code code = gimple_cond_code (gs);
3867
3868 if (lhs != boolean_true_node && lhs != boolean_false_node)
3869 return false;
3870
3871 if (rhs != boolean_true_node && rhs != boolean_false_node)
3872 return false;
3873
3874 if (code == NE_EXPR && lhs != rhs)
3875 return true;
3876
3877 if (code == EQ_EXPR && lhs == rhs)
3878 return true;
3879
3880 return false;
3881}
3882
3883/* Check if conditional statement GS is in the caonical form of 'if (1 != 0)'. */
3884
3885inline bool
3886gimple_cond_true_canonical_p (const gcond *gs)
3887{
3888 tree lhs = gimple_cond_lhs (gs);
3889 tree rhs = gimple_cond_rhs (gs);
3890 tree_code code = gimple_cond_code (gs);
3891 if (code == NE_EXPR
3892 && lhs == boolean_true_node
3893 && rhs == boolean_false_node)
3894 return true;
3895 return false;
3896}
3897
3898/* Check if conditional statement GS is of the form 'if (1 != 1)',
3899 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3900
3901inline bool
3902gimple_cond_false_p (const gcond *gs)
3903{
3904 tree lhs = gimple_cond_lhs (gs);
3905 tree rhs = gimple_cond_rhs (gs);
3906 enum tree_code code = gimple_cond_code (gs);
3907
3908 if (lhs != boolean_true_node && lhs != boolean_false_node)
3909 return false;
3910
3911 if (rhs != boolean_true_node && rhs != boolean_false_node)
3912 return false;
3913
3914 if (code == NE_EXPR && lhs == rhs)
3915 return true;
3916
3917 if (code == EQ_EXPR && lhs != rhs)
3918 return true;
3919
3920 return false;
3921}
3922
3923/* Check if conditional statement GS is in the caonical form of 'if (0 != 0)'. */
3924
3925inline bool
3926gimple_cond_false_canonical_p (const gcond *gs)
3927{
3928 tree lhs = gimple_cond_lhs (gs);
3929 tree rhs = gimple_cond_rhs (gs);
3930 tree_code code = gimple_cond_code (gs);
3931 if (code == NE_EXPR
3932 && lhs == boolean_false_node
3933 && rhs == boolean_false_node)
3934 return true;
3935 return false;
3936}
3937
3938/* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3939
3940inline void
3941gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3942 tree rhs)
3943{
3944 gimple_cond_set_code (gs: stmt, code);
3945 gimple_cond_set_lhs (gs: stmt, lhs);
3946 gimple_cond_set_rhs (gs: stmt, rhs);
3947}
3948
3949
3950/* Return the tree code for the expression computed by STMT. This is
3951 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
3952 GIMPLE_CALL, return CALL_EXPR as the expression code for
3953 consistency. This is useful when the caller needs to deal with the
3954 three kinds of computation that GIMPLE supports. */
3955
3956inline enum tree_code
3957gimple_expr_code (const gimple *stmt)
3958{
3959 if (const gassign *ass = dyn_cast<const gassign *> (p: stmt))
3960 return gimple_assign_rhs_code (gs: ass);
3961 if (const gcond *cond = dyn_cast<const gcond *> (p: stmt))
3962 return gimple_cond_code (gs: cond);
3963 else
3964 {
3965 gcc_gimple_checking_assert (gimple_code (stmt) == GIMPLE_CALL);
3966 return CALL_EXPR;
3967 }
3968}
3969
3970
3971/* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3972
3973inline tree
3974gimple_label_label (const glabel *gs)
3975{
3976 return gs->op[0];
3977}
3978
3979
3980/* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3981 GS. */
3982
3983inline void
3984gimple_label_set_label (glabel *gs, tree label)
3985{
3986 gs->op[0] = label;
3987}
3988
3989
3990/* Return the destination of the unconditional jump GS. */
3991
3992inline tree
3993gimple_goto_dest (const gimple *gs)
3994{
3995 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3996 return gimple_op (gs, i: 0);
3997}
3998
3999
4000/* Set DEST to be the destination of the unconditonal jump GS. */
4001
4002inline void
4003gimple_goto_set_dest (ggoto *gs, tree dest)
4004{
4005 gs->op[0] = dest;
4006}
4007
4008
4009/* Return the variables declared in the GIMPLE_BIND statement GS. */
4010
4011inline tree
4012gimple_bind_vars (const gbind *bind_stmt)
4013{
4014 return bind_stmt->vars;
4015}
4016
4017
4018/* Set VARS to be the set of variables declared in the GIMPLE_BIND
4019 statement GS. */
4020
4021inline void
4022gimple_bind_set_vars (gbind *bind_stmt, tree vars)
4023{
4024 bind_stmt->vars = vars;
4025}
4026
4027
4028/* Append VARS to the set of variables declared in the GIMPLE_BIND
4029 statement GS. */
4030
4031inline void
4032gimple_bind_append_vars (gbind *bind_stmt, tree vars)
4033{
4034 bind_stmt->vars = chainon (bind_stmt->vars, vars);
4035}
4036
4037
4038inline gimple_seq *
4039gimple_bind_body_ptr (gbind *bind_stmt)
4040{
4041 return &bind_stmt->body;
4042}
4043
4044/* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
4045
4046inline gimple_seq
4047gimple_bind_body (const gbind *gs)
4048{
4049 return *gimple_bind_body_ptr (bind_stmt: const_cast <gbind *> (gs));
4050}
4051
4052
4053/* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
4054 statement GS. */
4055
4056inline void
4057gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
4058{
4059 bind_stmt->body = seq;
4060}
4061
4062
4063/* Append a statement to the end of a GIMPLE_BIND's body. */
4064
4065inline void
4066gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
4067{
4068 gimple_seq_add_stmt (&bind_stmt->body, stmt);
4069}
4070
4071
4072/* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
4073
4074inline void
4075gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
4076{
4077 gimple_seq_add_seq (&bind_stmt->body, seq);
4078}
4079
4080
4081/* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
4082 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
4083
4084inline tree
4085gimple_bind_block (const gbind *bind_stmt)
4086{
4087 return bind_stmt->block;
4088}
4089
4090
4091/* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
4092 statement GS. */
4093
4094inline void
4095gimple_bind_set_block (gbind *bind_stmt, tree block)
4096{
4097 gcc_gimple_checking_assert (block == NULL_TREE
4098 || TREE_CODE (block) == BLOCK);
4099 bind_stmt->block = block;
4100}
4101
4102
4103/* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
4104
4105inline unsigned
4106gimple_asm_ninputs (const gasm *asm_stmt)
4107{
4108 return asm_stmt->ni;
4109}
4110
4111
4112/* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
4113
4114inline unsigned
4115gimple_asm_noutputs (const gasm *asm_stmt)
4116{
4117 return asm_stmt->no;
4118}
4119
4120
4121/* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
4122
4123inline unsigned
4124gimple_asm_nclobbers (const gasm *asm_stmt)
4125{
4126 return asm_stmt->nc;
4127}
4128
4129/* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
4130
4131inline unsigned
4132gimple_asm_nlabels (const gasm *asm_stmt)
4133{
4134 return asm_stmt->nl;
4135}
4136
4137/* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
4138
4139inline tree
4140gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
4141{
4142 gcc_gimple_checking_assert (index < asm_stmt->ni);
4143 return asm_stmt->op[index + asm_stmt->no];
4144}
4145
4146/* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
4147
4148inline void
4149gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
4150{
4151 gcc_gimple_checking_assert (index < asm_stmt->ni
4152 && TREE_CODE (in_op) == TREE_LIST);
4153 asm_stmt->op[index + asm_stmt->no] = in_op;
4154}
4155
4156
4157/* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
4158
4159inline tree
4160gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
4161{
4162 gcc_gimple_checking_assert (index < asm_stmt->no);
4163 return asm_stmt->op[index];
4164}
4165
4166/* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
4167
4168inline void
4169gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
4170{
4171 gcc_gimple_checking_assert (index < asm_stmt->no
4172 && TREE_CODE (out_op) == TREE_LIST);
4173 asm_stmt->op[index] = out_op;
4174}
4175
4176
4177/* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
4178
4179inline tree
4180gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
4181{
4182 gcc_gimple_checking_assert (index < asm_stmt->nc);
4183 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
4184}
4185
4186
4187/* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
4188
4189inline void
4190gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
4191{
4192 gcc_gimple_checking_assert (index < asm_stmt->nc
4193 && TREE_CODE (clobber_op) == TREE_LIST);
4194 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
4195}
4196
4197/* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
4198
4199inline tree
4200gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
4201{
4202 gcc_gimple_checking_assert (index < asm_stmt->nl);
4203 return asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc];
4204}
4205
4206/* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
4207
4208inline void
4209gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
4210{
4211 gcc_gimple_checking_assert (index < asm_stmt->nl
4212 && TREE_CODE (label_op) == TREE_LIST);
4213 asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc] = label_op;
4214}
4215
4216/* Return the string representing the assembly instruction in
4217 GIMPLE_ASM ASM_STMT. */
4218
4219inline const char *
4220gimple_asm_string (const gasm *asm_stmt)
4221{
4222 return asm_stmt->string;
4223}
4224
4225
4226/* Return true if ASM_STMT is marked volatile. */
4227
4228inline bool
4229gimple_asm_volatile_p (const gasm *asm_stmt)
4230{
4231 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
4232}
4233
4234
4235/* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
4236
4237inline void
4238gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
4239{
4240 if (volatile_p)
4241 asm_stmt->subcode |= GF_ASM_VOLATILE;
4242 else
4243 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
4244}
4245
4246
4247/* Return true if ASM_STMT is marked inline. */
4248
4249inline bool
4250gimple_asm_inline_p (const gasm *asm_stmt)
4251{
4252 return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
4253}
4254
4255
4256/* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
4257
4258inline void
4259gimple_asm_set_inline (gasm *asm_stmt, bool inline_p)
4260{
4261 if (inline_p)
4262 asm_stmt->subcode |= GF_ASM_INLINE;
4263 else
4264 asm_stmt->subcode &= ~GF_ASM_INLINE;
4265}
4266
4267
4268/* Mark whether asm ASM_STMT is a basic asm or an extended asm, based on
4269 BASIC_P. */
4270
4271inline void
4272gimple_asm_set_basic (gasm *asm_stmt, bool basic_p)
4273{
4274 if (basic_p)
4275 asm_stmt->subcode |= GF_ASM_BASIC;
4276 else
4277 asm_stmt->subcode &= ~GF_ASM_BASIC;
4278}
4279
4280
4281/* Return true if asm ASM_STMT is a basic asm rather than an extended asm. */
4282
4283inline bool
4284gimple_asm_basic_p (const gasm *asm_stmt)
4285{
4286 return (asm_stmt->subcode & GF_ASM_BASIC) != 0;
4287}
4288
4289
4290/* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4291
4292inline tree
4293gimple_catch_types (const gcatch *catch_stmt)
4294{
4295 return catch_stmt->types;
4296}
4297
4298
4299/* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4300
4301inline tree *
4302gimple_catch_types_ptr (gcatch *catch_stmt)
4303{
4304 return &catch_stmt->types;
4305}
4306
4307
4308/* Return a pointer to the GIMPLE sequence representing the body of
4309 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4310
4311inline gimple_seq *
4312gimple_catch_handler_ptr (gcatch *catch_stmt)
4313{
4314 return &catch_stmt->handler;
4315}
4316
4317
4318/* Return the GIMPLE sequence representing the body of the handler of
4319 GIMPLE_CATCH statement CATCH_STMT. */
4320
4321inline gimple_seq
4322gimple_catch_handler (const gcatch *catch_stmt)
4323{
4324 return *gimple_catch_handler_ptr (catch_stmt: const_cast <gcatch *> (catch_stmt));
4325}
4326
4327
4328/* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4329
4330inline void
4331gimple_catch_set_types (gcatch *catch_stmt, tree t)
4332{
4333 catch_stmt->types = t;
4334}
4335
4336
4337/* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4338
4339inline void
4340gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4341{
4342 catch_stmt->handler = handler;
4343}
4344
4345
4346/* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4347
4348inline tree
4349gimple_eh_filter_types (const gimple *gs)
4350{
4351 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (p: gs);
4352 return eh_filter_stmt->types;
4353}
4354
4355
4356/* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4357 GS. */
4358
4359inline tree *
4360gimple_eh_filter_types_ptr (gimple *gs)
4361{
4362 geh_filter *eh_filter_stmt = as_a <geh_filter *> (p: gs);
4363 return &eh_filter_stmt->types;
4364}
4365
4366
4367/* Return a pointer to the sequence of statement to execute when
4368 GIMPLE_EH_FILTER statement fails. */
4369
4370inline gimple_seq *
4371gimple_eh_filter_failure_ptr (gimple *gs)
4372{
4373 geh_filter *eh_filter_stmt = as_a <geh_filter *> (p: gs);
4374 return &eh_filter_stmt->failure;
4375}
4376
4377
4378/* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4379 statement fails. */
4380
4381inline gimple_seq
4382gimple_eh_filter_failure (const gimple *gs)
4383{
4384 return *gimple_eh_filter_failure_ptr (gs: const_cast <gimple *> (gs));
4385}
4386
4387
4388/* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4389 EH_FILTER_STMT. */
4390
4391inline void
4392gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4393{
4394 eh_filter_stmt->types = types;
4395}
4396
4397
4398/* Set FAILURE to be the sequence of statements to execute on failure
4399 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4400
4401inline void
4402gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4403 gimple_seq failure)
4404{
4405 eh_filter_stmt->failure = failure;
4406}
4407
4408/* Get the function decl to be called by the MUST_NOT_THROW region. */
4409
4410inline tree
4411gimple_eh_must_not_throw_fndecl (const geh_mnt *eh_mnt_stmt)
4412{
4413 return eh_mnt_stmt->fndecl;
4414}
4415
4416/* Set the function decl to be called by GS to DECL. */
4417
4418inline void
4419gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4420 tree decl)
4421{
4422 eh_mnt_stmt->fndecl = decl;
4423}
4424
4425/* GIMPLE_EH_ELSE accessors. */
4426
4427inline gimple_seq *
4428gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4429{
4430 return &eh_else_stmt->n_body;
4431}
4432
4433inline gimple_seq
4434gimple_eh_else_n_body (const geh_else *eh_else_stmt)
4435{
4436 return *gimple_eh_else_n_body_ptr (eh_else_stmt: const_cast <geh_else *> (eh_else_stmt));
4437}
4438
4439inline gimple_seq *
4440gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4441{
4442 return &eh_else_stmt->e_body;
4443}
4444
4445inline gimple_seq
4446gimple_eh_else_e_body (const geh_else *eh_else_stmt)
4447{
4448 return *gimple_eh_else_e_body_ptr (eh_else_stmt: const_cast <geh_else *> (eh_else_stmt));
4449}
4450
4451inline void
4452gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4453{
4454 eh_else_stmt->n_body = seq;
4455}
4456
4457inline void
4458gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4459{
4460 eh_else_stmt->e_body = seq;
4461}
4462
4463/* GIMPLE_TRY accessors. */
4464
4465/* Return the kind of try block represented by GIMPLE_TRY GS. This is
4466 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4467
4468inline enum gimple_try_flags
4469gimple_try_kind (const gimple *gs)
4470{
4471 GIMPLE_CHECK (gs, GIMPLE_TRY);
4472 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4473}
4474
4475
4476/* Set the kind of try block represented by GIMPLE_TRY GS. */
4477
4478inline void
4479gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4480{
4481 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4482 || kind == GIMPLE_TRY_FINALLY);
4483 if (gimple_try_kind (gs) != kind)
4484 gs->subcode = (unsigned int) kind;
4485}
4486
4487
4488/* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4489
4490inline bool
4491gimple_try_catch_is_cleanup (const gimple *gs)
4492{
4493 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4494 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4495}
4496
4497
4498/* Return a pointer to the sequence of statements used as the
4499 body for GIMPLE_TRY GS. */
4500
4501inline gimple_seq *
4502gimple_try_eval_ptr (gimple *gs)
4503{
4504 gtry *try_stmt = as_a <gtry *> (p: gs);
4505 return &try_stmt->eval;
4506}
4507
4508
4509/* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4510
4511inline gimple_seq
4512gimple_try_eval (const gimple *gs)
4513{
4514 return *gimple_try_eval_ptr (gs: const_cast <gimple *> (gs));
4515}
4516
4517
4518/* Return a pointer to the sequence of statements used as the cleanup body for
4519 GIMPLE_TRY GS. */
4520
4521inline gimple_seq *
4522gimple_try_cleanup_ptr (gimple *gs)
4523{
4524 gtry *try_stmt = as_a <gtry *> (p: gs);
4525 return &try_stmt->cleanup;
4526}
4527
4528
4529/* Return the sequence of statements used as the cleanup body for
4530 GIMPLE_TRY GS. */
4531
4532inline gimple_seq
4533gimple_try_cleanup (const gimple *gs)
4534{
4535 return *gimple_try_cleanup_ptr (gs: const_cast <gimple *> (gs));
4536}
4537
4538
4539/* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4540
4541inline void
4542gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4543{
4544 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4545 if (catch_is_cleanup)
4546 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4547 else
4548 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4549}
4550
4551
4552/* Set EVAL to be the sequence of statements to use as the body for
4553 GIMPLE_TRY TRY_STMT. */
4554
4555inline void
4556gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4557{
4558 try_stmt->eval = eval;
4559}
4560
4561
4562/* Set CLEANUP to be the sequence of statements to use as the cleanup
4563 body for GIMPLE_TRY TRY_STMT. */
4564
4565inline void
4566gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4567{
4568 try_stmt->cleanup = cleanup;
4569}
4570
4571
4572/* Return a pointer to the cleanup sequence for cleanup statement GS. */
4573
4574inline gimple_seq *
4575gimple_wce_cleanup_ptr (gimple *gs)
4576{
4577 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (p: gs);
4578 return &wce_stmt->cleanup;
4579}
4580
4581
4582/* Return the cleanup sequence for cleanup statement GS. */
4583
4584inline gimple_seq
4585gimple_wce_cleanup (gimple *gs)
4586{
4587 return *gimple_wce_cleanup_ptr (gs);
4588}
4589
4590
4591/* Set CLEANUP to be the cleanup sequence for GS. */
4592
4593inline void
4594gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4595{
4596 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (p: gs);
4597 wce_stmt->cleanup = cleanup;
4598}
4599
4600
4601/* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4602
4603inline bool
4604gimple_wce_cleanup_eh_only (const gimple *gs)
4605{
4606 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4607 return gs->subcode != 0;
4608}
4609
4610
4611/* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4612
4613inline void
4614gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4615{
4616 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4617 gs->subcode = (unsigned int) eh_only_p;
4618}
4619
4620
4621/* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4622
4623inline unsigned
4624gimple_phi_capacity (const gimple *gs)
4625{
4626 const gphi *phi_stmt = as_a <const gphi *> (p: gs);
4627 return phi_stmt->capacity;
4628}
4629
4630
4631/* Return the number of arguments in GIMPLE_PHI GS. This must always
4632 be exactly the number of incoming edges for the basic block holding
4633 GS. */
4634
4635inline unsigned
4636gimple_phi_num_args (const gimple *gs)
4637{
4638 const gphi *phi_stmt = as_a <const gphi *> (p: gs);
4639 return phi_stmt->nargs;
4640}
4641
4642
4643/* Return the SSA name created by GIMPLE_PHI GS. */
4644
4645inline tree
4646gimple_phi_result (const gphi *gs)
4647{
4648 return gs->result;
4649}
4650
4651inline tree
4652gimple_phi_result (const gimple *gs)
4653{
4654 const gphi *phi_stmt = as_a <const gphi *> (p: gs);
4655 return gimple_phi_result (gs: phi_stmt);
4656}
4657
4658/* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4659
4660inline tree *
4661gimple_phi_result_ptr (gphi *gs)
4662{
4663 return &gs->result;
4664}
4665
4666inline tree *
4667gimple_phi_result_ptr (gimple *gs)
4668{
4669 gphi *phi_stmt = as_a <gphi *> (p: gs);
4670 return gimple_phi_result_ptr (gs: phi_stmt);
4671}
4672
4673/* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4674
4675inline void
4676gimple_phi_set_result (gphi *phi, tree result)
4677{
4678 phi->result = result;
4679 if (result && TREE_CODE (result) == SSA_NAME)
4680 SSA_NAME_DEF_STMT (result) = phi;
4681}
4682
4683
4684/* Return the PHI argument corresponding to incoming edge INDEX for
4685 GIMPLE_PHI GS. */
4686
4687inline struct phi_arg_d *
4688gimple_phi_arg (gphi *gs, unsigned index)
4689{
4690 gcc_gimple_checking_assert (index < gs->nargs);
4691 return &(gs->args[index]);
4692}
4693
4694inline const phi_arg_d *
4695gimple_phi_arg (const gphi *gs, unsigned index)
4696{
4697 gcc_gimple_checking_assert (index < gs->nargs);
4698 return &(gs->args[index]);
4699}
4700
4701inline const phi_arg_d *
4702gimple_phi_arg (const gimple *gs, unsigned index)
4703{
4704 const gphi *phi_stmt = as_a <const gphi *> (p: gs);
4705 return gimple_phi_arg (gs: phi_stmt, index);
4706}
4707
4708inline struct phi_arg_d *
4709gimple_phi_arg (gimple *gs, unsigned index)
4710{
4711 gphi *phi_stmt = as_a <gphi *> (p: gs);
4712 return gimple_phi_arg (gs: phi_stmt, index);
4713}
4714
4715/* Set PHIARG to be the argument corresponding to incoming edge INDEX
4716 for GIMPLE_PHI PHI. */
4717
4718inline void
4719gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4720{
4721 gcc_gimple_checking_assert (index < phi->nargs);
4722 phi->args[index] = *phiarg;
4723}
4724
4725/* Return the PHI nodes for basic block BB, or NULL if there are no
4726 PHI nodes. */
4727
4728inline gimple_seq
4729phi_nodes (const_basic_block bb)
4730{
4731 gcc_checking_assert (!(bb->flags & BB_RTL));
4732 return bb->il.gimple.phi_nodes;
4733}
4734
4735/* Return a pointer to the PHI nodes for basic block BB. */
4736
4737inline gimple_seq *
4738phi_nodes_ptr (basic_block bb)
4739{
4740 gcc_checking_assert (!(bb->flags & BB_RTL));
4741 return &bb->il.gimple.phi_nodes;
4742}
4743
4744/* Return the tree operand for argument I of PHI node GS. */
4745
4746inline tree
4747gimple_phi_arg_def (const gphi *gs, size_t index)
4748{
4749 return gimple_phi_arg (gs, index)->def;
4750}
4751
4752inline tree
4753gimple_phi_arg_def (const gimple *gs, size_t index)
4754{
4755 return gimple_phi_arg (gs, index)->def;
4756}
4757
4758/* Return the tree operand for the argument associated with
4759 edge E of PHI node GS. */
4760
4761inline tree
4762gimple_phi_arg_def_from_edge (const gphi *gs, const_edge e)
4763{
4764 gcc_checking_assert (e->dest == gimple_bb (gs));
4765 return gimple_phi_arg (gs, index: e->dest_idx)->def;
4766}
4767
4768inline tree
4769gimple_phi_arg_def_from_edge (const gimple *gs, const_edge e)
4770{
4771 gcc_checking_assert (e->dest == gimple_bb (gs));
4772 return gimple_phi_arg (gs, index: e->dest_idx)->def;
4773}
4774
4775/* Return a pointer to the tree operand for argument I of phi node PHI. */
4776
4777inline tree *
4778gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4779{
4780 return &gimple_phi_arg (gs: phi, index)->def;
4781}
4782
4783/* Return the edge associated with argument I of phi node PHI. */
4784
4785inline edge
4786gimple_phi_arg_edge (const gphi *phi, size_t i)
4787{
4788 return EDGE_PRED (gimple_bb (phi), i);
4789}
4790
4791/* Return the source location of gimple argument I of phi node PHI. */
4792
4793inline location_t
4794gimple_phi_arg_location (const gphi *phi, size_t i)
4795{
4796 return gimple_phi_arg (gs: phi, index: i)->locus;
4797}
4798
4799/* Return the source location of the argument on edge E of phi node PHI. */
4800
4801inline location_t
4802gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4803{
4804 return gimple_phi_arg (gs: phi, index: e->dest_idx)->locus;
4805}
4806
4807/* Set the source location of gimple argument I of phi node PHI to LOC. */
4808
4809inline void
4810gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
4811{
4812 gimple_phi_arg (gs: phi, index: i)->locus = loc;
4813}
4814
4815/* Return address of source location of gimple argument I of phi node PHI. */
4816
4817inline location_t *
4818gimple_phi_arg_location_ptr (gphi *phi, size_t i)
4819{
4820 return &gimple_phi_arg (gs: phi, index: i)->locus;
4821}
4822
4823/* Return TRUE if argument I of phi node PHI has a location record. */
4824
4825inline bool
4826gimple_phi_arg_has_location (const gphi *phi, size_t i)
4827{
4828 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4829}
4830
4831/* Return the number of arguments that can be accessed by gimple_arg. */
4832
4833inline unsigned
4834gimple_num_args (const gimple *gs)
4835{
4836 if (auto phi = dyn_cast<const gphi *> (p: gs))
4837 return gimple_phi_num_args (gs: phi);
4838 if (auto call = dyn_cast<const gcall *> (p: gs))
4839 return gimple_call_num_args (gs: call);
4840 return gimple_num_ops (gs: as_a <const gassign *> (p: gs)) - 1;
4841}
4842
4843/* GS must be an assignment, a call, or a PHI.
4844 If it's an assignment, return rhs operand I.
4845 If it's a call, return function argument I.
4846 If it's a PHI, return the value of PHI argument I. */
4847
4848inline tree
4849gimple_arg (const gimple *gs, unsigned int i)
4850{
4851 if (auto phi = dyn_cast<const gphi *> (p: gs))
4852 return gimple_phi_arg_def (gs: phi, index: i);
4853 if (auto call = dyn_cast<const gcall *> (p: gs))
4854 return gimple_call_arg (gs: call, index: i);
4855 return gimple_op (gs: as_a <const gassign *> (p: gs), i: i + 1);
4856}
4857
4858/* Return a pointer to gimple_arg (GS, I). */
4859
4860inline tree *
4861gimple_arg_ptr (gimple *gs, unsigned int i)
4862{
4863 if (auto phi = dyn_cast<gphi *> (p: gs))
4864 return gimple_phi_arg_def_ptr (phi, index: i);
4865 if (auto call = dyn_cast<gcall *> (p: gs))
4866 return gimple_call_arg_ptr (gs: call, index: i);
4867 return gimple_op_ptr (gs: as_a <gassign *> (p: gs), i: i + 1);
4868}
4869
4870/* Return the region number for GIMPLE_RESX RESX_STMT. */
4871
4872inline int
4873gimple_resx_region (const gresx *resx_stmt)
4874{
4875 return resx_stmt->region;
4876}
4877
4878/* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4879
4880inline void
4881gimple_resx_set_region (gresx *resx_stmt, int region)
4882{
4883 resx_stmt->region = region;
4884}
4885
4886/* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4887
4888inline int
4889gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4890{
4891 return eh_dispatch_stmt->region;
4892}
4893
4894/* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4895 EH_DISPATCH_STMT. */
4896
4897inline void
4898gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4899{
4900 eh_dispatch_stmt->region = region;
4901}
4902
4903/* Return the number of labels associated with the switch statement GS. */
4904
4905inline unsigned
4906gimple_switch_num_labels (const gswitch *gs)
4907{
4908 unsigned num_ops;
4909 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4910 num_ops = gimple_num_ops (gs);
4911 gcc_gimple_checking_assert (num_ops > 1);
4912 return num_ops - 1;
4913}
4914
4915
4916/* Set NLABELS to be the number of labels for the switch statement GS. */
4917
4918inline void
4919gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4920{
4921 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4922 gimple_set_num_ops (gs: g, num_ops: nlabels + 1);
4923}
4924
4925
4926/* Return the index variable used by the switch statement GS. */
4927
4928inline tree
4929gimple_switch_index (const gswitch *gs)
4930{
4931 return gs->op[0];
4932}
4933
4934
4935/* Return a pointer to the index variable for the switch statement GS. */
4936
4937inline tree *
4938gimple_switch_index_ptr (gswitch *gs)
4939{
4940 return &gs->op[0];
4941}
4942
4943
4944/* Set INDEX to be the index variable for switch statement GS. */
4945
4946inline void
4947gimple_switch_set_index (gswitch *gs, tree index)
4948{
4949 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4950 gs->op[0] = index;
4951}
4952
4953
4954/* Return the label numbered INDEX. The default label is 0, followed by any
4955 labels in a switch statement. */
4956
4957inline tree
4958gimple_switch_label (const gswitch *gs, unsigned index)
4959{
4960 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4961 return gs->op[index + 1];
4962}
4963
4964/* Set the label number INDEX to LABEL. 0 is always the default label. */
4965
4966inline void
4967gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4968{
4969 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4970 && (label == NULL_TREE
4971 || TREE_CODE (label) == CASE_LABEL_EXPR));
4972 gs->op[index + 1] = label;
4973}
4974
4975/* Return the default label for a switch statement. */
4976
4977inline tree
4978gimple_switch_default_label (const gswitch *gs)
4979{
4980 tree label = gimple_switch_label (gs, index: 0);
4981 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4982 return label;
4983}
4984
4985/* Set the default label for a switch statement. */
4986
4987inline void
4988gimple_switch_set_default_label (gswitch *gs, tree label)
4989{
4990 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4991 gimple_switch_set_label (gs, index: 0, label);
4992}
4993
4994/* Return true if GS is a GIMPLE_DEBUG statement. */
4995
4996inline bool
4997is_gimple_debug (const gimple *gs)
4998{
4999 return gimple_code (g: gs) == GIMPLE_DEBUG;
5000}
5001
5002
5003/* Return the first nondebug statement in GIMPLE sequence S. */
5004
5005inline gimple *
5006gimple_seq_first_nondebug_stmt (gimple_seq s)
5007{
5008 gimple_seq_node n = gimple_seq_first (s);
5009 while (n && is_gimple_debug (gs: n))
5010 n = n->next;
5011 return n;
5012}
5013
5014
5015/* Return the last nondebug statement in GIMPLE sequence S. */
5016
5017inline gimple *
5018gimple_seq_last_nondebug_stmt (gimple_seq s)
5019{
5020 gimple_seq_node n;
5021 for (n = gimple_seq_last (s);
5022 n && is_gimple_debug (gs: n);
5023 n = n->prev)
5024 if (n == s)
5025 return NULL;
5026 return n;
5027}
5028
5029
5030/* Return true if S is a GIMPLE_DEBUG BIND statement. */
5031
5032inline bool
5033gimple_debug_bind_p (const gimple *s)
5034{
5035 if (is_gimple_debug (gs: s))
5036 return s->subcode == GIMPLE_DEBUG_BIND;
5037
5038 return false;
5039}
5040
5041/* Return the variable bound in a GIMPLE_DEBUG bind statement. */
5042
5043inline tree
5044gimple_debug_bind_get_var (const gimple *dbg)
5045{
5046 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5047 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5048 return gimple_op (gs: dbg, i: 0);
5049}
5050
5051/* Return the value bound to the variable in a GIMPLE_DEBUG bind
5052 statement. */
5053
5054inline tree
5055gimple_debug_bind_get_value (const gimple *dbg)
5056{
5057 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5058 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5059 return gimple_op (gs: dbg, i: 1);
5060}
5061
5062/* Return a pointer to the value bound to the variable in a
5063 GIMPLE_DEBUG bind statement. */
5064
5065inline tree *
5066gimple_debug_bind_get_value_ptr (gimple *dbg)
5067{
5068 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5069 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5070 return gimple_op_ptr (gs: dbg, i: 1);
5071}
5072
5073/* Set the variable bound in a GIMPLE_DEBUG bind statement. */
5074
5075inline void
5076gimple_debug_bind_set_var (gimple *dbg, tree var)
5077{
5078 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5079 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5080 gimple_set_op (gs: dbg, i: 0, op: var);
5081}
5082
5083/* Set the value bound to the variable in a GIMPLE_DEBUG bind
5084 statement. */
5085
5086inline void
5087gimple_debug_bind_set_value (gimple *dbg, tree value)
5088{
5089 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5090 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5091 gimple_set_op (gs: dbg, i: 1, op: value);
5092}
5093
5094/* The second operand of a GIMPLE_DEBUG_BIND, when the value was
5095 optimized away. */
5096#define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
5097
5098/* Remove the value bound to the variable in a GIMPLE_DEBUG bind
5099 statement. */
5100
5101inline void
5102gimple_debug_bind_reset_value (gimple *dbg)
5103{
5104 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5105 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5106 gimple_set_op (gs: dbg, i: 1, GIMPLE_DEBUG_BIND_NOVALUE);
5107}
5108
5109/* Return true if the GIMPLE_DEBUG bind statement is bound to a
5110 value. */
5111
5112inline bool
5113gimple_debug_bind_has_value_p (gimple *dbg)
5114{
5115 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5116 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5117 return gimple_op (gs: dbg, i: 1) != GIMPLE_DEBUG_BIND_NOVALUE;
5118}
5119
5120#undef GIMPLE_DEBUG_BIND_NOVALUE
5121
5122/* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
5123
5124inline bool
5125gimple_debug_source_bind_p (const gimple *s)
5126{
5127 if (is_gimple_debug (gs: s))
5128 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
5129
5130 return false;
5131}
5132
5133/* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
5134
5135inline tree
5136gimple_debug_source_bind_get_var (const gimple *dbg)
5137{
5138 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5139 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5140 return gimple_op (gs: dbg, i: 0);
5141}
5142
5143/* Return the value bound to the variable in a GIMPLE_DEBUG source bind
5144 statement. */
5145
5146inline tree
5147gimple_debug_source_bind_get_value (const gimple *dbg)
5148{
5149 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5150 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5151 return gimple_op (gs: dbg, i: 1);
5152}
5153
5154/* Return a pointer to the value bound to the variable in a
5155 GIMPLE_DEBUG source bind statement. */
5156
5157inline tree *
5158gimple_debug_source_bind_get_value_ptr (gimple *dbg)
5159{
5160 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5161 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5162 return gimple_op_ptr (gs: dbg, i: 1);
5163}
5164
5165/* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
5166
5167inline void
5168gimple_debug_source_bind_set_var (gimple *dbg, tree var)
5169{
5170 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5171 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5172 gimple_set_op (gs: dbg, i: 0, op: var);
5173}
5174
5175/* Set the value bound to the variable in a GIMPLE_DEBUG source bind
5176 statement. */
5177
5178inline void
5179gimple_debug_source_bind_set_value (gimple *dbg, tree value)
5180{
5181 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5182 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5183 gimple_set_op (gs: dbg, i: 1, op: value);
5184}
5185
5186/* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
5187
5188inline bool
5189gimple_debug_begin_stmt_p (const gimple *s)
5190{
5191 if (is_gimple_debug (gs: s))
5192 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
5193
5194 return false;
5195}
5196
5197/* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
5198
5199inline bool
5200gimple_debug_inline_entry_p (const gimple *s)
5201{
5202 if (is_gimple_debug (gs: s))
5203 return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
5204
5205 return false;
5206}
5207
5208/* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
5209
5210inline bool
5211gimple_debug_nonbind_marker_p (const gimple *s)
5212{
5213 if (is_gimple_debug (gs: s))
5214 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
5215 || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
5216
5217 return false;
5218}
5219
5220/* Return the line number for EXPR, or return -1 if we have no line
5221 number information for it. */
5222inline int
5223get_lineno (const gimple *stmt)
5224{
5225 location_t loc;
5226
5227 if (!stmt)
5228 return -1;
5229
5230 loc = gimple_location (g: stmt);
5231 if (loc == UNKNOWN_LOCATION)
5232 return -1;
5233
5234 return LOCATION_LINE (loc);
5235}
5236
5237/* Return a pointer to the body for the OMP statement GS. */
5238
5239inline gimple_seq *
5240gimple_omp_body_ptr (gimple *gs)
5241{
5242 return &static_cast <gimple_statement_omp *> (gs)->body;
5243}
5244
5245/* Return the body for the OMP statement GS. */
5246
5247inline gimple_seq
5248gimple_omp_body (const gimple *gs)
5249{
5250 return *gimple_omp_body_ptr (gs: const_cast <gimple *> (gs));
5251}
5252
5253/* Set BODY to be the body for the OMP statement GS. */
5254
5255inline void
5256gimple_omp_set_body (gimple *gs, gimple_seq body)
5257{
5258 static_cast <gimple_statement_omp *> (gs)->body = body;
5259}
5260
5261
5262/* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
5263
5264inline tree
5265gimple_omp_critical_name (const gomp_critical *crit_stmt)
5266{
5267 return crit_stmt->name;
5268}
5269
5270
5271/* Return a pointer to the name associated with OMP critical statement
5272 CRIT_STMT. */
5273
5274inline tree *
5275gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
5276{
5277 return &crit_stmt->name;
5278}
5279
5280
5281/* Set NAME to be the name associated with OMP critical statement
5282 CRIT_STMT. */
5283
5284inline void
5285gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
5286{
5287 crit_stmt->name = name;
5288}
5289
5290
5291/* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
5292
5293inline tree
5294gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
5295{
5296 return crit_stmt->clauses;
5297}
5298
5299
5300/* Return a pointer to the clauses associated with OMP critical statement
5301 CRIT_STMT. */
5302
5303inline tree *
5304gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
5305{
5306 return &crit_stmt->clauses;
5307}
5308
5309
5310/* Set CLAUSES to be the clauses associated with OMP critical statement
5311 CRIT_STMT. */
5312
5313inline void
5314gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
5315{
5316 crit_stmt->clauses = clauses;
5317}
5318
5319
5320/* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
5321
5322inline tree
5323gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
5324{
5325 return ord_stmt->clauses;
5326}
5327
5328
5329/* Return a pointer to the clauses associated with OMP ordered statement
5330 ORD_STMT. */
5331
5332inline tree *
5333gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
5334{
5335 return &ord_stmt->clauses;
5336}
5337
5338
5339/* Set CLAUSES to be the clauses associated with OMP ordered statement
5340 ORD_STMT. */
5341
5342inline void
5343gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
5344{
5345 ord_stmt->clauses = clauses;
5346}
5347
5348
5349/* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
5350
5351inline tree
5352gimple_omp_scan_clauses (const gomp_scan *scan_stmt)
5353{
5354 return scan_stmt->clauses;
5355}
5356
5357
5358/* Return a pointer to the clauses associated with OMP scan statement
5359 ORD_STMT. */
5360
5361inline tree *
5362gimple_omp_scan_clauses_ptr (gomp_scan *scan_stmt)
5363{
5364 return &scan_stmt->clauses;
5365}
5366
5367
5368/* Set CLAUSES to be the clauses associated with OMP scan statement
5369 ORD_STMT. */
5370
5371inline void
5372gimple_omp_scan_set_clauses (gomp_scan *scan_stmt, tree clauses)
5373{
5374 scan_stmt->clauses = clauses;
5375}
5376
5377
5378/* Return the clauses associated with OMP_TASKGROUP statement GS. */
5379
5380inline tree
5381gimple_omp_taskgroup_clauses (const gimple *gs)
5382{
5383 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5384 return
5385 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5386}
5387
5388
5389/* Return a pointer to the clauses associated with OMP taskgroup statement
5390 GS. */
5391
5392inline tree *
5393gimple_omp_taskgroup_clauses_ptr (gimple *gs)
5394{
5395 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5396 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5397}
5398
5399
5400/* Set CLAUSES to be the clauses associated with OMP taskgroup statement
5401 GS. */
5402
5403inline void
5404gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses)
5405{
5406 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5407 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5408 = clauses;
5409}
5410
5411
5412/* Return the clauses associated with OMP_MASKED statement GS. */
5413
5414inline tree
5415gimple_omp_masked_clauses (const gimple *gs)
5416{
5417 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5418 return
5419 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5420}
5421
5422
5423/* Return a pointer to the clauses associated with OMP masked statement
5424 GS. */
5425
5426inline tree *
5427gimple_omp_masked_clauses_ptr (gimple *gs)
5428{
5429 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5430 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5431}
5432
5433
5434/* Set CLAUSES to be the clauses associated with OMP masked statement
5435 GS. */
5436
5437inline void
5438gimple_omp_masked_set_clauses (gimple *gs, tree clauses)
5439{
5440 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5441 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5442 = clauses;
5443}
5444
5445
5446/* Return the clauses associated with OMP_SCOPE statement GS. */
5447
5448inline tree
5449gimple_omp_scope_clauses (const gimple *gs)
5450{
5451 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5452 return
5453 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5454}
5455
5456
5457/* Return a pointer to the clauses associated with OMP scope statement
5458 GS. */
5459
5460inline tree *
5461gimple_omp_scope_clauses_ptr (gimple *gs)
5462{
5463 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5464 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5465}
5466
5467
5468/* Set CLAUSES to be the clauses associated with OMP scope statement
5469 GS. */
5470
5471inline void
5472gimple_omp_scope_set_clauses (gimple *gs, tree clauses)
5473{
5474 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5475 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5476 = clauses;
5477}
5478
5479/* Return the clauses associated with OMP_DISPATCH statement GS. */
5480
5481inline tree
5482gimple_omp_dispatch_clauses (const gimple *gs)
5483{
5484 GIMPLE_CHECK (gs, GIMPLE_OMP_DISPATCH);
5485 return static_cast<const gimple_statement_omp_single_layout *> (gs)->clauses;
5486}
5487
5488/* Return a pointer to the clauses associated with OMP dispatch statement
5489 GS. */
5490
5491inline tree *
5492gimple_omp_dispatch_clauses_ptr (gimple *gs)
5493{
5494 GIMPLE_CHECK (gs, GIMPLE_OMP_DISPATCH);
5495 return &static_cast<gimple_statement_omp_single_layout *> (gs)->clauses;
5496}
5497
5498/* Set CLAUSES to be the clauses associated with OMP dispatch statement
5499 GS. */
5500
5501inline void
5502gimple_omp_dispatch_set_clauses (gimple *gs, tree clauses)
5503{
5504 GIMPLE_CHECK (gs, GIMPLE_OMP_DISPATCH);
5505 static_cast<gimple_statement_omp_single_layout *> (gs)->clauses = clauses;
5506}
5507
5508/* Return the clauses associated with OMP_INTEROP statement GS. */
5509
5510inline tree
5511gimple_omp_interop_clauses (const gimple *gs)
5512{
5513 GIMPLE_CHECK (gs, GIMPLE_OMP_INTEROP);
5514 return static_cast<const gimple_statement_omp_single_layout *> (gs)->clauses;
5515}
5516
5517/* Return a pointer to the clauses associated with OMP_INTEROP statement GS. */
5518
5519inline tree *
5520gimple_omp_interop_clauses_ptr (gimple *gs)
5521{
5522 GIMPLE_CHECK (gs, GIMPLE_OMP_INTEROP);
5523 return &static_cast<gimple_statement_omp_single_layout *> (gs)->clauses;
5524}
5525
5526/* Set CLAUSES to be the clauses associated with OMP interop statement
5527 GS. */
5528
5529inline void
5530gimple_omp_interop_set_clauses (gimple *gs, tree clauses)
5531{
5532 GIMPLE_CHECK (gs, GIMPLE_OMP_INTEROP);
5533 static_cast<gimple_statement_omp_single_layout *> (gs)->clauses = clauses;
5534}
5535
5536/* Return the kind of the OMP_FOR statemement G. */
5537
5538inline int
5539gimple_omp_for_kind (const gimple *g)
5540{
5541 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5542 return (gimple_omp_subcode (s: g) & GF_OMP_FOR_KIND_MASK);
5543}
5544
5545
5546/* Set the kind of the OMP_FOR statement G. */
5547
5548inline void
5549gimple_omp_for_set_kind (gomp_for *g, int kind)
5550{
5551 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
5552 | (kind & GF_OMP_FOR_KIND_MASK);
5553}
5554
5555
5556/* Return true if OMP_FOR statement G has the
5557 GF_OMP_FOR_COMBINED flag set. */
5558
5559inline bool
5560gimple_omp_for_combined_p (const gimple *g)
5561{
5562 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5563 return (gimple_omp_subcode (s: g) & GF_OMP_FOR_COMBINED) != 0;
5564}
5565
5566
5567/* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
5568 the boolean value of COMBINED_P. */
5569
5570inline void
5571gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
5572{
5573 if (combined_p)
5574 g->subcode |= GF_OMP_FOR_COMBINED;
5575 else
5576 g->subcode &= ~GF_OMP_FOR_COMBINED;
5577}
5578
5579
5580/* Return true if the OMP_FOR statement G has the
5581 GF_OMP_FOR_COMBINED_INTO flag set. */
5582
5583inline bool
5584gimple_omp_for_combined_into_p (const gimple *g)
5585{
5586 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5587 return (gimple_omp_subcode (s: g) & GF_OMP_FOR_COMBINED_INTO) != 0;
5588}
5589
5590
5591/* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5592 on the boolean value of COMBINED_P. */
5593
5594inline void
5595gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
5596{
5597 if (combined_p)
5598 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
5599 else
5600 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
5601}
5602
5603
5604/* Return the clauses associated with the OMP_FOR statement GS. */
5605
5606inline tree
5607gimple_omp_for_clauses (const gimple *gs)
5608{
5609 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (p: gs);
5610 return omp_for_stmt->clauses;
5611}
5612
5613
5614/* Return a pointer to the clauses associated with the OMP_FOR statement
5615 GS. */
5616
5617inline tree *
5618gimple_omp_for_clauses_ptr (gimple *gs)
5619{
5620 gomp_for *omp_for_stmt = as_a <gomp_for *> (p: gs);
5621 return &omp_for_stmt->clauses;
5622}
5623
5624
5625/* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5626 GS. */
5627
5628inline void
5629gimple_omp_for_set_clauses (gimple *gs, tree clauses)
5630{
5631 gomp_for *omp_for_stmt = as_a <gomp_for *> (p: gs);
5632 omp_for_stmt->clauses = clauses;
5633}
5634
5635
5636/* Get the collapse count of the OMP_FOR statement GS. */
5637
5638inline size_t
5639gimple_omp_for_collapse (const gimple *gs)
5640{
5641 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (p: gs);
5642 return omp_for_stmt->collapse;
5643}
5644
5645
5646/* Return the condition code associated with the OMP_FOR statement GS. */
5647
5648inline enum tree_code
5649gimple_omp_for_cond (const gimple *gs, size_t i)
5650{
5651 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (p: gs);
5652 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5653 return omp_for_stmt->iter[i].cond;
5654}
5655
5656
5657/* Set COND to be the condition code for the OMP_FOR statement GS. */
5658
5659inline void
5660gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
5661{
5662 gomp_for *omp_for_stmt = as_a <gomp_for *> (p: gs);
5663 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5664 && i < omp_for_stmt->collapse);
5665 omp_for_stmt->iter[i].cond = cond;
5666}
5667
5668
5669/* Return the index variable for the OMP_FOR statement GS. */
5670
5671inline tree
5672gimple_omp_for_index (const gimple *gs, size_t i)
5673{
5674 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (p: gs);
5675 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5676 return omp_for_stmt->iter[i].index;
5677}
5678
5679
5680/* Return a pointer to the index variable for the OMP_FOR statement GS. */
5681
5682inline tree *
5683gimple_omp_for_index_ptr (gimple *gs, size_t i)
5684{
5685 gomp_for *omp_for_stmt = as_a <gomp_for *> (p: gs);
5686 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5687 return &omp_for_stmt->iter[i].index;
5688}
5689
5690
5691/* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5692
5693inline void
5694gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5695{
5696 gomp_for *omp_for_stmt = as_a <gomp_for *> (p: gs);
5697 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5698 omp_for_stmt->iter[i].index = index;
5699}
5700
5701
5702/* Return the initial value for the OMP_FOR statement GS. */
5703
5704inline tree
5705gimple_omp_for_initial (const gimple *gs, size_t i)
5706{
5707 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (p: gs);
5708 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5709 return omp_for_stmt->iter[i].initial;
5710}
5711
5712
5713/* Return a pointer to the initial value for the OMP_FOR statement GS. */
5714
5715inline tree *
5716gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5717{
5718 gomp_for *omp_for_stmt = as_a <gomp_for *> (p: gs);
5719 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5720 return &omp_for_stmt->iter[i].initial;
5721}
5722
5723
5724/* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5725
5726inline void
5727gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5728{
5729 gomp_for *omp_for_stmt = as_a <gomp_for *> (p: gs);
5730 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5731 omp_for_stmt->iter[i].initial = initial;
5732}
5733
5734
5735/* Return the final value for the OMP_FOR statement GS. */
5736
5737inline tree
5738gimple_omp_for_final (const gimple *gs, size_t i)
5739{
5740 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (p: gs);
5741 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5742 return omp_for_stmt->iter[i].final;
5743}
5744
5745
5746/* Return a pointer to the final value for the OMP_FOR statement GS. */
5747
5748inline tree *
5749gimple_omp_for_final_ptr (gimple *gs, size_t i)
5750{
5751 gomp_for *omp_for_stmt = as_a <gomp_for *> (p: gs);
5752 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5753 return &omp_for_stmt->iter[i].final;
5754}
5755
5756
5757/* Set FINAL to be the final value for the OMP_FOR statement GS. */
5758
5759inline void
5760gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5761{
5762 gomp_for *omp_for_stmt = as_a <gomp_for *> (p: gs);
5763 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5764 omp_for_stmt->iter[i].final = final;
5765}
5766
5767
5768/* Return the increment value for the OMP_FOR statement GS. */
5769
5770inline tree
5771gimple_omp_for_incr (const gimple *gs, size_t i)
5772{
5773 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (p: gs);
5774 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5775 return omp_for_stmt->iter[i].incr;
5776}
5777
5778
5779/* Return a pointer to the increment value for the OMP_FOR statement GS. */
5780
5781inline tree *
5782gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5783{
5784 gomp_for *omp_for_stmt = as_a <gomp_for *> (p: gs);
5785 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5786 return &omp_for_stmt->iter[i].incr;
5787}
5788
5789
5790/* Set INCR to be the increment value for the OMP_FOR statement GS. */
5791
5792inline void
5793gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5794{
5795 gomp_for *omp_for_stmt = as_a <gomp_for *> (p: gs);
5796 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5797 omp_for_stmt->iter[i].incr = incr;
5798}
5799
5800
5801/* Return a pointer to the sequence of statements to execute before the OMP_FOR
5802 statement GS starts. */
5803
5804inline gimple_seq *
5805gimple_omp_for_pre_body_ptr (gimple *gs)
5806{
5807 gomp_for *omp_for_stmt = as_a <gomp_for *> (p: gs);
5808 return &omp_for_stmt->pre_body;
5809}
5810
5811
5812/* Return the sequence of statements to execute before the OMP_FOR
5813 statement GS starts. */
5814
5815inline gimple_seq
5816gimple_omp_for_pre_body (const gimple *gs)
5817{
5818 return *gimple_omp_for_pre_body_ptr (gs: const_cast <gimple *> (gs));
5819}
5820
5821
5822/* Set PRE_BODY to be the sequence of statements to execute before the
5823 OMP_FOR statement GS starts. */
5824
5825inline void
5826gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5827{
5828 gomp_for *omp_for_stmt = as_a <gomp_for *> (p: gs);
5829 omp_for_stmt->pre_body = pre_body;
5830}
5831
5832/* Return the clauses associated with OMP_PARALLEL GS. */
5833
5834inline tree
5835gimple_omp_parallel_clauses (const gimple *gs)
5836{
5837 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (p: gs);
5838 return omp_parallel_stmt->clauses;
5839}
5840
5841
5842/* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5843
5844inline tree *
5845gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5846{
5847 return &omp_parallel_stmt->clauses;
5848}
5849
5850
5851/* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5852
5853inline void
5854gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5855 tree clauses)
5856{
5857 omp_parallel_stmt->clauses = clauses;
5858}
5859
5860
5861/* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5862
5863inline tree
5864gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5865{
5866 return omp_parallel_stmt->child_fn;
5867}
5868
5869/* Return a pointer to the child function used to hold the body of
5870 OMP_PARALLEL_STMT. */
5871
5872inline tree *
5873gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5874{
5875 return &omp_parallel_stmt->child_fn;
5876}
5877
5878
5879/* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5880
5881inline void
5882gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5883 tree child_fn)
5884{
5885 omp_parallel_stmt->child_fn = child_fn;
5886}
5887
5888
5889/* Return the artificial argument used to send variables and values
5890 from the parent to the children threads in OMP_PARALLEL_STMT. */
5891
5892inline tree
5893gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5894{
5895 return omp_parallel_stmt->data_arg;
5896}
5897
5898
5899/* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5900
5901inline tree *
5902gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5903{
5904 return &omp_parallel_stmt->data_arg;
5905}
5906
5907
5908/* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5909
5910inline void
5911gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5912 tree data_arg)
5913{
5914 omp_parallel_stmt->data_arg = data_arg;
5915}
5916
5917/* Return the clauses associated with OMP_TASK GS. */
5918
5919inline tree
5920gimple_omp_task_clauses (const gimple *gs)
5921{
5922 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (p: gs);
5923 return omp_task_stmt->clauses;
5924}
5925
5926
5927/* Return a pointer to the clauses associated with OMP_TASK GS. */
5928
5929inline tree *
5930gimple_omp_task_clauses_ptr (gimple *gs)
5931{
5932 gomp_task *omp_task_stmt = as_a <gomp_task *> (p: gs);
5933 return &omp_task_stmt->clauses;
5934}
5935
5936
5937/* Set CLAUSES to be the list of clauses associated with OMP_TASK
5938 GS. */
5939
5940inline void
5941gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5942{
5943 gomp_task *omp_task_stmt = as_a <gomp_task *> (p: gs);
5944 omp_task_stmt->clauses = clauses;
5945}
5946
5947
5948/* Return true if OMP task statement G has the
5949 GF_OMP_TASK_TASKLOOP flag set. */
5950
5951inline bool
5952gimple_omp_task_taskloop_p (const gimple *g)
5953{
5954 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5955 return (gimple_omp_subcode (s: g) & GF_OMP_TASK_TASKLOOP) != 0;
5956}
5957
5958
5959/* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5960 value of TASKLOOP_P. */
5961
5962inline void
5963gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5964{
5965 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5966 if (taskloop_p)
5967 g->subcode |= GF_OMP_TASK_TASKLOOP;
5968 else
5969 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5970}
5971
5972
5973/* Return true if OMP task statement G has the
5974 GF_OMP_TASK_TASKWAIT flag set. */
5975
5976inline bool
5977gimple_omp_task_taskwait_p (const gimple *g)
5978{
5979 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5980 return (gimple_omp_subcode (s: g) & GF_OMP_TASK_TASKWAIT) != 0;
5981}
5982
5983
5984/* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5985 value of TASKWAIT_P. */
5986
5987inline void
5988gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p)
5989{
5990 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5991 if (taskwait_p)
5992 g->subcode |= GF_OMP_TASK_TASKWAIT;
5993 else
5994 g->subcode &= ~GF_OMP_TASK_TASKWAIT;
5995}
5996
5997
5998/* Return the child function used to hold the body of OMP_TASK GS. */
5999
6000inline tree
6001gimple_omp_task_child_fn (const gimple *gs)
6002{
6003 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (p: gs);
6004 return omp_task_stmt->child_fn;
6005}
6006
6007/* Return a pointer to the child function used to hold the body of
6008 OMP_TASK GS. */
6009
6010inline tree *
6011gimple_omp_task_child_fn_ptr (gimple *gs)
6012{
6013 gomp_task *omp_task_stmt = as_a <gomp_task *> (p: gs);
6014 return &omp_task_stmt->child_fn;
6015}
6016
6017
6018/* Set CHILD_FN to be the child function for OMP_TASK GS. */
6019
6020inline void
6021gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
6022{
6023 gomp_task *omp_task_stmt = as_a <gomp_task *> (p: gs);
6024 omp_task_stmt->child_fn = child_fn;
6025}
6026
6027
6028/* Return the artificial argument used to send variables and values
6029 from the parent to the children threads in OMP_TASK GS. */
6030
6031inline tree
6032gimple_omp_task_data_arg (const gimple *gs)
6033{
6034 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (p: gs);
6035 return omp_task_stmt->data_arg;
6036}
6037
6038
6039/* Return a pointer to the data argument for OMP_TASK GS. */
6040
6041inline tree *
6042gimple_omp_task_data_arg_ptr (gimple *gs)
6043{
6044 gomp_task *omp_task_stmt = as_a <gomp_task *> (p: gs);
6045 return &omp_task_stmt->data_arg;
6046}
6047
6048
6049/* Set DATA_ARG to be the data argument for OMP_TASK GS. */
6050
6051inline void
6052gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
6053{
6054 gomp_task *omp_task_stmt = as_a <gomp_task *> (p: gs);
6055 omp_task_stmt->data_arg = data_arg;
6056}
6057
6058
6059/* Return the clauses associated with OMP_TASK GS. */
6060
6061inline tree
6062gimple_omp_taskreg_clauses (const gimple *gs)
6063{
6064 const gimple_statement_omp_taskreg *omp_taskreg_stmt
6065 = as_a <const gimple_statement_omp_taskreg *> (p: gs);
6066 return omp_taskreg_stmt->clauses;
6067}
6068
6069
6070/* Return a pointer to the clauses associated with OMP_TASK GS. */
6071
6072inline tree *
6073gimple_omp_taskreg_clauses_ptr (gimple *gs)
6074{
6075 gimple_statement_omp_taskreg *omp_taskreg_stmt
6076 = as_a <gimple_statement_omp_taskreg *> (p: gs);
6077 return &omp_taskreg_stmt->clauses;
6078}
6079
6080
6081/* Set CLAUSES to be the list of clauses associated with OMP_TASK
6082 GS. */
6083
6084inline void
6085gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
6086{
6087 gimple_statement_omp_taskreg *omp_taskreg_stmt
6088 = as_a <gimple_statement_omp_taskreg *> (p: gs);
6089 omp_taskreg_stmt->clauses = clauses;
6090}
6091
6092
6093/* Return the child function used to hold the body of OMP_TASK GS. */
6094
6095inline tree
6096gimple_omp_taskreg_child_fn (const gimple *gs)
6097{
6098 const gimple_statement_omp_taskreg *omp_taskreg_stmt
6099 = as_a <const gimple_statement_omp_taskreg *> (p: gs);
6100 return omp_taskreg_stmt->child_fn;
6101}
6102
6103/* Return a pointer to the child function used to hold the body of
6104 OMP_TASK GS. */
6105
6106inline tree *
6107gimple_omp_taskreg_child_fn_ptr (gimple *gs)
6108{
6109 gimple_statement_omp_taskreg *omp_taskreg_stmt
6110 = as_a <gimple_statement_omp_taskreg *> (p: gs);
6111 return &omp_taskreg_stmt->child_fn;
6112}
6113
6114
6115/* Set CHILD_FN to be the child function for OMP_TASK GS. */
6116
6117inline void
6118gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
6119{
6120 gimple_statement_omp_taskreg *omp_taskreg_stmt
6121 = as_a <gimple_statement_omp_taskreg *> (p: gs);
6122 omp_taskreg_stmt->child_fn = child_fn;
6123}
6124
6125
6126/* Return the artificial argument used to send variables and values
6127 from the parent to the children threads in OMP_TASK GS. */
6128
6129inline tree
6130gimple_omp_taskreg_data_arg (const gimple *gs)
6131{
6132 const gimple_statement_omp_taskreg *omp_taskreg_stmt
6133 = as_a <const gimple_statement_omp_taskreg *> (p: gs);
6134 return omp_taskreg_stmt->data_arg;
6135}
6136
6137
6138/* Return a pointer to the data argument for OMP_TASK GS. */
6139
6140inline tree *
6141gimple_omp_taskreg_data_arg_ptr (gimple *gs)
6142{
6143 gimple_statement_omp_taskreg *omp_taskreg_stmt
6144 = as_a <gimple_statement_omp_taskreg *> (p: gs);
6145 return &omp_taskreg_stmt->data_arg;
6146}
6147
6148
6149/* Set DATA_ARG to be the data argument for OMP_TASK GS. */
6150
6151inline void
6152gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
6153{
6154 gimple_statement_omp_taskreg *omp_taskreg_stmt
6155 = as_a <gimple_statement_omp_taskreg *> (p: gs);
6156 omp_taskreg_stmt->data_arg = data_arg;
6157}
6158
6159
6160/* Return the copy function used to hold the body of OMP_TASK GS. */
6161
6162inline tree
6163gimple_omp_task_copy_fn (const gimple *gs)
6164{
6165 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (p: gs);
6166 return omp_task_stmt->copy_fn;
6167}
6168
6169/* Return a pointer to the copy function used to hold the body of
6170 OMP_TASK GS. */
6171
6172inline tree *
6173gimple_omp_task_copy_fn_ptr (gimple *gs)
6174{
6175 gomp_task *omp_task_stmt = as_a <gomp_task *> (p: gs);
6176 return &omp_task_stmt->copy_fn;
6177}
6178
6179
6180/* Set CHILD_FN to be the copy function for OMP_TASK GS. */
6181
6182inline void
6183gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
6184{
6185 gomp_task *omp_task_stmt = as_a <gomp_task *> (p: gs);
6186 omp_task_stmt->copy_fn = copy_fn;
6187}
6188
6189
6190/* Return size of the data block in bytes in OMP_TASK GS. */
6191
6192inline tree
6193gimple_omp_task_arg_size (const gimple *gs)
6194{
6195 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (p: gs);
6196 return omp_task_stmt->arg_size;
6197}
6198
6199
6200/* Return a pointer to the data block size for OMP_TASK GS. */
6201
6202inline tree *
6203gimple_omp_task_arg_size_ptr (gimple *gs)
6204{
6205 gomp_task *omp_task_stmt = as_a <gomp_task *> (p: gs);
6206 return &omp_task_stmt->arg_size;
6207}
6208
6209
6210/* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
6211
6212inline void
6213gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
6214{
6215 gomp_task *omp_task_stmt = as_a <gomp_task *> (p: gs);
6216 omp_task_stmt->arg_size = arg_size;
6217}
6218
6219
6220/* Return align of the data block in bytes in OMP_TASK GS. */
6221
6222inline tree
6223gimple_omp_task_arg_align (const gimple *gs)
6224{
6225 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (p: gs);
6226 return omp_task_stmt->arg_align;
6227}
6228
6229
6230/* Return a pointer to the data block align for OMP_TASK GS. */
6231
6232inline tree *
6233gimple_omp_task_arg_align_ptr (gimple *gs)
6234{
6235 gomp_task *omp_task_stmt = as_a <gomp_task *> (p: gs);
6236 return &omp_task_stmt->arg_align;
6237}
6238
6239
6240/* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
6241
6242inline void
6243gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
6244{
6245 gomp_task *omp_task_stmt = as_a <gomp_task *> (p: gs);
6246 omp_task_stmt->arg_align = arg_align;
6247}
6248
6249
6250/* Return the clauses associated with OMP_SINGLE GS. */
6251
6252inline tree
6253gimple_omp_single_clauses (const gimple *gs)
6254{
6255 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (p: gs);
6256 return omp_single_stmt->clauses;
6257}
6258
6259
6260/* Return a pointer to the clauses associated with OMP_SINGLE GS. */
6261
6262inline tree *
6263gimple_omp_single_clauses_ptr (gimple *gs)
6264{
6265 gomp_single *omp_single_stmt = as_a <gomp_single *> (p: gs);
6266 return &omp_single_stmt->clauses;
6267}
6268
6269
6270/* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
6271
6272inline void
6273gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
6274{
6275 omp_single_stmt->clauses = clauses;
6276}
6277
6278
6279/* Return the clauses associated with OMP_TARGET GS. */
6280
6281inline tree
6282gimple_omp_target_clauses (const gimple *gs)
6283{
6284 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (p: gs);
6285 return omp_target_stmt->clauses;
6286}
6287
6288
6289/* Return a pointer to the clauses associated with OMP_TARGET GS. */
6290
6291inline tree *
6292gimple_omp_target_clauses_ptr (gimple *gs)
6293{
6294 gomp_target *omp_target_stmt = as_a <gomp_target *> (p: gs);
6295 return &omp_target_stmt->clauses;
6296}
6297
6298
6299/* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
6300
6301inline void
6302gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
6303 tree clauses)
6304{
6305 omp_target_stmt->clauses = clauses;
6306}
6307
6308
6309/* Return the kind of the OMP_TARGET G. */
6310
6311inline int
6312gimple_omp_target_kind (const gimple *g)
6313{
6314 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
6315 return (gimple_omp_subcode (s: g) & GF_OMP_TARGET_KIND_MASK);
6316}
6317
6318
6319/* Set the kind of the OMP_TARGET G. */
6320
6321inline void
6322gimple_omp_target_set_kind (gomp_target *g, int kind)
6323{
6324 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
6325 | (kind & GF_OMP_TARGET_KIND_MASK);
6326}
6327
6328
6329/* Return the child function used to hold the body of OMP_TARGET_STMT. */
6330
6331inline tree
6332gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
6333{
6334 return omp_target_stmt->child_fn;
6335}
6336
6337/* Return a pointer to the child function used to hold the body of
6338 OMP_TARGET_STMT. */
6339
6340inline tree *
6341gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
6342{
6343 return &omp_target_stmt->child_fn;
6344}
6345
6346
6347/* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
6348
6349inline void
6350gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
6351 tree child_fn)
6352{
6353 omp_target_stmt->child_fn = child_fn;
6354}
6355
6356
6357/* Return the artificial argument used to send variables and values
6358 from the parent to the children threads in OMP_TARGET_STMT. */
6359
6360inline tree
6361gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
6362{
6363 return omp_target_stmt->data_arg;
6364}
6365
6366
6367/* Return a pointer to the data argument for OMP_TARGET GS. */
6368
6369inline tree *
6370gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
6371{
6372 return &omp_target_stmt->data_arg;
6373}
6374
6375
6376/* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
6377
6378inline void
6379gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
6380 tree data_arg)
6381{
6382 omp_target_stmt->data_arg = data_arg;
6383}
6384
6385
6386/* Return the Gimple sequence used to store loops for OpenMP iterators used
6387 by OMP_TARGET_STMT. */
6388
6389inline gimple_seq
6390gimple_omp_target_iterator_loops (const gomp_target *omp_target_stmt)
6391{
6392 return omp_target_stmt->iterator_loops;
6393}
6394
6395
6396/* Return a pointer to the Gimple sequence used to store loops for OpenMP
6397 iterators used by OMP_TARGET GS. */
6398
6399inline gimple_seq *
6400gimple_omp_target_iterator_loops_ptr (gimple *gs)
6401{
6402 gomp_target *omp_target_stmt = as_a <gomp_target *> (p: gs);
6403 return &omp_target_stmt->iterator_loops;
6404}
6405
6406
6407/* Set ITERATOR_LOOPS to be the Gimple sequence used to store loops
6408 constructed for OpenMP iterators in OMP_TARGET_STMT. */
6409
6410inline void
6411gimple_omp_target_set_iterator_loops (gomp_target *omp_target_stmt,
6412 gimple_seq iterator_loops)
6413{
6414 omp_target_stmt->iterator_loops = iterator_loops;
6415}
6416
6417
6418/* Return the clauses associated with OMP_TEAMS GS. */
6419
6420inline tree
6421gimple_omp_teams_clauses (const gimple *gs)
6422{
6423 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (p: gs);
6424 return omp_teams_stmt->clauses;
6425}
6426
6427
6428/* Return a pointer to the clauses associated with OMP_TEAMS GS. */
6429
6430inline tree *
6431gimple_omp_teams_clauses_ptr (gimple *gs)
6432{
6433 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (p: gs);
6434 return &omp_teams_stmt->clauses;
6435}
6436
6437
6438/* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
6439
6440inline void
6441gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
6442{
6443 omp_teams_stmt->clauses = clauses;
6444}
6445
6446/* Return the child function used to hold the body of OMP_TEAMS_STMT. */
6447
6448inline tree
6449gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt)
6450{
6451 return omp_teams_stmt->child_fn;
6452}
6453
6454/* Return a pointer to the child function used to hold the body of
6455 OMP_TEAMS_STMT. */
6456
6457inline tree *
6458gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt)
6459{
6460 return &omp_teams_stmt->child_fn;
6461}
6462
6463
6464/* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
6465
6466inline void
6467gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn)
6468{
6469 omp_teams_stmt->child_fn = child_fn;
6470}
6471
6472
6473/* Return the artificial argument used to send variables and values
6474 from the parent to the children threads in OMP_TEAMS_STMT. */
6475
6476inline tree
6477gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt)
6478{
6479 return omp_teams_stmt->data_arg;
6480}
6481
6482
6483/* Return a pointer to the data argument for OMP_TEAMS_STMT. */
6484
6485inline tree *
6486gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt)
6487{
6488 return &omp_teams_stmt->data_arg;
6489}
6490
6491
6492/* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
6493
6494inline void
6495gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg)
6496{
6497 omp_teams_stmt->data_arg = data_arg;
6498}
6499
6500/* Return the host flag of an OMP_TEAMS_STMT. */
6501
6502inline bool
6503gimple_omp_teams_host (const gomp_teams *omp_teams_stmt)
6504{
6505 return (gimple_omp_subcode (s: omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0;
6506}
6507
6508/* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6509
6510inline void
6511gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value)
6512{
6513 if (value)
6514 omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST;
6515 else
6516 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST;
6517}
6518
6519/* Return the clauses associated with OMP_SECTIONS GS. */
6520
6521inline tree
6522gimple_omp_sections_clauses (const gimple *gs)
6523{
6524 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (p: gs);
6525 return omp_sections_stmt->clauses;
6526}
6527
6528
6529/* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
6530
6531inline tree *
6532gimple_omp_sections_clauses_ptr (gimple *gs)
6533{
6534 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (p: gs);
6535 return &omp_sections_stmt->clauses;
6536}
6537
6538
6539/* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
6540 GS. */
6541
6542inline void
6543gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
6544{
6545 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (p: gs);
6546 omp_sections_stmt->clauses = clauses;
6547}
6548
6549
6550/* Return the control variable associated with the GIMPLE_OMP_SECTIONS
6551 in GS. */
6552
6553inline tree
6554gimple_omp_sections_control (const gimple *gs)
6555{
6556 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (p: gs);
6557 return omp_sections_stmt->control;
6558}
6559
6560
6561/* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
6562 GS. */
6563
6564inline tree *
6565gimple_omp_sections_control_ptr (gimple *gs)
6566{
6567 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (p: gs);
6568 return &omp_sections_stmt->control;
6569}
6570
6571
6572/* Set CONTROL to be the set of clauses associated with the
6573 GIMPLE_OMP_SECTIONS in GS. */
6574
6575inline void
6576gimple_omp_sections_set_control (gimple *gs, tree control)
6577{
6578 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (p: gs);
6579 omp_sections_stmt->control = control;
6580}
6581
6582
6583/* Set the value being stored in an atomic store. */
6584
6585inline void
6586gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
6587{
6588 store_stmt->val = val;
6589}
6590
6591
6592/* Return the value being stored in an atomic store. */
6593
6594inline tree
6595gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
6596{
6597 return store_stmt->val;
6598}
6599
6600
6601/* Return a pointer to the value being stored in an atomic store. */
6602
6603inline tree *
6604gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
6605{
6606 return &store_stmt->val;
6607}
6608
6609
6610/* Set the LHS of an atomic load. */
6611
6612inline void
6613gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
6614{
6615 load_stmt->lhs = lhs;
6616}
6617
6618
6619/* Get the LHS of an atomic load. */
6620
6621inline tree
6622gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
6623{
6624 return load_stmt->lhs;
6625}
6626
6627
6628/* Return a pointer to the LHS of an atomic load. */
6629
6630inline tree *
6631gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
6632{
6633 return &load_stmt->lhs;
6634}
6635
6636
6637/* Set the RHS of an atomic load. */
6638
6639inline void
6640gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
6641{
6642 load_stmt->rhs = rhs;
6643}
6644
6645
6646/* Get the RHS of an atomic load. */
6647
6648inline tree
6649gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
6650{
6651 return load_stmt->rhs;
6652}
6653
6654
6655/* Return a pointer to the RHS of an atomic load. */
6656
6657inline tree *
6658gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
6659{
6660 return &load_stmt->rhs;
6661}
6662
6663
6664/* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6665
6666inline tree
6667gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
6668{
6669 return cont_stmt->control_def;
6670}
6671
6672/* The same as above, but return the address. */
6673
6674inline tree *
6675gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
6676{
6677 return &cont_stmt->control_def;
6678}
6679
6680/* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6681
6682inline void
6683gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
6684{
6685 cont_stmt->control_def = def;
6686}
6687
6688
6689/* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6690
6691inline tree
6692gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6693{
6694 return cont_stmt->control_use;
6695}
6696
6697
6698/* The same as above, but return the address. */
6699
6700inline tree *
6701gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6702{
6703 return &cont_stmt->control_use;
6704}
6705
6706
6707/* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6708
6709inline void
6710gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6711{
6712 cont_stmt->control_use = use;
6713}
6714
6715/* Return the guard associated with the GIMPLE_ASSUME statement GS. */
6716
6717inline tree
6718gimple_assume_guard (const gimple *gs)
6719{
6720 const gimple_statement_assume *assume_stmt
6721 = as_a <const gimple_statement_assume *> (p: gs);
6722 return assume_stmt->guard;
6723}
6724
6725/* Set the guard associated with the GIMPLE_ASSUME statement GS. */
6726
6727inline void
6728gimple_assume_set_guard (gimple *gs, tree guard)
6729{
6730 gimple_statement_assume *assume_stmt = as_a <gimple_statement_assume *> (p: gs);
6731 assume_stmt->guard = guard;
6732}
6733
6734inline tree *
6735gimple_assume_guard_ptr (gimple *gs)
6736{
6737 gimple_statement_assume *assume_stmt = as_a <gimple_statement_assume *> (p: gs);
6738 return &assume_stmt->guard;
6739}
6740
6741/* Return the address of the GIMPLE sequence contained in the GIMPLE_ASSUME
6742 statement GS. */
6743
6744inline gimple_seq *
6745gimple_assume_body_ptr (gimple *gs)
6746{
6747 gimple_statement_assume *assume_stmt = as_a <gimple_statement_assume *> (p: gs);
6748 return &assume_stmt->body;
6749}
6750
6751/* Return the GIMPLE sequence contained in the GIMPLE_ASSUME statement GS. */
6752
6753inline gimple_seq
6754gimple_assume_body (const gimple *gs)
6755{
6756 const gimple_statement_assume *assume_stmt
6757 = as_a <const gimple_statement_assume *> (p: gs);
6758 return assume_stmt->body;
6759}
6760
6761/* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6762 TRANSACTION_STMT. */
6763
6764inline gimple_seq *
6765gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6766{
6767 return &transaction_stmt->body;
6768}
6769
6770/* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6771
6772inline gimple_seq
6773gimple_transaction_body (const gtransaction *transaction_stmt)
6774{
6775 return transaction_stmt->body;
6776}
6777
6778/* Return the label associated with a GIMPLE_TRANSACTION. */
6779
6780inline tree
6781gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6782{
6783 return transaction_stmt->label_norm;
6784}
6785
6786inline tree *
6787gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6788{
6789 return &transaction_stmt->label_norm;
6790}
6791
6792inline tree
6793gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6794{
6795 return transaction_stmt->label_uninst;
6796}
6797
6798inline tree *
6799gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6800{
6801 return &transaction_stmt->label_uninst;
6802}
6803
6804inline tree
6805gimple_transaction_label_over (const gtransaction *transaction_stmt)
6806{
6807 return transaction_stmt->label_over;
6808}
6809
6810inline tree *
6811gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6812{
6813 return &transaction_stmt->label_over;
6814}
6815
6816/* Return the subcode associated with a GIMPLE_TRANSACTION. */
6817
6818inline unsigned int
6819gimple_transaction_subcode (const gtransaction *transaction_stmt)
6820{
6821 return transaction_stmt->subcode;
6822}
6823
6824/* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6825 TRANSACTION_STMT. */
6826
6827inline void
6828gimple_transaction_set_body (gtransaction *transaction_stmt,
6829 gimple_seq body)
6830{
6831 transaction_stmt->body = body;
6832}
6833
6834/* Set the label associated with a GIMPLE_TRANSACTION. */
6835
6836inline void
6837gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6838{
6839 transaction_stmt->label_norm = label;
6840}
6841
6842inline void
6843gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6844{
6845 transaction_stmt->label_uninst = label;
6846}
6847
6848inline void
6849gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6850{
6851 transaction_stmt->label_over = label;
6852}
6853
6854/* Set the subcode associated with a GIMPLE_TRANSACTION. */
6855
6856inline void
6857gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6858 unsigned int subcode)
6859{
6860 transaction_stmt->subcode = subcode;
6861}
6862
6863/* Return a pointer to the return value for GIMPLE_RETURN GS. */
6864
6865inline tree *
6866gimple_return_retval_ptr (greturn *gs)
6867{
6868 return &gs->op[0];
6869}
6870
6871/* Return the return value for GIMPLE_RETURN GS. */
6872
6873inline tree
6874gimple_return_retval (const greturn *gs)
6875{
6876 return gs->op[0];
6877}
6878
6879
6880/* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6881
6882inline void
6883gimple_return_set_retval (greturn *gs, tree retval)
6884{
6885 gs->op[0] = retval;
6886}
6887
6888
6889/* Returns true when the gimple statement STMT is any of the OMP types. */
6890
6891#define CASE_GIMPLE_OMP \
6892 case GIMPLE_OMP_PARALLEL: \
6893 case GIMPLE_OMP_TASK: \
6894 case GIMPLE_OMP_FOR: \
6895 case GIMPLE_OMP_SECTIONS: \
6896 case GIMPLE_OMP_SECTIONS_SWITCH: \
6897 case GIMPLE_OMP_SINGLE: \
6898 case GIMPLE_OMP_TARGET: \
6899 case GIMPLE_OMP_TEAMS: \
6900 case GIMPLE_OMP_SCOPE: \
6901 case GIMPLE_OMP_DISPATCH: \
6902 case GIMPLE_OMP_INTEROP: \
6903 case GIMPLE_OMP_SECTION: \
6904 case GIMPLE_OMP_STRUCTURED_BLOCK: \
6905 case GIMPLE_OMP_MASTER: \
6906 case GIMPLE_OMP_MASKED: \
6907 case GIMPLE_OMP_TASKGROUP: \
6908 case GIMPLE_OMP_ORDERED: \
6909 case GIMPLE_OMP_CRITICAL: \
6910 case GIMPLE_OMP_SCAN: \
6911 case GIMPLE_OMP_RETURN: \
6912 case GIMPLE_OMP_ATOMIC_LOAD: \
6913 case GIMPLE_OMP_ATOMIC_STORE: \
6914 case GIMPLE_OMP_CONTINUE
6915
6916inline bool
6917is_gimple_omp (const gimple *stmt)
6918{
6919 switch (gimple_code (g: stmt))
6920 {
6921 CASE_GIMPLE_OMP:
6922 return true;
6923 default:
6924 return false;
6925 }
6926}
6927
6928/* Return true if the OMP gimple statement STMT is any of the OpenACC types
6929 specifically. */
6930
6931inline bool
6932is_gimple_omp_oacc (const gimple *stmt)
6933{
6934 gcc_assert (is_gimple_omp (stmt));
6935 switch (gimple_code (g: stmt))
6936 {
6937 case GIMPLE_OMP_ATOMIC_LOAD:
6938 case GIMPLE_OMP_ATOMIC_STORE:
6939 case GIMPLE_OMP_CONTINUE:
6940 case GIMPLE_OMP_RETURN:
6941 /* Codes shared between OpenACC and OpenMP cannot be used to disambiguate
6942 the two. */
6943 gcc_unreachable ();
6944
6945 case GIMPLE_OMP_FOR:
6946 switch (gimple_omp_for_kind (g: stmt))
6947 {
6948 case GF_OMP_FOR_KIND_OACC_LOOP:
6949 return true;
6950 default:
6951 return false;
6952 }
6953 case GIMPLE_OMP_TARGET:
6954 switch (gimple_omp_target_kind (g: stmt))
6955 {
6956 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6957 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6958 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6959 case GF_OMP_TARGET_KIND_OACC_DATA:
6960 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6961 case GF_OMP_TARGET_KIND_OACC_ENTER_DATA:
6962 case GF_OMP_TARGET_KIND_OACC_EXIT_DATA:
6963 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6964 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6965 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED:
6966 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE:
6967 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS:
6968 return true;
6969 default:
6970 return false;
6971 }
6972 default:
6973 return false;
6974 }
6975}
6976
6977
6978/* Return true if the OMP gimple statement STMT is offloaded. */
6979
6980inline bool
6981is_gimple_omp_offloaded (const gimple *stmt)
6982{
6983 gcc_assert (is_gimple_omp (stmt));
6984 switch (gimple_code (g: stmt))
6985 {
6986 case GIMPLE_OMP_TARGET:
6987 switch (gimple_omp_target_kind (g: stmt))
6988 {
6989 case GF_OMP_TARGET_KIND_REGION:
6990 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6991 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6992 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6993 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED:
6994 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE:
6995 return true;
6996 default:
6997 return false;
6998 }
6999 default:
7000 return false;
7001 }
7002}
7003
7004
7005/* Returns TRUE if statement G is a GIMPLE_NOP. */
7006
7007inline bool
7008gimple_nop_p (const gimple *g)
7009{
7010 return gimple_code (g) == GIMPLE_NOP;
7011}
7012
7013
7014/* Return true if GS is a GIMPLE_RESX. */
7015
7016inline bool
7017is_gimple_resx (const gimple *gs)
7018{
7019 return gimple_code (g: gs) == GIMPLE_RESX;
7020}
7021
7022
7023/* Enum and arrays used for allocation stats. Keep in sync with
7024 gimple.cc:gimple_alloc_kind_names. */
7025enum gimple_alloc_kind
7026{
7027 gimple_alloc_kind_assign, /* Assignments. */
7028 gimple_alloc_kind_phi, /* PHI nodes. */
7029 gimple_alloc_kind_cond, /* Conditionals. */
7030 gimple_alloc_kind_rest, /* Everything else. */
7031 gimple_alloc_kind_all
7032};
7033
7034extern uint64_t gimple_alloc_counts[];
7035extern uint64_t gimple_alloc_sizes[];
7036
7037/* Return the allocation kind for a given stmt CODE. */
7038inline enum gimple_alloc_kind
7039gimple_alloc_kind (enum gimple_code code)
7040{
7041 switch (code)
7042 {
7043 case GIMPLE_ASSIGN:
7044 return gimple_alloc_kind_assign;
7045 case GIMPLE_PHI:
7046 return gimple_alloc_kind_phi;
7047 case GIMPLE_COND:
7048 return gimple_alloc_kind_cond;
7049 default:
7050 return gimple_alloc_kind_rest;
7051 }
7052}
7053
7054/* Return true if a location should not be emitted for this statement
7055 by annotate_all_with_location. */
7056
7057inline bool
7058gimple_do_not_emit_location_p (gimple *g)
7059{
7060 return gimple_plf (stmt: g, plf: GF_PLF_1);
7061}
7062
7063/* Mark statement G so a location will not be emitted by
7064 annotate_one_with_location. */
7065
7066inline void
7067gimple_set_do_not_emit_location (gimple *g)
7068{
7069 /* The PLF flags are initialized to 0 when a new tuple is created,
7070 so no need to initialize it anywhere. */
7071 gimple_set_plf (stmt: g, plf: GF_PLF_1, val_p: true);
7072}
7073
7074#endif /* GCC_GIMPLE_H */
7075

source code of gcc/gimple.h