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