OSDN Git Service

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