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