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