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