OSDN Git Service

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