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