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