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