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