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