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