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