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