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