OSDN Git Service

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