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