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