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