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