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