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