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