comparison gcc/gimple.h.orig @ 57:326d9e06c2e3

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