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