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