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