OSDN Git Service

PR middle-end/51761
[pf3gnuchains/gcc-fork.git] / gcc / gimple.h
1 /* Gimple IR definitions.
2
3    Copyright 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
4    Contributed by Aldy Hernandez <aldyh@redhat.com>
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
24
25 #include "pointer-set.h"
26 #include "vec.h"
27 #include "vecprim.h"
28 #include "vecir.h"
29 #include "ggc.h"
30 #include "basic-block.h"
31 #include "tree-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   bool in_cleanup_point_expr;
1096 };
1097
1098 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1099                                            bool (*) (tree), fallback_t);
1100 extern void gimplify_type_sizes (tree, gimple_seq *);
1101 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1102 extern bool gimplify_stmt (tree *, gimple_seq *);
1103 extern gimple gimplify_body (tree *, tree, bool);
1104 extern void push_gimplify_context (struct gimplify_ctx *);
1105 extern void pop_gimplify_context (gimple);
1106 extern void gimplify_and_add (tree, gimple_seq *);
1107
1108 /* Miscellaneous helpers.  */
1109 extern void gimple_add_tmp_var (tree);
1110 extern gimple gimple_current_bind_expr (void);
1111 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1112 extern tree voidify_wrapper_expr (tree, tree);
1113 extern tree build_and_jump (tree *);
1114 extern tree force_labels_r (tree *, int *, void *);
1115 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1116                                                   gimple_seq *);
1117 struct gimplify_omp_ctx;
1118 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1119 extern tree gimple_boolify (tree);
1120 extern gimple_predicate rhs_predicate_for (tree);
1121 extern tree canonicalize_cond_expr_cond (tree);
1122
1123 /* In omp-low.c.  */
1124 extern tree omp_reduction_init (tree, tree);
1125
1126 /* In trans-mem.c.  */
1127 extern void diagnose_tm_safe_errors (tree);
1128
1129 /* In tree-nested.c.  */
1130 extern void lower_nested_functions (tree);
1131 extern void insert_field_into_struct (tree, tree);
1132
1133 /* In gimplify.c.  */
1134 extern void gimplify_function_tree (tree);
1135
1136 /* In cfgexpand.c.  */
1137 extern tree gimple_assign_rhs_to_tree (gimple);
1138
1139 /* In builtins.c  */
1140 extern bool validate_gimple_arglist (const_gimple, ...);
1141
1142 /* In tree-ssa.c  */
1143 extern bool tree_ssa_useless_type_conversion (tree);
1144 extern tree tree_ssa_strip_useless_type_conversions (tree);
1145 extern bool useless_type_conversion_p (tree, tree);
1146 extern bool types_compatible_p (tree, tree);
1147
1148 /* Return the code for GIMPLE statement G.  */
1149
1150 static inline enum gimple_code
1151 gimple_code (const_gimple g)
1152 {
1153   return g->gsbase.code;
1154 }
1155
1156
1157 /* Return the GSS code used by a GIMPLE code.  */
1158
1159 static inline enum gimple_statement_structure_enum
1160 gss_for_code (enum gimple_code code)
1161 {
1162   gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1163   return gss_for_code_[code];
1164 }
1165
1166
1167 /* Return which GSS code is used by GS.  */
1168
1169 static inline enum gimple_statement_structure_enum
1170 gimple_statement_structure (gimple gs)
1171 {
1172   return gss_for_code (gimple_code (gs));
1173 }
1174
1175
1176 /* Return true if statement G has sub-statements.  This is only true for
1177    High GIMPLE statements.  */
1178
1179 static inline bool
1180 gimple_has_substatements (gimple g)
1181 {
1182   switch (gimple_code (g))
1183     {
1184     case GIMPLE_BIND:
1185     case GIMPLE_CATCH:
1186     case GIMPLE_EH_FILTER:
1187     case GIMPLE_EH_ELSE:
1188     case GIMPLE_TRY:
1189     case GIMPLE_OMP_FOR:
1190     case GIMPLE_OMP_MASTER:
1191     case GIMPLE_OMP_ORDERED:
1192     case GIMPLE_OMP_SECTION:
1193     case GIMPLE_OMP_PARALLEL:
1194     case GIMPLE_OMP_TASK:
1195     case GIMPLE_OMP_SECTIONS:
1196     case GIMPLE_OMP_SINGLE:
1197     case GIMPLE_OMP_CRITICAL:
1198     case GIMPLE_WITH_CLEANUP_EXPR:
1199     case GIMPLE_TRANSACTION:
1200       return true;
1201
1202     default:
1203       return false;
1204     }
1205 }
1206
1207
1208 /* Return the basic block holding statement G.  */
1209
1210 static inline struct basic_block_def *
1211 gimple_bb (const_gimple g)
1212 {
1213   return g->gsbase.bb;
1214 }
1215
1216
1217 /* Return the lexical scope block holding statement G.  */
1218
1219 static inline tree
1220 gimple_block (const_gimple g)
1221 {
1222   return g->gsbase.block;
1223 }
1224
1225
1226 /* Set BLOCK to be the lexical scope block holding statement G.  */
1227
1228 static inline void
1229 gimple_set_block (gimple g, tree block)
1230 {
1231   g->gsbase.block = block;
1232 }
1233
1234
1235 /* Return location information for statement G.  */
1236
1237 static inline location_t
1238 gimple_location (const_gimple g)
1239 {
1240   return g->gsbase.location;
1241 }
1242
1243 /* Return pointer to location information for statement G.  */
1244
1245 static inline const location_t *
1246 gimple_location_ptr (const_gimple g)
1247 {
1248   return &g->gsbase.location;
1249 }
1250
1251
1252 /* Set location information for statement G.  */
1253
1254 static inline void
1255 gimple_set_location (gimple g, location_t location)
1256 {
1257   g->gsbase.location = location;
1258 }
1259
1260
1261 /* Return true if G contains location information.  */
1262
1263 static inline bool
1264 gimple_has_location (const_gimple g)
1265 {
1266   return gimple_location (g) != UNKNOWN_LOCATION;
1267 }
1268
1269
1270 /* Return the file name of the location of STMT.  */
1271
1272 static inline const char *
1273 gimple_filename (const_gimple stmt)
1274 {
1275   return LOCATION_FILE (gimple_location (stmt));
1276 }
1277
1278
1279 /* Return the line number of the location of STMT.  */
1280
1281 static inline int
1282 gimple_lineno (const_gimple stmt)
1283 {
1284   return LOCATION_LINE (gimple_location (stmt));
1285 }
1286
1287
1288 /* Determine whether SEQ is a singleton. */
1289
1290 static inline bool
1291 gimple_seq_singleton_p (gimple_seq seq)
1292 {
1293   return ((gimple_seq_first (seq) != NULL)
1294           && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1295 }
1296
1297 /* Return true if no warnings should be emitted for statement STMT.  */
1298
1299 static inline bool
1300 gimple_no_warning_p (const_gimple stmt)
1301 {
1302   return stmt->gsbase.no_warning;
1303 }
1304
1305 /* Set the no_warning flag of STMT to NO_WARNING.  */
1306
1307 static inline void
1308 gimple_set_no_warning (gimple stmt, bool no_warning)
1309 {
1310   stmt->gsbase.no_warning = (unsigned) no_warning;
1311 }
1312
1313 /* Set the visited status on statement STMT to VISITED_P.  */
1314
1315 static inline void
1316 gimple_set_visited (gimple stmt, bool visited_p)
1317 {
1318   stmt->gsbase.visited = (unsigned) visited_p;
1319 }
1320
1321
1322 /* Return the visited status for statement STMT.  */
1323
1324 static inline bool
1325 gimple_visited_p (gimple stmt)
1326 {
1327   return stmt->gsbase.visited;
1328 }
1329
1330
1331 /* Set pass local flag PLF on statement STMT to VAL_P.  */
1332
1333 static inline void
1334 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1335 {
1336   if (val_p)
1337     stmt->gsbase.plf |= (unsigned int) plf;
1338   else
1339     stmt->gsbase.plf &= ~((unsigned int) plf);
1340 }
1341
1342
1343 /* Return the value of pass local flag PLF on statement STMT.  */
1344
1345 static inline unsigned int
1346 gimple_plf (gimple stmt, enum plf_mask plf)
1347 {
1348   return stmt->gsbase.plf & ((unsigned int) plf);
1349 }
1350
1351
1352 /* Set the UID of statement.  */
1353
1354 static inline void
1355 gimple_set_uid (gimple g, unsigned uid)
1356 {
1357   g->gsbase.uid = uid;
1358 }
1359
1360
1361 /* Return the UID of statement.  */
1362
1363 static inline unsigned
1364 gimple_uid (const_gimple g)
1365 {
1366   return g->gsbase.uid;
1367 }
1368
1369
1370 /* Return true if GIMPLE statement G has register or memory operands.  */
1371
1372 static inline bool
1373 gimple_has_ops (const_gimple g)
1374 {
1375   return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1376 }
1377
1378
1379 /* Return true if GIMPLE statement G has memory operands.  */
1380
1381 static inline bool
1382 gimple_has_mem_ops (const_gimple g)
1383 {
1384   return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1385 }
1386
1387
1388 /* Return the set of DEF operands for statement G.  */
1389
1390 static inline struct def_optype_d *
1391 gimple_def_ops (const_gimple g)
1392 {
1393   if (!gimple_has_ops (g))
1394     return NULL;
1395   return g->gsops.opbase.def_ops;
1396 }
1397
1398
1399 /* Set DEF to be the set of DEF operands for statement G.  */
1400
1401 static inline void
1402 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1403 {
1404   gcc_gimple_checking_assert (gimple_has_ops (g));
1405   g->gsops.opbase.def_ops = def;
1406 }
1407
1408
1409 /* Return the set of USE operands for statement G.  */
1410
1411 static inline struct use_optype_d *
1412 gimple_use_ops (const_gimple g)
1413 {
1414   if (!gimple_has_ops (g))
1415     return NULL;
1416   return g->gsops.opbase.use_ops;
1417 }
1418
1419
1420 /* Set USE to be the set of USE operands for statement G.  */
1421
1422 static inline void
1423 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1424 {
1425   gcc_gimple_checking_assert (gimple_has_ops (g));
1426   g->gsops.opbase.use_ops = use;
1427 }
1428
1429
1430 /* Return the set of VUSE operand for statement G.  */
1431
1432 static inline use_operand_p
1433 gimple_vuse_op (const_gimple g)
1434 {
1435   struct use_optype_d *ops;
1436   if (!gimple_has_mem_ops (g))
1437     return NULL_USE_OPERAND_P;
1438   ops = g->gsops.opbase.use_ops;
1439   if (ops
1440       && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1441     return USE_OP_PTR (ops);
1442   return NULL_USE_OPERAND_P;
1443 }
1444
1445 /* Return the set of VDEF operand for statement G.  */
1446
1447 static inline def_operand_p
1448 gimple_vdef_op (const_gimple g)
1449 {
1450   struct def_optype_d *ops;
1451   if (!gimple_has_mem_ops (g))
1452     return NULL_DEF_OPERAND_P;
1453   ops = g->gsops.opbase.def_ops;
1454   if (ops
1455       && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1456     return DEF_OP_PTR (ops);
1457   return NULL_DEF_OPERAND_P;
1458 }
1459
1460
1461 /* Return the single VUSE operand of the statement G.  */
1462
1463 static inline tree
1464 gimple_vuse (const_gimple g)
1465 {
1466   if (!gimple_has_mem_ops (g))
1467     return NULL_TREE;
1468   return g->gsmembase.vuse;
1469 }
1470
1471 /* Return the single VDEF operand of the statement G.  */
1472
1473 static inline tree
1474 gimple_vdef (const_gimple g)
1475 {
1476   if (!gimple_has_mem_ops (g))
1477     return NULL_TREE;
1478   return g->gsmembase.vdef;
1479 }
1480
1481 /* Return the single VUSE operand of the statement G.  */
1482
1483 static inline tree *
1484 gimple_vuse_ptr (gimple g)
1485 {
1486   if (!gimple_has_mem_ops (g))
1487     return NULL;
1488   return &g->gsmembase.vuse;
1489 }
1490
1491 /* Return the single VDEF operand of the statement G.  */
1492
1493 static inline tree *
1494 gimple_vdef_ptr (gimple g)
1495 {
1496   if (!gimple_has_mem_ops (g))
1497     return NULL;
1498   return &g->gsmembase.vdef;
1499 }
1500
1501 /* Set the single VUSE operand of the statement G.  */
1502
1503 static inline void
1504 gimple_set_vuse (gimple g, tree vuse)
1505 {
1506   gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1507   g->gsmembase.vuse = vuse;
1508 }
1509
1510 /* Set the single VDEF operand of the statement G.  */
1511
1512 static inline void
1513 gimple_set_vdef (gimple g, tree vdef)
1514 {
1515   gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1516   g->gsmembase.vdef = vdef;
1517 }
1518
1519
1520 /* Return true if statement G has operands and the modified field has
1521    been set.  */
1522
1523 static inline bool
1524 gimple_modified_p (const_gimple g)
1525 {
1526   return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1527 }
1528
1529
1530 /* Return the tree code for the expression computed by STMT.  This is
1531    only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN.  For
1532    GIMPLE_CALL, return CALL_EXPR as the expression code for
1533    consistency.  This is useful when the caller needs to deal with the
1534    three kinds of computation that GIMPLE supports.  */
1535
1536 static inline enum tree_code
1537 gimple_expr_code (const_gimple stmt)
1538 {
1539   enum gimple_code code = gimple_code (stmt);
1540   if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1541     return (enum tree_code) stmt->gsbase.subcode;
1542   else
1543     {
1544       gcc_gimple_checking_assert (code == GIMPLE_CALL);
1545       return CALL_EXPR;
1546     }
1547 }
1548
1549
1550 /* Mark statement S as modified, and update it.  */
1551
1552 static inline void
1553 update_stmt (gimple s)
1554 {
1555   if (gimple_has_ops (s))
1556     {
1557       gimple_set_modified (s, true);
1558       update_stmt_operands (s);
1559     }
1560 }
1561
1562 /* Update statement S if it has been optimized.  */
1563
1564 static inline void
1565 update_stmt_if_modified (gimple s)
1566 {
1567   if (gimple_modified_p (s))
1568     update_stmt_operands (s);
1569 }
1570
1571 /* Return true if statement STMT contains volatile operands.  */
1572
1573 static inline bool
1574 gimple_has_volatile_ops (const_gimple stmt)
1575 {
1576   if (gimple_has_mem_ops (stmt))
1577     return stmt->gsbase.has_volatile_ops;
1578   else
1579     return false;
1580 }
1581
1582
1583 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP.  */
1584
1585 static inline void
1586 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1587 {
1588   if (gimple_has_mem_ops (stmt))
1589     stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1590 }
1591
1592
1593 /* Return true if statement STMT may access memory.  */
1594
1595 static inline bool
1596 gimple_references_memory_p (gimple stmt)
1597 {
1598   return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1599 }
1600
1601
1602 /* Return the subcode for OMP statement S.  */
1603
1604 static inline unsigned
1605 gimple_omp_subcode (const_gimple s)
1606 {
1607   gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1608               && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1609   return s->gsbase.subcode;
1610 }
1611
1612 /* Set the subcode for OMP statement S to SUBCODE.  */
1613
1614 static inline void
1615 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1616 {
1617   /* We only have 16 bits for the subcode.  Assert that we are not
1618      overflowing it.  */
1619   gcc_gimple_checking_assert (subcode < (1 << 16));
1620   s->gsbase.subcode = subcode;
1621 }
1622
1623 /* Set the nowait flag on OMP_RETURN statement S.  */
1624
1625 static inline void
1626 gimple_omp_return_set_nowait (gimple s)
1627 {
1628   GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1629   s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1630 }
1631
1632
1633 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1634    flag set.  */
1635
1636 static inline bool
1637 gimple_omp_return_nowait_p (const_gimple g)
1638 {
1639   GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1640   return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1641 }
1642
1643
1644 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1645    flag set.  */
1646
1647 static inline bool
1648 gimple_omp_section_last_p (const_gimple g)
1649 {
1650   GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1651   return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1652 }
1653
1654
1655 /* Set the GF_OMP_SECTION_LAST flag on G.  */
1656
1657 static inline void
1658 gimple_omp_section_set_last (gimple g)
1659 {
1660   GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1661   g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1662 }
1663
1664
1665 /* Return true if OMP parallel statement G has the
1666    GF_OMP_PARALLEL_COMBINED flag set.  */
1667
1668 static inline bool
1669 gimple_omp_parallel_combined_p (const_gimple g)
1670 {
1671   GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1672   return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1673 }
1674
1675
1676 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1677    value of COMBINED_P.  */
1678
1679 static inline void
1680 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1681 {
1682   GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1683   if (combined_p)
1684     g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1685   else
1686     g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1687 }
1688
1689
1690 /* Return true if OMP atomic load/store statement G has the
1691    GF_OMP_ATOMIC_NEED_VALUE flag set.  */
1692
1693 static inline bool
1694 gimple_omp_atomic_need_value_p (const_gimple g)
1695 {
1696   if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1697     GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1698   return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1699 }
1700
1701
1702 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G.  */
1703
1704 static inline void
1705 gimple_omp_atomic_set_need_value (gimple g)
1706 {
1707   if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1708     GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1709   g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1710 }
1711
1712
1713 /* Return the number of operands for statement GS.  */
1714
1715 static inline unsigned
1716 gimple_num_ops (const_gimple gs)
1717 {
1718   return gs->gsbase.num_ops;
1719 }
1720
1721
1722 /* Set the number of operands for statement GS.  */
1723
1724 static inline void
1725 gimple_set_num_ops (gimple gs, unsigned num_ops)
1726 {
1727   gs->gsbase.num_ops = num_ops;
1728 }
1729
1730
1731 /* Return the array of operands for statement GS.  */
1732
1733 static inline tree *
1734 gimple_ops (gimple gs)
1735 {
1736   size_t off;
1737
1738   /* All the tuples have their operand vector at the very bottom
1739      of the structure.  Note that those structures that do not
1740      have an operand vector have a zero offset.  */
1741   off = gimple_ops_offset_[gimple_statement_structure (gs)];
1742   gcc_gimple_checking_assert (off != 0);
1743
1744   return (tree *) ((char *) gs + off);
1745 }
1746
1747
1748 /* Return operand I for statement GS.  */
1749
1750 static inline tree
1751 gimple_op (const_gimple gs, unsigned i)
1752 {
1753   if (gimple_has_ops (gs))
1754     {
1755       gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1756       return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1757     }
1758   else
1759     return NULL_TREE;
1760 }
1761
1762 /* Return a pointer to operand I for statement GS.  */
1763
1764 static inline tree *
1765 gimple_op_ptr (const_gimple gs, unsigned i)
1766 {
1767   if (gimple_has_ops (gs))
1768     {
1769       gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1770       return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1771     }
1772   else
1773     return NULL;
1774 }
1775
1776 /* Set operand I of statement GS to OP.  */
1777
1778 static inline void
1779 gimple_set_op (gimple gs, unsigned i, tree op)
1780 {
1781   gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1782
1783   /* Note.  It may be tempting to assert that OP matches
1784      is_gimple_operand, but that would be wrong.  Different tuples
1785      accept slightly different sets of tree operands.  Each caller
1786      should perform its own validation.  */
1787   gimple_ops (gs)[i] = op;
1788 }
1789
1790 /* Return true if GS is a GIMPLE_ASSIGN.  */
1791
1792 static inline bool
1793 is_gimple_assign (const_gimple gs)
1794 {
1795   return gimple_code (gs) == GIMPLE_ASSIGN;
1796 }
1797
1798 /* Determine if expression CODE is one of the valid expressions that can
1799    be used on the RHS of GIMPLE assignments.  */
1800
1801 static inline enum gimple_rhs_class
1802 get_gimple_rhs_class (enum tree_code code)
1803 {
1804   return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1805 }
1806
1807 /* Return the LHS of assignment statement GS.  */
1808
1809 static inline tree
1810 gimple_assign_lhs (const_gimple gs)
1811 {
1812   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1813   return gimple_op (gs, 0);
1814 }
1815
1816
1817 /* Return a pointer to the LHS of assignment statement GS.  */
1818
1819 static inline tree *
1820 gimple_assign_lhs_ptr (const_gimple gs)
1821 {
1822   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1823   return gimple_op_ptr (gs, 0);
1824 }
1825
1826
1827 /* Set LHS to be the LHS operand of assignment statement GS.  */
1828
1829 static inline void
1830 gimple_assign_set_lhs (gimple gs, tree lhs)
1831 {
1832   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1833   gimple_set_op (gs, 0, lhs);
1834
1835   if (lhs && TREE_CODE (lhs) == SSA_NAME)
1836     SSA_NAME_DEF_STMT (lhs) = gs;
1837 }
1838
1839
1840 /* Return the first operand on the RHS of assignment statement GS.  */
1841
1842 static inline tree
1843 gimple_assign_rhs1 (const_gimple gs)
1844 {
1845   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1846   return gimple_op (gs, 1);
1847 }
1848
1849
1850 /* Return a pointer to the first operand on the RHS of assignment
1851    statement GS.  */
1852
1853 static inline tree *
1854 gimple_assign_rhs1_ptr (const_gimple gs)
1855 {
1856   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1857   return gimple_op_ptr (gs, 1);
1858 }
1859
1860 /* Set RHS to be the first operand on the RHS of assignment statement GS.  */
1861
1862 static inline void
1863 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1864 {
1865   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1866
1867   gimple_set_op (gs, 1, rhs);
1868 }
1869
1870
1871 /* Return the second operand on the RHS of assignment statement GS.
1872    If GS does not have two operands, NULL is returned instead.  */
1873
1874 static inline tree
1875 gimple_assign_rhs2 (const_gimple gs)
1876 {
1877   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1878
1879   if (gimple_num_ops (gs) >= 3)
1880     return gimple_op (gs, 2);
1881   else
1882     return NULL_TREE;
1883 }
1884
1885
1886 /* Return a pointer to the second operand on the RHS of assignment
1887    statement GS.  */
1888
1889 static inline tree *
1890 gimple_assign_rhs2_ptr (const_gimple gs)
1891 {
1892   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1893   return gimple_op_ptr (gs, 2);
1894 }
1895
1896
1897 /* Set RHS to be the second operand on the RHS of assignment statement GS.  */
1898
1899 static inline void
1900 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1901 {
1902   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1903
1904   gimple_set_op (gs, 2, rhs);
1905 }
1906
1907 /* Return the third operand on the RHS of assignment statement GS.
1908    If GS does not have two operands, NULL is returned instead.  */
1909
1910 static inline tree
1911 gimple_assign_rhs3 (const_gimple gs)
1912 {
1913   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1914
1915   if (gimple_num_ops (gs) >= 4)
1916     return gimple_op (gs, 3);
1917   else
1918     return NULL_TREE;
1919 }
1920
1921 /* Return a pointer to the third operand on the RHS of assignment
1922    statement GS.  */
1923
1924 static inline tree *
1925 gimple_assign_rhs3_ptr (const_gimple gs)
1926 {
1927   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1928   return gimple_op_ptr (gs, 3);
1929 }
1930
1931
1932 /* Set RHS to be the third operand on the RHS of assignment statement GS.  */
1933
1934 static inline void
1935 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1936 {
1937   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1938
1939   gimple_set_op (gs, 3, rhs);
1940 }
1941
1942 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1943    to see only a maximum of two operands.  */
1944
1945 static inline void
1946 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1947                                 tree op1, tree op2)
1948 {
1949   gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1950 }
1951
1952 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1953    to see only a maximum of two operands.  */
1954
1955 static inline void
1956 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1957                        tree *op1)
1958 {
1959   tree op2;
1960   extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1961   gcc_assert (op2 == NULL_TREE);
1962 }
1963
1964 /* Returns true if GS is a nontemporal move.  */
1965
1966 static inline bool
1967 gimple_assign_nontemporal_move_p (const_gimple gs)
1968 {
1969   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1970   return gs->gsbase.nontemporal_move;
1971 }
1972
1973 /* Sets nontemporal move flag of GS to NONTEMPORAL.  */
1974
1975 static inline void
1976 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1977 {
1978   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1979   gs->gsbase.nontemporal_move = nontemporal;
1980 }
1981
1982
1983 /* Return the code of the expression computed on the rhs of assignment
1984    statement GS.  In case that the RHS is a single object, returns the
1985    tree code of the object.  */
1986
1987 static inline enum tree_code
1988 gimple_assign_rhs_code (const_gimple gs)
1989 {
1990   enum tree_code code;
1991   GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1992
1993   code = (enum tree_code) gs->gsbase.subcode;
1994   /* While we initially set subcode to the TREE_CODE of the rhs for
1995      GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
1996      in sync when we rewrite stmts into SSA form or do SSA propagations.  */
1997   if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1998     code = TREE_CODE (gimple_assign_rhs1 (gs));
1999
2000   return code;
2001 }
2002
2003
2004 /* Set CODE to be the code for the expression computed on the RHS of
2005    assignment S.  */
2006
2007 static inline void
2008 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2009 {
2010   GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2011   s->gsbase.subcode = code;
2012 }
2013
2014
2015 /* Return the gimple rhs class of the code of the expression computed on
2016    the rhs of assignment statement GS.
2017    This will never return GIMPLE_INVALID_RHS.  */
2018
2019 static inline enum gimple_rhs_class
2020 gimple_assign_rhs_class (const_gimple gs)
2021 {
2022   return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2023 }
2024
2025 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2026    there is no operator associated with the assignment itself.
2027    Unlike gimple_assign_copy_p, this predicate returns true for
2028    any RHS operand, including those that perform an operation
2029    and do not have the semantics of a copy, such as COND_EXPR.  */
2030
2031 static inline bool
2032 gimple_assign_single_p (gimple gs)
2033 {
2034   return (is_gimple_assign (gs)
2035           && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2036 }
2037
2038
2039 /* Return true if S is a type-cast assignment.  */
2040
2041 static inline bool
2042 gimple_assign_cast_p (gimple s)
2043 {
2044   if (is_gimple_assign (s))
2045     {
2046       enum tree_code sc = gimple_assign_rhs_code (s);
2047       return CONVERT_EXPR_CODE_P (sc)
2048              || sc == VIEW_CONVERT_EXPR
2049              || sc == FIX_TRUNC_EXPR;
2050     }
2051
2052   return false;
2053 }
2054
2055 /* Return true if S is a clobber statement.  */
2056
2057 static inline bool
2058 gimple_clobber_p (gimple s)
2059 {
2060   return gimple_assign_single_p (s)
2061          && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2062 }
2063
2064 /* Return true if GS is a GIMPLE_CALL.  */
2065
2066 static inline bool
2067 is_gimple_call (const_gimple gs)
2068 {
2069   return gimple_code (gs) == GIMPLE_CALL;
2070 }
2071
2072 /* Return the LHS of call statement GS.  */
2073
2074 static inline tree
2075 gimple_call_lhs (const_gimple gs)
2076 {
2077   GIMPLE_CHECK (gs, GIMPLE_CALL);
2078   return gimple_op (gs, 0);
2079 }
2080
2081
2082 /* Return a pointer to the LHS of call statement GS.  */
2083
2084 static inline tree *
2085 gimple_call_lhs_ptr (const_gimple gs)
2086 {
2087   GIMPLE_CHECK (gs, GIMPLE_CALL);
2088   return gimple_op_ptr (gs, 0);
2089 }
2090
2091
2092 /* Set LHS to be the LHS operand of call statement GS.  */
2093
2094 static inline void
2095 gimple_call_set_lhs (gimple gs, tree lhs)
2096 {
2097   GIMPLE_CHECK (gs, GIMPLE_CALL);
2098   gimple_set_op (gs, 0, lhs);
2099   if (lhs && TREE_CODE (lhs) == SSA_NAME)
2100     SSA_NAME_DEF_STMT (lhs) = gs;
2101 }
2102
2103
2104 /* Return true if call GS calls an internal-only function, as enumerated
2105    by internal_fn.  */
2106
2107 static inline bool
2108 gimple_call_internal_p (const_gimple gs)
2109 {
2110   GIMPLE_CHECK (gs, GIMPLE_CALL);
2111   return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2112 }
2113
2114
2115 /* Return the target of internal call GS.  */
2116
2117 static inline enum internal_fn
2118 gimple_call_internal_fn (const_gimple gs)
2119 {
2120   gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2121   return gs->gimple_call.u.internal_fn;
2122 }
2123
2124
2125 /* Return the function type of the function called by GS.  */
2126
2127 static inline tree
2128 gimple_call_fntype (const_gimple gs)
2129 {
2130   GIMPLE_CHECK (gs, GIMPLE_CALL);
2131   if (gimple_call_internal_p (gs))
2132     return NULL_TREE;
2133   return gs->gimple_call.u.fntype;
2134 }
2135
2136 /* Set the type of the function called by GS to FNTYPE.  */
2137
2138 static inline void
2139 gimple_call_set_fntype (gimple gs, tree fntype)
2140 {
2141   GIMPLE_CHECK (gs, GIMPLE_CALL);
2142   gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2143   gs->gimple_call.u.fntype = fntype;
2144 }
2145
2146
2147 /* Return the tree node representing the function called by call
2148    statement GS.  */
2149
2150 static inline tree
2151 gimple_call_fn (const_gimple gs)
2152 {
2153   GIMPLE_CHECK (gs, GIMPLE_CALL);
2154   return gimple_op (gs, 1);
2155 }
2156
2157 /* Return a pointer to the tree node representing the function called by call
2158    statement GS.  */
2159
2160 static inline tree *
2161 gimple_call_fn_ptr (const_gimple gs)
2162 {
2163   GIMPLE_CHECK (gs, GIMPLE_CALL);
2164   return gimple_op_ptr (gs, 1);
2165 }
2166
2167
2168 /* Set FN to be the function called by call statement GS.  */
2169
2170 static inline void
2171 gimple_call_set_fn (gimple gs, tree fn)
2172 {
2173   GIMPLE_CHECK (gs, GIMPLE_CALL);
2174   gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2175   gimple_set_op (gs, 1, fn);
2176 }
2177
2178
2179 /* Set FNDECL to be the function called by call statement GS.  */
2180
2181 static inline void
2182 gimple_call_set_fndecl (gimple gs, tree decl)
2183 {
2184   GIMPLE_CHECK (gs, GIMPLE_CALL);
2185   gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2186   gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2187 }
2188
2189
2190 /* Set internal function FN to be the function called by call statement GS.  */
2191
2192 static inline void
2193 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2194 {
2195   GIMPLE_CHECK (gs, GIMPLE_CALL);
2196   gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2197   gs->gimple_call.u.internal_fn = fn;
2198 }
2199
2200
2201 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2202    associated with the callee if known.  Otherwise return NULL_TREE.  */
2203
2204 static inline tree
2205 gimple_call_addr_fndecl (const_tree fn)
2206 {
2207   if (fn && TREE_CODE (fn) == ADDR_EXPR)
2208     {
2209       tree fndecl = TREE_OPERAND (fn, 0);
2210       if (TREE_CODE (fndecl) == MEM_REF
2211           && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2212           && integer_zerop (TREE_OPERAND (fndecl, 1)))
2213         fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2214       if (TREE_CODE (fndecl) == FUNCTION_DECL)
2215         return fndecl;
2216     }
2217   return NULL_TREE;
2218 }
2219
2220 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2221    Otherwise return NULL.  This function is analogous to
2222    get_callee_fndecl in tree land.  */
2223
2224 static inline tree
2225 gimple_call_fndecl (const_gimple gs)
2226 {
2227   return gimple_call_addr_fndecl (gimple_call_fn (gs));
2228 }
2229
2230
2231 /* Return the type returned by call statement GS.  */
2232
2233 static inline tree
2234 gimple_call_return_type (const_gimple gs)
2235 {
2236   tree type = gimple_call_fntype (gs);
2237
2238   if (type == NULL_TREE)
2239     return TREE_TYPE (gimple_call_lhs (gs));
2240
2241   /* The type returned by a function is the type of its
2242      function type.  */
2243   return TREE_TYPE (type);
2244 }
2245
2246
2247 /* Return the static chain for call statement GS.  */
2248
2249 static inline tree
2250 gimple_call_chain (const_gimple gs)
2251 {
2252   GIMPLE_CHECK (gs, GIMPLE_CALL);
2253   return gimple_op (gs, 2);
2254 }
2255
2256
2257 /* Return a pointer to the static chain for call statement GS.  */
2258
2259 static inline tree *
2260 gimple_call_chain_ptr (const_gimple gs)
2261 {
2262   GIMPLE_CHECK (gs, GIMPLE_CALL);
2263   return gimple_op_ptr (gs, 2);
2264 }
2265
2266 /* Set CHAIN to be the static chain for call statement GS.  */
2267
2268 static inline void
2269 gimple_call_set_chain (gimple gs, tree chain)
2270 {
2271   GIMPLE_CHECK (gs, GIMPLE_CALL);
2272
2273   gimple_set_op (gs, 2, chain);
2274 }
2275
2276
2277 /* Return the number of arguments used by call statement GS.  */
2278
2279 static inline unsigned
2280 gimple_call_num_args (const_gimple gs)
2281 {
2282   unsigned num_ops;
2283   GIMPLE_CHECK (gs, GIMPLE_CALL);
2284   num_ops = gimple_num_ops (gs);
2285   return num_ops - 3;
2286 }
2287
2288
2289 /* Return the argument at position INDEX for call statement GS.  */
2290
2291 static inline tree
2292 gimple_call_arg (const_gimple gs, unsigned index)
2293 {
2294   GIMPLE_CHECK (gs, GIMPLE_CALL);
2295   return gimple_op (gs, index + 3);
2296 }
2297
2298
2299 /* Return a pointer to the argument at position INDEX for call
2300    statement GS.  */
2301
2302 static inline tree *
2303 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2304 {
2305   GIMPLE_CHECK (gs, GIMPLE_CALL);
2306   return gimple_op_ptr (gs, index + 3);
2307 }
2308
2309
2310 /* Set ARG to be the argument at position INDEX for call statement GS.  */
2311
2312 static inline void
2313 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2314 {
2315   GIMPLE_CHECK (gs, GIMPLE_CALL);
2316   gimple_set_op (gs, index + 3, arg);
2317 }
2318
2319
2320 /* If TAIL_P is true, mark call statement S as being a tail call
2321    (i.e., a call just before the exit of a function).  These calls are
2322    candidate for tail call optimization.  */
2323
2324 static inline void
2325 gimple_call_set_tail (gimple s, bool tail_p)
2326 {
2327   GIMPLE_CHECK (s, GIMPLE_CALL);
2328   if (tail_p)
2329     s->gsbase.subcode |= GF_CALL_TAILCALL;
2330   else
2331     s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2332 }
2333
2334
2335 /* Return true if GIMPLE_CALL S is marked as a tail call.  */
2336
2337 static inline bool
2338 gimple_call_tail_p (gimple s)
2339 {
2340   GIMPLE_CHECK (s, GIMPLE_CALL);
2341   return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2342 }
2343
2344
2345 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2346    slot optimization.  This transformation uses the target of the call
2347    expansion as the return slot for calls that return in memory.  */
2348
2349 static inline void
2350 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2351 {
2352   GIMPLE_CHECK (s, GIMPLE_CALL);
2353   if (return_slot_opt_p)
2354     s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2355   else
2356     s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2357 }
2358
2359
2360 /* Return true if S is marked for return slot optimization.  */
2361
2362 static inline bool
2363 gimple_call_return_slot_opt_p (gimple s)
2364 {
2365   GIMPLE_CHECK (s, GIMPLE_CALL);
2366   return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2367 }
2368
2369
2370 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2371    thunk to the thunked-to function.  */
2372
2373 static inline void
2374 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2375 {
2376   GIMPLE_CHECK (s, GIMPLE_CALL);
2377   if (from_thunk_p)
2378     s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2379   else
2380     s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2381 }
2382
2383
2384 /* Return true if GIMPLE_CALL S is a jump from a thunk.  */
2385
2386 static inline bool
2387 gimple_call_from_thunk_p (gimple s)
2388 {
2389   GIMPLE_CHECK (s, GIMPLE_CALL);
2390   return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2391 }
2392
2393
2394 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2395    argument pack in its argument list.  */
2396
2397 static inline void
2398 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2399 {
2400   GIMPLE_CHECK (s, GIMPLE_CALL);
2401   if (pass_arg_pack_p)
2402     s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2403   else
2404     s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2405 }
2406
2407
2408 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2409    argument pack in its argument list.  */
2410
2411 static inline bool
2412 gimple_call_va_arg_pack_p (gimple s)
2413 {
2414   GIMPLE_CHECK (s, GIMPLE_CALL);
2415   return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2416 }
2417
2418
2419 /* Return true if S is a noreturn call.  */
2420
2421 static inline bool
2422 gimple_call_noreturn_p (gimple s)
2423 {
2424   GIMPLE_CHECK (s, GIMPLE_CALL);
2425   return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2426 }
2427
2428
2429 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2430    even if the called function can throw in other cases.  */
2431
2432 static inline void
2433 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2434 {
2435   GIMPLE_CHECK (s, GIMPLE_CALL);
2436   if (nothrow_p)
2437     s->gsbase.subcode |= GF_CALL_NOTHROW;
2438   else
2439     s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2440 }
2441
2442 /* Return true if S is a nothrow call.  */
2443
2444 static inline bool
2445 gimple_call_nothrow_p (gimple s)
2446 {
2447   GIMPLE_CHECK (s, GIMPLE_CALL);
2448   return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2449 }
2450
2451 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2452    is known to be emitted for VLA objects.  Those are wrapped by
2453    stack_save/stack_restore calls and hence can't lead to unbounded
2454    stack growth even when they occur in loops.  */
2455
2456 static inline void
2457 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2458 {
2459   GIMPLE_CHECK (s, GIMPLE_CALL);
2460   if (for_var)
2461     s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2462   else
2463     s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2464 }
2465
2466 /* Return true of S is a call to builtin_alloca emitted for VLA objects.  */
2467
2468 static inline bool
2469 gimple_call_alloca_for_var_p (gimple s)
2470 {
2471   GIMPLE_CHECK (s, GIMPLE_CALL);
2472   return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2473 }
2474
2475 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL.  */
2476
2477 static inline void
2478 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2479 {
2480   GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2481   GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2482   dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2483 }
2484
2485
2486 /* Return a pointer to the points-to solution for the set of call-used
2487    variables of the call CALL.  */
2488
2489 static inline struct pt_solution *
2490 gimple_call_use_set (gimple call)
2491 {
2492   GIMPLE_CHECK (call, GIMPLE_CALL);
2493   return &call->gimple_call.call_used;
2494 }
2495
2496
2497 /* Return a pointer to the points-to solution for the set of call-used
2498    variables of the call CALL.  */
2499
2500 static inline struct pt_solution *
2501 gimple_call_clobber_set (gimple call)
2502 {
2503   GIMPLE_CHECK (call, GIMPLE_CALL);
2504   return &call->gimple_call.call_clobbered;
2505 }
2506
2507
2508 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2509    non-NULL lhs.  */
2510
2511 static inline bool
2512 gimple_has_lhs (gimple stmt)
2513 {
2514   return (is_gimple_assign (stmt)
2515           || (is_gimple_call (stmt)
2516               && gimple_call_lhs (stmt) != NULL_TREE));
2517 }
2518
2519
2520 /* Return the code of the predicate computed by conditional statement GS.  */
2521
2522 static inline enum tree_code
2523 gimple_cond_code (const_gimple gs)
2524 {
2525   GIMPLE_CHECK (gs, GIMPLE_COND);
2526   return (enum tree_code) gs->gsbase.subcode;
2527 }
2528
2529
2530 /* Set CODE to be the predicate code for the conditional statement GS.  */
2531
2532 static inline void
2533 gimple_cond_set_code (gimple gs, enum tree_code code)
2534 {
2535   GIMPLE_CHECK (gs, GIMPLE_COND);
2536   gs->gsbase.subcode = code;
2537 }
2538
2539
2540 /* Return the LHS of the predicate computed by conditional statement GS.  */
2541
2542 static inline tree
2543 gimple_cond_lhs (const_gimple gs)
2544 {
2545   GIMPLE_CHECK (gs, GIMPLE_COND);
2546   return gimple_op (gs, 0);
2547 }
2548
2549 /* Return the pointer to the LHS of the predicate computed by conditional
2550    statement GS.  */
2551
2552 static inline tree *
2553 gimple_cond_lhs_ptr (const_gimple gs)
2554 {
2555   GIMPLE_CHECK (gs, GIMPLE_COND);
2556   return gimple_op_ptr (gs, 0);
2557 }
2558
2559 /* Set LHS to be the LHS operand of the predicate computed by
2560    conditional statement GS.  */
2561
2562 static inline void
2563 gimple_cond_set_lhs (gimple gs, tree lhs)
2564 {
2565   GIMPLE_CHECK (gs, GIMPLE_COND);
2566   gimple_set_op (gs, 0, lhs);
2567 }
2568
2569
2570 /* Return the RHS operand of the predicate computed by conditional GS.  */
2571
2572 static inline tree
2573 gimple_cond_rhs (const_gimple gs)
2574 {
2575   GIMPLE_CHECK (gs, GIMPLE_COND);
2576   return gimple_op (gs, 1);
2577 }
2578
2579 /* Return the pointer to the RHS operand of the predicate computed by
2580    conditional GS.  */
2581
2582 static inline tree *
2583 gimple_cond_rhs_ptr (const_gimple gs)
2584 {
2585   GIMPLE_CHECK (gs, GIMPLE_COND);
2586   return gimple_op_ptr (gs, 1);
2587 }
2588
2589
2590 /* Set RHS to be the RHS operand of the predicate computed by
2591    conditional statement GS.  */
2592
2593 static inline void
2594 gimple_cond_set_rhs (gimple gs, tree rhs)
2595 {
2596   GIMPLE_CHECK (gs, GIMPLE_COND);
2597   gimple_set_op (gs, 1, rhs);
2598 }
2599
2600
2601 /* Return the label used by conditional statement GS when its
2602    predicate evaluates to true.  */
2603
2604 static inline tree
2605 gimple_cond_true_label (const_gimple gs)
2606 {
2607   GIMPLE_CHECK (gs, GIMPLE_COND);
2608   return gimple_op (gs, 2);
2609 }
2610
2611
2612 /* Set LABEL to be the label used by conditional statement GS when its
2613    predicate evaluates to true.  */
2614
2615 static inline void
2616 gimple_cond_set_true_label (gimple gs, tree label)
2617 {
2618   GIMPLE_CHECK (gs, GIMPLE_COND);
2619   gimple_set_op (gs, 2, label);
2620 }
2621
2622
2623 /* Set LABEL to be the label used by conditional statement GS when its
2624    predicate evaluates to false.  */
2625
2626 static inline void
2627 gimple_cond_set_false_label (gimple gs, tree label)
2628 {
2629   GIMPLE_CHECK (gs, GIMPLE_COND);
2630   gimple_set_op (gs, 3, label);
2631 }
2632
2633
2634 /* Return the label used by conditional statement GS when its
2635    predicate evaluates to false.  */
2636
2637 static inline tree
2638 gimple_cond_false_label (const_gimple gs)
2639 {
2640   GIMPLE_CHECK (gs, GIMPLE_COND);
2641   return gimple_op (gs, 3);
2642 }
2643
2644
2645 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'.  */
2646
2647 static inline void
2648 gimple_cond_make_false (gimple gs)
2649 {
2650   gimple_cond_set_lhs (gs, boolean_true_node);
2651   gimple_cond_set_rhs (gs, boolean_false_node);
2652   gs->gsbase.subcode = EQ_EXPR;
2653 }
2654
2655
2656 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'.  */
2657
2658 static inline void
2659 gimple_cond_make_true (gimple gs)
2660 {
2661   gimple_cond_set_lhs (gs, boolean_true_node);
2662   gimple_cond_set_rhs (gs, boolean_true_node);
2663   gs->gsbase.subcode = EQ_EXPR;
2664 }
2665
2666 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2667   'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2668
2669 static inline bool
2670 gimple_cond_true_p (const_gimple gs)
2671 {
2672   tree lhs = gimple_cond_lhs (gs);
2673   tree rhs = gimple_cond_rhs (gs);
2674   enum tree_code code = gimple_cond_code (gs);
2675
2676   if (lhs != boolean_true_node && lhs != boolean_false_node)
2677     return false;
2678
2679   if (rhs != boolean_true_node && rhs != boolean_false_node)
2680     return false;
2681
2682   if (code == NE_EXPR && lhs != rhs)
2683     return true;
2684
2685   if (code == EQ_EXPR && lhs == rhs)
2686       return true;
2687
2688   return false;
2689 }
2690
2691 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2692    'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2693
2694 static inline bool
2695 gimple_cond_false_p (const_gimple gs)
2696 {
2697   tree lhs = gimple_cond_lhs (gs);
2698   tree rhs = gimple_cond_rhs (gs);
2699   enum tree_code code = gimple_cond_code (gs);
2700
2701   if (lhs != boolean_true_node && lhs != boolean_false_node)
2702     return false;
2703
2704   if (rhs != boolean_true_node && rhs != boolean_false_node)
2705     return false;
2706
2707   if (code == NE_EXPR && lhs == rhs)
2708     return true;
2709
2710   if (code == EQ_EXPR && lhs != rhs)
2711       return true;
2712
2713   return false;
2714 }
2715
2716 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2717    'if (var == 1)' */
2718
2719 static inline bool
2720 gimple_cond_single_var_p (gimple gs)
2721 {
2722   if (gimple_cond_code (gs) == NE_EXPR
2723       && gimple_cond_rhs (gs) == boolean_false_node)
2724     return true;
2725
2726   if (gimple_cond_code (gs) == EQ_EXPR
2727       && gimple_cond_rhs (gs) == boolean_true_node)
2728     return true;
2729
2730   return false;
2731 }
2732
2733 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS.  */
2734
2735 static inline void
2736 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2737 {
2738   gimple_cond_set_code (stmt, code);
2739   gimple_cond_set_lhs (stmt, lhs);
2740   gimple_cond_set_rhs (stmt, rhs);
2741 }
2742
2743 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS.  */
2744
2745 static inline tree
2746 gimple_label_label (const_gimple gs)
2747 {
2748   GIMPLE_CHECK (gs, GIMPLE_LABEL);
2749   return gimple_op (gs, 0);
2750 }
2751
2752
2753 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2754    GS.  */
2755
2756 static inline void
2757 gimple_label_set_label (gimple gs, tree label)
2758 {
2759   GIMPLE_CHECK (gs, GIMPLE_LABEL);
2760   gimple_set_op (gs, 0, label);
2761 }
2762
2763
2764 /* Return the destination of the unconditional jump GS.  */
2765
2766 static inline tree
2767 gimple_goto_dest (const_gimple gs)
2768 {
2769   GIMPLE_CHECK (gs, GIMPLE_GOTO);
2770   return gimple_op (gs, 0);
2771 }
2772
2773
2774 /* Set DEST to be the destination of the unconditonal jump GS.  */
2775
2776 static inline void
2777 gimple_goto_set_dest (gimple gs, tree dest)
2778 {
2779   GIMPLE_CHECK (gs, GIMPLE_GOTO);
2780   gimple_set_op (gs, 0, dest);
2781 }
2782
2783
2784 /* Return the variables declared in the GIMPLE_BIND statement GS.  */
2785
2786 static inline tree
2787 gimple_bind_vars (const_gimple gs)
2788 {
2789   GIMPLE_CHECK (gs, GIMPLE_BIND);
2790   return gs->gimple_bind.vars;
2791 }
2792
2793
2794 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2795    statement GS.  */
2796
2797 static inline void
2798 gimple_bind_set_vars (gimple gs, tree vars)
2799 {
2800   GIMPLE_CHECK (gs, GIMPLE_BIND);
2801   gs->gimple_bind.vars = vars;
2802 }
2803
2804
2805 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2806    statement GS.  */
2807
2808 static inline void
2809 gimple_bind_append_vars (gimple gs, tree vars)
2810 {
2811   GIMPLE_CHECK (gs, GIMPLE_BIND);
2812   gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2813 }
2814
2815
2816 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS.  */
2817
2818 static inline gimple_seq
2819 gimple_bind_body (gimple gs)
2820 {
2821   GIMPLE_CHECK (gs, GIMPLE_BIND);
2822   return gs->gimple_bind.body;
2823 }
2824
2825
2826 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2827    statement GS.  */
2828
2829 static inline void
2830 gimple_bind_set_body (gimple gs, gimple_seq seq)
2831 {
2832   GIMPLE_CHECK (gs, GIMPLE_BIND);
2833   gs->gimple_bind.body = seq;
2834 }
2835
2836
2837 /* Append a statement to the end of a GIMPLE_BIND's body.  */
2838
2839 static inline void
2840 gimple_bind_add_stmt (gimple gs, gimple stmt)
2841 {
2842   GIMPLE_CHECK (gs, GIMPLE_BIND);
2843   gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2844 }
2845
2846
2847 /* Append a sequence of statements to the end of a GIMPLE_BIND's body.  */
2848
2849 static inline void
2850 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2851 {
2852   GIMPLE_CHECK (gs, GIMPLE_BIND);
2853   gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2854 }
2855
2856
2857 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2858    GS.  This is analogous to the BIND_EXPR_BLOCK field in trees.  */
2859
2860 static inline tree
2861 gimple_bind_block (const_gimple gs)
2862 {
2863   GIMPLE_CHECK (gs, GIMPLE_BIND);
2864   return gs->gimple_bind.block;
2865 }
2866
2867
2868 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2869    statement GS.  */
2870
2871 static inline void
2872 gimple_bind_set_block (gimple gs, tree block)
2873 {
2874   GIMPLE_CHECK (gs, GIMPLE_BIND);
2875   gcc_gimple_checking_assert (block == NULL_TREE
2876                               || TREE_CODE (block) == BLOCK);
2877   gs->gimple_bind.block = block;
2878 }
2879
2880
2881 /* Return the number of input operands for GIMPLE_ASM GS.  */
2882
2883 static inline unsigned
2884 gimple_asm_ninputs (const_gimple gs)
2885 {
2886   GIMPLE_CHECK (gs, GIMPLE_ASM);
2887   return gs->gimple_asm.ni;
2888 }
2889
2890
2891 /* Return the number of output operands for GIMPLE_ASM GS.  */
2892
2893 static inline unsigned
2894 gimple_asm_noutputs (const_gimple gs)
2895 {
2896   GIMPLE_CHECK (gs, GIMPLE_ASM);
2897   return gs->gimple_asm.no;
2898 }
2899
2900
2901 /* Return the number of clobber operands for GIMPLE_ASM GS.  */
2902
2903 static inline unsigned
2904 gimple_asm_nclobbers (const_gimple gs)
2905 {
2906   GIMPLE_CHECK (gs, GIMPLE_ASM);
2907   return gs->gimple_asm.nc;
2908 }
2909
2910 /* Return the number of label operands for GIMPLE_ASM GS.  */
2911
2912 static inline unsigned
2913 gimple_asm_nlabels (const_gimple gs)
2914 {
2915   GIMPLE_CHECK (gs, GIMPLE_ASM);
2916   return gs->gimple_asm.nl;
2917 }
2918
2919 /* Return input operand INDEX of GIMPLE_ASM GS.  */
2920
2921 static inline tree
2922 gimple_asm_input_op (const_gimple gs, unsigned index)
2923 {
2924   GIMPLE_CHECK (gs, GIMPLE_ASM);
2925   gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2926   return gimple_op (gs, index);
2927 }
2928
2929 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS.  */
2930
2931 static inline tree *
2932 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2933 {
2934   GIMPLE_CHECK (gs, GIMPLE_ASM);
2935   gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2936   return gimple_op_ptr (gs, index);
2937 }
2938
2939
2940 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS.  */
2941
2942 static inline void
2943 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2944 {
2945   GIMPLE_CHECK (gs, GIMPLE_ASM);
2946   gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
2947                               && TREE_CODE (in_op) == TREE_LIST);
2948   gimple_set_op (gs, index, in_op);
2949 }
2950
2951
2952 /* Return output operand INDEX of GIMPLE_ASM GS.  */
2953
2954 static inline tree
2955 gimple_asm_output_op (const_gimple gs, unsigned index)
2956 {
2957   GIMPLE_CHECK (gs, GIMPLE_ASM);
2958   gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2959   return gimple_op (gs, index + gs->gimple_asm.ni);
2960 }
2961
2962 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS.  */
2963
2964 static inline tree *
2965 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2966 {
2967   GIMPLE_CHECK (gs, GIMPLE_ASM);
2968   gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2969   return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2970 }
2971
2972
2973 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS.  */
2974
2975 static inline void
2976 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2977 {
2978   GIMPLE_CHECK (gs, GIMPLE_ASM);
2979   gcc_gimple_checking_assert (index <= gs->gimple_asm.no
2980                               && TREE_CODE (out_op) == TREE_LIST);
2981   gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2982 }
2983
2984
2985 /* Return clobber operand INDEX of GIMPLE_ASM GS.  */
2986
2987 static inline tree
2988 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2989 {
2990   GIMPLE_CHECK (gs, GIMPLE_ASM);
2991   gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
2992   return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2993 }
2994
2995
2996 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS.  */
2997
2998 static inline void
2999 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3000 {
3001   GIMPLE_CHECK (gs, GIMPLE_ASM);
3002   gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
3003                               && TREE_CODE (clobber_op) == TREE_LIST);
3004   gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3005 }
3006
3007 /* Return label operand INDEX of GIMPLE_ASM GS.  */
3008
3009 static inline tree
3010 gimple_asm_label_op (const_gimple gs, unsigned index)
3011 {
3012   GIMPLE_CHECK (gs, GIMPLE_ASM);
3013   gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
3014   return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3015 }
3016
3017 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS.  */
3018
3019 static inline void
3020 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3021 {
3022   GIMPLE_CHECK (gs, GIMPLE_ASM);
3023   gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
3024                               && TREE_CODE (label_op) == TREE_LIST);
3025   gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3026 }
3027
3028 /* Return the string representing the assembly instruction in
3029    GIMPLE_ASM GS.  */
3030
3031 static inline const char *
3032 gimple_asm_string (const_gimple gs)
3033 {
3034   GIMPLE_CHECK (gs, GIMPLE_ASM);
3035   return gs->gimple_asm.string;
3036 }
3037
3038
3039 /* Return true if GS is an asm statement marked volatile.  */
3040
3041 static inline bool
3042 gimple_asm_volatile_p (const_gimple gs)
3043 {
3044   GIMPLE_CHECK (gs, GIMPLE_ASM);
3045   return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3046 }
3047
3048
3049 /* If VOLATLE_P is true, mark asm statement GS as volatile.  */
3050
3051 static inline void
3052 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3053 {
3054   GIMPLE_CHECK (gs, GIMPLE_ASM);
3055   if (volatile_p)
3056     gs->gsbase.subcode |= GF_ASM_VOLATILE;
3057   else
3058     gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3059 }
3060
3061
3062 /* If INPUT_P is true, mark asm GS as an ASM_INPUT.  */
3063
3064 static inline void
3065 gimple_asm_set_input (gimple gs, bool input_p)
3066 {
3067   GIMPLE_CHECK (gs, GIMPLE_ASM);
3068   if (input_p)
3069     gs->gsbase.subcode |= GF_ASM_INPUT;
3070   else
3071     gs->gsbase.subcode &= ~GF_ASM_INPUT;
3072 }
3073
3074
3075 /* Return true if asm GS is an ASM_INPUT.  */
3076
3077 static inline bool
3078 gimple_asm_input_p (const_gimple gs)
3079 {
3080   GIMPLE_CHECK (gs, GIMPLE_ASM);
3081   return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3082 }
3083
3084
3085 /* Return the types handled by GIMPLE_CATCH statement GS.  */
3086
3087 static inline tree
3088 gimple_catch_types (const_gimple gs)
3089 {
3090   GIMPLE_CHECK (gs, GIMPLE_CATCH);
3091   return gs->gimple_catch.types;
3092 }
3093
3094
3095 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS.  */
3096
3097 static inline tree *
3098 gimple_catch_types_ptr (gimple gs)
3099 {
3100   GIMPLE_CHECK (gs, GIMPLE_CATCH);
3101   return &gs->gimple_catch.types;
3102 }
3103
3104
3105 /* Return the GIMPLE sequence representing the body of the handler of
3106    GIMPLE_CATCH statement GS.  */
3107
3108 static inline gimple_seq
3109 gimple_catch_handler (gimple gs)
3110 {
3111   GIMPLE_CHECK (gs, GIMPLE_CATCH);
3112   return gs->gimple_catch.handler;
3113 }
3114
3115
3116 /* Return a pointer to the GIMPLE sequence representing the body of
3117    the handler of GIMPLE_CATCH statement GS.  */
3118
3119 static inline gimple_seq *
3120 gimple_catch_handler_ptr (gimple gs)
3121 {
3122   GIMPLE_CHECK (gs, GIMPLE_CATCH);
3123   return &gs->gimple_catch.handler;
3124 }
3125
3126
3127 /* Set T to be the set of types handled by GIMPLE_CATCH GS.  */
3128
3129 static inline void
3130 gimple_catch_set_types (gimple gs, tree t)
3131 {
3132   GIMPLE_CHECK (gs, GIMPLE_CATCH);
3133   gs->gimple_catch.types = t;
3134 }
3135
3136
3137 /* Set HANDLER to be the body of GIMPLE_CATCH GS.  */
3138
3139 static inline void
3140 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3141 {
3142   GIMPLE_CHECK (gs, GIMPLE_CATCH);
3143   gs->gimple_catch.handler = handler;
3144 }
3145
3146
3147 /* Return the types handled by GIMPLE_EH_FILTER statement GS.  */
3148
3149 static inline tree
3150 gimple_eh_filter_types (const_gimple gs)
3151 {
3152   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3153   return gs->gimple_eh_filter.types;
3154 }
3155
3156
3157 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3158    GS.  */
3159
3160 static inline tree *
3161 gimple_eh_filter_types_ptr (gimple gs)
3162 {
3163   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3164   return &gs->gimple_eh_filter.types;
3165 }
3166
3167
3168 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3169    statement fails.  */
3170
3171 static inline gimple_seq
3172 gimple_eh_filter_failure (gimple gs)
3173 {
3174   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3175   return gs->gimple_eh_filter.failure;
3176 }
3177
3178
3179 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS.  */
3180
3181 static inline void
3182 gimple_eh_filter_set_types (gimple gs, tree types)
3183 {
3184   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3185   gs->gimple_eh_filter.types = types;
3186 }
3187
3188
3189 /* Set FAILURE to be the sequence of statements to execute on failure
3190    for GIMPLE_EH_FILTER GS.  */
3191
3192 static inline void
3193 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3194 {
3195   GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3196   gs->gimple_eh_filter.failure = failure;
3197 }
3198
3199 /* Get the function decl to be called by the MUST_NOT_THROW region.  */
3200
3201 static inline tree
3202 gimple_eh_must_not_throw_fndecl (gimple gs)
3203 {
3204   GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3205   return gs->gimple_eh_mnt.fndecl;
3206 }
3207
3208 /* Set the function decl to be called by GS to DECL.  */
3209
3210 static inline void
3211 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3212 {
3213   GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3214   gs->gimple_eh_mnt.fndecl = decl;
3215 }
3216
3217 /* GIMPLE_EH_ELSE accessors.  */
3218
3219 static inline gimple_seq
3220 gimple_eh_else_n_body (gimple gs)
3221 {
3222   GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3223   return gs->gimple_eh_else.n_body;
3224 }
3225
3226 static inline gimple_seq
3227 gimple_eh_else_e_body (gimple gs)
3228 {
3229   GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3230   return gs->gimple_eh_else.e_body;
3231 }
3232
3233 static inline void
3234 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3235 {
3236   GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3237   gs->gimple_eh_else.n_body = seq;
3238 }
3239
3240 static inline void
3241 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3242 {
3243   GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3244   gs->gimple_eh_else.e_body = seq;
3245 }
3246
3247 /* GIMPLE_TRY accessors. */
3248
3249 /* Return the kind of try block represented by GIMPLE_TRY GS.  This is
3250    either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY.  */
3251
3252 static inline enum gimple_try_flags
3253 gimple_try_kind (const_gimple gs)
3254 {
3255   GIMPLE_CHECK (gs, GIMPLE_TRY);
3256   return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3257 }
3258
3259
3260 /* Set the kind of try block represented by GIMPLE_TRY GS.  */
3261
3262 static inline void
3263 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3264 {
3265   GIMPLE_CHECK (gs, GIMPLE_TRY);
3266   gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3267                               || kind == GIMPLE_TRY_FINALLY);
3268   if (gimple_try_kind (gs) != kind)
3269     gs->gsbase.subcode = (unsigned int) kind;
3270 }
3271
3272
3273 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag.  */
3274
3275 static inline bool
3276 gimple_try_catch_is_cleanup (const_gimple gs)
3277 {
3278   gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3279   return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3280 }
3281
3282
3283 /* Return the sequence of statements used as the body for GIMPLE_TRY GS.  */
3284
3285 static inline gimple_seq
3286 gimple_try_eval (gimple gs)
3287 {
3288   GIMPLE_CHECK (gs, GIMPLE_TRY);
3289   return gs->gimple_try.eval;
3290 }
3291
3292
3293 /* Return the sequence of statements used as the cleanup body for
3294    GIMPLE_TRY GS.  */
3295
3296 static inline gimple_seq
3297 gimple_try_cleanup (gimple gs)
3298 {
3299   GIMPLE_CHECK (gs, GIMPLE_TRY);
3300   return gs->gimple_try.cleanup;
3301 }
3302
3303
3304 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag.  */
3305
3306 static inline void
3307 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3308 {
3309   gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3310   if (catch_is_cleanup)
3311     g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3312   else
3313     g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3314 }
3315
3316
3317 /* Set EVAL to be the sequence of statements to use as the body for
3318    GIMPLE_TRY GS.  */
3319
3320 static inline void
3321 gimple_try_set_eval (gimple gs, gimple_seq eval)
3322 {
3323   GIMPLE_CHECK (gs, GIMPLE_TRY);
3324   gs->gimple_try.eval = eval;
3325 }
3326
3327
3328 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3329    body for GIMPLE_TRY GS.  */
3330
3331 static inline void
3332 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3333 {
3334   GIMPLE_CHECK (gs, GIMPLE_TRY);
3335   gs->gimple_try.cleanup = cleanup;
3336 }
3337
3338
3339 /* Return the cleanup sequence for cleanup statement GS.  */
3340
3341 static inline gimple_seq
3342 gimple_wce_cleanup (gimple gs)
3343 {
3344   GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3345   return gs->gimple_wce.cleanup;
3346 }
3347
3348
3349 /* Set CLEANUP to be the cleanup sequence for GS.  */
3350
3351 static inline void
3352 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3353 {
3354   GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3355   gs->gimple_wce.cleanup = cleanup;
3356 }
3357
3358
3359 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple.  */
3360
3361 static inline bool
3362 gimple_wce_cleanup_eh_only (const_gimple gs)
3363 {
3364   GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3365   return gs->gsbase.subcode != 0;
3366 }
3367
3368
3369 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple.  */
3370
3371 static inline void
3372 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3373 {
3374   GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3375   gs->gsbase.subcode = (unsigned int) eh_only_p;
3376 }
3377
3378
3379 /* Return the maximum number of arguments supported by GIMPLE_PHI GS.  */
3380
3381 static inline unsigned
3382 gimple_phi_capacity (const_gimple gs)
3383 {
3384   GIMPLE_CHECK (gs, GIMPLE_PHI);
3385   return gs->gimple_phi.capacity;
3386 }
3387
3388
3389 /* Return the number of arguments in GIMPLE_PHI GS.  This must always
3390    be exactly the number of incoming edges for the basic block holding
3391    GS.  */
3392
3393 static inline unsigned
3394 gimple_phi_num_args (const_gimple gs)
3395 {
3396   GIMPLE_CHECK (gs, GIMPLE_PHI);
3397   return gs->gimple_phi.nargs;
3398 }
3399
3400
3401 /* Return the SSA name created by GIMPLE_PHI GS.  */
3402
3403 static inline tree
3404 gimple_phi_result (const_gimple gs)
3405 {
3406   GIMPLE_CHECK (gs, GIMPLE_PHI);
3407   return gs->gimple_phi.result;
3408 }
3409
3410 /* Return a pointer to the SSA name created by GIMPLE_PHI GS.  */
3411
3412 static inline tree *
3413 gimple_phi_result_ptr (gimple gs)
3414 {
3415   GIMPLE_CHECK (gs, GIMPLE_PHI);
3416   return &gs->gimple_phi.result;
3417 }
3418
3419 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS.  */
3420
3421 static inline void
3422 gimple_phi_set_result (gimple gs, tree result)
3423 {
3424   GIMPLE_CHECK (gs, GIMPLE_PHI);
3425   gs->gimple_phi.result = result;
3426 }
3427
3428
3429 /* Return the PHI argument corresponding to incoming edge INDEX for
3430    GIMPLE_PHI GS.  */
3431
3432 static inline struct phi_arg_d *
3433 gimple_phi_arg (gimple gs, unsigned index)
3434 {
3435   GIMPLE_CHECK (gs, GIMPLE_PHI);
3436   gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3437   return &(gs->gimple_phi.args[index]);
3438 }
3439
3440 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3441    for GIMPLE_PHI GS.  */
3442
3443 static inline void
3444 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3445 {
3446   GIMPLE_CHECK (gs, GIMPLE_PHI);
3447   gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3448   gs->gimple_phi.args[index] = *phiarg;
3449 }
3450
3451 /* Return the region number for GIMPLE_RESX GS.  */
3452
3453 static inline int
3454 gimple_resx_region (const_gimple gs)
3455 {
3456   GIMPLE_CHECK (gs, GIMPLE_RESX);
3457   return gs->gimple_eh_ctrl.region;
3458 }
3459
3460 /* Set REGION to be the region number for GIMPLE_RESX GS.  */
3461
3462 static inline void
3463 gimple_resx_set_region (gimple gs, int region)
3464 {
3465   GIMPLE_CHECK (gs, GIMPLE_RESX);
3466   gs->gimple_eh_ctrl.region = region;
3467 }
3468
3469 /* Return the region number for GIMPLE_EH_DISPATCH GS.  */
3470
3471 static inline int
3472 gimple_eh_dispatch_region (const_gimple gs)
3473 {
3474   GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3475   return gs->gimple_eh_ctrl.region;
3476 }
3477
3478 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS.  */
3479
3480 static inline void
3481 gimple_eh_dispatch_set_region (gimple gs, int region)
3482 {
3483   GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3484   gs->gimple_eh_ctrl.region = region;
3485 }
3486
3487 /* Return the number of labels associated with the switch statement GS.  */
3488
3489 static inline unsigned
3490 gimple_switch_num_labels (const_gimple gs)
3491 {
3492   unsigned num_ops;
3493   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3494   num_ops = gimple_num_ops (gs);
3495   gcc_gimple_checking_assert (num_ops > 1);
3496   return num_ops - 1;
3497 }
3498
3499
3500 /* Set NLABELS to be the number of labels for the switch statement GS.  */
3501
3502 static inline void
3503 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3504 {
3505   GIMPLE_CHECK (g, GIMPLE_SWITCH);
3506   gimple_set_num_ops (g, nlabels + 1);
3507 }
3508
3509
3510 /* Return the index variable used by the switch statement GS.  */
3511
3512 static inline tree
3513 gimple_switch_index (const_gimple gs)
3514 {
3515   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3516   return gimple_op (gs, 0);
3517 }
3518
3519
3520 /* Return a pointer to the index variable for the switch statement GS.  */
3521
3522 static inline tree *
3523 gimple_switch_index_ptr (const_gimple gs)
3524 {
3525   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3526   return gimple_op_ptr (gs, 0);
3527 }
3528
3529
3530 /* Set INDEX to be the index variable for switch statement GS.  */
3531
3532 static inline void
3533 gimple_switch_set_index (gimple gs, tree index)
3534 {
3535   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3536   gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3537   gimple_set_op (gs, 0, index);
3538 }
3539
3540
3541 /* Return the label numbered INDEX.  The default label is 0, followed by any
3542    labels in a switch statement.  */
3543
3544 static inline tree
3545 gimple_switch_label (const_gimple gs, unsigned index)
3546 {
3547   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3548   gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3549   return gimple_op (gs, index + 1);
3550 }
3551
3552 /* Set the label number INDEX to LABEL.  0 is always the default label.  */
3553
3554 static inline void
3555 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3556 {
3557   GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3558   gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3559                               && (label == NULL_TREE
3560                                   || TREE_CODE (label) == CASE_LABEL_EXPR));
3561   gimple_set_op (gs, index + 1, label);
3562 }
3563
3564 /* Return the default label for a switch statement.  */
3565
3566 static inline tree
3567 gimple_switch_default_label (const_gimple gs)
3568 {
3569   return gimple_switch_label (gs, 0);
3570 }
3571
3572 /* Set the default label for a switch statement.  */
3573
3574 static inline void
3575 gimple_switch_set_default_label (gimple gs, tree label)
3576 {
3577   gimple_switch_set_label (gs, 0, label);
3578 }
3579
3580 /* Return true if GS is a GIMPLE_DEBUG statement.  */
3581
3582 static inline bool
3583 is_gimple_debug (const_gimple gs)
3584 {
3585   return gimple_code (gs) == GIMPLE_DEBUG;
3586 }
3587
3588 /* Return true if S is a GIMPLE_DEBUG BIND statement.  */
3589
3590 static inline bool
3591 gimple_debug_bind_p (const_gimple s)
3592 {
3593   if (is_gimple_debug (s))
3594     return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3595
3596   return false;
3597 }
3598
3599 /* Return the variable bound in a GIMPLE_DEBUG bind statement.  */
3600
3601 static inline tree
3602 gimple_debug_bind_get_var (gimple dbg)
3603 {
3604   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3605   gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3606   return gimple_op (dbg, 0);
3607 }
3608
3609 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3610    statement.  */
3611
3612 static inline tree
3613 gimple_debug_bind_get_value (gimple dbg)
3614 {
3615   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3616   gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3617   return gimple_op (dbg, 1);
3618 }
3619
3620 /* Return a pointer to the value bound to the variable in a
3621    GIMPLE_DEBUG bind statement.  */
3622
3623 static inline tree *
3624 gimple_debug_bind_get_value_ptr (gimple dbg)
3625 {
3626   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3627   gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3628   return gimple_op_ptr (dbg, 1);
3629 }
3630
3631 /* Set the variable bound in a GIMPLE_DEBUG bind statement.  */
3632
3633 static inline void
3634 gimple_debug_bind_set_var (gimple dbg, tree var)
3635 {
3636   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3637   gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3638   gimple_set_op (dbg, 0, var);
3639 }
3640
3641 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3642    statement.  */
3643
3644 static inline void
3645 gimple_debug_bind_set_value (gimple dbg, tree value)
3646 {
3647   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3648   gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3649   gimple_set_op (dbg, 1, value);
3650 }
3651
3652 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3653    optimized away.  */
3654 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3655
3656 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3657    statement.  */
3658
3659 static inline void
3660 gimple_debug_bind_reset_value (gimple dbg)
3661 {
3662   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3663   gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3664   gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3665 }
3666
3667 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3668    value.  */
3669
3670 static inline bool
3671 gimple_debug_bind_has_value_p (gimple dbg)
3672 {
3673   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3674   gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3675   return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3676 }
3677
3678 #undef GIMPLE_DEBUG_BIND_NOVALUE
3679
3680 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement.  */
3681
3682 static inline bool
3683 gimple_debug_source_bind_p (const_gimple s)
3684 {
3685   if (is_gimple_debug (s))
3686     return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3687
3688   return false;
3689 }
3690
3691 /* Return the variable bound in a GIMPLE_DEBUG source bind statement.  */
3692
3693 static inline tree
3694 gimple_debug_source_bind_get_var (gimple dbg)
3695 {
3696   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3697   gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3698   return gimple_op (dbg, 0);
3699 }
3700
3701 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3702    statement.  */
3703
3704 static inline tree
3705 gimple_debug_source_bind_get_value (gimple dbg)
3706 {
3707   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3708   gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3709   return gimple_op (dbg, 1);
3710 }
3711
3712 /* Return a pointer to the value bound to the variable in a
3713    GIMPLE_DEBUG source bind statement.  */
3714
3715 static inline tree *
3716 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3717 {
3718   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3719   gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3720   return gimple_op_ptr (dbg, 1);
3721 }
3722
3723 /* Set the variable bound in a GIMPLE_DEBUG source bind statement.  */
3724
3725 static inline void
3726 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3727 {
3728   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3729   gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3730   gimple_set_op (dbg, 0, var);
3731 }
3732
3733 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3734    statement.  */
3735
3736 static inline void
3737 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3738 {
3739   GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3740   gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3741   gimple_set_op (dbg, 1, value);
3742 }
3743
3744 /* Return the body for the OMP statement GS.  */
3745
3746 static inline gimple_seq
3747 gimple_omp_body (gimple gs)
3748 {
3749   return gs->omp.body;
3750 }
3751
3752 /* Set BODY to be the body for the OMP statement GS.  */
3753
3754 static inline void
3755 gimple_omp_set_body (gimple gs, gimple_seq body)
3756 {
3757   gs->omp.body = body;
3758 }
3759
3760
3761 /* Return the name associated with OMP_CRITICAL statement GS.  */
3762
3763 static inline tree
3764 gimple_omp_critical_name (const_gimple gs)
3765 {
3766   GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3767   return gs->gimple_omp_critical.name;
3768 }
3769
3770
3771 /* Return a pointer to the name associated with OMP critical statement GS.  */
3772
3773 static inline tree *
3774 gimple_omp_critical_name_ptr (gimple gs)
3775 {
3776   GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3777   return &gs->gimple_omp_critical.name;
3778 }
3779
3780
3781 /* Set NAME to be the name associated with OMP critical statement GS.  */
3782
3783 static inline void
3784 gimple_omp_critical_set_name (gimple gs, tree name)
3785 {
3786   GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3787   gs->gimple_omp_critical.name = name;
3788 }
3789
3790
3791 /* Return the clauses associated with OMP_FOR GS.  */
3792
3793 static inline tree
3794 gimple_omp_for_clauses (const_gimple gs)
3795 {
3796   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3797   return gs->gimple_omp_for.clauses;
3798 }
3799
3800
3801 /* Return a pointer to the OMP_FOR GS.  */
3802
3803 static inline tree *
3804 gimple_omp_for_clauses_ptr (gimple gs)
3805 {
3806   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3807   return &gs->gimple_omp_for.clauses;
3808 }
3809
3810
3811 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS.  */
3812
3813 static inline void
3814 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3815 {
3816   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3817   gs->gimple_omp_for.clauses = clauses;
3818 }
3819
3820
3821 /* Get the collapse count of OMP_FOR GS.  */
3822
3823 static inline size_t
3824 gimple_omp_for_collapse (gimple gs)
3825 {
3826   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3827   return gs->gimple_omp_for.collapse;
3828 }
3829
3830
3831 /* Return the index variable for OMP_FOR GS.  */
3832
3833 static inline tree
3834 gimple_omp_for_index (const_gimple gs, size_t i)
3835 {
3836   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3837   gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3838   return gs->gimple_omp_for.iter[i].index;
3839 }
3840
3841
3842 /* Return a pointer to the index variable for OMP_FOR GS.  */
3843
3844 static inline tree *
3845 gimple_omp_for_index_ptr (gimple gs, size_t i)
3846 {
3847   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3848   gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3849   return &gs->gimple_omp_for.iter[i].index;
3850 }
3851
3852
3853 /* Set INDEX to be the index variable for OMP_FOR GS.  */
3854
3855 static inline void
3856 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3857 {
3858   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3859   gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3860   gs->gimple_omp_for.iter[i].index = index;
3861 }
3862
3863
3864 /* Return the initial value for OMP_FOR GS.  */
3865
3866 static inline tree
3867 gimple_omp_for_initial (const_gimple gs, size_t i)
3868 {
3869   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3870   gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3871   return gs->gimple_omp_for.iter[i].initial;
3872 }
3873
3874
3875 /* Return a pointer to the initial value for OMP_FOR GS.  */
3876
3877 static inline tree *
3878 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3879 {
3880   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3881   gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3882   return &gs->gimple_omp_for.iter[i].initial;
3883 }
3884
3885
3886 /* Set INITIAL to be the initial value for OMP_FOR GS.  */
3887
3888 static inline void
3889 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3890 {
3891   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3892   gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3893   gs->gimple_omp_for.iter[i].initial = initial;
3894 }
3895
3896
3897 /* Return the final value for OMP_FOR GS.  */
3898
3899 static inline tree
3900 gimple_omp_for_final (const_gimple gs, size_t i)
3901 {
3902   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3903   gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3904   return gs->gimple_omp_for.iter[i].final;
3905 }
3906
3907
3908 /* Return a pointer to the final value for OMP_FOR GS.  */
3909
3910 static inline tree *
3911 gimple_omp_for_final_ptr (gimple gs, size_t i)
3912 {
3913   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3914   gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3915   return &gs->gimple_omp_for.iter[i].final;
3916 }
3917
3918
3919 /* Set FINAL to be the final value for OMP_FOR GS.  */
3920
3921 static inline void
3922 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3923 {
3924   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3925   gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3926   gs->gimple_omp_for.iter[i].final = final;
3927 }
3928
3929
3930 /* Return the increment value for OMP_FOR GS.  */
3931
3932 static inline tree
3933 gimple_omp_for_incr (const_gimple gs, size_t i)
3934 {
3935   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3936   gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3937   return gs->gimple_omp_for.iter[i].incr;
3938 }
3939
3940
3941 /* Return a pointer to the increment value for OMP_FOR GS.  */
3942
3943 static inline tree *
3944 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3945 {
3946   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3947   gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3948   return &gs->gimple_omp_for.iter[i].incr;
3949 }
3950
3951
3952 /* Set INCR to be the increment value for OMP_FOR GS.  */
3953
3954 static inline void
3955 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3956 {
3957   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3958   gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3959   gs->gimple_omp_for.iter[i].incr = incr;
3960 }
3961
3962
3963 /* Return the sequence of statements to execute before the OMP_FOR
3964    statement GS starts.  */
3965
3966 static inline gimple_seq
3967 gimple_omp_for_pre_body (gimple gs)
3968 {
3969   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3970   return gs->gimple_omp_for.pre_body;
3971 }
3972
3973
3974 /* Set PRE_BODY to be the sequence of statements to execute before the
3975    OMP_FOR statement GS starts.  */
3976
3977 static inline void
3978 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3979 {
3980   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3981   gs->gimple_omp_for.pre_body = pre_body;
3982 }
3983
3984
3985 /* Return the clauses associated with OMP_PARALLEL GS.  */
3986
3987 static inline tree
3988 gimple_omp_parallel_clauses (const_gimple gs)
3989 {
3990   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3991   return gs->gimple_omp_parallel.clauses;
3992 }
3993
3994
3995 /* Return a pointer to the clauses associated with OMP_PARALLEL GS.  */
3996
3997 static inline tree *
3998 gimple_omp_parallel_clauses_ptr (gimple gs)
3999 {
4000   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4001   return &gs->gimple_omp_parallel.clauses;
4002 }
4003
4004
4005 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4006    GS.  */
4007
4008 static inline void
4009 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4010 {
4011   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4012   gs->gimple_omp_parallel.clauses = clauses;
4013 }
4014
4015
4016 /* Return the child function used to hold the body of OMP_PARALLEL GS.  */
4017
4018 static inline tree
4019 gimple_omp_parallel_child_fn (const_gimple gs)
4020 {
4021   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4022   return gs->gimple_omp_parallel.child_fn;
4023 }
4024
4025 /* Return a pointer to the child function used to hold the body of
4026    OMP_PARALLEL GS.  */
4027
4028 static inline tree *
4029 gimple_omp_parallel_child_fn_ptr (gimple gs)
4030 {
4031   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4032   return &gs->gimple_omp_parallel.child_fn;
4033 }
4034
4035
4036 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS.  */
4037
4038 static inline void
4039 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4040 {
4041   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4042   gs->gimple_omp_parallel.child_fn = child_fn;
4043 }
4044
4045
4046 /* Return the artificial argument used to send variables and values
4047    from the parent to the children threads in OMP_PARALLEL GS.  */
4048
4049 static inline tree
4050 gimple_omp_parallel_data_arg (const_gimple gs)
4051 {
4052   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4053   return gs->gimple_omp_parallel.data_arg;
4054 }
4055
4056
4057 /* Return a pointer to the data argument for OMP_PARALLEL GS.  */
4058
4059 static inline tree *
4060 gimple_omp_parallel_data_arg_ptr (gimple gs)
4061 {
4062   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4063   return &gs->gimple_omp_parallel.data_arg;
4064 }
4065
4066
4067 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS.  */
4068
4069 static inline void
4070 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4071 {
4072   GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4073   gs->gimple_omp_parallel.data_arg = data_arg;
4074 }
4075
4076
4077 /* Return the clauses associated with OMP_TASK GS.  */
4078
4079 static inline tree
4080 gimple_omp_task_clauses (const_gimple gs)
4081 {
4082   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4083   return gs->gimple_omp_parallel.clauses;
4084 }
4085
4086
4087 /* Return a pointer to the clauses associated with OMP_TASK GS.  */
4088
4089 static inline tree *
4090 gimple_omp_task_clauses_ptr (gimple gs)
4091 {
4092   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4093   return &gs->gimple_omp_parallel.clauses;
4094 }
4095
4096
4097 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4098    GS.  */
4099
4100 static inline void
4101 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4102 {
4103   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4104   gs->gimple_omp_parallel.clauses = clauses;
4105 }
4106
4107
4108 /* Return the child function used to hold the body of OMP_TASK GS.  */
4109
4110 static inline tree
4111 gimple_omp_task_child_fn (const_gimple gs)
4112 {
4113   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4114   return gs->gimple_omp_parallel.child_fn;
4115 }
4116
4117 /* Return a pointer to the child function used to hold the body of
4118    OMP_TASK GS.  */
4119
4120 static inline tree *
4121 gimple_omp_task_child_fn_ptr (gimple gs)
4122 {
4123   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4124   return &gs->gimple_omp_parallel.child_fn;
4125 }
4126
4127
4128 /* Set CHILD_FN to be the child function for OMP_TASK GS.  */
4129
4130 static inline void
4131 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4132 {
4133   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4134   gs->gimple_omp_parallel.child_fn = child_fn;
4135 }
4136
4137
4138 /* Return the artificial argument used to send variables and values
4139    from the parent to the children threads in OMP_TASK GS.  */
4140
4141 static inline tree
4142 gimple_omp_task_data_arg (const_gimple gs)
4143 {
4144   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4145   return gs->gimple_omp_parallel.data_arg;
4146 }
4147
4148
4149 /* Return a pointer to the data argument for OMP_TASK GS.  */
4150
4151 static inline tree *
4152 gimple_omp_task_data_arg_ptr (gimple gs)
4153 {
4154   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4155   return &gs->gimple_omp_parallel.data_arg;
4156 }
4157
4158
4159 /* Set DATA_ARG to be the data argument for OMP_TASK GS.  */
4160
4161 static inline void
4162 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4163 {
4164   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4165   gs->gimple_omp_parallel.data_arg = data_arg;
4166 }
4167
4168
4169 /* Return the clauses associated with OMP_TASK GS.  */
4170
4171 static inline tree
4172 gimple_omp_taskreg_clauses (const_gimple gs)
4173 {
4174   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4175     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4176   return gs->gimple_omp_parallel.clauses;
4177 }
4178
4179
4180 /* Return a pointer to the clauses associated with OMP_TASK GS.  */
4181
4182 static inline tree *
4183 gimple_omp_taskreg_clauses_ptr (gimple gs)
4184 {
4185   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4186     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4187   return &gs->gimple_omp_parallel.clauses;
4188 }
4189
4190
4191 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4192    GS.  */
4193
4194 static inline void
4195 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4196 {
4197   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4198     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4199   gs->gimple_omp_parallel.clauses = clauses;
4200 }
4201
4202
4203 /* Return the child function used to hold the body of OMP_TASK GS.  */
4204
4205 static inline tree
4206 gimple_omp_taskreg_child_fn (const_gimple gs)
4207 {
4208   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4209     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4210   return gs->gimple_omp_parallel.child_fn;
4211 }
4212
4213 /* Return a pointer to the child function used to hold the body of
4214    OMP_TASK GS.  */
4215
4216 static inline tree *
4217 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4218 {
4219   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4220     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4221   return &gs->gimple_omp_parallel.child_fn;
4222 }
4223
4224
4225 /* Set CHILD_FN to be the child function for OMP_TASK GS.  */
4226
4227 static inline void
4228 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4229 {
4230   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4231     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4232   gs->gimple_omp_parallel.child_fn = child_fn;
4233 }
4234
4235
4236 /* Return the artificial argument used to send variables and values
4237    from the parent to the children threads in OMP_TASK GS.  */
4238
4239 static inline tree
4240 gimple_omp_taskreg_data_arg (const_gimple gs)
4241 {
4242   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4243     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4244   return gs->gimple_omp_parallel.data_arg;
4245 }
4246
4247
4248 /* Return a pointer to the data argument for OMP_TASK GS.  */
4249
4250 static inline tree *
4251 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4252 {
4253   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4254     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4255   return &gs->gimple_omp_parallel.data_arg;
4256 }
4257
4258
4259 /* Set DATA_ARG to be the data argument for OMP_TASK GS.  */
4260
4261 static inline void
4262 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4263 {
4264   if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4265     GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4266   gs->gimple_omp_parallel.data_arg = data_arg;
4267 }
4268
4269
4270 /* Return the copy function used to hold the body of OMP_TASK GS.  */
4271
4272 static inline tree
4273 gimple_omp_task_copy_fn (const_gimple gs)
4274 {
4275   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4276   return gs->gimple_omp_task.copy_fn;
4277 }
4278
4279 /* Return a pointer to the copy function used to hold the body of
4280    OMP_TASK GS.  */
4281
4282 static inline tree *
4283 gimple_omp_task_copy_fn_ptr (gimple gs)
4284 {
4285   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4286   return &gs->gimple_omp_task.copy_fn;
4287 }
4288
4289
4290 /* Set CHILD_FN to be the copy function for OMP_TASK GS.  */
4291
4292 static inline void
4293 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4294 {
4295   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4296   gs->gimple_omp_task.copy_fn = copy_fn;
4297 }
4298
4299
4300 /* Return size of the data block in bytes in OMP_TASK GS.  */
4301
4302 static inline tree
4303 gimple_omp_task_arg_size (const_gimple gs)
4304 {
4305   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4306   return gs->gimple_omp_task.arg_size;
4307 }
4308
4309
4310 /* Return a pointer to the data block size for OMP_TASK GS.  */
4311
4312 static inline tree *
4313 gimple_omp_task_arg_size_ptr (gimple gs)
4314 {
4315   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4316   return &gs->gimple_omp_task.arg_size;
4317 }
4318
4319
4320 /* Set ARG_SIZE to be the data block size for OMP_TASK GS.  */
4321
4322 static inline void
4323 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4324 {
4325   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4326   gs->gimple_omp_task.arg_size = arg_size;
4327 }
4328
4329
4330 /* Return align of the data block in bytes in OMP_TASK GS.  */
4331
4332 static inline tree
4333 gimple_omp_task_arg_align (const_gimple gs)
4334 {
4335   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4336   return gs->gimple_omp_task.arg_align;
4337 }
4338
4339
4340 /* Return a pointer to the data block align for OMP_TASK GS.  */
4341
4342 static inline tree *
4343 gimple_omp_task_arg_align_ptr (gimple gs)
4344 {
4345   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4346   return &gs->gimple_omp_task.arg_align;
4347 }
4348
4349
4350 /* Set ARG_SIZE to be the data block align for OMP_TASK GS.  */
4351
4352 static inline void
4353 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4354 {
4355   GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4356   gs->gimple_omp_task.arg_align = arg_align;
4357 }
4358
4359
4360 /* Return the clauses associated with OMP_SINGLE GS.  */
4361
4362 static inline tree
4363 gimple_omp_single_clauses (const_gimple gs)
4364 {
4365   GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4366   return gs->gimple_omp_single.clauses;
4367 }
4368
4369
4370 /* Return a pointer to the clauses associated with OMP_SINGLE GS.  */
4371
4372 static inline tree *
4373 gimple_omp_single_clauses_ptr (gimple gs)
4374 {
4375   GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4376   return &gs->gimple_omp_single.clauses;
4377 }
4378
4379
4380 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS.  */
4381
4382 static inline void
4383 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4384 {
4385   GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4386   gs->gimple_omp_single.clauses = clauses;
4387 }
4388
4389
4390 /* Return the clauses associated with OMP_SECTIONS GS.  */
4391
4392 static inline tree
4393 gimple_omp_sections_clauses (const_gimple gs)
4394 {
4395   GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4396   return gs->gimple_omp_sections.clauses;
4397 }
4398
4399
4400 /* Return a pointer to the clauses associated with OMP_SECTIONS GS.  */
4401
4402 static inline tree *
4403 gimple_omp_sections_clauses_ptr (gimple gs)
4404 {
4405   GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4406   return &gs->gimple_omp_sections.clauses;
4407 }
4408
4409
4410 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4411    GS.  */
4412
4413 static inline void
4414 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4415 {
4416   GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4417   gs->gimple_omp_sections.clauses = clauses;
4418 }
4419
4420
4421 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4422    in GS.  */
4423
4424 static inline tree
4425 gimple_omp_sections_control (const_gimple gs)
4426 {
4427   GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4428   return gs->gimple_omp_sections.control;
4429 }
4430
4431
4432 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4433    GS.  */
4434
4435 static inline tree *
4436 gimple_omp_sections_control_ptr (gimple gs)
4437 {
4438   GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4439   return &gs->gimple_omp_sections.control;
4440 }
4441
4442
4443 /* Set CONTROL to be the set of clauses associated with the
4444    GIMPLE_OMP_SECTIONS in GS.  */
4445
4446 static inline void
4447 gimple_omp_sections_set_control (gimple gs, tree control)
4448 {
4449   GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4450   gs->gimple_omp_sections.control = control;
4451 }
4452
4453
4454 /* Set COND to be the condition code for OMP_FOR GS.  */
4455
4456 static inline void
4457 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4458 {
4459   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4460   gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4461                               && i < gs->gimple_omp_for.collapse);
4462   gs->gimple_omp_for.iter[i].cond = cond;
4463 }
4464
4465
4466 /* Return the condition code associated with OMP_FOR GS.  */
4467
4468 static inline enum tree_code
4469 gimple_omp_for_cond (const_gimple gs, size_t i)
4470 {
4471   GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4472   gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4473   return gs->gimple_omp_for.iter[i].cond;
4474 }
4475
4476
4477 /* Set the value being stored in an atomic store.  */
4478
4479 static inline void
4480 gimple_omp_atomic_store_set_val (gimple g, tree val)
4481 {
4482   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4483   g->gimple_omp_atomic_store.val = val;
4484 }
4485
4486
4487 /* Return the value being stored in an atomic store.  */
4488
4489 static inline tree
4490 gimple_omp_atomic_store_val (const_gimple g)
4491 {
4492   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4493   return g->gimple_omp_atomic_store.val;
4494 }
4495
4496
4497 /* Return a pointer to the value being stored in an atomic store.  */
4498
4499 static inline tree *
4500 gimple_omp_atomic_store_val_ptr (gimple g)
4501 {
4502   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4503   return &g->gimple_omp_atomic_store.val;
4504 }
4505
4506
4507 /* Set the LHS of an atomic load.  */
4508
4509 static inline void
4510 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4511 {
4512   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4513   g->gimple_omp_atomic_load.lhs = lhs;
4514 }
4515
4516
4517 /* Get the LHS of an atomic load.  */
4518
4519 static inline tree
4520 gimple_omp_atomic_load_lhs (const_gimple g)
4521 {
4522   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4523   return g->gimple_omp_atomic_load.lhs;
4524 }
4525
4526
4527 /* Return a pointer to the LHS of an atomic load.  */
4528
4529 static inline tree *
4530 gimple_omp_atomic_load_lhs_ptr (gimple g)
4531 {
4532   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4533   return &g->gimple_omp_atomic_load.lhs;
4534 }
4535
4536
4537 /* Set the RHS of an atomic load.  */
4538
4539 static inline void
4540 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4541 {
4542   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4543   g->gimple_omp_atomic_load.rhs = rhs;
4544 }
4545
4546
4547 /* Get the RHS of an atomic load.  */
4548
4549 static inline tree
4550 gimple_omp_atomic_load_rhs (const_gimple g)
4551 {
4552   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4553   return g->gimple_omp_atomic_load.rhs;
4554 }
4555
4556
4557 /* Return a pointer to the RHS of an atomic load.  */
4558
4559 static inline tree *
4560 gimple_omp_atomic_load_rhs_ptr (gimple g)
4561 {
4562   GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4563   return &g->gimple_omp_atomic_load.rhs;
4564 }
4565
4566
4567 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE.  */
4568
4569 static inline tree
4570 gimple_omp_continue_control_def (const_gimple g)
4571 {
4572   GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4573   return g->gimple_omp_continue.control_def;
4574 }
4575
4576 /* The same as above, but return the address.  */
4577
4578 static inline tree *
4579 gimple_omp_continue_control_def_ptr (gimple g)
4580 {
4581   GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4582   return &g->gimple_omp_continue.control_def;
4583 }
4584
4585 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE.  */
4586
4587 static inline void
4588 gimple_omp_continue_set_control_def (gimple g, tree def)
4589 {
4590   GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4591   g->gimple_omp_continue.control_def = def;
4592 }
4593
4594
4595 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE.  */
4596
4597 static inline tree
4598 gimple_omp_continue_control_use (const_gimple g)
4599 {
4600   GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4601   return g->gimple_omp_continue.control_use;
4602 }
4603
4604
4605 /* The same as above, but return the address.  */
4606
4607 static inline tree *
4608 gimple_omp_continue_control_use_ptr (gimple g)
4609 {
4610   GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4611   return &g->gimple_omp_continue.control_use;
4612 }
4613
4614
4615 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE.  */
4616
4617 static inline void
4618 gimple_omp_continue_set_control_use (gimple g, tree use)
4619 {
4620   GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4621   g->gimple_omp_continue.control_use = use;
4622 }
4623
4624 /* Return the body for the GIMPLE_TRANSACTION statement GS.  */
4625
4626 static inline gimple_seq
4627 gimple_transaction_body (gimple gs)
4628 {
4629   GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4630   return gs->gimple_transaction.body;
4631 }
4632
4633 /* Return the label associated with a GIMPLE_TRANSACTION.  */
4634
4635 static inline tree
4636 gimple_transaction_label (const_gimple gs)
4637 {
4638   GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4639   return gs->gimple_transaction.label;
4640 }
4641
4642 static inline tree *
4643 gimple_transaction_label_ptr (gimple gs)
4644 {
4645   GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4646   return &gs->gimple_transaction.label;
4647 }
4648
4649 /* Return the subcode associated with a GIMPLE_TRANSACTION.  */
4650
4651 static inline unsigned int
4652 gimple_transaction_subcode (const_gimple gs)
4653 {
4654   GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4655   return gs->gsbase.subcode;
4656 }
4657
4658 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS.  */
4659
4660 static inline void
4661 gimple_transaction_set_body (gimple gs, gimple_seq body)
4662 {
4663   GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4664   gs->gimple_transaction.body = body;
4665 }
4666
4667 /* Set the label associated with a GIMPLE_TRANSACTION.  */
4668
4669 static inline void
4670 gimple_transaction_set_label (gimple gs, tree label)
4671 {
4672   GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4673   gs->gimple_transaction.label = label;
4674 }
4675
4676 /* Set the subcode associated with a GIMPLE_TRANSACTION.  */
4677
4678 static inline void
4679 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4680 {
4681   GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4682   gs->gsbase.subcode = subcode;
4683 }
4684
4685
4686 /* Return a pointer to the return value for GIMPLE_RETURN GS.  */
4687
4688 static inline tree *
4689 gimple_return_retval_ptr (const_gimple gs)
4690 {
4691   GIMPLE_CHECK (gs, GIMPLE_RETURN);
4692   return gimple_op_ptr (gs, 0);
4693 }
4694
4695 /* Return the return value for GIMPLE_RETURN GS.  */
4696
4697 static inline tree
4698 gimple_return_retval (const_gimple gs)
4699 {
4700   GIMPLE_CHECK (gs, GIMPLE_RETURN);
4701   return gimple_op (gs, 0);
4702 }
4703
4704
4705 /* Set RETVAL to be the return value for GIMPLE_RETURN GS.  */
4706
4707 static inline void
4708 gimple_return_set_retval (gimple gs, tree retval)
4709 {
4710   GIMPLE_CHECK (gs, GIMPLE_RETURN);
4711   gimple_set_op (gs, 0, retval);
4712 }
4713
4714
4715 /* Returns true when the gimple statment STMT is any of the OpenMP types.  */
4716
4717 #define CASE_GIMPLE_OMP                         \
4718     case GIMPLE_OMP_PARALLEL:                   \
4719     case GIMPLE_OMP_TASK:                       \
4720     case GIMPLE_OMP_FOR:                        \
4721     case GIMPLE_OMP_SECTIONS:                   \
4722     case GIMPLE_OMP_SECTIONS_SWITCH:            \
4723     case GIMPLE_OMP_SINGLE:                     \
4724     case GIMPLE_OMP_SECTION:                    \
4725     case GIMPLE_OMP_MASTER:                     \
4726     case GIMPLE_OMP_ORDERED:                    \
4727     case GIMPLE_OMP_CRITICAL:                   \
4728     case GIMPLE_OMP_RETURN:                     \
4729     case GIMPLE_OMP_ATOMIC_LOAD:                \
4730     case GIMPLE_OMP_ATOMIC_STORE:               \
4731     case GIMPLE_OMP_CONTINUE
4732
4733 static inline bool
4734 is_gimple_omp (const_gimple stmt)
4735 {
4736   switch (gimple_code (stmt))
4737     {
4738     CASE_GIMPLE_OMP:
4739       return true;
4740     default:
4741       return false;
4742     }
4743 }
4744
4745
4746 /* Returns TRUE if statement G is a GIMPLE_NOP.  */
4747
4748 static inline bool
4749 gimple_nop_p (const_gimple g)
4750 {
4751   return gimple_code (g) == GIMPLE_NOP;
4752 }
4753
4754
4755 /* Return true if GS is a GIMPLE_RESX.  */
4756
4757 static inline bool
4758 is_gimple_resx (const_gimple gs)
4759 {
4760   return gimple_code (gs) == GIMPLE_RESX;
4761 }
4762
4763 /* Return the predictor of GIMPLE_PREDICT statement GS.  */
4764
4765 static inline enum br_predictor
4766 gimple_predict_predictor (gimple gs)
4767 {
4768   GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4769   return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4770 }
4771
4772
4773 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT.  */
4774
4775 static inline void
4776 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4777 {
4778   GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4779   gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4780                        | (unsigned) predictor;
4781 }
4782
4783
4784 /* Return the outcome of GIMPLE_PREDICT statement GS.  */
4785
4786 static inline enum prediction
4787 gimple_predict_outcome (gimple gs)
4788 {
4789   GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4790   return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4791 }
4792
4793
4794 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME.  */
4795
4796 static inline void
4797 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4798 {
4799   GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4800   if (outcome == TAKEN)
4801     gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4802   else
4803     gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4804 }
4805
4806
4807 /* Return the type of the main expression computed by STMT.  Return
4808    void_type_node if the statement computes nothing.  */
4809
4810 static inline tree
4811 gimple_expr_type (const_gimple stmt)
4812 {
4813   enum gimple_code code = gimple_code (stmt);
4814
4815   if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4816     {
4817       tree type;
4818       /* In general we want to pass out a type that can be substituted
4819          for both the RHS and the LHS types if there is a possibly
4820          useless conversion involved.  That means returning the
4821          original RHS type as far as we can reconstruct it.  */
4822       if (code == GIMPLE_CALL)
4823         type = gimple_call_return_type (stmt);
4824       else
4825         switch (gimple_assign_rhs_code (stmt))
4826           {
4827           case POINTER_PLUS_EXPR:
4828             type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4829             break;
4830
4831           default:
4832             /* As fallback use the type of the LHS.  */
4833             type = TREE_TYPE (gimple_get_lhs (stmt));
4834             break;
4835           }
4836       return type;
4837     }
4838   else if (code == GIMPLE_COND)
4839     return boolean_type_node;
4840   else
4841     return void_type_node;
4842 }
4843
4844
4845 /* Return a new iterator pointing to GIMPLE_SEQ's first statement.  */
4846
4847 static inline gimple_stmt_iterator
4848 gsi_start (gimple_seq seq)
4849 {
4850   gimple_stmt_iterator i;
4851
4852   i.ptr = gimple_seq_first (seq);
4853   i.seq = seq;
4854   i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4855
4856   return i;
4857 }
4858
4859
4860 /* Return a new iterator pointing to the first statement in basic block BB.  */
4861
4862 static inline gimple_stmt_iterator
4863 gsi_start_bb (basic_block bb)
4864 {
4865   gimple_stmt_iterator i;
4866   gimple_seq seq;
4867
4868   seq = bb_seq (bb);
4869   i.ptr = gimple_seq_first (seq);
4870   i.seq = seq;
4871   i.bb = bb;
4872
4873   return i;
4874 }
4875
4876
4877 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement.  */
4878
4879 static inline gimple_stmt_iterator
4880 gsi_last (gimple_seq seq)
4881 {
4882   gimple_stmt_iterator i;
4883
4884   i.ptr = gimple_seq_last (seq);
4885   i.seq = seq;
4886   i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4887
4888   return i;
4889 }
4890
4891
4892 /* Return a new iterator pointing to the last statement in basic block BB.  */
4893
4894 static inline gimple_stmt_iterator
4895 gsi_last_bb (basic_block bb)
4896 {
4897   gimple_stmt_iterator i;
4898   gimple_seq seq;
4899
4900   seq = bb_seq (bb);
4901   i.ptr = gimple_seq_last (seq);
4902   i.seq = seq;
4903   i.bb = bb;
4904
4905   return i;
4906 }
4907
4908
4909 /* Return true if I is at the end of its sequence.  */
4910
4911 static inline bool
4912 gsi_end_p (gimple_stmt_iterator i)
4913 {
4914   return i.ptr == NULL;
4915 }
4916
4917
4918 /* Return true if I is one statement before the end of its sequence.  */
4919
4920 static inline bool
4921 gsi_one_before_end_p (gimple_stmt_iterator i)
4922 {
4923   return i.ptr != NULL && i.ptr->next == NULL;
4924 }
4925
4926
4927 /* Advance the iterator to the next gimple statement.  */
4928
4929 static inline void
4930 gsi_next (gimple_stmt_iterator *i)
4931 {
4932   i->ptr = i->ptr->next;
4933 }
4934
4935 /* Advance the iterator to the previous gimple statement.  */
4936
4937 static inline void
4938 gsi_prev (gimple_stmt_iterator *i)
4939 {
4940   i->ptr = i->ptr->prev;
4941 }
4942
4943 /* Return the current stmt.  */
4944
4945 static inline gimple
4946 gsi_stmt (gimple_stmt_iterator i)
4947 {
4948   return i.ptr->stmt;
4949 }
4950
4951 /* Return a block statement iterator that points to the first non-label
4952    statement in block BB.  */
4953
4954 static inline gimple_stmt_iterator
4955 gsi_after_labels (basic_block bb)
4956 {
4957   gimple_stmt_iterator gsi = gsi_start_bb (bb);
4958
4959   while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4960     gsi_next (&gsi);
4961
4962   return gsi;
4963 }
4964
4965 /* Advance the iterator to the next non-debug gimple statement.  */
4966
4967 static inline void
4968 gsi_next_nondebug (gimple_stmt_iterator *i)
4969 {
4970   do
4971     {
4972       gsi_next (i);
4973     }
4974   while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4975 }
4976
4977 /* Advance the iterator to the next non-debug gimple statement.  */
4978
4979 static inline void
4980 gsi_prev_nondebug (gimple_stmt_iterator *i)
4981 {
4982   do
4983     {
4984       gsi_prev (i);
4985     }
4986   while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4987 }
4988
4989 /* Return a new iterator pointing to the first non-debug statement in
4990    basic block BB.  */
4991
4992 static inline gimple_stmt_iterator
4993 gsi_start_nondebug_bb (basic_block bb)
4994 {
4995   gimple_stmt_iterator i = gsi_start_bb (bb);
4996
4997   if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4998     gsi_next_nondebug (&i);
4999
5000   return i;
5001 }
5002
5003 /* Return a new iterator pointing to the last non-debug statement in
5004    basic block BB.  */
5005
5006 static inline gimple_stmt_iterator
5007 gsi_last_nondebug_bb (basic_block bb)
5008 {
5009   gimple_stmt_iterator i = gsi_last_bb (bb);
5010
5011   if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5012     gsi_prev_nondebug (&i);
5013
5014   return i;
5015 }
5016
5017 /* Return a pointer to the current stmt.
5018
5019   NOTE: You may want to use gsi_replace on the iterator itself,
5020   as this performs additional bookkeeping that will not be done
5021   if you simply assign through a pointer returned by gsi_stmt_ptr.  */
5022
5023 static inline gimple *
5024 gsi_stmt_ptr (gimple_stmt_iterator *i)
5025 {
5026   return &i->ptr->stmt;
5027 }
5028
5029
5030 /* Return the basic block associated with this iterator.  */
5031
5032 static inline basic_block
5033 gsi_bb (gimple_stmt_iterator i)
5034 {
5035   return i.bb;
5036 }
5037
5038
5039 /* Return the sequence associated with this iterator.  */
5040
5041 static inline gimple_seq
5042 gsi_seq (gimple_stmt_iterator i)
5043 {
5044   return i.seq;
5045 }
5046
5047
5048 enum gsi_iterator_update
5049 {
5050   GSI_NEW_STMT,         /* Only valid when single statement is added, move
5051                            iterator to it.  */
5052   GSI_SAME_STMT,        /* Leave the iterator at the same statement.  */
5053   GSI_CONTINUE_LINKING  /* Move iterator to whatever position is suitable
5054                            for linking other statements in the same
5055                            direction.  */
5056 };
5057
5058 /* In gimple-iterator.c  */
5059 gimple_stmt_iterator gsi_start_phis (basic_block);
5060 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5061 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
5062 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5063 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5064                         enum gsi_iterator_update);
5065 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5066                                        enum gsi_iterator_update);
5067 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5068                             enum gsi_iterator_update);
5069 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5070                                            enum gsi_iterator_update);
5071 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5072                        enum gsi_iterator_update);
5073 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5074                                       enum gsi_iterator_update);
5075 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5076                            enum gsi_iterator_update);
5077 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5078                                           enum gsi_iterator_update);
5079 void gsi_remove (gimple_stmt_iterator *, bool);
5080 gimple_stmt_iterator gsi_for_stmt (gimple);
5081 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5082 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5083 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
5084 void gsi_insert_on_edge (edge, gimple);
5085 void gsi_insert_seq_on_edge (edge, gimple_seq);
5086 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5087 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5088 void gsi_commit_one_edge_insert (edge, basic_block *);
5089 void gsi_commit_edge_inserts (void);
5090 gimple gimple_call_copy_skip_args (gimple, bitmap);
5091
5092
5093 /* Convenience routines to walk all statements of a gimple function.
5094    Note that this is useful exclusively before the code is converted
5095    into SSA form.  Once the program is in SSA form, the standard
5096    operand interface should be used to analyze/modify statements.  */
5097 struct walk_stmt_info
5098 {
5099   /* Points to the current statement being walked.  */
5100   gimple_stmt_iterator gsi;
5101
5102   /* Additional data that the callback functions may want to carry
5103      through the recursion.  */
5104   void *info;
5105
5106   /* Pointer map used to mark visited tree nodes when calling
5107      walk_tree on each operand.  If set to NULL, duplicate tree nodes
5108      will be visited more than once.  */
5109   struct pointer_set_t *pset;
5110
5111   /* Operand returned by the callbacks.  This is set when calling
5112      walk_gimple_seq.  If the walk_stmt_fn or walk_tree_fn callback
5113      returns non-NULL, this field will contain the tree returned by
5114      the last callback.  */
5115   tree callback_result;
5116
5117   /* Indicates whether the operand being examined may be replaced
5118      with something that matches is_gimple_val (if true) or something
5119      slightly more complicated (if false).  "Something" technically
5120      means the common subset of is_gimple_lvalue and is_gimple_rhs,
5121      but we never try to form anything more complicated than that, so
5122      we don't bother checking.
5123
5124      Also note that CALLBACK should update this flag while walking the
5125      sub-expressions of a statement.  For instance, when walking the
5126      statement 'foo (&var)', the flag VAL_ONLY will initially be set
5127      to true, however, when walking &var, the operand of that
5128      ADDR_EXPR does not need to be a GIMPLE value.  */
5129   BOOL_BITFIELD val_only : 1;
5130
5131   /* True if we are currently walking the LHS of an assignment.  */
5132   BOOL_BITFIELD is_lhs : 1;
5133
5134   /* Optional.  Set to true by the callback functions if they made any
5135      changes.  */
5136   BOOL_BITFIELD changed : 1;
5137
5138   /* True if we're interested in location information.  */
5139   BOOL_BITFIELD want_locations : 1;
5140
5141   /* True if we've removed the statement that was processed.  */
5142   BOOL_BITFIELD removed_stmt : 1;
5143 };
5144
5145 /* Callback for walk_gimple_stmt.  Called for every statement found
5146    during traversal.  The first argument points to the statement to
5147    walk.  The second argument is a flag that the callback sets to
5148    'true' if it the callback handled all the operands and
5149    sub-statements of the statement (the default value of this flag is
5150    'false').  The third argument is an anonymous pointer to data
5151    to be used by the callback.  */
5152 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5153                               struct walk_stmt_info *);
5154
5155 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5156                         struct walk_stmt_info *);
5157 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5158                        struct walk_stmt_info *);
5159 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5160
5161 #ifdef GATHER_STATISTICS
5162 /* Enum and arrays used for allocation stats.  Keep in sync with
5163    gimple.c:gimple_alloc_kind_names.  */
5164 enum gimple_alloc_kind
5165 {
5166   gimple_alloc_kind_assign,     /* Assignments.  */
5167   gimple_alloc_kind_phi,        /* PHI nodes.  */
5168   gimple_alloc_kind_cond,       /* Conditionals.  */
5169   gimple_alloc_kind_seq,        /* Sequences.  */
5170   gimple_alloc_kind_rest,       /* Everything else.  */
5171   gimple_alloc_kind_all
5172 };
5173
5174 extern int gimple_alloc_counts[];
5175 extern int gimple_alloc_sizes[];
5176
5177 /* Return the allocation kind for a given stmt CODE.  */
5178 static inline enum gimple_alloc_kind
5179 gimple_alloc_kind (enum gimple_code code)
5180 {
5181   switch (code)
5182     {
5183       case GIMPLE_ASSIGN:
5184         return gimple_alloc_kind_assign;
5185       case GIMPLE_PHI:
5186         return gimple_alloc_kind_phi;
5187       case GIMPLE_COND:
5188         return gimple_alloc_kind_cond;
5189       default:
5190         return gimple_alloc_kind_rest;
5191     }
5192 }
5193 #endif /* GATHER_STATISTICS */
5194
5195 extern void dump_gimple_statistics (void);
5196
5197 /* In gimple-fold.c.  */
5198 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5199 tree gimple_fold_builtin (gimple);
5200 bool fold_stmt (gimple_stmt_iterator *);
5201 bool fold_stmt_inplace (gimple_stmt_iterator *);
5202 tree get_symbol_constant_value (tree);
5203 tree canonicalize_constructor_val (tree);
5204 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree, 
5205                                         enum tree_code, tree, tree);
5206 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5207                                        enum tree_code, tree, tree);
5208
5209 bool gimple_val_nonnegative_real_p (tree);
5210 #endif  /* GCC_GIMPLE_H */