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