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