OSDN Git Service

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