OSDN Git Service

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