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