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