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