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