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