]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/gimple.h
Update copyright years in gcc/
[thirdparty/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 is_gimple_builtin_call (gimple stmt);
1257 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
1258 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
1259 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1260 extern void dump_decl_set (FILE *, bitmap);
1261 extern bool nonfreeing_call_p (gimple);
1262 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1263 extern void sort_case_labels (vec<tree> );
1264 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
1265 extern void gimple_seq_set_location (gimple_seq , location_t);
1266
1267 /* Formal (expression) temporary table handling: multiple occurrences of
1268 the same scalar expression are evaluated into the same temporary. */
1269
1270 typedef struct gimple_temp_hash_elt
1271 {
1272 tree val; /* Key */
1273 tree temp; /* Value */
1274 } elt_t;
1275
1276 /* Get the number of the next statement uid to be allocated. */
1277 static inline unsigned int
1278 gimple_stmt_max_uid (struct function *fn)
1279 {
1280 return fn->last_stmt_uid;
1281 }
1282
1283 /* Set the number of the next statement uid to be allocated. */
1284 static inline void
1285 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1286 {
1287 fn->last_stmt_uid = maxid;
1288 }
1289
1290 /* Set the number of the next statement uid to be allocated. */
1291 static inline unsigned int
1292 inc_gimple_stmt_max_uid (struct function *fn)
1293 {
1294 return fn->last_stmt_uid++;
1295 }
1296
1297 /* Return the first node in GIMPLE sequence S. */
1298
1299 static inline gimple_seq_node
1300 gimple_seq_first (gimple_seq s)
1301 {
1302 return s;
1303 }
1304
1305
1306 /* Return the first statement in GIMPLE sequence S. */
1307
1308 static inline gimple
1309 gimple_seq_first_stmt (gimple_seq s)
1310 {
1311 gimple_seq_node n = gimple_seq_first (s);
1312 return n;
1313 }
1314
1315
1316 /* Return the last node in GIMPLE sequence S. */
1317
1318 static inline gimple_seq_node
1319 gimple_seq_last (gimple_seq s)
1320 {
1321 return s ? s->prev : NULL;
1322 }
1323
1324
1325 /* Return the last statement in GIMPLE sequence S. */
1326
1327 static inline gimple
1328 gimple_seq_last_stmt (gimple_seq s)
1329 {
1330 gimple_seq_node n = gimple_seq_last (s);
1331 return n;
1332 }
1333
1334
1335 /* Set the last node in GIMPLE sequence *PS to LAST. */
1336
1337 static inline void
1338 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1339 {
1340 (*ps)->prev = last;
1341 }
1342
1343
1344 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1345
1346 static inline void
1347 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1348 {
1349 *ps = first;
1350 }
1351
1352
1353 /* Return true if GIMPLE sequence S is empty. */
1354
1355 static inline bool
1356 gimple_seq_empty_p (gimple_seq s)
1357 {
1358 return s == NULL;
1359 }
1360
1361 /* Allocate a new sequence and initialize its first element with STMT. */
1362
1363 static inline gimple_seq
1364 gimple_seq_alloc_with_stmt (gimple stmt)
1365 {
1366 gimple_seq seq = NULL;
1367 gimple_seq_add_stmt (&seq, stmt);
1368 return seq;
1369 }
1370
1371
1372 /* Returns the sequence of statements in BB. */
1373
1374 static inline gimple_seq
1375 bb_seq (const_basic_block bb)
1376 {
1377 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1378 }
1379
1380 static inline gimple_seq *
1381 bb_seq_addr (basic_block bb)
1382 {
1383 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1384 }
1385
1386 /* Sets the sequence of statements in BB to SEQ. */
1387
1388 static inline void
1389 set_bb_seq (basic_block bb, gimple_seq seq)
1390 {
1391 gcc_checking_assert (!(bb->flags & BB_RTL));
1392 bb->il.gimple.seq = seq;
1393 }
1394
1395
1396 /* Return the code for GIMPLE statement G. */
1397
1398 static inline enum gimple_code
1399 gimple_code (const_gimple g)
1400 {
1401 return g->code;
1402 }
1403
1404
1405 /* Return the GSS code used by a GIMPLE code. */
1406
1407 static inline enum gimple_statement_structure_enum
1408 gss_for_code (enum gimple_code code)
1409 {
1410 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1411 return gss_for_code_[code];
1412 }
1413
1414
1415 /* Return which GSS code is used by GS. */
1416
1417 static inline enum gimple_statement_structure_enum
1418 gimple_statement_structure (gimple gs)
1419 {
1420 return gss_for_code (gimple_code (gs));
1421 }
1422
1423
1424 /* Return true if statement G has sub-statements. This is only true for
1425 High GIMPLE statements. */
1426
1427 static inline bool
1428 gimple_has_substatements (gimple g)
1429 {
1430 switch (gimple_code (g))
1431 {
1432 case GIMPLE_BIND:
1433 case GIMPLE_CATCH:
1434 case GIMPLE_EH_FILTER:
1435 case GIMPLE_EH_ELSE:
1436 case GIMPLE_TRY:
1437 case GIMPLE_OMP_FOR:
1438 case GIMPLE_OMP_MASTER:
1439 case GIMPLE_OMP_TASKGROUP:
1440 case GIMPLE_OMP_ORDERED:
1441 case GIMPLE_OMP_SECTION:
1442 case GIMPLE_OMP_PARALLEL:
1443 case GIMPLE_OMP_TASK:
1444 case GIMPLE_OMP_SECTIONS:
1445 case GIMPLE_OMP_SINGLE:
1446 case GIMPLE_OMP_TARGET:
1447 case GIMPLE_OMP_TEAMS:
1448 case GIMPLE_OMP_CRITICAL:
1449 case GIMPLE_WITH_CLEANUP_EXPR:
1450 case GIMPLE_TRANSACTION:
1451 return true;
1452
1453 default:
1454 return false;
1455 }
1456 }
1457
1458
1459 /* Return the basic block holding statement G. */
1460
1461 static inline basic_block
1462 gimple_bb (const_gimple g)
1463 {
1464 return g->bb;
1465 }
1466
1467
1468 /* Return the lexical scope block holding statement G. */
1469
1470 static inline tree
1471 gimple_block (const_gimple g)
1472 {
1473 return LOCATION_BLOCK (g->location);
1474 }
1475
1476
1477 /* Set BLOCK to be the lexical scope block holding statement G. */
1478
1479 static inline void
1480 gimple_set_block (gimple g, tree block)
1481 {
1482 if (block)
1483 g->location =
1484 COMBINE_LOCATION_DATA (line_table, g->location, block);
1485 else
1486 g->location = LOCATION_LOCUS (g->location);
1487 }
1488
1489
1490 /* Return location information for statement G. */
1491
1492 static inline location_t
1493 gimple_location (const_gimple g)
1494 {
1495 return g->location;
1496 }
1497
1498 /* Return pointer to location information for statement G. */
1499
1500 static inline const location_t *
1501 gimple_location_ptr (const_gimple g)
1502 {
1503 return &g->location;
1504 }
1505
1506
1507 /* Set location information for statement G. */
1508
1509 static inline void
1510 gimple_set_location (gimple g, location_t location)
1511 {
1512 g->location = location;
1513 }
1514
1515
1516 /* Return true if G contains location information. */
1517
1518 static inline bool
1519 gimple_has_location (const_gimple g)
1520 {
1521 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1522 }
1523
1524
1525 /* Return the file name of the location of STMT. */
1526
1527 static inline const char *
1528 gimple_filename (const_gimple stmt)
1529 {
1530 return LOCATION_FILE (gimple_location (stmt));
1531 }
1532
1533
1534 /* Return the line number of the location of STMT. */
1535
1536 static inline int
1537 gimple_lineno (const_gimple stmt)
1538 {
1539 return LOCATION_LINE (gimple_location (stmt));
1540 }
1541
1542
1543 /* Determine whether SEQ is a singleton. */
1544
1545 static inline bool
1546 gimple_seq_singleton_p (gimple_seq seq)
1547 {
1548 return ((gimple_seq_first (seq) != NULL)
1549 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1550 }
1551
1552 /* Return true if no warnings should be emitted for statement STMT. */
1553
1554 static inline bool
1555 gimple_no_warning_p (const_gimple stmt)
1556 {
1557 return stmt->no_warning;
1558 }
1559
1560 /* Set the no_warning flag of STMT to NO_WARNING. */
1561
1562 static inline void
1563 gimple_set_no_warning (gimple stmt, bool no_warning)
1564 {
1565 stmt->no_warning = (unsigned) no_warning;
1566 }
1567
1568 /* Set the visited status on statement STMT to VISITED_P. */
1569
1570 static inline void
1571 gimple_set_visited (gimple stmt, bool visited_p)
1572 {
1573 stmt->visited = (unsigned) visited_p;
1574 }
1575
1576
1577 /* Return the visited status for statement STMT. */
1578
1579 static inline bool
1580 gimple_visited_p (gimple stmt)
1581 {
1582 return stmt->visited;
1583 }
1584
1585
1586 /* Set pass local flag PLF on statement STMT to VAL_P. */
1587
1588 static inline void
1589 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1590 {
1591 if (val_p)
1592 stmt->plf |= (unsigned int) plf;
1593 else
1594 stmt->plf &= ~((unsigned int) plf);
1595 }
1596
1597
1598 /* Return the value of pass local flag PLF on statement STMT. */
1599
1600 static inline unsigned int
1601 gimple_plf (gimple stmt, enum plf_mask plf)
1602 {
1603 return stmt->plf & ((unsigned int) plf);
1604 }
1605
1606
1607 /* Set the UID of statement. */
1608
1609 static inline void
1610 gimple_set_uid (gimple g, unsigned uid)
1611 {
1612 g->uid = uid;
1613 }
1614
1615
1616 /* Return the UID of statement. */
1617
1618 static inline unsigned
1619 gimple_uid (const_gimple g)
1620 {
1621 return g->uid;
1622 }
1623
1624
1625 /* Make statement G a singleton sequence. */
1626
1627 static inline void
1628 gimple_init_singleton (gimple g)
1629 {
1630 g->next = NULL;
1631 g->prev = g;
1632 }
1633
1634
1635 /* Return true if GIMPLE statement G has register or memory operands. */
1636
1637 static inline bool
1638 gimple_has_ops (const_gimple g)
1639 {
1640 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1641 }
1642
1643 template <>
1644 template <>
1645 inline bool
1646 is_a_helper <const gimple_statement_with_ops>::test (const_gimple gs)
1647 {
1648 return gimple_has_ops (gs);
1649 }
1650
1651 template <>
1652 template <>
1653 inline bool
1654 is_a_helper <gimple_statement_with_ops>::test (gimple gs)
1655 {
1656 return gimple_has_ops (gs);
1657 }
1658
1659 /* Return true if GIMPLE statement G has memory operands. */
1660
1661 static inline bool
1662 gimple_has_mem_ops (const_gimple g)
1663 {
1664 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1665 }
1666
1667 template <>
1668 template <>
1669 inline bool
1670 is_a_helper <const gimple_statement_with_memory_ops>::test (const_gimple gs)
1671 {
1672 return gimple_has_mem_ops (gs);
1673 }
1674
1675 template <>
1676 template <>
1677 inline bool
1678 is_a_helper <gimple_statement_with_memory_ops>::test (gimple gs)
1679 {
1680 return gimple_has_mem_ops (gs);
1681 }
1682
1683 /* Return the set of USE operands for statement G. */
1684
1685 static inline struct use_optype_d *
1686 gimple_use_ops (const_gimple g)
1687 {
1688 const gimple_statement_with_ops *ops_stmt =
1689 dyn_cast <const gimple_statement_with_ops> (g);
1690 if (!ops_stmt)
1691 return NULL;
1692 return ops_stmt->use_ops;
1693 }
1694
1695
1696 /* Set USE to be the set of USE operands for statement G. */
1697
1698 static inline void
1699 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1700 {
1701 gimple_statement_with_ops *ops_stmt =
1702 as_a <gimple_statement_with_ops> (g);
1703 ops_stmt->use_ops = use;
1704 }
1705
1706
1707 /* Return the single VUSE operand of the statement G. */
1708
1709 static inline tree
1710 gimple_vuse (const_gimple g)
1711 {
1712 const gimple_statement_with_memory_ops *mem_ops_stmt =
1713 dyn_cast <const gimple_statement_with_memory_ops> (g);
1714 if (!mem_ops_stmt)
1715 return NULL_TREE;
1716 return mem_ops_stmt->vuse;
1717 }
1718
1719 /* Return the single VDEF operand of the statement G. */
1720
1721 static inline tree
1722 gimple_vdef (const_gimple g)
1723 {
1724 const gimple_statement_with_memory_ops *mem_ops_stmt =
1725 dyn_cast <const gimple_statement_with_memory_ops> (g);
1726 if (!mem_ops_stmt)
1727 return NULL_TREE;
1728 return mem_ops_stmt->vdef;
1729 }
1730
1731 /* Return the single VUSE operand of the statement G. */
1732
1733 static inline tree *
1734 gimple_vuse_ptr (gimple g)
1735 {
1736 gimple_statement_with_memory_ops *mem_ops_stmt =
1737 dyn_cast <gimple_statement_with_memory_ops> (g);
1738 if (!mem_ops_stmt)
1739 return NULL;
1740 return &mem_ops_stmt->vuse;
1741 }
1742
1743 /* Return the single VDEF operand of the statement G. */
1744
1745 static inline tree *
1746 gimple_vdef_ptr (gimple g)
1747 {
1748 gimple_statement_with_memory_ops *mem_ops_stmt =
1749 dyn_cast <gimple_statement_with_memory_ops> (g);
1750 if (!mem_ops_stmt)
1751 return NULL;
1752 return &mem_ops_stmt->vdef;
1753 }
1754
1755 /* Set the single VUSE operand of the statement G. */
1756
1757 static inline void
1758 gimple_set_vuse (gimple g, tree vuse)
1759 {
1760 gimple_statement_with_memory_ops *mem_ops_stmt =
1761 as_a <gimple_statement_with_memory_ops> (g);
1762 mem_ops_stmt->vuse = vuse;
1763 }
1764
1765 /* Set the single VDEF operand of the statement G. */
1766
1767 static inline void
1768 gimple_set_vdef (gimple g, tree vdef)
1769 {
1770 gimple_statement_with_memory_ops *mem_ops_stmt =
1771 as_a <gimple_statement_with_memory_ops> (g);
1772 mem_ops_stmt->vdef = vdef;
1773 }
1774
1775
1776 /* Return true if statement G has operands and the modified field has
1777 been set. */
1778
1779 static inline bool
1780 gimple_modified_p (const_gimple g)
1781 {
1782 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1783 }
1784
1785
1786 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1787 a MODIFIED field. */
1788
1789 static inline void
1790 gimple_set_modified (gimple s, bool modifiedp)
1791 {
1792 if (gimple_has_ops (s))
1793 s->modified = (unsigned) modifiedp;
1794 }
1795
1796
1797 /* Return the tree code for the expression computed by STMT. This is
1798 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1799 GIMPLE_CALL, return CALL_EXPR as the expression code for
1800 consistency. This is useful when the caller needs to deal with the
1801 three kinds of computation that GIMPLE supports. */
1802
1803 static inline enum tree_code
1804 gimple_expr_code (const_gimple stmt)
1805 {
1806 enum gimple_code code = gimple_code (stmt);
1807 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1808 return (enum tree_code) stmt->subcode;
1809 else
1810 {
1811 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1812 return CALL_EXPR;
1813 }
1814 }
1815
1816
1817 /* Return true if statement STMT contains volatile operands. */
1818
1819 static inline bool
1820 gimple_has_volatile_ops (const_gimple stmt)
1821 {
1822 if (gimple_has_mem_ops (stmt))
1823 return stmt->has_volatile_ops;
1824 else
1825 return false;
1826 }
1827
1828
1829 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1830
1831 static inline void
1832 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1833 {
1834 if (gimple_has_mem_ops (stmt))
1835 stmt->has_volatile_ops = (unsigned) volatilep;
1836 }
1837
1838 /* Return true if STMT is in a transaction. */
1839
1840 static inline bool
1841 gimple_in_transaction (gimple stmt)
1842 {
1843 return bb_in_transaction (gimple_bb (stmt));
1844 }
1845
1846 /* Return true if statement STMT may access memory. */
1847
1848 static inline bool
1849 gimple_references_memory_p (gimple stmt)
1850 {
1851 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1852 }
1853
1854
1855 /* Return the subcode for OMP statement S. */
1856
1857 static inline unsigned
1858 gimple_omp_subcode (const_gimple s)
1859 {
1860 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1861 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1862 return s->subcode;
1863 }
1864
1865 /* Set the subcode for OMP statement S to SUBCODE. */
1866
1867 static inline void
1868 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1869 {
1870 /* We only have 16 bits for the subcode. Assert that we are not
1871 overflowing it. */
1872 gcc_gimple_checking_assert (subcode < (1 << 16));
1873 s->subcode = subcode;
1874 }
1875
1876 /* Set the nowait flag on OMP_RETURN statement S. */
1877
1878 static inline void
1879 gimple_omp_return_set_nowait (gimple s)
1880 {
1881 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1882 s->subcode |= GF_OMP_RETURN_NOWAIT;
1883 }
1884
1885
1886 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1887 flag set. */
1888
1889 static inline bool
1890 gimple_omp_return_nowait_p (const_gimple g)
1891 {
1892 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1893 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1894 }
1895
1896
1897 /* Set the LHS of OMP return. */
1898
1899 static inline void
1900 gimple_omp_return_set_lhs (gimple g, tree lhs)
1901 {
1902 gimple_statement_omp_return *omp_return_stmt =
1903 as_a <gimple_statement_omp_return> (g);
1904 omp_return_stmt->val = lhs;
1905 }
1906
1907
1908 /* Get the LHS of OMP return. */
1909
1910 static inline tree
1911 gimple_omp_return_lhs (const_gimple g)
1912 {
1913 const gimple_statement_omp_return *omp_return_stmt =
1914 as_a <const gimple_statement_omp_return> (g);
1915 return omp_return_stmt->val;
1916 }
1917
1918
1919 /* Return a pointer to the LHS of OMP return. */
1920
1921 static inline tree *
1922 gimple_omp_return_lhs_ptr (gimple g)
1923 {
1924 gimple_statement_omp_return *omp_return_stmt =
1925 as_a <gimple_statement_omp_return> (g);
1926 return &omp_return_stmt->val;
1927 }
1928
1929
1930 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1931 flag set. */
1932
1933 static inline bool
1934 gimple_omp_section_last_p (const_gimple g)
1935 {
1936 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1937 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1938 }
1939
1940
1941 /* Set the GF_OMP_SECTION_LAST flag on G. */
1942
1943 static inline void
1944 gimple_omp_section_set_last (gimple g)
1945 {
1946 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1947 g->subcode |= GF_OMP_SECTION_LAST;
1948 }
1949
1950
1951 /* Return true if OMP parallel statement G has the
1952 GF_OMP_PARALLEL_COMBINED flag set. */
1953
1954 static inline bool
1955 gimple_omp_parallel_combined_p (const_gimple g)
1956 {
1957 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1958 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1959 }
1960
1961
1962 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1963 value of COMBINED_P. */
1964
1965 static inline void
1966 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1967 {
1968 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1969 if (combined_p)
1970 g->subcode |= GF_OMP_PARALLEL_COMBINED;
1971 else
1972 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
1973 }
1974
1975
1976 /* Return true if OMP atomic load/store statement G has the
1977 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1978
1979 static inline bool
1980 gimple_omp_atomic_need_value_p (const_gimple g)
1981 {
1982 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1983 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1984 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1985 }
1986
1987
1988 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1989
1990 static inline void
1991 gimple_omp_atomic_set_need_value (gimple g)
1992 {
1993 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1994 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1995 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1996 }
1997
1998
1999 /* Return true if OMP atomic load/store statement G has the
2000 GF_OMP_ATOMIC_SEQ_CST flag set. */
2001
2002 static inline bool
2003 gimple_omp_atomic_seq_cst_p (const_gimple g)
2004 {
2005 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2006 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2007 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2008 }
2009
2010
2011 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2012
2013 static inline void
2014 gimple_omp_atomic_set_seq_cst (gimple g)
2015 {
2016 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2017 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2018 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2019 }
2020
2021
2022 /* Return the number of operands for statement GS. */
2023
2024 static inline unsigned
2025 gimple_num_ops (const_gimple gs)
2026 {
2027 return gs->num_ops;
2028 }
2029
2030
2031 /* Set the number of operands for statement GS. */
2032
2033 static inline void
2034 gimple_set_num_ops (gimple gs, unsigned num_ops)
2035 {
2036 gs->num_ops = num_ops;
2037 }
2038
2039
2040 /* Return the array of operands for statement GS. */
2041
2042 static inline tree *
2043 gimple_ops (gimple gs)
2044 {
2045 size_t off;
2046
2047 /* All the tuples have their operand vector at the very bottom
2048 of the structure. Note that those structures that do not
2049 have an operand vector have a zero offset. */
2050 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2051 gcc_gimple_checking_assert (off != 0);
2052
2053 return (tree *) ((char *) gs + off);
2054 }
2055
2056
2057 /* Return operand I for statement GS. */
2058
2059 static inline tree
2060 gimple_op (const_gimple gs, unsigned i)
2061 {
2062 if (gimple_has_ops (gs))
2063 {
2064 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2065 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2066 }
2067 else
2068 return NULL_TREE;
2069 }
2070
2071 /* Return a pointer to operand I for statement GS. */
2072
2073 static inline tree *
2074 gimple_op_ptr (const_gimple gs, unsigned i)
2075 {
2076 if (gimple_has_ops (gs))
2077 {
2078 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2079 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2080 }
2081 else
2082 return NULL;
2083 }
2084
2085 /* Set operand I of statement GS to OP. */
2086
2087 static inline void
2088 gimple_set_op (gimple gs, unsigned i, tree op)
2089 {
2090 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2091
2092 /* Note. It may be tempting to assert that OP matches
2093 is_gimple_operand, but that would be wrong. Different tuples
2094 accept slightly different sets of tree operands. Each caller
2095 should perform its own validation. */
2096 gimple_ops (gs)[i] = op;
2097 }
2098
2099 /* Return true if GS is a GIMPLE_ASSIGN. */
2100
2101 static inline bool
2102 is_gimple_assign (const_gimple gs)
2103 {
2104 return gimple_code (gs) == GIMPLE_ASSIGN;
2105 }
2106
2107 /* Determine if expression CODE is one of the valid expressions that can
2108 be used on the RHS of GIMPLE assignments. */
2109
2110 static inline enum gimple_rhs_class
2111 get_gimple_rhs_class (enum tree_code code)
2112 {
2113 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2114 }
2115
2116 /* Return the LHS of assignment statement GS. */
2117
2118 static inline tree
2119 gimple_assign_lhs (const_gimple gs)
2120 {
2121 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2122 return gimple_op (gs, 0);
2123 }
2124
2125
2126 /* Return a pointer to the LHS of assignment statement GS. */
2127
2128 static inline tree *
2129 gimple_assign_lhs_ptr (const_gimple gs)
2130 {
2131 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2132 return gimple_op_ptr (gs, 0);
2133 }
2134
2135
2136 /* Set LHS to be the LHS operand of assignment statement GS. */
2137
2138 static inline void
2139 gimple_assign_set_lhs (gimple gs, tree lhs)
2140 {
2141 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2142 gimple_set_op (gs, 0, lhs);
2143
2144 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2145 SSA_NAME_DEF_STMT (lhs) = gs;
2146 }
2147
2148
2149 /* Return the first operand on the RHS of assignment statement GS. */
2150
2151 static inline tree
2152 gimple_assign_rhs1 (const_gimple gs)
2153 {
2154 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2155 return gimple_op (gs, 1);
2156 }
2157
2158
2159 /* Return a pointer to the first operand on the RHS of assignment
2160 statement GS. */
2161
2162 static inline tree *
2163 gimple_assign_rhs1_ptr (const_gimple gs)
2164 {
2165 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2166 return gimple_op_ptr (gs, 1);
2167 }
2168
2169 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2170
2171 static inline void
2172 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2173 {
2174 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2175
2176 gimple_set_op (gs, 1, rhs);
2177 }
2178
2179
2180 /* Return the second operand on the RHS of assignment statement GS.
2181 If GS does not have two operands, NULL is returned instead. */
2182
2183 static inline tree
2184 gimple_assign_rhs2 (const_gimple gs)
2185 {
2186 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2187
2188 if (gimple_num_ops (gs) >= 3)
2189 return gimple_op (gs, 2);
2190 else
2191 return NULL_TREE;
2192 }
2193
2194
2195 /* Return a pointer to the second operand on the RHS of assignment
2196 statement GS. */
2197
2198 static inline tree *
2199 gimple_assign_rhs2_ptr (const_gimple gs)
2200 {
2201 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2202 return gimple_op_ptr (gs, 2);
2203 }
2204
2205
2206 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2207
2208 static inline void
2209 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2210 {
2211 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2212
2213 gimple_set_op (gs, 2, rhs);
2214 }
2215
2216 /* Return the third operand on the RHS of assignment statement GS.
2217 If GS does not have two operands, NULL is returned instead. */
2218
2219 static inline tree
2220 gimple_assign_rhs3 (const_gimple gs)
2221 {
2222 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2223
2224 if (gimple_num_ops (gs) >= 4)
2225 return gimple_op (gs, 3);
2226 else
2227 return NULL_TREE;
2228 }
2229
2230 /* Return a pointer to the third operand on the RHS of assignment
2231 statement GS. */
2232
2233 static inline tree *
2234 gimple_assign_rhs3_ptr (const_gimple gs)
2235 {
2236 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2237 return gimple_op_ptr (gs, 3);
2238 }
2239
2240
2241 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2242
2243 static inline void
2244 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2245 {
2246 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2247
2248 gimple_set_op (gs, 3, rhs);
2249 }
2250
2251 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2252 to see only a maximum of two operands. */
2253
2254 static inline void
2255 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2256 tree op1, tree op2)
2257 {
2258 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2259 }
2260
2261 /* Returns true if GS is a nontemporal move. */
2262
2263 static inline bool
2264 gimple_assign_nontemporal_move_p (const_gimple gs)
2265 {
2266 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2267 return gs->nontemporal_move;
2268 }
2269
2270 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2271
2272 static inline void
2273 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2274 {
2275 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2276 gs->nontemporal_move = nontemporal;
2277 }
2278
2279
2280 /* Return the code of the expression computed on the rhs of assignment
2281 statement GS. In case that the RHS is a single object, returns the
2282 tree code of the object. */
2283
2284 static inline enum tree_code
2285 gimple_assign_rhs_code (const_gimple gs)
2286 {
2287 enum tree_code code;
2288 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2289
2290 code = (enum tree_code) gs->subcode;
2291 /* While we initially set subcode to the TREE_CODE of the rhs for
2292 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2293 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2294 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2295 code = TREE_CODE (gimple_assign_rhs1 (gs));
2296
2297 return code;
2298 }
2299
2300
2301 /* Set CODE to be the code for the expression computed on the RHS of
2302 assignment S. */
2303
2304 static inline void
2305 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2306 {
2307 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2308 s->subcode = code;
2309 }
2310
2311
2312 /* Return the gimple rhs class of the code of the expression computed on
2313 the rhs of assignment statement GS.
2314 This will never return GIMPLE_INVALID_RHS. */
2315
2316 static inline enum gimple_rhs_class
2317 gimple_assign_rhs_class (const_gimple gs)
2318 {
2319 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2320 }
2321
2322 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2323 there is no operator associated with the assignment itself.
2324 Unlike gimple_assign_copy_p, this predicate returns true for
2325 any RHS operand, including those that perform an operation
2326 and do not have the semantics of a copy, such as COND_EXPR. */
2327
2328 static inline bool
2329 gimple_assign_single_p (gimple gs)
2330 {
2331 return (is_gimple_assign (gs)
2332 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2333 }
2334
2335 /* Return true if GS performs a store to its lhs. */
2336
2337 static inline bool
2338 gimple_store_p (gimple gs)
2339 {
2340 tree lhs = gimple_get_lhs (gs);
2341 return lhs && !is_gimple_reg (lhs);
2342 }
2343
2344 /* Return true if GS is an assignment that loads from its rhs1. */
2345
2346 static inline bool
2347 gimple_assign_load_p (gimple gs)
2348 {
2349 tree rhs;
2350 if (!gimple_assign_single_p (gs))
2351 return false;
2352 rhs = gimple_assign_rhs1 (gs);
2353 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2354 return true;
2355 rhs = get_base_address (rhs);
2356 return (DECL_P (rhs)
2357 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2358 }
2359
2360
2361 /* Return true if S is a type-cast assignment. */
2362
2363 static inline bool
2364 gimple_assign_cast_p (gimple s)
2365 {
2366 if (is_gimple_assign (s))
2367 {
2368 enum tree_code sc = gimple_assign_rhs_code (s);
2369 return CONVERT_EXPR_CODE_P (sc)
2370 || sc == VIEW_CONVERT_EXPR
2371 || sc == FIX_TRUNC_EXPR;
2372 }
2373
2374 return false;
2375 }
2376
2377 /* Return true if S is a clobber statement. */
2378
2379 static inline bool
2380 gimple_clobber_p (gimple s)
2381 {
2382 return gimple_assign_single_p (s)
2383 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2384 }
2385
2386 /* Return true if GS is a GIMPLE_CALL. */
2387
2388 static inline bool
2389 is_gimple_call (const_gimple gs)
2390 {
2391 return gimple_code (gs) == GIMPLE_CALL;
2392 }
2393
2394 /* Return the LHS of call statement GS. */
2395
2396 static inline tree
2397 gimple_call_lhs (const_gimple gs)
2398 {
2399 GIMPLE_CHECK (gs, GIMPLE_CALL);
2400 return gimple_op (gs, 0);
2401 }
2402
2403
2404 /* Return a pointer to the LHS of call statement GS. */
2405
2406 static inline tree *
2407 gimple_call_lhs_ptr (const_gimple gs)
2408 {
2409 GIMPLE_CHECK (gs, GIMPLE_CALL);
2410 return gimple_op_ptr (gs, 0);
2411 }
2412
2413
2414 /* Set LHS to be the LHS operand of call statement GS. */
2415
2416 static inline void
2417 gimple_call_set_lhs (gimple gs, tree lhs)
2418 {
2419 GIMPLE_CHECK (gs, GIMPLE_CALL);
2420 gimple_set_op (gs, 0, lhs);
2421 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2422 SSA_NAME_DEF_STMT (lhs) = gs;
2423 }
2424
2425
2426 /* Return true if call GS calls an internal-only function, as enumerated
2427 by internal_fn. */
2428
2429 static inline bool
2430 gimple_call_internal_p (const_gimple gs)
2431 {
2432 GIMPLE_CHECK (gs, GIMPLE_CALL);
2433 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2434 }
2435
2436
2437 /* Return the target of internal call GS. */
2438
2439 static inline enum internal_fn
2440 gimple_call_internal_fn (const_gimple gs)
2441 {
2442 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2443 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2444 }
2445
2446
2447 /* Return the function type of the function called by GS. */
2448
2449 static inline tree
2450 gimple_call_fntype (const_gimple gs)
2451 {
2452 const gimple_statement_call *call_stmt =
2453 as_a <const gimple_statement_call> (gs);
2454 if (gimple_call_internal_p (gs))
2455 return NULL_TREE;
2456 return call_stmt->u.fntype;
2457 }
2458
2459 /* Set the type of the function called by GS to FNTYPE. */
2460
2461 static inline void
2462 gimple_call_set_fntype (gimple gs, tree fntype)
2463 {
2464 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
2465 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2466 call_stmt->u.fntype = fntype;
2467 }
2468
2469
2470 /* Return the tree node representing the function called by call
2471 statement GS. */
2472
2473 static inline tree
2474 gimple_call_fn (const_gimple gs)
2475 {
2476 GIMPLE_CHECK (gs, GIMPLE_CALL);
2477 return gimple_op (gs, 1);
2478 }
2479
2480 /* Return a pointer to the tree node representing the function called by call
2481 statement GS. */
2482
2483 static inline tree *
2484 gimple_call_fn_ptr (const_gimple gs)
2485 {
2486 GIMPLE_CHECK (gs, GIMPLE_CALL);
2487 return gimple_op_ptr (gs, 1);
2488 }
2489
2490
2491 /* Set FN to be the function called by call statement GS. */
2492
2493 static inline void
2494 gimple_call_set_fn (gimple gs, tree fn)
2495 {
2496 GIMPLE_CHECK (gs, GIMPLE_CALL);
2497 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2498 gimple_set_op (gs, 1, fn);
2499 }
2500
2501
2502 /* Set FNDECL to be the function called by call statement GS. */
2503
2504 static inline void
2505 gimple_call_set_fndecl (gimple gs, tree decl)
2506 {
2507 GIMPLE_CHECK (gs, GIMPLE_CALL);
2508 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2509 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2510 }
2511
2512
2513 /* Set internal function FN to be the function called by call statement GS. */
2514
2515 static inline void
2516 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2517 {
2518 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
2519 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2520 call_stmt->u.internal_fn = fn;
2521 }
2522
2523
2524 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2525 Otherwise return NULL. This function is analogous to
2526 get_callee_fndecl in tree land. */
2527
2528 static inline tree
2529 gimple_call_fndecl (const_gimple gs)
2530 {
2531 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2532 }
2533
2534
2535 /* Return the type returned by call statement GS. */
2536
2537 static inline tree
2538 gimple_call_return_type (const_gimple gs)
2539 {
2540 tree type = gimple_call_fntype (gs);
2541
2542 if (type == NULL_TREE)
2543 return TREE_TYPE (gimple_call_lhs (gs));
2544
2545 /* The type returned by a function is the type of its
2546 function type. */
2547 return TREE_TYPE (type);
2548 }
2549
2550
2551 /* Return the static chain for call statement GS. */
2552
2553 static inline tree
2554 gimple_call_chain (const_gimple gs)
2555 {
2556 GIMPLE_CHECK (gs, GIMPLE_CALL);
2557 return gimple_op (gs, 2);
2558 }
2559
2560
2561 /* Return a pointer to the static chain for call statement GS. */
2562
2563 static inline tree *
2564 gimple_call_chain_ptr (const_gimple gs)
2565 {
2566 GIMPLE_CHECK (gs, GIMPLE_CALL);
2567 return gimple_op_ptr (gs, 2);
2568 }
2569
2570 /* Set CHAIN to be the static chain for call statement GS. */
2571
2572 static inline void
2573 gimple_call_set_chain (gimple gs, tree chain)
2574 {
2575 GIMPLE_CHECK (gs, GIMPLE_CALL);
2576
2577 gimple_set_op (gs, 2, chain);
2578 }
2579
2580
2581 /* Return the number of arguments used by call statement GS. */
2582
2583 static inline unsigned
2584 gimple_call_num_args (const_gimple gs)
2585 {
2586 unsigned num_ops;
2587 GIMPLE_CHECK (gs, GIMPLE_CALL);
2588 num_ops = gimple_num_ops (gs);
2589 return num_ops - 3;
2590 }
2591
2592
2593 /* Return the argument at position INDEX for call statement GS. */
2594
2595 static inline tree
2596 gimple_call_arg (const_gimple gs, unsigned index)
2597 {
2598 GIMPLE_CHECK (gs, GIMPLE_CALL);
2599 return gimple_op (gs, index + 3);
2600 }
2601
2602
2603 /* Return a pointer to the argument at position INDEX for call
2604 statement GS. */
2605
2606 static inline tree *
2607 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2608 {
2609 GIMPLE_CHECK (gs, GIMPLE_CALL);
2610 return gimple_op_ptr (gs, index + 3);
2611 }
2612
2613
2614 /* Set ARG to be the argument at position INDEX for call statement GS. */
2615
2616 static inline void
2617 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2618 {
2619 GIMPLE_CHECK (gs, GIMPLE_CALL);
2620 gimple_set_op (gs, index + 3, arg);
2621 }
2622
2623
2624 /* If TAIL_P is true, mark call statement S as being a tail call
2625 (i.e., a call just before the exit of a function). These calls are
2626 candidate for tail call optimization. */
2627
2628 static inline void
2629 gimple_call_set_tail (gimple s, bool tail_p)
2630 {
2631 GIMPLE_CHECK (s, GIMPLE_CALL);
2632 if (tail_p)
2633 s->subcode |= GF_CALL_TAILCALL;
2634 else
2635 s->subcode &= ~GF_CALL_TAILCALL;
2636 }
2637
2638
2639 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2640
2641 static inline bool
2642 gimple_call_tail_p (gimple s)
2643 {
2644 GIMPLE_CHECK (s, GIMPLE_CALL);
2645 return (s->subcode & GF_CALL_TAILCALL) != 0;
2646 }
2647
2648
2649 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2650 slot optimization. This transformation uses the target of the call
2651 expansion as the return slot for calls that return in memory. */
2652
2653 static inline void
2654 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2655 {
2656 GIMPLE_CHECK (s, GIMPLE_CALL);
2657 if (return_slot_opt_p)
2658 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2659 else
2660 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2661 }
2662
2663
2664 /* Return true if S is marked for return slot optimization. */
2665
2666 static inline bool
2667 gimple_call_return_slot_opt_p (gimple s)
2668 {
2669 GIMPLE_CHECK (s, GIMPLE_CALL);
2670 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2671 }
2672
2673
2674 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2675 thunk to the thunked-to function. */
2676
2677 static inline void
2678 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2679 {
2680 GIMPLE_CHECK (s, GIMPLE_CALL);
2681 if (from_thunk_p)
2682 s->subcode |= GF_CALL_FROM_THUNK;
2683 else
2684 s->subcode &= ~GF_CALL_FROM_THUNK;
2685 }
2686
2687
2688 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2689
2690 static inline bool
2691 gimple_call_from_thunk_p (gimple s)
2692 {
2693 GIMPLE_CHECK (s, GIMPLE_CALL);
2694 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2695 }
2696
2697
2698 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2699 argument pack in its argument list. */
2700
2701 static inline void
2702 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2703 {
2704 GIMPLE_CHECK (s, GIMPLE_CALL);
2705 if (pass_arg_pack_p)
2706 s->subcode |= GF_CALL_VA_ARG_PACK;
2707 else
2708 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2709 }
2710
2711
2712 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2713 argument pack in its argument list. */
2714
2715 static inline bool
2716 gimple_call_va_arg_pack_p (gimple s)
2717 {
2718 GIMPLE_CHECK (s, GIMPLE_CALL);
2719 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2720 }
2721
2722
2723 /* Return true if S is a noreturn call. */
2724
2725 static inline bool
2726 gimple_call_noreturn_p (gimple s)
2727 {
2728 GIMPLE_CHECK (s, GIMPLE_CALL);
2729 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2730 }
2731
2732
2733 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2734 even if the called function can throw in other cases. */
2735
2736 static inline void
2737 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2738 {
2739 GIMPLE_CHECK (s, GIMPLE_CALL);
2740 if (nothrow_p)
2741 s->subcode |= GF_CALL_NOTHROW;
2742 else
2743 s->subcode &= ~GF_CALL_NOTHROW;
2744 }
2745
2746 /* Return true if S is a nothrow call. */
2747
2748 static inline bool
2749 gimple_call_nothrow_p (gimple s)
2750 {
2751 GIMPLE_CHECK (s, GIMPLE_CALL);
2752 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2753 }
2754
2755 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2756 is known to be emitted for VLA objects. Those are wrapped by
2757 stack_save/stack_restore calls and hence can't lead to unbounded
2758 stack growth even when they occur in loops. */
2759
2760 static inline void
2761 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2762 {
2763 GIMPLE_CHECK (s, GIMPLE_CALL);
2764 if (for_var)
2765 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2766 else
2767 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2768 }
2769
2770 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2771
2772 static inline bool
2773 gimple_call_alloca_for_var_p (gimple s)
2774 {
2775 GIMPLE_CHECK (s, GIMPLE_CALL);
2776 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2777 }
2778
2779 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2780
2781 static inline void
2782 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2783 {
2784 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2785 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2786 dest_call->subcode = orig_call->subcode;
2787 }
2788
2789
2790 /* Return a pointer to the points-to solution for the set of call-used
2791 variables of the call CALL. */
2792
2793 static inline struct pt_solution *
2794 gimple_call_use_set (gimple call)
2795 {
2796 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (call);
2797 return &call_stmt->call_used;
2798 }
2799
2800
2801 /* Return a pointer to the points-to solution for the set of call-used
2802 variables of the call CALL. */
2803
2804 static inline struct pt_solution *
2805 gimple_call_clobber_set (gimple call)
2806 {
2807 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (call);
2808 return &call_stmt->call_clobbered;
2809 }
2810
2811
2812 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2813 non-NULL lhs. */
2814
2815 static inline bool
2816 gimple_has_lhs (gimple stmt)
2817 {
2818 return (is_gimple_assign (stmt)
2819 || (is_gimple_call (stmt)
2820 && gimple_call_lhs (stmt) != NULL_TREE));
2821 }
2822
2823
2824 /* Return the code of the predicate computed by conditional statement GS. */
2825
2826 static inline enum tree_code
2827 gimple_cond_code (const_gimple gs)
2828 {
2829 GIMPLE_CHECK (gs, GIMPLE_COND);
2830 return (enum tree_code) gs->subcode;
2831 }
2832
2833
2834 /* Set CODE to be the predicate code for the conditional statement GS. */
2835
2836 static inline void
2837 gimple_cond_set_code (gimple gs, enum tree_code code)
2838 {
2839 GIMPLE_CHECK (gs, GIMPLE_COND);
2840 gs->subcode = code;
2841 }
2842
2843
2844 /* Return the LHS of the predicate computed by conditional statement GS. */
2845
2846 static inline tree
2847 gimple_cond_lhs (const_gimple gs)
2848 {
2849 GIMPLE_CHECK (gs, GIMPLE_COND);
2850 return gimple_op (gs, 0);
2851 }
2852
2853 /* Return the pointer to the LHS of the predicate computed by conditional
2854 statement GS. */
2855
2856 static inline tree *
2857 gimple_cond_lhs_ptr (const_gimple gs)
2858 {
2859 GIMPLE_CHECK (gs, GIMPLE_COND);
2860 return gimple_op_ptr (gs, 0);
2861 }
2862
2863 /* Set LHS to be the LHS operand of the predicate computed by
2864 conditional statement GS. */
2865
2866 static inline void
2867 gimple_cond_set_lhs (gimple gs, tree lhs)
2868 {
2869 GIMPLE_CHECK (gs, GIMPLE_COND);
2870 gimple_set_op (gs, 0, lhs);
2871 }
2872
2873
2874 /* Return the RHS operand of the predicate computed by conditional GS. */
2875
2876 static inline tree
2877 gimple_cond_rhs (const_gimple gs)
2878 {
2879 GIMPLE_CHECK (gs, GIMPLE_COND);
2880 return gimple_op (gs, 1);
2881 }
2882
2883 /* Return the pointer to the RHS operand of the predicate computed by
2884 conditional GS. */
2885
2886 static inline tree *
2887 gimple_cond_rhs_ptr (const_gimple gs)
2888 {
2889 GIMPLE_CHECK (gs, GIMPLE_COND);
2890 return gimple_op_ptr (gs, 1);
2891 }
2892
2893
2894 /* Set RHS to be the RHS operand of the predicate computed by
2895 conditional statement GS. */
2896
2897 static inline void
2898 gimple_cond_set_rhs (gimple gs, tree rhs)
2899 {
2900 GIMPLE_CHECK (gs, GIMPLE_COND);
2901 gimple_set_op (gs, 1, rhs);
2902 }
2903
2904
2905 /* Return the label used by conditional statement GS when its
2906 predicate evaluates to true. */
2907
2908 static inline tree
2909 gimple_cond_true_label (const_gimple gs)
2910 {
2911 GIMPLE_CHECK (gs, GIMPLE_COND);
2912 return gimple_op (gs, 2);
2913 }
2914
2915
2916 /* Set LABEL to be the label used by conditional statement GS when its
2917 predicate evaluates to true. */
2918
2919 static inline void
2920 gimple_cond_set_true_label (gimple gs, tree label)
2921 {
2922 GIMPLE_CHECK (gs, GIMPLE_COND);
2923 gimple_set_op (gs, 2, label);
2924 }
2925
2926
2927 /* Set LABEL to be the label used by conditional statement GS when its
2928 predicate evaluates to false. */
2929
2930 static inline void
2931 gimple_cond_set_false_label (gimple gs, tree label)
2932 {
2933 GIMPLE_CHECK (gs, GIMPLE_COND);
2934 gimple_set_op (gs, 3, label);
2935 }
2936
2937
2938 /* Return the label used by conditional statement GS when its
2939 predicate evaluates to false. */
2940
2941 static inline tree
2942 gimple_cond_false_label (const_gimple gs)
2943 {
2944 GIMPLE_CHECK (gs, GIMPLE_COND);
2945 return gimple_op (gs, 3);
2946 }
2947
2948
2949 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2950
2951 static inline void
2952 gimple_cond_make_false (gimple gs)
2953 {
2954 gimple_cond_set_lhs (gs, boolean_true_node);
2955 gimple_cond_set_rhs (gs, boolean_false_node);
2956 gs->subcode = EQ_EXPR;
2957 }
2958
2959
2960 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2961
2962 static inline void
2963 gimple_cond_make_true (gimple gs)
2964 {
2965 gimple_cond_set_lhs (gs, boolean_true_node);
2966 gimple_cond_set_rhs (gs, boolean_true_node);
2967 gs->subcode = EQ_EXPR;
2968 }
2969
2970 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2971 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2972
2973 static inline bool
2974 gimple_cond_true_p (const_gimple gs)
2975 {
2976 tree lhs = gimple_cond_lhs (gs);
2977 tree rhs = gimple_cond_rhs (gs);
2978 enum tree_code code = gimple_cond_code (gs);
2979
2980 if (lhs != boolean_true_node && lhs != boolean_false_node)
2981 return false;
2982
2983 if (rhs != boolean_true_node && rhs != boolean_false_node)
2984 return false;
2985
2986 if (code == NE_EXPR && lhs != rhs)
2987 return true;
2988
2989 if (code == EQ_EXPR && lhs == rhs)
2990 return true;
2991
2992 return false;
2993 }
2994
2995 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2996 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2997
2998 static inline bool
2999 gimple_cond_false_p (const_gimple gs)
3000 {
3001 tree lhs = gimple_cond_lhs (gs);
3002 tree rhs = gimple_cond_rhs (gs);
3003 enum tree_code code = gimple_cond_code (gs);
3004
3005 if (lhs != boolean_true_node && lhs != boolean_false_node)
3006 return false;
3007
3008 if (rhs != boolean_true_node && rhs != boolean_false_node)
3009 return false;
3010
3011 if (code == NE_EXPR && lhs == rhs)
3012 return true;
3013
3014 if (code == EQ_EXPR && lhs != rhs)
3015 return true;
3016
3017 return false;
3018 }
3019
3020 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3021
3022 static inline void
3023 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
3024 {
3025 gimple_cond_set_code (stmt, code);
3026 gimple_cond_set_lhs (stmt, lhs);
3027 gimple_cond_set_rhs (stmt, rhs);
3028 }
3029
3030 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3031
3032 static inline tree
3033 gimple_label_label (const_gimple gs)
3034 {
3035 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3036 return gimple_op (gs, 0);
3037 }
3038
3039
3040 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3041 GS. */
3042
3043 static inline void
3044 gimple_label_set_label (gimple gs, tree label)
3045 {
3046 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3047 gimple_set_op (gs, 0, label);
3048 }
3049
3050
3051 /* Return the destination of the unconditional jump GS. */
3052
3053 static inline tree
3054 gimple_goto_dest (const_gimple gs)
3055 {
3056 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3057 return gimple_op (gs, 0);
3058 }
3059
3060
3061 /* Set DEST to be the destination of the unconditonal jump GS. */
3062
3063 static inline void
3064 gimple_goto_set_dest (gimple gs, tree dest)
3065 {
3066 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3067 gimple_set_op (gs, 0, dest);
3068 }
3069
3070
3071 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3072
3073 static inline tree
3074 gimple_bind_vars (const_gimple gs)
3075 {
3076 const gimple_statement_bind *bind_stmt =
3077 as_a <const gimple_statement_bind> (gs);
3078 return bind_stmt->vars;
3079 }
3080
3081
3082 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3083 statement GS. */
3084
3085 static inline void
3086 gimple_bind_set_vars (gimple gs, tree vars)
3087 {
3088 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3089 bind_stmt->vars = vars;
3090 }
3091
3092
3093 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3094 statement GS. */
3095
3096 static inline void
3097 gimple_bind_append_vars (gimple gs, tree vars)
3098 {
3099 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3100 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3101 }
3102
3103
3104 static inline gimple_seq *
3105 gimple_bind_body_ptr (gimple gs)
3106 {
3107 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3108 return &bind_stmt->body;
3109 }
3110
3111 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3112
3113 static inline gimple_seq
3114 gimple_bind_body (gimple gs)
3115 {
3116 return *gimple_bind_body_ptr (gs);
3117 }
3118
3119
3120 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3121 statement GS. */
3122
3123 static inline void
3124 gimple_bind_set_body (gimple gs, gimple_seq seq)
3125 {
3126 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3127 bind_stmt->body = seq;
3128 }
3129
3130
3131 /* Append a statement to the end of a GIMPLE_BIND's body. */
3132
3133 static inline void
3134 gimple_bind_add_stmt (gimple gs, gimple stmt)
3135 {
3136 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3137 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3138 }
3139
3140
3141 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3142
3143 static inline void
3144 gimple_bind_add_seq (gimple gs, gimple_seq seq)
3145 {
3146 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3147 gimple_seq_add_seq (&bind_stmt->body, seq);
3148 }
3149
3150
3151 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3152 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3153
3154 static inline tree
3155 gimple_bind_block (const_gimple gs)
3156 {
3157 const gimple_statement_bind *bind_stmt =
3158 as_a <const gimple_statement_bind> (gs);
3159 return bind_stmt->block;
3160 }
3161
3162
3163 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3164 statement GS. */
3165
3166 static inline void
3167 gimple_bind_set_block (gimple gs, tree block)
3168 {
3169 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3170 gcc_gimple_checking_assert (block == NULL_TREE
3171 || TREE_CODE (block) == BLOCK);
3172 bind_stmt->block = block;
3173 }
3174
3175
3176 /* Return the number of input operands for GIMPLE_ASM GS. */
3177
3178 static inline unsigned
3179 gimple_asm_ninputs (const_gimple gs)
3180 {
3181 const gimple_statement_asm *asm_stmt =
3182 as_a <const gimple_statement_asm> (gs);
3183 return asm_stmt->ni;
3184 }
3185
3186
3187 /* Return the number of output operands for GIMPLE_ASM GS. */
3188
3189 static inline unsigned
3190 gimple_asm_noutputs (const_gimple gs)
3191 {
3192 const gimple_statement_asm *asm_stmt =
3193 as_a <const gimple_statement_asm> (gs);
3194 return asm_stmt->no;
3195 }
3196
3197
3198 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3199
3200 static inline unsigned
3201 gimple_asm_nclobbers (const_gimple gs)
3202 {
3203 const gimple_statement_asm *asm_stmt =
3204 as_a <const gimple_statement_asm> (gs);
3205 return asm_stmt->nc;
3206 }
3207
3208 /* Return the number of label operands for GIMPLE_ASM GS. */
3209
3210 static inline unsigned
3211 gimple_asm_nlabels (const_gimple gs)
3212 {
3213 const gimple_statement_asm *asm_stmt =
3214 as_a <const gimple_statement_asm> (gs);
3215 return asm_stmt->nl;
3216 }
3217
3218 /* Return input operand INDEX of GIMPLE_ASM GS. */
3219
3220 static inline tree
3221 gimple_asm_input_op (const_gimple gs, unsigned index)
3222 {
3223 const gimple_statement_asm *asm_stmt =
3224 as_a <const gimple_statement_asm> (gs);
3225 gcc_gimple_checking_assert (index < asm_stmt->ni);
3226 return gimple_op (gs, index + asm_stmt->no);
3227 }
3228
3229 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3230
3231 static inline tree *
3232 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3233 {
3234 const gimple_statement_asm *asm_stmt =
3235 as_a <const gimple_statement_asm> (gs);
3236 gcc_gimple_checking_assert (index < asm_stmt->ni);
3237 return gimple_op_ptr (gs, index + asm_stmt->no);
3238 }
3239
3240
3241 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3242
3243 static inline void
3244 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3245 {
3246 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3247 gcc_gimple_checking_assert (index < asm_stmt->ni
3248 && TREE_CODE (in_op) == TREE_LIST);
3249 gimple_set_op (gs, index + asm_stmt->no, in_op);
3250 }
3251
3252
3253 /* Return output operand INDEX of GIMPLE_ASM GS. */
3254
3255 static inline tree
3256 gimple_asm_output_op (const_gimple gs, unsigned index)
3257 {
3258 const gimple_statement_asm *asm_stmt =
3259 as_a <const gimple_statement_asm> (gs);
3260 gcc_gimple_checking_assert (index < asm_stmt->no);
3261 return gimple_op (gs, index);
3262 }
3263
3264 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3265
3266 static inline tree *
3267 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3268 {
3269 const gimple_statement_asm *asm_stmt =
3270 as_a <const gimple_statement_asm> (gs);
3271 gcc_gimple_checking_assert (index < asm_stmt->no);
3272 return gimple_op_ptr (gs, index);
3273 }
3274
3275
3276 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3277
3278 static inline void
3279 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3280 {
3281 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3282 gcc_gimple_checking_assert (index < asm_stmt->no
3283 && TREE_CODE (out_op) == TREE_LIST);
3284 gimple_set_op (gs, index, out_op);
3285 }
3286
3287
3288 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3289
3290 static inline tree
3291 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3292 {
3293 const gimple_statement_asm *asm_stmt =
3294 as_a <const gimple_statement_asm> (gs);
3295 gcc_gimple_checking_assert (index < asm_stmt->nc);
3296 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3297 }
3298
3299
3300 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3301
3302 static inline void
3303 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3304 {
3305 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3306 gcc_gimple_checking_assert (index < asm_stmt->nc
3307 && TREE_CODE (clobber_op) == TREE_LIST);
3308 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3309 }
3310
3311 /* Return label operand INDEX of GIMPLE_ASM GS. */
3312
3313 static inline tree
3314 gimple_asm_label_op (const_gimple gs, unsigned index)
3315 {
3316 const gimple_statement_asm *asm_stmt =
3317 as_a <const gimple_statement_asm> (gs);
3318 gcc_gimple_checking_assert (index < asm_stmt->nl);
3319 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3320 }
3321
3322 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3323
3324 static inline void
3325 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3326 {
3327 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3328 gcc_gimple_checking_assert (index < asm_stmt->nl
3329 && TREE_CODE (label_op) == TREE_LIST);
3330 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3331 }
3332
3333 /* Return the string representing the assembly instruction in
3334 GIMPLE_ASM GS. */
3335
3336 static inline const char *
3337 gimple_asm_string (const_gimple gs)
3338 {
3339 const gimple_statement_asm *asm_stmt =
3340 as_a <const gimple_statement_asm> (gs);
3341 return asm_stmt->string;
3342 }
3343
3344
3345 /* Return true if GS is an asm statement marked volatile. */
3346
3347 static inline bool
3348 gimple_asm_volatile_p (const_gimple gs)
3349 {
3350 GIMPLE_CHECK (gs, GIMPLE_ASM);
3351 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3352 }
3353
3354
3355 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3356
3357 static inline void
3358 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3359 {
3360 GIMPLE_CHECK (gs, GIMPLE_ASM);
3361 if (volatile_p)
3362 gs->subcode |= GF_ASM_VOLATILE;
3363 else
3364 gs->subcode &= ~GF_ASM_VOLATILE;
3365 }
3366
3367
3368 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3369
3370 static inline void
3371 gimple_asm_set_input (gimple gs, bool input_p)
3372 {
3373 GIMPLE_CHECK (gs, GIMPLE_ASM);
3374 if (input_p)
3375 gs->subcode |= GF_ASM_INPUT;
3376 else
3377 gs->subcode &= ~GF_ASM_INPUT;
3378 }
3379
3380
3381 /* Return true if asm GS is an ASM_INPUT. */
3382
3383 static inline bool
3384 gimple_asm_input_p (const_gimple gs)
3385 {
3386 GIMPLE_CHECK (gs, GIMPLE_ASM);
3387 return (gs->subcode & GF_ASM_INPUT) != 0;
3388 }
3389
3390
3391 /* Return the types handled by GIMPLE_CATCH statement GS. */
3392
3393 static inline tree
3394 gimple_catch_types (const_gimple gs)
3395 {
3396 const gimple_statement_catch *catch_stmt =
3397 as_a <const gimple_statement_catch> (gs);
3398 return catch_stmt->types;
3399 }
3400
3401
3402 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3403
3404 static inline tree *
3405 gimple_catch_types_ptr (gimple gs)
3406 {
3407 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3408 return &catch_stmt->types;
3409 }
3410
3411
3412 /* Return a pointer to the GIMPLE sequence representing the body of
3413 the handler of GIMPLE_CATCH statement GS. */
3414
3415 static inline gimple_seq *
3416 gimple_catch_handler_ptr (gimple gs)
3417 {
3418 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3419 return &catch_stmt->handler;
3420 }
3421
3422
3423 /* Return the GIMPLE sequence representing the body of the handler of
3424 GIMPLE_CATCH statement GS. */
3425
3426 static inline gimple_seq
3427 gimple_catch_handler (gimple gs)
3428 {
3429 return *gimple_catch_handler_ptr (gs);
3430 }
3431
3432
3433 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3434
3435 static inline void
3436 gimple_catch_set_types (gimple gs, tree t)
3437 {
3438 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3439 catch_stmt->types = t;
3440 }
3441
3442
3443 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3444
3445 static inline void
3446 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3447 {
3448 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3449 catch_stmt->handler = handler;
3450 }
3451
3452
3453 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3454
3455 static inline tree
3456 gimple_eh_filter_types (const_gimple gs)
3457 {
3458 const gimple_statement_eh_filter *eh_filter_stmt =
3459 as_a <const gimple_statement_eh_filter> (gs);
3460 return eh_filter_stmt->types;
3461 }
3462
3463
3464 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3465 GS. */
3466
3467 static inline tree *
3468 gimple_eh_filter_types_ptr (gimple gs)
3469 {
3470 gimple_statement_eh_filter *eh_filter_stmt =
3471 as_a <gimple_statement_eh_filter> (gs);
3472 return &eh_filter_stmt->types;
3473 }
3474
3475
3476 /* Return a pointer to the sequence of statement to execute when
3477 GIMPLE_EH_FILTER statement fails. */
3478
3479 static inline gimple_seq *
3480 gimple_eh_filter_failure_ptr (gimple gs)
3481 {
3482 gimple_statement_eh_filter *eh_filter_stmt =
3483 as_a <gimple_statement_eh_filter> (gs);
3484 return &eh_filter_stmt->failure;
3485 }
3486
3487
3488 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3489 statement fails. */
3490
3491 static inline gimple_seq
3492 gimple_eh_filter_failure (gimple gs)
3493 {
3494 return *gimple_eh_filter_failure_ptr (gs);
3495 }
3496
3497
3498 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3499
3500 static inline void
3501 gimple_eh_filter_set_types (gimple gs, tree types)
3502 {
3503 gimple_statement_eh_filter *eh_filter_stmt =
3504 as_a <gimple_statement_eh_filter> (gs);
3505 eh_filter_stmt->types = types;
3506 }
3507
3508
3509 /* Set FAILURE to be the sequence of statements to execute on failure
3510 for GIMPLE_EH_FILTER GS. */
3511
3512 static inline void
3513 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3514 {
3515 gimple_statement_eh_filter *eh_filter_stmt =
3516 as_a <gimple_statement_eh_filter> (gs);
3517 eh_filter_stmt->failure = failure;
3518 }
3519
3520 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3521
3522 static inline tree
3523 gimple_eh_must_not_throw_fndecl (gimple gs)
3524 {
3525 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt> (gs);
3526 return eh_mnt_stmt->fndecl;
3527 }
3528
3529 /* Set the function decl to be called by GS to DECL. */
3530
3531 static inline void
3532 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3533 {
3534 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt> (gs);
3535 eh_mnt_stmt->fndecl = decl;
3536 }
3537
3538 /* GIMPLE_EH_ELSE accessors. */
3539
3540 static inline gimple_seq *
3541 gimple_eh_else_n_body_ptr (gimple gs)
3542 {
3543 gimple_statement_eh_else *eh_else_stmt =
3544 as_a <gimple_statement_eh_else> (gs);
3545 return &eh_else_stmt->n_body;
3546 }
3547
3548 static inline gimple_seq
3549 gimple_eh_else_n_body (gimple gs)
3550 {
3551 return *gimple_eh_else_n_body_ptr (gs);
3552 }
3553
3554 static inline gimple_seq *
3555 gimple_eh_else_e_body_ptr (gimple gs)
3556 {
3557 gimple_statement_eh_else *eh_else_stmt =
3558 as_a <gimple_statement_eh_else> (gs);
3559 return &eh_else_stmt->e_body;
3560 }
3561
3562 static inline gimple_seq
3563 gimple_eh_else_e_body (gimple gs)
3564 {
3565 return *gimple_eh_else_e_body_ptr (gs);
3566 }
3567
3568 static inline void
3569 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3570 {
3571 gimple_statement_eh_else *eh_else_stmt =
3572 as_a <gimple_statement_eh_else> (gs);
3573 eh_else_stmt->n_body = seq;
3574 }
3575
3576 static inline void
3577 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3578 {
3579 gimple_statement_eh_else *eh_else_stmt =
3580 as_a <gimple_statement_eh_else> (gs);
3581 eh_else_stmt->e_body = seq;
3582 }
3583
3584 /* GIMPLE_TRY accessors. */
3585
3586 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3587 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3588
3589 static inline enum gimple_try_flags
3590 gimple_try_kind (const_gimple gs)
3591 {
3592 GIMPLE_CHECK (gs, GIMPLE_TRY);
3593 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3594 }
3595
3596
3597 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3598
3599 static inline void
3600 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3601 {
3602 GIMPLE_CHECK (gs, GIMPLE_TRY);
3603 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3604 || kind == GIMPLE_TRY_FINALLY);
3605 if (gimple_try_kind (gs) != kind)
3606 gs->subcode = (unsigned int) kind;
3607 }
3608
3609
3610 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3611
3612 static inline bool
3613 gimple_try_catch_is_cleanup (const_gimple gs)
3614 {
3615 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3616 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3617 }
3618
3619
3620 /* Return a pointer to the sequence of statements used as the
3621 body for GIMPLE_TRY GS. */
3622
3623 static inline gimple_seq *
3624 gimple_try_eval_ptr (gimple gs)
3625 {
3626 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3627 return &try_stmt->eval;
3628 }
3629
3630
3631 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3632
3633 static inline gimple_seq
3634 gimple_try_eval (gimple gs)
3635 {
3636 return *gimple_try_eval_ptr (gs);
3637 }
3638
3639
3640 /* Return a pointer to the sequence of statements used as the cleanup body for
3641 GIMPLE_TRY GS. */
3642
3643 static inline gimple_seq *
3644 gimple_try_cleanup_ptr (gimple gs)
3645 {
3646 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3647 return &try_stmt->cleanup;
3648 }
3649
3650
3651 /* Return the sequence of statements used as the cleanup body for
3652 GIMPLE_TRY GS. */
3653
3654 static inline gimple_seq
3655 gimple_try_cleanup (gimple gs)
3656 {
3657 return *gimple_try_cleanup_ptr (gs);
3658 }
3659
3660
3661 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3662
3663 static inline void
3664 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3665 {
3666 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3667 if (catch_is_cleanup)
3668 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3669 else
3670 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3671 }
3672
3673
3674 /* Set EVAL to be the sequence of statements to use as the body for
3675 GIMPLE_TRY GS. */
3676
3677 static inline void
3678 gimple_try_set_eval (gimple gs, gimple_seq eval)
3679 {
3680 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3681 try_stmt->eval = eval;
3682 }
3683
3684
3685 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3686 body for GIMPLE_TRY GS. */
3687
3688 static inline void
3689 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3690 {
3691 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3692 try_stmt->cleanup = cleanup;
3693 }
3694
3695
3696 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3697
3698 static inline gimple_seq *
3699 gimple_wce_cleanup_ptr (gimple gs)
3700 {
3701 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce> (gs);
3702 return &wce_stmt->cleanup;
3703 }
3704
3705
3706 /* Return the cleanup sequence for cleanup statement GS. */
3707
3708 static inline gimple_seq
3709 gimple_wce_cleanup (gimple gs)
3710 {
3711 return *gimple_wce_cleanup_ptr (gs);
3712 }
3713
3714
3715 /* Set CLEANUP to be the cleanup sequence for GS. */
3716
3717 static inline void
3718 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3719 {
3720 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce> (gs);
3721 wce_stmt->cleanup = cleanup;
3722 }
3723
3724
3725 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3726
3727 static inline bool
3728 gimple_wce_cleanup_eh_only (const_gimple gs)
3729 {
3730 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3731 return gs->subcode != 0;
3732 }
3733
3734
3735 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3736
3737 static inline void
3738 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3739 {
3740 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3741 gs->subcode = (unsigned int) eh_only_p;
3742 }
3743
3744
3745 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3746
3747 static inline unsigned
3748 gimple_phi_capacity (const_gimple gs)
3749 {
3750 const gimple_statement_phi *phi_stmt =
3751 as_a <const gimple_statement_phi> (gs);
3752 return phi_stmt->capacity;
3753 }
3754
3755
3756 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3757 be exactly the number of incoming edges for the basic block holding
3758 GS. */
3759
3760 static inline unsigned
3761 gimple_phi_num_args (const_gimple gs)
3762 {
3763 const gimple_statement_phi *phi_stmt =
3764 as_a <const gimple_statement_phi> (gs);
3765 return phi_stmt->nargs;
3766 }
3767
3768
3769 /* Return the SSA name created by GIMPLE_PHI GS. */
3770
3771 static inline tree
3772 gimple_phi_result (const_gimple gs)
3773 {
3774 const gimple_statement_phi *phi_stmt =
3775 as_a <const gimple_statement_phi> (gs);
3776 return phi_stmt->result;
3777 }
3778
3779 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3780
3781 static inline tree *
3782 gimple_phi_result_ptr (gimple gs)
3783 {
3784 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3785 return &phi_stmt->result;
3786 }
3787
3788 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3789
3790 static inline void
3791 gimple_phi_set_result (gimple gs, tree result)
3792 {
3793 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3794 phi_stmt->result = result;
3795 if (result && TREE_CODE (result) == SSA_NAME)
3796 SSA_NAME_DEF_STMT (result) = gs;
3797 }
3798
3799
3800 /* Return the PHI argument corresponding to incoming edge INDEX for
3801 GIMPLE_PHI GS. */
3802
3803 static inline struct phi_arg_d *
3804 gimple_phi_arg (gimple gs, unsigned index)
3805 {
3806 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3807 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3808 return &(phi_stmt->args[index]);
3809 }
3810
3811 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3812 for GIMPLE_PHI GS. */
3813
3814 static inline void
3815 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3816 {
3817 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3818 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3819 phi_stmt->args[index] = *phiarg;
3820 }
3821
3822 /* Return the PHI nodes for basic block BB, or NULL if there are no
3823 PHI nodes. */
3824
3825 static inline gimple_seq
3826 phi_nodes (const_basic_block bb)
3827 {
3828 gcc_checking_assert (!(bb->flags & BB_RTL));
3829 return bb->il.gimple.phi_nodes;
3830 }
3831
3832 /* Return a pointer to the PHI nodes for basic block BB. */
3833
3834 static inline gimple_seq *
3835 phi_nodes_ptr (basic_block bb)
3836 {
3837 gcc_checking_assert (!(bb->flags & BB_RTL));
3838 return &bb->il.gimple.phi_nodes;
3839 }
3840
3841 /* Return the tree operand for argument I of PHI node GS. */
3842
3843 static inline tree
3844 gimple_phi_arg_def (gimple gs, size_t index)
3845 {
3846 return gimple_phi_arg (gs, index)->def;
3847 }
3848
3849
3850 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3851
3852 static inline tree *
3853 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3854 {
3855 return &gimple_phi_arg (gs, index)->def;
3856 }
3857
3858 /* Return the edge associated with argument I of phi node GS. */
3859
3860 static inline edge
3861 gimple_phi_arg_edge (gimple gs, size_t i)
3862 {
3863 return EDGE_PRED (gimple_bb (gs), i);
3864 }
3865
3866 /* Return the source location of gimple argument I of phi node GS. */
3867
3868 static inline source_location
3869 gimple_phi_arg_location (gimple gs, size_t i)
3870 {
3871 return gimple_phi_arg (gs, i)->locus;
3872 }
3873
3874 /* Return the source location of the argument on edge E of phi node GS. */
3875
3876 static inline source_location
3877 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3878 {
3879 return gimple_phi_arg (gs, e->dest_idx)->locus;
3880 }
3881
3882 /* Set the source location of gimple argument I of phi node GS to LOC. */
3883
3884 static inline void
3885 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3886 {
3887 gimple_phi_arg (gs, i)->locus = loc;
3888 }
3889
3890 /* Return TRUE if argument I of phi node GS has a location record. */
3891
3892 static inline bool
3893 gimple_phi_arg_has_location (gimple gs, size_t i)
3894 {
3895 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3896 }
3897
3898
3899 /* Return the region number for GIMPLE_RESX GS. */
3900
3901 static inline int
3902 gimple_resx_region (const_gimple gs)
3903 {
3904 const gimple_statement_resx *resx_stmt =
3905 as_a <const gimple_statement_resx> (gs);
3906 return resx_stmt->region;
3907 }
3908
3909 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3910
3911 static inline void
3912 gimple_resx_set_region (gimple gs, int region)
3913 {
3914 gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx> (gs);
3915 resx_stmt->region = region;
3916 }
3917
3918 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3919
3920 static inline int
3921 gimple_eh_dispatch_region (const_gimple gs)
3922 {
3923 const gimple_statement_eh_dispatch *eh_dispatch_stmt =
3924 as_a <const gimple_statement_eh_dispatch> (gs);
3925 return eh_dispatch_stmt->region;
3926 }
3927
3928 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3929
3930 static inline void
3931 gimple_eh_dispatch_set_region (gimple gs, int region)
3932 {
3933 gimple_statement_eh_dispatch *eh_dispatch_stmt =
3934 as_a <gimple_statement_eh_dispatch> (gs);
3935 eh_dispatch_stmt->region = region;
3936 }
3937
3938 /* Return the number of labels associated with the switch statement GS. */
3939
3940 static inline unsigned
3941 gimple_switch_num_labels (const_gimple gs)
3942 {
3943 unsigned num_ops;
3944 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3945 num_ops = gimple_num_ops (gs);
3946 gcc_gimple_checking_assert (num_ops > 1);
3947 return num_ops - 1;
3948 }
3949
3950
3951 /* Set NLABELS to be the number of labels for the switch statement GS. */
3952
3953 static inline void
3954 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3955 {
3956 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3957 gimple_set_num_ops (g, nlabels + 1);
3958 }
3959
3960
3961 /* Return the index variable used by the switch statement GS. */
3962
3963 static inline tree
3964 gimple_switch_index (const_gimple gs)
3965 {
3966 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3967 return gimple_op (gs, 0);
3968 }
3969
3970
3971 /* Return a pointer to the index variable for the switch statement GS. */
3972
3973 static inline tree *
3974 gimple_switch_index_ptr (const_gimple gs)
3975 {
3976 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3977 return gimple_op_ptr (gs, 0);
3978 }
3979
3980
3981 /* Set INDEX to be the index variable for switch statement GS. */
3982
3983 static inline void
3984 gimple_switch_set_index (gimple gs, tree index)
3985 {
3986 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3987 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3988 gimple_set_op (gs, 0, index);
3989 }
3990
3991
3992 /* Return the label numbered INDEX. The default label is 0, followed by any
3993 labels in a switch statement. */
3994
3995 static inline tree
3996 gimple_switch_label (const_gimple gs, unsigned index)
3997 {
3998 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3999 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4000 return gimple_op (gs, index + 1);
4001 }
4002
4003 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4004
4005 static inline void
4006 gimple_switch_set_label (gimple gs, unsigned index, tree label)
4007 {
4008 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4009 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4010 && (label == NULL_TREE
4011 || TREE_CODE (label) == CASE_LABEL_EXPR));
4012 gimple_set_op (gs, index + 1, label);
4013 }
4014
4015 /* Return the default label for a switch statement. */
4016
4017 static inline tree
4018 gimple_switch_default_label (const_gimple gs)
4019 {
4020 tree label = gimple_switch_label (gs, 0);
4021 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4022 return label;
4023 }
4024
4025 /* Set the default label for a switch statement. */
4026
4027 static inline void
4028 gimple_switch_set_default_label (gimple gs, tree label)
4029 {
4030 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4031 gimple_switch_set_label (gs, 0, label);
4032 }
4033
4034 /* Return true if GS is a GIMPLE_DEBUG statement. */
4035
4036 static inline bool
4037 is_gimple_debug (const_gimple gs)
4038 {
4039 return gimple_code (gs) == GIMPLE_DEBUG;
4040 }
4041
4042 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4043
4044 static inline bool
4045 gimple_debug_bind_p (const_gimple s)
4046 {
4047 if (is_gimple_debug (s))
4048 return s->subcode == GIMPLE_DEBUG_BIND;
4049
4050 return false;
4051 }
4052
4053 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4054
4055 static inline tree
4056 gimple_debug_bind_get_var (gimple dbg)
4057 {
4058 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4059 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4060 return gimple_op (dbg, 0);
4061 }
4062
4063 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4064 statement. */
4065
4066 static inline tree
4067 gimple_debug_bind_get_value (gimple dbg)
4068 {
4069 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4070 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4071 return gimple_op (dbg, 1);
4072 }
4073
4074 /* Return a pointer to the value bound to the variable in a
4075 GIMPLE_DEBUG bind statement. */
4076
4077 static inline tree *
4078 gimple_debug_bind_get_value_ptr (gimple dbg)
4079 {
4080 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4081 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4082 return gimple_op_ptr (dbg, 1);
4083 }
4084
4085 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4086
4087 static inline void
4088 gimple_debug_bind_set_var (gimple dbg, tree var)
4089 {
4090 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4091 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4092 gimple_set_op (dbg, 0, var);
4093 }
4094
4095 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4096 statement. */
4097
4098 static inline void
4099 gimple_debug_bind_set_value (gimple dbg, tree value)
4100 {
4101 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4102 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4103 gimple_set_op (dbg, 1, value);
4104 }
4105
4106 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4107 optimized away. */
4108 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4109
4110 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4111 statement. */
4112
4113 static inline void
4114 gimple_debug_bind_reset_value (gimple dbg)
4115 {
4116 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4117 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4118 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4119 }
4120
4121 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4122 value. */
4123
4124 static inline bool
4125 gimple_debug_bind_has_value_p (gimple dbg)
4126 {
4127 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4128 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4129 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4130 }
4131
4132 #undef GIMPLE_DEBUG_BIND_NOVALUE
4133
4134 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4135
4136 static inline bool
4137 gimple_debug_source_bind_p (const_gimple s)
4138 {
4139 if (is_gimple_debug (s))
4140 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4141
4142 return false;
4143 }
4144
4145 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4146
4147 static inline tree
4148 gimple_debug_source_bind_get_var (gimple dbg)
4149 {
4150 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4151 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4152 return gimple_op (dbg, 0);
4153 }
4154
4155 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4156 statement. */
4157
4158 static inline tree
4159 gimple_debug_source_bind_get_value (gimple dbg)
4160 {
4161 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4162 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4163 return gimple_op (dbg, 1);
4164 }
4165
4166 /* Return a pointer to the value bound to the variable in a
4167 GIMPLE_DEBUG source bind statement. */
4168
4169 static inline tree *
4170 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4171 {
4172 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4173 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4174 return gimple_op_ptr (dbg, 1);
4175 }
4176
4177 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4178
4179 static inline void
4180 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4181 {
4182 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4183 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4184 gimple_set_op (dbg, 0, var);
4185 }
4186
4187 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4188 statement. */
4189
4190 static inline void
4191 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4192 {
4193 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4194 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4195 gimple_set_op (dbg, 1, value);
4196 }
4197
4198 /* Return the line number for EXPR, or return -1 if we have no line
4199 number information for it. */
4200 static inline int
4201 get_lineno (const_gimple stmt)
4202 {
4203 location_t loc;
4204
4205 if (!stmt)
4206 return -1;
4207
4208 loc = gimple_location (stmt);
4209 if (loc == UNKNOWN_LOCATION)
4210 return -1;
4211
4212 return LOCATION_LINE (loc);
4213 }
4214
4215 /* Return a pointer to the body for the OMP statement GS. */
4216
4217 static inline gimple_seq *
4218 gimple_omp_body_ptr (gimple gs)
4219 {
4220 return &static_cast <gimple_statement_omp *> (gs)->body;
4221 }
4222
4223 /* Return the body for the OMP statement GS. */
4224
4225 static inline gimple_seq
4226 gimple_omp_body (gimple gs)
4227 {
4228 return *gimple_omp_body_ptr (gs);
4229 }
4230
4231 /* Set BODY to be the body for the OMP statement GS. */
4232
4233 static inline void
4234 gimple_omp_set_body (gimple gs, gimple_seq body)
4235 {
4236 static_cast <gimple_statement_omp *> (gs)->body = body;
4237 }
4238
4239
4240 /* Return the name associated with OMP_CRITICAL statement GS. */
4241
4242 static inline tree
4243 gimple_omp_critical_name (const_gimple gs)
4244 {
4245 const gimple_statement_omp_critical *omp_critical_stmt =
4246 as_a <const gimple_statement_omp_critical> (gs);
4247 return omp_critical_stmt->name;
4248 }
4249
4250
4251 /* Return a pointer to the name associated with OMP critical statement GS. */
4252
4253 static inline tree *
4254 gimple_omp_critical_name_ptr (gimple gs)
4255 {
4256 gimple_statement_omp_critical *omp_critical_stmt =
4257 as_a <gimple_statement_omp_critical> (gs);
4258 return &omp_critical_stmt->name;
4259 }
4260
4261
4262 /* Set NAME to be the name associated with OMP critical statement GS. */
4263
4264 static inline void
4265 gimple_omp_critical_set_name (gimple gs, tree name)
4266 {
4267 gimple_statement_omp_critical *omp_critical_stmt =
4268 as_a <gimple_statement_omp_critical> (gs);
4269 omp_critical_stmt->name = name;
4270 }
4271
4272
4273 /* Return the kind of OMP for statemement. */
4274
4275 static inline int
4276 gimple_omp_for_kind (const_gimple g)
4277 {
4278 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4279 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4280 }
4281
4282
4283 /* Set the OMP for kind. */
4284
4285 static inline void
4286 gimple_omp_for_set_kind (gimple g, int kind)
4287 {
4288 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4289 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4290 | (kind & GF_OMP_FOR_KIND_MASK);
4291 }
4292
4293
4294 /* Return true if OMP for statement G has the
4295 GF_OMP_FOR_COMBINED flag set. */
4296
4297 static inline bool
4298 gimple_omp_for_combined_p (const_gimple g)
4299 {
4300 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4301 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4302 }
4303
4304
4305 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4306 value of COMBINED_P. */
4307
4308 static inline void
4309 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4310 {
4311 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4312 if (combined_p)
4313 g->subcode |= GF_OMP_FOR_COMBINED;
4314 else
4315 g->subcode &= ~GF_OMP_FOR_COMBINED;
4316 }
4317
4318
4319 /* Return true if OMP for statement G has the
4320 GF_OMP_FOR_COMBINED_INTO flag set. */
4321
4322 static inline bool
4323 gimple_omp_for_combined_into_p (const_gimple g)
4324 {
4325 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4326 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4327 }
4328
4329
4330 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4331 value of COMBINED_P. */
4332
4333 static inline void
4334 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4335 {
4336 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4337 if (combined_p)
4338 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4339 else
4340 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4341 }
4342
4343
4344 /* Return the clauses associated with OMP_FOR GS. */
4345
4346 static inline tree
4347 gimple_omp_for_clauses (const_gimple gs)
4348 {
4349 const gimple_statement_omp_for *omp_for_stmt =
4350 as_a <const gimple_statement_omp_for> (gs);
4351 return omp_for_stmt->clauses;
4352 }
4353
4354
4355 /* Return a pointer to the OMP_FOR GS. */
4356
4357 static inline tree *
4358 gimple_omp_for_clauses_ptr (gimple gs)
4359 {
4360 gimple_statement_omp_for *omp_for_stmt =
4361 as_a <gimple_statement_omp_for> (gs);
4362 return &omp_for_stmt->clauses;
4363 }
4364
4365
4366 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4367
4368 static inline void
4369 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4370 {
4371 gimple_statement_omp_for *omp_for_stmt =
4372 as_a <gimple_statement_omp_for> (gs);
4373 omp_for_stmt->clauses = clauses;
4374 }
4375
4376
4377 /* Get the collapse count of OMP_FOR GS. */
4378
4379 static inline size_t
4380 gimple_omp_for_collapse (gimple gs)
4381 {
4382 gimple_statement_omp_for *omp_for_stmt =
4383 as_a <gimple_statement_omp_for> (gs);
4384 return omp_for_stmt->collapse;
4385 }
4386
4387
4388 /* Return the index variable for OMP_FOR GS. */
4389
4390 static inline tree
4391 gimple_omp_for_index (const_gimple gs, size_t i)
4392 {
4393 const gimple_statement_omp_for *omp_for_stmt =
4394 as_a <const gimple_statement_omp_for> (gs);
4395 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4396 return omp_for_stmt->iter[i].index;
4397 }
4398
4399
4400 /* Return a pointer to the index variable for OMP_FOR GS. */
4401
4402 static inline tree *
4403 gimple_omp_for_index_ptr (gimple gs, size_t i)
4404 {
4405 gimple_statement_omp_for *omp_for_stmt =
4406 as_a <gimple_statement_omp_for> (gs);
4407 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4408 return &omp_for_stmt->iter[i].index;
4409 }
4410
4411
4412 /* Set INDEX to be the index variable for OMP_FOR GS. */
4413
4414 static inline void
4415 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4416 {
4417 gimple_statement_omp_for *omp_for_stmt =
4418 as_a <gimple_statement_omp_for> (gs);
4419 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4420 omp_for_stmt->iter[i].index = index;
4421 }
4422
4423
4424 /* Return the initial value for OMP_FOR GS. */
4425
4426 static inline tree
4427 gimple_omp_for_initial (const_gimple gs, size_t i)
4428 {
4429 const gimple_statement_omp_for *omp_for_stmt =
4430 as_a <const gimple_statement_omp_for> (gs);
4431 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4432 return omp_for_stmt->iter[i].initial;
4433 }
4434
4435
4436 /* Return a pointer to the initial value for OMP_FOR GS. */
4437
4438 static inline tree *
4439 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4440 {
4441 gimple_statement_omp_for *omp_for_stmt =
4442 as_a <gimple_statement_omp_for> (gs);
4443 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4444 return &omp_for_stmt->iter[i].initial;
4445 }
4446
4447
4448 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4449
4450 static inline void
4451 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4452 {
4453 gimple_statement_omp_for *omp_for_stmt =
4454 as_a <gimple_statement_omp_for> (gs);
4455 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4456 omp_for_stmt->iter[i].initial = initial;
4457 }
4458
4459
4460 /* Return the final value for OMP_FOR GS. */
4461
4462 static inline tree
4463 gimple_omp_for_final (const_gimple gs, size_t i)
4464 {
4465 const gimple_statement_omp_for *omp_for_stmt =
4466 as_a <const gimple_statement_omp_for> (gs);
4467 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4468 return omp_for_stmt->iter[i].final;
4469 }
4470
4471
4472 /* Return a pointer to the final value for OMP_FOR GS. */
4473
4474 static inline tree *
4475 gimple_omp_for_final_ptr (gimple gs, size_t i)
4476 {
4477 gimple_statement_omp_for *omp_for_stmt =
4478 as_a <gimple_statement_omp_for> (gs);
4479 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4480 return &omp_for_stmt->iter[i].final;
4481 }
4482
4483
4484 /* Set FINAL to be the final value for OMP_FOR GS. */
4485
4486 static inline void
4487 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4488 {
4489 gimple_statement_omp_for *omp_for_stmt =
4490 as_a <gimple_statement_omp_for> (gs);
4491 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4492 omp_for_stmt->iter[i].final = final;
4493 }
4494
4495
4496 /* Return the increment value for OMP_FOR GS. */
4497
4498 static inline tree
4499 gimple_omp_for_incr (const_gimple gs, size_t i)
4500 {
4501 const gimple_statement_omp_for *omp_for_stmt =
4502 as_a <const gimple_statement_omp_for> (gs);
4503 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4504 return omp_for_stmt->iter[i].incr;
4505 }
4506
4507
4508 /* Return a pointer to the increment value for OMP_FOR GS. */
4509
4510 static inline tree *
4511 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4512 {
4513 gimple_statement_omp_for *omp_for_stmt =
4514 as_a <gimple_statement_omp_for> (gs);
4515 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4516 return &omp_for_stmt->iter[i].incr;
4517 }
4518
4519
4520 /* Set INCR to be the increment value for OMP_FOR GS. */
4521
4522 static inline void
4523 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4524 {
4525 gimple_statement_omp_for *omp_for_stmt =
4526 as_a <gimple_statement_omp_for> (gs);
4527 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4528 omp_for_stmt->iter[i].incr = incr;
4529 }
4530
4531
4532 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4533 statement GS starts. */
4534
4535 static inline gimple_seq *
4536 gimple_omp_for_pre_body_ptr (gimple gs)
4537 {
4538 gimple_statement_omp_for *omp_for_stmt =
4539 as_a <gimple_statement_omp_for> (gs);
4540 return &omp_for_stmt->pre_body;
4541 }
4542
4543
4544 /* Return the sequence of statements to execute before the OMP_FOR
4545 statement GS starts. */
4546
4547 static inline gimple_seq
4548 gimple_omp_for_pre_body (gimple gs)
4549 {
4550 return *gimple_omp_for_pre_body_ptr (gs);
4551 }
4552
4553
4554 /* Set PRE_BODY to be the sequence of statements to execute before the
4555 OMP_FOR statement GS starts. */
4556
4557 static inline void
4558 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4559 {
4560 gimple_statement_omp_for *omp_for_stmt =
4561 as_a <gimple_statement_omp_for> (gs);
4562 omp_for_stmt->pre_body = pre_body;
4563 }
4564
4565
4566 /* Return the clauses associated with OMP_PARALLEL GS. */
4567
4568 static inline tree
4569 gimple_omp_parallel_clauses (const_gimple gs)
4570 {
4571 const gimple_statement_omp_parallel *omp_parallel_stmt =
4572 as_a <const gimple_statement_omp_parallel> (gs);
4573 return omp_parallel_stmt->clauses;
4574 }
4575
4576
4577 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4578
4579 static inline tree *
4580 gimple_omp_parallel_clauses_ptr (gimple gs)
4581 {
4582 gimple_statement_omp_parallel *omp_parallel_stmt =
4583 as_a <gimple_statement_omp_parallel> (gs);
4584 return &omp_parallel_stmt->clauses;
4585 }
4586
4587
4588 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4589 GS. */
4590
4591 static inline void
4592 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4593 {
4594 gimple_statement_omp_parallel *omp_parallel_stmt =
4595 as_a <gimple_statement_omp_parallel> (gs);
4596 omp_parallel_stmt->clauses = clauses;
4597 }
4598
4599
4600 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4601
4602 static inline tree
4603 gimple_omp_parallel_child_fn (const_gimple gs)
4604 {
4605 const gimple_statement_omp_parallel *omp_parallel_stmt =
4606 as_a <const gimple_statement_omp_parallel> (gs);
4607 return omp_parallel_stmt->child_fn;
4608 }
4609
4610 /* Return a pointer to the child function used to hold the body of
4611 OMP_PARALLEL GS. */
4612
4613 static inline tree *
4614 gimple_omp_parallel_child_fn_ptr (gimple gs)
4615 {
4616 gimple_statement_omp_parallel *omp_parallel_stmt =
4617 as_a <gimple_statement_omp_parallel> (gs);
4618 return &omp_parallel_stmt->child_fn;
4619 }
4620
4621
4622 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4623
4624 static inline void
4625 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4626 {
4627 gimple_statement_omp_parallel *omp_parallel_stmt =
4628 as_a <gimple_statement_omp_parallel> (gs);
4629 omp_parallel_stmt->child_fn = child_fn;
4630 }
4631
4632
4633 /* Return the artificial argument used to send variables and values
4634 from the parent to the children threads in OMP_PARALLEL GS. */
4635
4636 static inline tree
4637 gimple_omp_parallel_data_arg (const_gimple gs)
4638 {
4639 const gimple_statement_omp_parallel *omp_parallel_stmt =
4640 as_a <const gimple_statement_omp_parallel> (gs);
4641 return omp_parallel_stmt->data_arg;
4642 }
4643
4644
4645 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4646
4647 static inline tree *
4648 gimple_omp_parallel_data_arg_ptr (gimple gs)
4649 {
4650 gimple_statement_omp_parallel *omp_parallel_stmt =
4651 as_a <gimple_statement_omp_parallel> (gs);
4652 return &omp_parallel_stmt->data_arg;
4653 }
4654
4655
4656 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4657
4658 static inline void
4659 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4660 {
4661 gimple_statement_omp_parallel *omp_parallel_stmt =
4662 as_a <gimple_statement_omp_parallel> (gs);
4663 omp_parallel_stmt->data_arg = data_arg;
4664 }
4665
4666
4667 /* Return the clauses associated with OMP_TASK GS. */
4668
4669 static inline tree
4670 gimple_omp_task_clauses (const_gimple gs)
4671 {
4672 const gimple_statement_omp_task *omp_task_stmt =
4673 as_a <const gimple_statement_omp_task> (gs);
4674 return omp_task_stmt->clauses;
4675 }
4676
4677
4678 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4679
4680 static inline tree *
4681 gimple_omp_task_clauses_ptr (gimple gs)
4682 {
4683 gimple_statement_omp_task *omp_task_stmt =
4684 as_a <gimple_statement_omp_task> (gs);
4685 return &omp_task_stmt->clauses;
4686 }
4687
4688
4689 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4690 GS. */
4691
4692 static inline void
4693 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4694 {
4695 gimple_statement_omp_task *omp_task_stmt =
4696 as_a <gimple_statement_omp_task> (gs);
4697 omp_task_stmt->clauses = clauses;
4698 }
4699
4700
4701 /* Return the child function used to hold the body of OMP_TASK GS. */
4702
4703 static inline tree
4704 gimple_omp_task_child_fn (const_gimple gs)
4705 {
4706 const gimple_statement_omp_task *omp_task_stmt =
4707 as_a <const gimple_statement_omp_task> (gs);
4708 return omp_task_stmt->child_fn;
4709 }
4710
4711 /* Return a pointer to the child function used to hold the body of
4712 OMP_TASK GS. */
4713
4714 static inline tree *
4715 gimple_omp_task_child_fn_ptr (gimple gs)
4716 {
4717 gimple_statement_omp_task *omp_task_stmt =
4718 as_a <gimple_statement_omp_task> (gs);
4719 return &omp_task_stmt->child_fn;
4720 }
4721
4722
4723 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4724
4725 static inline void
4726 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4727 {
4728 gimple_statement_omp_task *omp_task_stmt =
4729 as_a <gimple_statement_omp_task> (gs);
4730 omp_task_stmt->child_fn = child_fn;
4731 }
4732
4733
4734 /* Return the artificial argument used to send variables and values
4735 from the parent to the children threads in OMP_TASK GS. */
4736
4737 static inline tree
4738 gimple_omp_task_data_arg (const_gimple gs)
4739 {
4740 const gimple_statement_omp_task *omp_task_stmt =
4741 as_a <const gimple_statement_omp_task> (gs);
4742 return omp_task_stmt->data_arg;
4743 }
4744
4745
4746 /* Return a pointer to the data argument for OMP_TASK GS. */
4747
4748 static inline tree *
4749 gimple_omp_task_data_arg_ptr (gimple gs)
4750 {
4751 gimple_statement_omp_task *omp_task_stmt =
4752 as_a <gimple_statement_omp_task> (gs);
4753 return &omp_task_stmt->data_arg;
4754 }
4755
4756
4757 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4758
4759 static inline void
4760 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4761 {
4762 gimple_statement_omp_task *omp_task_stmt =
4763 as_a <gimple_statement_omp_task> (gs);
4764 omp_task_stmt->data_arg = data_arg;
4765 }
4766
4767
4768 /* Return the clauses associated with OMP_TASK GS. */
4769
4770 static inline tree
4771 gimple_omp_taskreg_clauses (const_gimple gs)
4772 {
4773 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4774 as_a <const gimple_statement_omp_taskreg> (gs);
4775 return omp_taskreg_stmt->clauses;
4776 }
4777
4778
4779 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4780
4781 static inline tree *
4782 gimple_omp_taskreg_clauses_ptr (gimple gs)
4783 {
4784 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4785 as_a <gimple_statement_omp_taskreg> (gs);
4786 return &omp_taskreg_stmt->clauses;
4787 }
4788
4789
4790 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4791 GS. */
4792
4793 static inline void
4794 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4795 {
4796 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4797 as_a <gimple_statement_omp_taskreg> (gs);
4798 omp_taskreg_stmt->clauses = clauses;
4799 }
4800
4801
4802 /* Return the child function used to hold the body of OMP_TASK GS. */
4803
4804 static inline tree
4805 gimple_omp_taskreg_child_fn (const_gimple gs)
4806 {
4807 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4808 as_a <const gimple_statement_omp_taskreg> (gs);
4809 return omp_taskreg_stmt->child_fn;
4810 }
4811
4812 /* Return a pointer to the child function used to hold the body of
4813 OMP_TASK GS. */
4814
4815 static inline tree *
4816 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4817 {
4818 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4819 as_a <gimple_statement_omp_taskreg> (gs);
4820 return &omp_taskreg_stmt->child_fn;
4821 }
4822
4823
4824 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4825
4826 static inline void
4827 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4828 {
4829 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4830 as_a <gimple_statement_omp_taskreg> (gs);
4831 omp_taskreg_stmt->child_fn = child_fn;
4832 }
4833
4834
4835 /* Return the artificial argument used to send variables and values
4836 from the parent to the children threads in OMP_TASK GS. */
4837
4838 static inline tree
4839 gimple_omp_taskreg_data_arg (const_gimple gs)
4840 {
4841 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4842 as_a <const gimple_statement_omp_taskreg> (gs);
4843 return omp_taskreg_stmt->data_arg;
4844 }
4845
4846
4847 /* Return a pointer to the data argument for OMP_TASK GS. */
4848
4849 static inline tree *
4850 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4851 {
4852 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4853 as_a <gimple_statement_omp_taskreg> (gs);
4854 return &omp_taskreg_stmt->data_arg;
4855 }
4856
4857
4858 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4859
4860 static inline void
4861 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4862 {
4863 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4864 as_a <gimple_statement_omp_taskreg> (gs);
4865 omp_taskreg_stmt->data_arg = data_arg;
4866 }
4867
4868
4869 /* Return the copy function used to hold the body of OMP_TASK GS. */
4870
4871 static inline tree
4872 gimple_omp_task_copy_fn (const_gimple gs)
4873 {
4874 const gimple_statement_omp_task *omp_task_stmt =
4875 as_a <const gimple_statement_omp_task> (gs);
4876 return omp_task_stmt->copy_fn;
4877 }
4878
4879 /* Return a pointer to the copy function used to hold the body of
4880 OMP_TASK GS. */
4881
4882 static inline tree *
4883 gimple_omp_task_copy_fn_ptr (gimple gs)
4884 {
4885 gimple_statement_omp_task *omp_task_stmt =
4886 as_a <gimple_statement_omp_task> (gs);
4887 return &omp_task_stmt->copy_fn;
4888 }
4889
4890
4891 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4892
4893 static inline void
4894 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4895 {
4896 gimple_statement_omp_task *omp_task_stmt =
4897 as_a <gimple_statement_omp_task> (gs);
4898 omp_task_stmt->copy_fn = copy_fn;
4899 }
4900
4901
4902 /* Return size of the data block in bytes in OMP_TASK GS. */
4903
4904 static inline tree
4905 gimple_omp_task_arg_size (const_gimple gs)
4906 {
4907 const gimple_statement_omp_task *omp_task_stmt =
4908 as_a <const gimple_statement_omp_task> (gs);
4909 return omp_task_stmt->arg_size;
4910 }
4911
4912
4913 /* Return a pointer to the data block size for OMP_TASK GS. */
4914
4915 static inline tree *
4916 gimple_omp_task_arg_size_ptr (gimple gs)
4917 {
4918 gimple_statement_omp_task *omp_task_stmt =
4919 as_a <gimple_statement_omp_task> (gs);
4920 return &omp_task_stmt->arg_size;
4921 }
4922
4923
4924 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4925
4926 static inline void
4927 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4928 {
4929 gimple_statement_omp_task *omp_task_stmt =
4930 as_a <gimple_statement_omp_task> (gs);
4931 omp_task_stmt->arg_size = arg_size;
4932 }
4933
4934
4935 /* Return align of the data block in bytes in OMP_TASK GS. */
4936
4937 static inline tree
4938 gimple_omp_task_arg_align (const_gimple gs)
4939 {
4940 const gimple_statement_omp_task *omp_task_stmt =
4941 as_a <const gimple_statement_omp_task> (gs);
4942 return omp_task_stmt->arg_align;
4943 }
4944
4945
4946 /* Return a pointer to the data block align for OMP_TASK GS. */
4947
4948 static inline tree *
4949 gimple_omp_task_arg_align_ptr (gimple gs)
4950 {
4951 gimple_statement_omp_task *omp_task_stmt =
4952 as_a <gimple_statement_omp_task> (gs);
4953 return &omp_task_stmt->arg_align;
4954 }
4955
4956
4957 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4958
4959 static inline void
4960 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4961 {
4962 gimple_statement_omp_task *omp_task_stmt =
4963 as_a <gimple_statement_omp_task> (gs);
4964 omp_task_stmt->arg_align = arg_align;
4965 }
4966
4967
4968 /* Return the clauses associated with OMP_SINGLE GS. */
4969
4970 static inline tree
4971 gimple_omp_single_clauses (const_gimple gs)
4972 {
4973 const gimple_statement_omp_single *omp_single_stmt =
4974 as_a <const gimple_statement_omp_single> (gs);
4975 return omp_single_stmt->clauses;
4976 }
4977
4978
4979 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4980
4981 static inline tree *
4982 gimple_omp_single_clauses_ptr (gimple gs)
4983 {
4984 gimple_statement_omp_single *omp_single_stmt =
4985 as_a <gimple_statement_omp_single> (gs);
4986 return &omp_single_stmt->clauses;
4987 }
4988
4989
4990 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4991
4992 static inline void
4993 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4994 {
4995 gimple_statement_omp_single *omp_single_stmt =
4996 as_a <gimple_statement_omp_single> (gs);
4997 omp_single_stmt->clauses = clauses;
4998 }
4999
5000
5001 /* Return the clauses associated with OMP_TARGET GS. */
5002
5003 static inline tree
5004 gimple_omp_target_clauses (const_gimple gs)
5005 {
5006 const gimple_statement_omp_target *omp_target_stmt =
5007 as_a <const gimple_statement_omp_target> (gs);
5008 return omp_target_stmt->clauses;
5009 }
5010
5011
5012 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5013
5014 static inline tree *
5015 gimple_omp_target_clauses_ptr (gimple gs)
5016 {
5017 gimple_statement_omp_target *omp_target_stmt =
5018 as_a <gimple_statement_omp_target> (gs);
5019 return &omp_target_stmt->clauses;
5020 }
5021
5022
5023 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5024
5025 static inline void
5026 gimple_omp_target_set_clauses (gimple gs, tree clauses)
5027 {
5028 gimple_statement_omp_target *omp_target_stmt =
5029 as_a <gimple_statement_omp_target> (gs);
5030 omp_target_stmt->clauses = clauses;
5031 }
5032
5033
5034 /* Return the kind of OMP target statemement. */
5035
5036 static inline int
5037 gimple_omp_target_kind (const_gimple g)
5038 {
5039 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5040 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5041 }
5042
5043
5044 /* Set the OMP target kind. */
5045
5046 static inline void
5047 gimple_omp_target_set_kind (gimple g, int kind)
5048 {
5049 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5050 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5051 | (kind & GF_OMP_TARGET_KIND_MASK);
5052 }
5053
5054
5055 /* Return the child function used to hold the body of OMP_TARGET GS. */
5056
5057 static inline tree
5058 gimple_omp_target_child_fn (const_gimple gs)
5059 {
5060 const gimple_statement_omp_target *omp_target_stmt =
5061 as_a <const gimple_statement_omp_target> (gs);
5062 return omp_target_stmt->child_fn;
5063 }
5064
5065 /* Return a pointer to the child function used to hold the body of
5066 OMP_TARGET GS. */
5067
5068 static inline tree *
5069 gimple_omp_target_child_fn_ptr (gimple gs)
5070 {
5071 gimple_statement_omp_target *omp_target_stmt =
5072 as_a <gimple_statement_omp_target> (gs);
5073 return &omp_target_stmt->child_fn;
5074 }
5075
5076
5077 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5078
5079 static inline void
5080 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
5081 {
5082 gimple_statement_omp_target *omp_target_stmt =
5083 as_a <gimple_statement_omp_target> (gs);
5084 omp_target_stmt->child_fn = child_fn;
5085 }
5086
5087
5088 /* Return the artificial argument used to send variables and values
5089 from the parent to the children threads in OMP_TARGET GS. */
5090
5091 static inline tree
5092 gimple_omp_target_data_arg (const_gimple gs)
5093 {
5094 const gimple_statement_omp_target *omp_target_stmt =
5095 as_a <const gimple_statement_omp_target> (gs);
5096 return omp_target_stmt->data_arg;
5097 }
5098
5099
5100 /* Return a pointer to the data argument for OMP_TARGET GS. */
5101
5102 static inline tree *
5103 gimple_omp_target_data_arg_ptr (gimple gs)
5104 {
5105 gimple_statement_omp_target *omp_target_stmt =
5106 as_a <gimple_statement_omp_target> (gs);
5107 return &omp_target_stmt->data_arg;
5108 }
5109
5110
5111 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5112
5113 static inline void
5114 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5115 {
5116 gimple_statement_omp_target *omp_target_stmt =
5117 as_a <gimple_statement_omp_target> (gs);
5118 omp_target_stmt->data_arg = data_arg;
5119 }
5120
5121
5122 /* Return the clauses associated with OMP_TEAMS GS. */
5123
5124 static inline tree
5125 gimple_omp_teams_clauses (const_gimple gs)
5126 {
5127 const gimple_statement_omp_teams *omp_teams_stmt =
5128 as_a <const gimple_statement_omp_teams> (gs);
5129 return omp_teams_stmt->clauses;
5130 }
5131
5132
5133 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5134
5135 static inline tree *
5136 gimple_omp_teams_clauses_ptr (gimple gs)
5137 {
5138 gimple_statement_omp_teams *omp_teams_stmt =
5139 as_a <gimple_statement_omp_teams> (gs);
5140 return &omp_teams_stmt->clauses;
5141 }
5142
5143
5144 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5145
5146 static inline void
5147 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5148 {
5149 gimple_statement_omp_teams *omp_teams_stmt =
5150 as_a <gimple_statement_omp_teams> (gs);
5151 omp_teams_stmt->clauses = clauses;
5152 }
5153
5154
5155 /* Return the clauses associated with OMP_SECTIONS GS. */
5156
5157 static inline tree
5158 gimple_omp_sections_clauses (const_gimple gs)
5159 {
5160 const gimple_statement_omp_sections *omp_sections_stmt =
5161 as_a <const gimple_statement_omp_sections> (gs);
5162 return omp_sections_stmt->clauses;
5163 }
5164
5165
5166 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5167
5168 static inline tree *
5169 gimple_omp_sections_clauses_ptr (gimple gs)
5170 {
5171 gimple_statement_omp_sections *omp_sections_stmt =
5172 as_a <gimple_statement_omp_sections> (gs);
5173 return &omp_sections_stmt->clauses;
5174 }
5175
5176
5177 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5178 GS. */
5179
5180 static inline void
5181 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5182 {
5183 gimple_statement_omp_sections *omp_sections_stmt =
5184 as_a <gimple_statement_omp_sections> (gs);
5185 omp_sections_stmt->clauses = clauses;
5186 }
5187
5188
5189 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5190 in GS. */
5191
5192 static inline tree
5193 gimple_omp_sections_control (const_gimple gs)
5194 {
5195 const gimple_statement_omp_sections *omp_sections_stmt =
5196 as_a <const gimple_statement_omp_sections> (gs);
5197 return omp_sections_stmt->control;
5198 }
5199
5200
5201 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5202 GS. */
5203
5204 static inline tree *
5205 gimple_omp_sections_control_ptr (gimple gs)
5206 {
5207 gimple_statement_omp_sections *omp_sections_stmt =
5208 as_a <gimple_statement_omp_sections> (gs);
5209 return &omp_sections_stmt->control;
5210 }
5211
5212
5213 /* Set CONTROL to be the set of clauses associated with the
5214 GIMPLE_OMP_SECTIONS in GS. */
5215
5216 static inline void
5217 gimple_omp_sections_set_control (gimple gs, tree control)
5218 {
5219 gimple_statement_omp_sections *omp_sections_stmt =
5220 as_a <gimple_statement_omp_sections> (gs);
5221 omp_sections_stmt->control = control;
5222 }
5223
5224
5225 /* Set COND to be the condition code for OMP_FOR GS. */
5226
5227 static inline void
5228 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5229 {
5230 gimple_statement_omp_for *omp_for_stmt =
5231 as_a <gimple_statement_omp_for> (gs);
5232 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5233 && i < omp_for_stmt->collapse);
5234 omp_for_stmt->iter[i].cond = cond;
5235 }
5236
5237
5238 /* Return the condition code associated with OMP_FOR GS. */
5239
5240 static inline enum tree_code
5241 gimple_omp_for_cond (const_gimple gs, size_t i)
5242 {
5243 const gimple_statement_omp_for *omp_for_stmt =
5244 as_a <const gimple_statement_omp_for> (gs);
5245 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5246 return omp_for_stmt->iter[i].cond;
5247 }
5248
5249
5250 /* Set the value being stored in an atomic store. */
5251
5252 static inline void
5253 gimple_omp_atomic_store_set_val (gimple g, tree val)
5254 {
5255 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5256 as_a <gimple_statement_omp_atomic_store> (g);
5257 omp_atomic_store_stmt->val = val;
5258 }
5259
5260
5261 /* Return the value being stored in an atomic store. */
5262
5263 static inline tree
5264 gimple_omp_atomic_store_val (const_gimple g)
5265 {
5266 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5267 as_a <const gimple_statement_omp_atomic_store> (g);
5268 return omp_atomic_store_stmt->val;
5269 }
5270
5271
5272 /* Return a pointer to the value being stored in an atomic store. */
5273
5274 static inline tree *
5275 gimple_omp_atomic_store_val_ptr (gimple g)
5276 {
5277 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5278 as_a <gimple_statement_omp_atomic_store> (g);
5279 return &omp_atomic_store_stmt->val;
5280 }
5281
5282
5283 /* Set the LHS of an atomic load. */
5284
5285 static inline void
5286 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5287 {
5288 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5289 as_a <gimple_statement_omp_atomic_load> (g);
5290 omp_atomic_load_stmt->lhs = lhs;
5291 }
5292
5293
5294 /* Get the LHS of an atomic load. */
5295
5296 static inline tree
5297 gimple_omp_atomic_load_lhs (const_gimple g)
5298 {
5299 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5300 as_a <const gimple_statement_omp_atomic_load> (g);
5301 return omp_atomic_load_stmt->lhs;
5302 }
5303
5304
5305 /* Return a pointer to the LHS of an atomic load. */
5306
5307 static inline tree *
5308 gimple_omp_atomic_load_lhs_ptr (gimple g)
5309 {
5310 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5311 as_a <gimple_statement_omp_atomic_load> (g);
5312 return &omp_atomic_load_stmt->lhs;
5313 }
5314
5315
5316 /* Set the RHS of an atomic load. */
5317
5318 static inline void
5319 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5320 {
5321 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5322 as_a <gimple_statement_omp_atomic_load> (g);
5323 omp_atomic_load_stmt->rhs = rhs;
5324 }
5325
5326
5327 /* Get the RHS of an atomic load. */
5328
5329 static inline tree
5330 gimple_omp_atomic_load_rhs (const_gimple g)
5331 {
5332 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5333 as_a <const gimple_statement_omp_atomic_load> (g);
5334 return omp_atomic_load_stmt->rhs;
5335 }
5336
5337
5338 /* Return a pointer to the RHS of an atomic load. */
5339
5340 static inline tree *
5341 gimple_omp_atomic_load_rhs_ptr (gimple g)
5342 {
5343 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5344 as_a <gimple_statement_omp_atomic_load> (g);
5345 return &omp_atomic_load_stmt->rhs;
5346 }
5347
5348
5349 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5350
5351 static inline tree
5352 gimple_omp_continue_control_def (const_gimple g)
5353 {
5354 const gimple_statement_omp_continue *omp_continue_stmt =
5355 as_a <const gimple_statement_omp_continue> (g);
5356 return omp_continue_stmt->control_def;
5357 }
5358
5359 /* The same as above, but return the address. */
5360
5361 static inline tree *
5362 gimple_omp_continue_control_def_ptr (gimple g)
5363 {
5364 gimple_statement_omp_continue *omp_continue_stmt =
5365 as_a <gimple_statement_omp_continue> (g);
5366 return &omp_continue_stmt->control_def;
5367 }
5368
5369 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5370
5371 static inline void
5372 gimple_omp_continue_set_control_def (gimple g, tree def)
5373 {
5374 gimple_statement_omp_continue *omp_continue_stmt =
5375 as_a <gimple_statement_omp_continue> (g);
5376 omp_continue_stmt->control_def = def;
5377 }
5378
5379
5380 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5381
5382 static inline tree
5383 gimple_omp_continue_control_use (const_gimple g)
5384 {
5385 const gimple_statement_omp_continue *omp_continue_stmt =
5386 as_a <const gimple_statement_omp_continue> (g);
5387 return omp_continue_stmt->control_use;
5388 }
5389
5390
5391 /* The same as above, but return the address. */
5392
5393 static inline tree *
5394 gimple_omp_continue_control_use_ptr (gimple g)
5395 {
5396 gimple_statement_omp_continue *omp_continue_stmt =
5397 as_a <gimple_statement_omp_continue> (g);
5398 return &omp_continue_stmt->control_use;
5399 }
5400
5401
5402 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5403
5404 static inline void
5405 gimple_omp_continue_set_control_use (gimple g, tree use)
5406 {
5407 gimple_statement_omp_continue *omp_continue_stmt =
5408 as_a <gimple_statement_omp_continue> (g);
5409 omp_continue_stmt->control_use = use;
5410 }
5411
5412 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5413
5414 static inline gimple_seq *
5415 gimple_transaction_body_ptr (gimple gs)
5416 {
5417 gimple_statement_transaction *transaction_stmt =
5418 as_a <gimple_statement_transaction> (gs);
5419 return &transaction_stmt->body;
5420 }
5421
5422 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5423
5424 static inline gimple_seq
5425 gimple_transaction_body (gimple gs)
5426 {
5427 return *gimple_transaction_body_ptr (gs);
5428 }
5429
5430 /* Return the label associated with a GIMPLE_TRANSACTION. */
5431
5432 static inline tree
5433 gimple_transaction_label (const_gimple gs)
5434 {
5435 const gimple_statement_transaction *transaction_stmt =
5436 as_a <const gimple_statement_transaction> (gs);
5437 return transaction_stmt->label;
5438 }
5439
5440 static inline tree *
5441 gimple_transaction_label_ptr (gimple gs)
5442 {
5443 gimple_statement_transaction *transaction_stmt =
5444 as_a <gimple_statement_transaction> (gs);
5445 return &transaction_stmt->label;
5446 }
5447
5448 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5449
5450 static inline unsigned int
5451 gimple_transaction_subcode (const_gimple gs)
5452 {
5453 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5454 return gs->subcode;
5455 }
5456
5457 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5458
5459 static inline void
5460 gimple_transaction_set_body (gimple gs, gimple_seq body)
5461 {
5462 gimple_statement_transaction *transaction_stmt =
5463 as_a <gimple_statement_transaction> (gs);
5464 transaction_stmt->body = body;
5465 }
5466
5467 /* Set the label associated with a GIMPLE_TRANSACTION. */
5468
5469 static inline void
5470 gimple_transaction_set_label (gimple gs, tree label)
5471 {
5472 gimple_statement_transaction *transaction_stmt =
5473 as_a <gimple_statement_transaction> (gs);
5474 transaction_stmt->label = label;
5475 }
5476
5477 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5478
5479 static inline void
5480 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5481 {
5482 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5483 gs->subcode = subcode;
5484 }
5485
5486
5487 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5488
5489 static inline tree *
5490 gimple_return_retval_ptr (const_gimple gs)
5491 {
5492 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5493 return gimple_op_ptr (gs, 0);
5494 }
5495
5496 /* Return the return value for GIMPLE_RETURN GS. */
5497
5498 static inline tree
5499 gimple_return_retval (const_gimple gs)
5500 {
5501 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5502 return gimple_op (gs, 0);
5503 }
5504
5505
5506 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5507
5508 static inline void
5509 gimple_return_set_retval (gimple gs, tree retval)
5510 {
5511 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5512 gimple_set_op (gs, 0, retval);
5513 }
5514
5515
5516 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5517
5518 #define CASE_GIMPLE_OMP \
5519 case GIMPLE_OMP_PARALLEL: \
5520 case GIMPLE_OMP_TASK: \
5521 case GIMPLE_OMP_FOR: \
5522 case GIMPLE_OMP_SECTIONS: \
5523 case GIMPLE_OMP_SECTIONS_SWITCH: \
5524 case GIMPLE_OMP_SINGLE: \
5525 case GIMPLE_OMP_TARGET: \
5526 case GIMPLE_OMP_TEAMS: \
5527 case GIMPLE_OMP_SECTION: \
5528 case GIMPLE_OMP_MASTER: \
5529 case GIMPLE_OMP_TASKGROUP: \
5530 case GIMPLE_OMP_ORDERED: \
5531 case GIMPLE_OMP_CRITICAL: \
5532 case GIMPLE_OMP_RETURN: \
5533 case GIMPLE_OMP_ATOMIC_LOAD: \
5534 case GIMPLE_OMP_ATOMIC_STORE: \
5535 case GIMPLE_OMP_CONTINUE
5536
5537 static inline bool
5538 is_gimple_omp (const_gimple stmt)
5539 {
5540 switch (gimple_code (stmt))
5541 {
5542 CASE_GIMPLE_OMP:
5543 return true;
5544 default:
5545 return false;
5546 }
5547 }
5548
5549
5550 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5551
5552 static inline bool
5553 gimple_nop_p (const_gimple g)
5554 {
5555 return gimple_code (g) == GIMPLE_NOP;
5556 }
5557
5558
5559 /* Return true if GS is a GIMPLE_RESX. */
5560
5561 static inline bool
5562 is_gimple_resx (const_gimple gs)
5563 {
5564 return gimple_code (gs) == GIMPLE_RESX;
5565 }
5566
5567 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5568
5569 static inline enum br_predictor
5570 gimple_predict_predictor (gimple gs)
5571 {
5572 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5573 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5574 }
5575
5576
5577 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5578
5579 static inline void
5580 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5581 {
5582 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5583 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5584 | (unsigned) predictor;
5585 }
5586
5587
5588 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5589
5590 static inline enum prediction
5591 gimple_predict_outcome (gimple gs)
5592 {
5593 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5594 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5595 }
5596
5597
5598 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5599
5600 static inline void
5601 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5602 {
5603 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5604 if (outcome == TAKEN)
5605 gs->subcode |= GF_PREDICT_TAKEN;
5606 else
5607 gs->subcode &= ~GF_PREDICT_TAKEN;
5608 }
5609
5610
5611 /* Return the type of the main expression computed by STMT. Return
5612 void_type_node if the statement computes nothing. */
5613
5614 static inline tree
5615 gimple_expr_type (const_gimple stmt)
5616 {
5617 enum gimple_code code = gimple_code (stmt);
5618
5619 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5620 {
5621 tree type;
5622 /* In general we want to pass out a type that can be substituted
5623 for both the RHS and the LHS types if there is a possibly
5624 useless conversion involved. That means returning the
5625 original RHS type as far as we can reconstruct it. */
5626 if (code == GIMPLE_CALL)
5627 {
5628 if (gimple_call_internal_p (stmt)
5629 && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
5630 type = TREE_TYPE (gimple_call_arg (stmt, 3));
5631 else
5632 type = gimple_call_return_type (stmt);
5633 }
5634 else
5635 switch (gimple_assign_rhs_code (stmt))
5636 {
5637 case POINTER_PLUS_EXPR:
5638 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5639 break;
5640
5641 default:
5642 /* As fallback use the type of the LHS. */
5643 type = TREE_TYPE (gimple_get_lhs (stmt));
5644 break;
5645 }
5646 return type;
5647 }
5648 else if (code == GIMPLE_COND)
5649 return boolean_type_node;
5650 else
5651 return void_type_node;
5652 }
5653
5654 /* Enum and arrays used for allocation stats. Keep in sync with
5655 gimple.c:gimple_alloc_kind_names. */
5656 enum gimple_alloc_kind
5657 {
5658 gimple_alloc_kind_assign, /* Assignments. */
5659 gimple_alloc_kind_phi, /* PHI nodes. */
5660 gimple_alloc_kind_cond, /* Conditionals. */
5661 gimple_alloc_kind_rest, /* Everything else. */
5662 gimple_alloc_kind_all
5663 };
5664
5665 extern int gimple_alloc_counts[];
5666 extern int gimple_alloc_sizes[];
5667
5668 /* Return the allocation kind for a given stmt CODE. */
5669 static inline enum gimple_alloc_kind
5670 gimple_alloc_kind (enum gimple_code code)
5671 {
5672 switch (code)
5673 {
5674 case GIMPLE_ASSIGN:
5675 return gimple_alloc_kind_assign;
5676 case GIMPLE_PHI:
5677 return gimple_alloc_kind_phi;
5678 case GIMPLE_COND:
5679 return gimple_alloc_kind_cond;
5680 default:
5681 return gimple_alloc_kind_rest;
5682 }
5683 }
5684
5685 /* Return true if a location should not be emitted for this statement
5686 by annotate_all_with_location. */
5687
5688 static inline bool
5689 gimple_do_not_emit_location_p (gimple g)
5690 {
5691 return gimple_plf (g, GF_PLF_1);
5692 }
5693
5694 /* Mark statement G so a location will not be emitted by
5695 annotate_one_with_location. */
5696
5697 static inline void
5698 gimple_set_do_not_emit_location (gimple g)
5699 {
5700 /* The PLF flags are initialized to 0 when a new tuple is created,
5701 so no need to initialize it anywhere. */
5702 gimple_set_plf (g, GF_PLF_1, true);
5703 }
5704
5705
5706 /* Macros for showing usage statistics. */
5707 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5708 ? (x) \
5709 : ((x) < 1024*1024*10 \
5710 ? (x) / 1024 \
5711 : (x) / (1024*1024))))
5712
5713 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5714
5715 #endif /* GCC_GIMPLE_H */