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