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