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