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