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