1 /* Core data structures for the 'tree' type. 2 Copyright (C) 1989-2014 Free Software Foundation, Inc. 3 4 This file is part of GCC. 5 6 GCC is free software; you can redistribute it and/or modify it under 7 the terms of the GNU General Public License as published by the Free 8 Software Foundation; either version 3, or (at your option) any later 9 version. 10 11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY 12 WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GCC; see the file COPYING3. If not see 18 <http://www.gnu.org/licenses/>. */ 19 20 #ifndef GCC_TREE_CORE_H 21 #define GCC_TREE_CORE_H 22 23 #include "hashtab.h" 24 #include "machmode.h" 25 #include "input.h" 26 #include "statistics.h" 27 #include "vec.h" 28 #include "double-int.h" 29 #include "real.h" 30 #include "fixed-value.h" 31 #include "alias.h" 32 #include "flags.h" 33 #include "symtab.h" 34 35 /* This file contains all the data structures that define the 'tree' type. 36 There are no accessor macros nor functions in this file. Only the 37 basic data structures, extern declarations and type definitions. */ 38 39 /*--------------------------------------------------------------------------- 40 Forward type declarations. Mostly to avoid including unnecessary headers 41 ---------------------------------------------------------------------------*/ 42 struct function; 43 struct real_value; 44 struct fixed_value; 45 struct ptr_info_def; 46 struct range_info_def; 47 struct die_struct; 48 struct pointer_set_t; 49 50 51 /*--------------------------------------------------------------------------- 52 #defined constants 53 ---------------------------------------------------------------------------*/ 54 /* Nonzero if this is a call to a function whose return value depends 55 solely on its arguments, has no side effects, and does not read 56 global memory. This corresponds to TREE_READONLY for function 57 decls. */ 58 #define ECF_CONST (1 << 0) 59 60 /* Nonzero if this is a call to "pure" function (like const function, 61 but may read memory. This corresponds to DECL_PURE_P for function 62 decls. */ 63 #define ECF_PURE (1 << 1) 64 65 /* Nonzero if this is ECF_CONST or ECF_PURE but cannot be proven to no 66 infinite loop. This corresponds to DECL_LOOPING_CONST_OR_PURE_P 67 for function decls.*/ 68 #define ECF_LOOPING_CONST_OR_PURE (1 << 2) 69 70 /* Nonzero if this call will never return. */ 71 #define ECF_NORETURN (1 << 3) 72 73 /* Nonzero if this is a call to malloc or a related function. */ 74 #define ECF_MALLOC (1 << 4) 75 76 /* Nonzero if it is plausible that this is a call to alloca. */ 77 #define ECF_MAY_BE_ALLOCA (1 << 5) 78 79 /* Nonzero if this is a call to a function that won't throw an exception. */ 80 #define ECF_NOTHROW (1 << 6) 81 82 /* Nonzero if this is a call to setjmp or a related function. */ 83 #define ECF_RETURNS_TWICE (1 << 7) 84 85 /* Nonzero if this call replaces the current stack frame. */ 86 #define ECF_SIBCALL (1 << 8) 87 88 /* Function does not read or write memory (but may have side effects, so 89 it does not necessarily fit ECF_CONST). */ 90 #define ECF_NOVOPS (1 << 9) 91 92 /* The function does not lead to calls within current function unit. */ 93 #define ECF_LEAF (1 << 10) 94 95 /* Nonzero if this call does not affect transactions. */ 96 #define ECF_TM_PURE (1 << 11) 97 98 /* Nonzero if this call is into the transaction runtime library. */ 99 #define ECF_TM_BUILTIN (1 << 12) 100 101 /* Call argument flags. */ 102 /* Nonzero if the argument is not dereferenced recursively, thus only 103 directly reachable memory is read or written. */ 104 #define EAF_DIRECT (1 << 0) 105 106 /* Nonzero if memory reached by the argument is not clobbered. */ 107 #define EAF_NOCLOBBER (1 << 1) 108 109 /* Nonzero if the argument does not escape. */ 110 #define EAF_NOESCAPE (1 << 2) 111 112 /* Nonzero if the argument is not used by the function. */ 113 #define EAF_UNUSED (1 << 3) 114 115 /* Call return flags. */ 116 /* Mask for the argument number that is returned. Lower two bits of 117 the return flags, encodes argument slots zero to three. */ 118 #define ERF_RETURN_ARG_MASK (3) 119 120 /* Nonzero if the return value is equal to the argument number 121 flags & ERF_RETURN_ARG_MASK. */ 122 #define ERF_RETURNS_ARG (1 << 2) 123 124 /* Nonzero if the return value does not alias with anything. Functions 125 with the malloc attribute have this set on their return value. */ 126 #define ERF_NOALIAS (1 << 3) 127 128 129 /*--------------------------------------------------------------------------- 130 Enumerations 131 ---------------------------------------------------------------------------*/ 132 /* Codes of tree nodes. */ 133 #define DEFTREECODE(SYM, STRING, TYPE, NARGS) SYM, 134 #define END_OF_BASE_TREE_CODES LAST_AND_UNUSED_TREE_CODE, 135 136 enum tree_code { 137 #include "all-tree.def" 138 MAX_TREE_CODES 139 }; 140 141 #undef DEFTREECODE 142 #undef END_OF_BASE_TREE_CODES 143 144 /* Number of language-independent tree codes. */ 145 #define NUM_TREE_CODES \ 146 ((int) LAST_AND_UNUSED_TREE_CODE) 147 148 #define CODE_CONTAINS_STRUCT(CODE, STRUCT) \ 149 (tree_contains_struct[(CODE)][(STRUCT)]) 150 151 152 /* Classify which part of the compiler has defined a given builtin function. 153 Note that we assume below that this is no more than two bits. */ 154 enum built_in_class { 155 NOT_BUILT_IN = 0, 156 BUILT_IN_FRONTEND, 157 BUILT_IN_MD, 158 BUILT_IN_NORMAL 159 }; 160 161 /* Last marker used for LTO stremaing of built_in_class. We can not add it 162 to the enum since we need the enumb to fit in 2 bits. */ 163 #define BUILT_IN_LAST (BUILT_IN_NORMAL + 1) 164 165 /* Codes that identify the various built in functions 166 so that expand_call can identify them quickly. */ 167 #define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND) ENUM, 168 enum built_in_function { 169 #include "builtins.def" 170 171 /* Complex division routines in libgcc. These are done via builtins 172 because emit_library_call_value can't handle complex values. */ 173 BUILT_IN_COMPLEX_MUL_MIN, 174 BUILT_IN_COMPLEX_MUL_MAX 175 = BUILT_IN_COMPLEX_MUL_MIN 176 + MAX_MODE_COMPLEX_FLOAT 177 - MIN_MODE_COMPLEX_FLOAT, 178 179 BUILT_IN_COMPLEX_DIV_MIN, 180 BUILT_IN_COMPLEX_DIV_MAX 181 = BUILT_IN_COMPLEX_DIV_MIN 182 + MAX_MODE_COMPLEX_FLOAT 183 - MIN_MODE_COMPLEX_FLOAT, 184 185 /* Upper bound on non-language-specific builtins. */ 186 END_BUILTINS 187 }; 188 #undef DEF_BUILTIN 189 190 /* Tree code classes. Each tree_code has an associated code class 191 represented by a TREE_CODE_CLASS. */ 192 enum tree_code_class { 193 tcc_exceptional, /* An exceptional code (fits no category). */ 194 tcc_constant, /* A constant. */ 195 /* Order of tcc_type and tcc_declaration is important. */ 196 tcc_type, /* A type object code. */ 197 tcc_declaration, /* A declaration (also serving as variable refs). */ 198 tcc_reference, /* A reference to storage. */ 199 tcc_comparison, /* A comparison expression. */ 200 tcc_unary, /* A unary arithmetic expression. */ 201 tcc_binary, /* A binary arithmetic expression. */ 202 tcc_statement, /* A statement expression, which have side effects 203 but usually no interesting value. */ 204 tcc_vl_exp, /* A function call or other expression with a 205 variable-length operand vector. */ 206 tcc_expression /* Any other expression. */ 207 }; 208 209 /* OMP_CLAUSE codes. Do not reorder, as this is used to index into 210 the tables omp_clause_num_ops and omp_clause_code_name. */ 211 enum omp_clause_code { 212 /* Clause zero is special-cased inside the parser 213 (c_parser_omp_variable_list). */ 214 OMP_CLAUSE_ERROR = 0, 215 216 /* OpenMP clause: private (variable_list). */ 217 OMP_CLAUSE_PRIVATE, 218 219 /* OpenMP clause: shared (variable_list). */ 220 OMP_CLAUSE_SHARED, 221 222 /* OpenMP clause: firstprivate (variable_list). */ 223 OMP_CLAUSE_FIRSTPRIVATE, 224 225 /* OpenMP clause: lastprivate (variable_list). */ 226 OMP_CLAUSE_LASTPRIVATE, 227 228 /* OpenMP clause: reduction (operator:variable_list). 229 OMP_CLAUSE_REDUCTION_CODE: The tree_code of the operator. 230 Operand 1: OMP_CLAUSE_REDUCTION_INIT: Stmt-list to initialize the var. 231 Operand 2: OMP_CLAUSE_REDUCTION_MERGE: Stmt-list to merge private var 232 into the shared one. 233 Operand 3: OMP_CLAUSE_REDUCTION_PLACEHOLDER: A dummy VAR_DECL 234 placeholder used in OMP_CLAUSE_REDUCTION_{INIT,MERGE}. */ 235 OMP_CLAUSE_REDUCTION, 236 237 /* OpenMP clause: copyin (variable_list). */ 238 OMP_CLAUSE_COPYIN, 239 240 /* OpenMP clause: copyprivate (variable_list). */ 241 OMP_CLAUSE_COPYPRIVATE, 242 243 /* OpenMP clause: linear (variable-list[:linear-step]). */ 244 OMP_CLAUSE_LINEAR, 245 246 /* OpenMP clause: aligned (variable-list[:alignment]). */ 247 OMP_CLAUSE_ALIGNED, 248 249 /* OpenMP clause: depend ({in,out,inout}:variable-list). */ 250 OMP_CLAUSE_DEPEND, 251 252 /* OpenMP clause: uniform (argument-list). */ 253 OMP_CLAUSE_UNIFORM, 254 255 /* OpenMP clause: from (variable-list). */ 256 OMP_CLAUSE_FROM, 257 258 /* OpenMP clause: to (variable-list). */ 259 OMP_CLAUSE_TO, 260 261 /* OpenMP clause: map ({alloc:,to:,from:,tofrom:,}variable-list). */ 262 OMP_CLAUSE_MAP, 263 264 /* Internal clause: temporary for combined loops expansion. */ 265 OMP_CLAUSE__LOOPTEMP_, 266 267 /* OpenMP clause: if (scalar-expression). */ 268 OMP_CLAUSE_IF, 269 270 /* OpenMP clause: num_threads (integer-expression). */ 271 OMP_CLAUSE_NUM_THREADS, 272 273 /* OpenMP clause: schedule. */ 274 OMP_CLAUSE_SCHEDULE, 275 276 /* OpenMP clause: nowait. */ 277 OMP_CLAUSE_NOWAIT, 278 279 /* OpenMP clause: ordered. */ 280 OMP_CLAUSE_ORDERED, 281 282 /* OpenMP clause: default. */ 283 OMP_CLAUSE_DEFAULT, 284 285 /* OpenMP clause: collapse (constant-integer-expression). */ 286 OMP_CLAUSE_COLLAPSE, 287 288 /* OpenMP clause: untied. */ 289 OMP_CLAUSE_UNTIED, 290 291 /* OpenMP clause: final (scalar-expression). */ 292 OMP_CLAUSE_FINAL, 293 294 /* OpenMP clause: mergeable. */ 295 OMP_CLAUSE_MERGEABLE, 296 297 /* OpenMP clause: device (integer-expression). */ 298 OMP_CLAUSE_DEVICE, 299 300 /* OpenMP clause: dist_schedule (static[:chunk-size]). */ 301 OMP_CLAUSE_DIST_SCHEDULE, 302 303 /* OpenMP clause: inbranch. */ 304 OMP_CLAUSE_INBRANCH, 305 306 /* OpenMP clause: notinbranch. */ 307 OMP_CLAUSE_NOTINBRANCH, 308 309 /* OpenMP clause: num_teams(integer-expression). */ 310 OMP_CLAUSE_NUM_TEAMS, 311 312 /* OpenMP clause: thread_limit(integer-expression). */ 313 OMP_CLAUSE_THREAD_LIMIT, 314 315 /* OpenMP clause: proc_bind ({master,close,spread}). */ 316 OMP_CLAUSE_PROC_BIND, 317 318 /* OpenMP clause: safelen (constant-integer-expression). */ 319 OMP_CLAUSE_SAFELEN, 320 321 /* OpenMP clause: simdlen (constant-integer-expression). */ 322 OMP_CLAUSE_SIMDLEN, 323 324 /* OpenMP clause: for. */ 325 OMP_CLAUSE_FOR, 326 327 /* OpenMP clause: parallel. */ 328 OMP_CLAUSE_PARALLEL, 329 330 /* OpenMP clause: sections. */ 331 OMP_CLAUSE_SECTIONS, 332 333 /* OpenMP clause: taskgroup. */ 334 OMP_CLAUSE_TASKGROUP, 335 336 /* Internally used only clause, holding SIMD uid. */ 337 OMP_CLAUSE__SIMDUID_ 338 }; 339 340 #undef DEFTREESTRUCT 341 #define DEFTREESTRUCT(ENUM, NAME) ENUM, 342 enum tree_node_structure_enum { 343 #include "treestruct.def" 344 LAST_TS_ENUM 345 }; 346 #undef DEFTREESTRUCT 347 348 enum omp_clause_schedule_kind { 349 OMP_CLAUSE_SCHEDULE_STATIC, 350 OMP_CLAUSE_SCHEDULE_DYNAMIC, 351 OMP_CLAUSE_SCHEDULE_GUIDED, 352 OMP_CLAUSE_SCHEDULE_AUTO, 353 OMP_CLAUSE_SCHEDULE_RUNTIME, 354 OMP_CLAUSE_SCHEDULE_LAST 355 }; 356 357 enum omp_clause_default_kind { 358 OMP_CLAUSE_DEFAULT_UNSPECIFIED, 359 OMP_CLAUSE_DEFAULT_SHARED, 360 OMP_CLAUSE_DEFAULT_NONE, 361 OMP_CLAUSE_DEFAULT_PRIVATE, 362 OMP_CLAUSE_DEFAULT_FIRSTPRIVATE, 363 OMP_CLAUSE_DEFAULT_LAST 364 }; 365 366 /* There is a TYPE_QUAL value for each type qualifier. They can be 367 combined by bitwise-or to form the complete set of qualifiers for a 368 type. */ 369 enum cv_qualifier { 370 TYPE_UNQUALIFIED = 0x0, 371 TYPE_QUAL_CONST = 0x1, 372 TYPE_QUAL_VOLATILE = 0x2, 373 TYPE_QUAL_RESTRICT = 0x4, 374 TYPE_QUAL_ATOMIC = 0x8 375 }; 376 377 /* Enumerate visibility settings. */ 378 #ifndef SYMBOL_VISIBILITY_DEFINED 379 #define SYMBOL_VISIBILITY_DEFINED 380 enum symbol_visibility { 381 VISIBILITY_DEFAULT, 382 VISIBILITY_PROTECTED, 383 VISIBILITY_HIDDEN, 384 VISIBILITY_INTERNAL 385 }; 386 #endif // SYMBOL_VISIBILITY_DEFINED 387 388 /* Standard named or nameless data types of the C compiler. */ 389 enum tree_index { 390 TI_ERROR_MARK, 391 TI_INTQI_TYPE, 392 TI_INTHI_TYPE, 393 TI_INTSI_TYPE, 394 TI_INTDI_TYPE, 395 TI_INTTI_TYPE, 396 397 TI_UINTQI_TYPE, 398 TI_UINTHI_TYPE, 399 TI_UINTSI_TYPE, 400 TI_UINTDI_TYPE, 401 TI_UINTTI_TYPE, 402 403 TI_ATOMICQI_TYPE, 404 TI_ATOMICHI_TYPE, 405 TI_ATOMICSI_TYPE, 406 TI_ATOMICDI_TYPE, 407 TI_ATOMICTI_TYPE, 408 409 TI_UINT16_TYPE, 410 TI_UINT32_TYPE, 411 TI_UINT64_TYPE, 412 413 TI_INTEGER_ZERO, 414 TI_INTEGER_ONE, 415 TI_INTEGER_THREE, 416 TI_INTEGER_MINUS_ONE, 417 TI_NULL_POINTER, 418 419 TI_SIZE_ZERO, 420 TI_SIZE_ONE, 421 422 TI_BITSIZE_ZERO, 423 TI_BITSIZE_ONE, 424 TI_BITSIZE_UNIT, 425 426 TI_PUBLIC, 427 TI_PROTECTED, 428 TI_PRIVATE, 429 430 TI_BOOLEAN_FALSE, 431 TI_BOOLEAN_TRUE, 432 433 TI_COMPLEX_INTEGER_TYPE, 434 TI_COMPLEX_FLOAT_TYPE, 435 TI_COMPLEX_DOUBLE_TYPE, 436 TI_COMPLEX_LONG_DOUBLE_TYPE, 437 438 TI_FLOAT_TYPE, 439 TI_DOUBLE_TYPE, 440 TI_LONG_DOUBLE_TYPE, 441 442 TI_FLOAT_PTR_TYPE, 443 TI_DOUBLE_PTR_TYPE, 444 TI_LONG_DOUBLE_PTR_TYPE, 445 TI_INTEGER_PTR_TYPE, 446 447 TI_VOID_TYPE, 448 TI_PTR_TYPE, 449 TI_CONST_PTR_TYPE, 450 TI_SIZE_TYPE, 451 TI_PID_TYPE, 452 TI_PTRDIFF_TYPE, 453 TI_VA_LIST_TYPE, 454 TI_VA_LIST_GPR_COUNTER_FIELD, 455 TI_VA_LIST_FPR_COUNTER_FIELD, 456 TI_BOOLEAN_TYPE, 457 TI_FILEPTR_TYPE, 458 TI_POINTER_SIZED_TYPE, 459 460 TI_DFLOAT32_TYPE, 461 TI_DFLOAT64_TYPE, 462 TI_DFLOAT128_TYPE, 463 TI_DFLOAT32_PTR_TYPE, 464 TI_DFLOAT64_PTR_TYPE, 465 TI_DFLOAT128_PTR_TYPE, 466 467 TI_VOID_LIST_NODE, 468 469 TI_MAIN_IDENTIFIER, 470 471 TI_SAT_SFRACT_TYPE, 472 TI_SAT_FRACT_TYPE, 473 TI_SAT_LFRACT_TYPE, 474 TI_SAT_LLFRACT_TYPE, 475 TI_SAT_USFRACT_TYPE, 476 TI_SAT_UFRACT_TYPE, 477 TI_SAT_ULFRACT_TYPE, 478 TI_SAT_ULLFRACT_TYPE, 479 TI_SFRACT_TYPE, 480 TI_FRACT_TYPE, 481 TI_LFRACT_TYPE, 482 TI_LLFRACT_TYPE, 483 TI_USFRACT_TYPE, 484 TI_UFRACT_TYPE, 485 TI_ULFRACT_TYPE, 486 TI_ULLFRACT_TYPE, 487 TI_SAT_SACCUM_TYPE, 488 TI_SAT_ACCUM_TYPE, 489 TI_SAT_LACCUM_TYPE, 490 TI_SAT_LLACCUM_TYPE, 491 TI_SAT_USACCUM_TYPE, 492 TI_SAT_UACCUM_TYPE, 493 TI_SAT_ULACCUM_TYPE, 494 TI_SAT_ULLACCUM_TYPE, 495 TI_SACCUM_TYPE, 496 TI_ACCUM_TYPE, 497 TI_LACCUM_TYPE, 498 TI_LLACCUM_TYPE, 499 TI_USACCUM_TYPE, 500 TI_UACCUM_TYPE, 501 TI_ULACCUM_TYPE, 502 TI_ULLACCUM_TYPE, 503 TI_QQ_TYPE, 504 TI_HQ_TYPE, 505 TI_SQ_TYPE, 506 TI_DQ_TYPE, 507 TI_TQ_TYPE, 508 TI_UQQ_TYPE, 509 TI_UHQ_TYPE, 510 TI_USQ_TYPE, 511 TI_UDQ_TYPE, 512 TI_UTQ_TYPE, 513 TI_SAT_QQ_TYPE, 514 TI_SAT_HQ_TYPE, 515 TI_SAT_SQ_TYPE, 516 TI_SAT_DQ_TYPE, 517 TI_SAT_TQ_TYPE, 518 TI_SAT_UQQ_TYPE, 519 TI_SAT_UHQ_TYPE, 520 TI_SAT_USQ_TYPE, 521 TI_SAT_UDQ_TYPE, 522 TI_SAT_UTQ_TYPE, 523 TI_HA_TYPE, 524 TI_SA_TYPE, 525 TI_DA_TYPE, 526 TI_TA_TYPE, 527 TI_UHA_TYPE, 528 TI_USA_TYPE, 529 TI_UDA_TYPE, 530 TI_UTA_TYPE, 531 TI_SAT_HA_TYPE, 532 TI_SAT_SA_TYPE, 533 TI_SAT_DA_TYPE, 534 TI_SAT_TA_TYPE, 535 TI_SAT_UHA_TYPE, 536 TI_SAT_USA_TYPE, 537 TI_SAT_UDA_TYPE, 538 TI_SAT_UTA_TYPE, 539 540 TI_OPTIMIZATION_DEFAULT, 541 TI_OPTIMIZATION_CURRENT, 542 TI_TARGET_OPTION_DEFAULT, 543 TI_TARGET_OPTION_CURRENT, 544 TI_CURRENT_TARGET_PRAGMA, 545 TI_CURRENT_OPTIMIZE_PRAGMA, 546 547 TI_MAX 548 }; 549 550 /* An enumeration of the standard C integer types. These must be 551 ordered so that shorter types appear before longer ones, and so 552 that signed types appear before unsigned ones, for the correct 553 functioning of interpret_integer() in c-lex.c. */ 554 enum integer_type_kind { 555 itk_char, 556 itk_signed_char, 557 itk_unsigned_char, 558 itk_short, 559 itk_unsigned_short, 560 itk_int, 561 itk_unsigned_int, 562 itk_long, 563 itk_unsigned_long, 564 itk_long_long, 565 itk_unsigned_long_long, 566 itk_int128, 567 itk_unsigned_int128, 568 itk_none 569 }; 570 571 /* A pointer-to-function member type looks like: 572 573 struct { 574 __P __pfn; 575 ptrdiff_t __delta; 576 }; 577 578 If __pfn is NULL, it is a NULL pointer-to-member-function. 579 580 (Because the vtable is always the first thing in the object, we 581 don't need its offset.) If the function is virtual, then PFN is 582 one plus twice the index into the vtable; otherwise, it is just a 583 pointer to the function. 584 585 Unfortunately, using the lowest bit of PFN doesn't work in 586 architectures that don't impose alignment requirements on function 587 addresses, or that use the lowest bit to tell one ISA from another, 588 for example. For such architectures, we use the lowest bit of 589 DELTA instead of the lowest bit of the PFN, and DELTA will be 590 multiplied by 2. */ 591 enum ptrmemfunc_vbit_where_t { 592 ptrmemfunc_vbit_in_pfn, 593 ptrmemfunc_vbit_in_delta 594 }; 595 596 /* Flags that may be passed in the third argument of decl_attributes, and 597 to handler functions for attributes. */ 598 enum attribute_flags { 599 /* The type passed in is the type of a DECL, and any attributes that 600 should be passed in again to be applied to the DECL rather than the 601 type should be returned. */ 602 ATTR_FLAG_DECL_NEXT = 1, 603 /* The type passed in is a function return type, and any attributes that 604 should be passed in again to be applied to the function type rather 605 than the return type should be returned. */ 606 ATTR_FLAG_FUNCTION_NEXT = 2, 607 /* The type passed in is an array element type, and any attributes that 608 should be passed in again to be applied to the array type rather 609 than the element type should be returned. */ 610 ATTR_FLAG_ARRAY_NEXT = 4, 611 /* The type passed in is a structure, union or enumeration type being 612 created, and should be modified in place. */ 613 ATTR_FLAG_TYPE_IN_PLACE = 8, 614 /* The attributes are being applied by default to a library function whose 615 name indicates known behavior, and should be silently ignored if they 616 are not in fact compatible with the function type. */ 617 ATTR_FLAG_BUILT_IN = 16, 618 /* A given attribute has been parsed as a C++-11 attribute. */ 619 ATTR_FLAG_CXX11 = 32 620 }; 621 622 /* Types used to represent sizes. */ 623 enum size_type_kind { 624 stk_sizetype, /* Normal representation of sizes in bytes. */ 625 stk_ssizetype, /* Signed representation of sizes in bytes. */ 626 stk_bitsizetype, /* Normal representation of sizes in bits. */ 627 stk_sbitsizetype, /* Signed representation of sizes in bits. */ 628 stk_type_kind_last 629 }; 630 631 enum operand_equal_flag { 632 OEP_ONLY_CONST = 1, 633 OEP_PURE_SAME = 2, 634 OEP_CONSTANT_ADDRESS_OF = 4 635 }; 636 637 /* Enum and arrays used for tree allocation stats. 638 Keep in sync with tree.c:tree_node_kind_names. */ 639 enum tree_node_kind { 640 d_kind, 641 t_kind, 642 b_kind, 643 s_kind, 644 r_kind, 645 e_kind, 646 c_kind, 647 id_kind, 648 vec_kind, 649 binfo_kind, 650 ssa_name_kind, 651 constr_kind, 652 x_kind, 653 lang_decl, 654 lang_type, 655 omp_clause_kind, 656 all_kinds 657 }; 658 659 enum annot_expr_kind { 660 annot_expr_ivdep_kind 661 }; 662 663 664 /*--------------------------------------------------------------------------- 665 Type definitions 666 ---------------------------------------------------------------------------*/ 667 /* When processing aliases at the symbol table level, we need the 668 declaration of target. For this reason we need to queue aliases and 669 process them after all declarations has been produced. */ 670 struct GTY(()) alias_pair { 671 tree decl; 672 tree target; 673 }; 674 675 /* An initialization priority. */ 676 typedef unsigned short priority_type; 677 678 /* The type of a callback function for walking over tree structure. */ 679 typedef tree (*walk_tree_fn) (tree *, int *, void *); 680 681 /* The type of a callback function that represents a custom walk_tree. */ 682 typedef tree (*walk_tree_lh) (tree *, int *, tree (*) (tree *, int *, void *), 683 void *, struct pointer_set_t*); 684 685 686 /*--------------------------------------------------------------------------- 687 Main data structures 688 ---------------------------------------------------------------------------*/ 689 /* A tree node can represent a data type, a variable, an expression 690 or a statement. Each node has a TREE_CODE which says what kind of 691 thing it represents. Some common codes are: 692 INTEGER_TYPE -- represents a type of integers. 693 ARRAY_TYPE -- represents a type of pointer. 694 VAR_DECL -- represents a declared variable. 695 INTEGER_CST -- represents a constant integer value. 696 PLUS_EXPR -- represents a sum (an expression). 697 698 As for the contents of a tree node: there are some fields 699 that all nodes share. Each TREE_CODE has various special-purpose 700 fields as well. The fields of a node are never accessed directly, 701 always through accessor macros. */ 702 703 /* Every kind of tree node starts with this structure, 704 so all nodes have these fields. 705 706 See the accessor macros, defined below, for documentation of the 707 fields, and the table below which connects the fields and the 708 accessor macros. */ 709 710 struct GTY(()) tree_base { 711 ENUM_BITFIELD(tree_code) code : 16; 712 713 unsigned side_effects_flag : 1; 714 unsigned constant_flag : 1; 715 unsigned addressable_flag : 1; 716 unsigned volatile_flag : 1; 717 unsigned readonly_flag : 1; 718 unsigned asm_written_flag: 1; 719 unsigned nowarning_flag : 1; 720 unsigned visited : 1; 721 722 unsigned used_flag : 1; 723 unsigned nothrow_flag : 1; 724 unsigned static_flag : 1; 725 unsigned public_flag : 1; 726 unsigned private_flag : 1; 727 unsigned protected_flag : 1; 728 unsigned deprecated_flag : 1; 729 unsigned default_def_flag : 1; 730 731 union { 732 /* The bits in the following structure should only be used with 733 accessor macros that constrain inputs with tree checking. */ 734 struct { 735 unsigned lang_flag_0 : 1; 736 unsigned lang_flag_1 : 1; 737 unsigned lang_flag_2 : 1; 738 unsigned lang_flag_3 : 1; 739 unsigned lang_flag_4 : 1; 740 unsigned lang_flag_5 : 1; 741 unsigned lang_flag_6 : 1; 742 unsigned saturating_flag : 1; 743 744 unsigned unsigned_flag : 1; 745 unsigned packed_flag : 1; 746 unsigned user_align : 1; 747 unsigned nameless_flag : 1; 748 unsigned atomic_flag : 1; 749 unsigned spare0 : 3; 750 751 unsigned spare1 : 8; 752 753 /* This field is only used with TREE_TYPE nodes; the only reason it is 754 present in tree_base instead of tree_type is to save space. The size 755 of the field must be large enough to hold addr_space_t values. */ 756 unsigned address_space : 8; 757 } bits; 758 /* The following fields are present in tree_base to save space. The 759 nodes using them do not require any of the flags above and so can 760 make better use of the 4-byte sized word. */ 761 /* VEC length. This field is only used with TREE_VEC. */ 762 int length; 763 /* SSA version number. This field is only used with SSA_NAME. */ 764 unsigned int version; 765 } GTY((skip(""))) u; 766 }; 767 768 /* The following table lists the uses of each of the above flags and 769 for which types of nodes they are defined. 770 771 addressable_flag: 772 773 TREE_ADDRESSABLE in 774 VAR_DECL, PARM_DECL, RESULT_DECL, FUNCTION_DECL, LABEL_DECL 775 SSA_NAME 776 all types 777 CONSTRUCTOR, IDENTIFIER_NODE 778 STMT_EXPR 779 780 CALL_EXPR_TAILCALL in 781 CALL_EXPR 782 783 CASE_LOW_SEEN in 784 CASE_LABEL_EXPR 785 786 PREDICT_EXPR_OUTCOME in 787 PREDICT_EXPR 788 789 static_flag: 790 791 TREE_STATIC in 792 VAR_DECL, FUNCTION_DECL 793 CONSTRUCTOR 794 795 TREE_NO_TRAMPOLINE in 796 ADDR_EXPR 797 798 BINFO_VIRTUAL_P in 799 TREE_BINFO 800 801 TREE_SYMBOL_REFERENCED in 802 IDENTIFIER_NODE 803 804 CLEANUP_EH_ONLY in 805 TARGET_EXPR, WITH_CLEANUP_EXPR 806 807 TRY_CATCH_IS_CLEANUP in 808 TRY_CATCH_EXPR 809 810 ASM_INPUT_P in 811 ASM_EXPR 812 813 TYPE_REF_CAN_ALIAS_ALL in 814 POINTER_TYPE, REFERENCE_TYPE 815 816 CASE_HIGH_SEEN in 817 CASE_LABEL_EXPR 818 819 ENUM_IS_SCOPED in 820 ENUMERAL_TYPE 821 822 TRANSACTION_EXPR_OUTER in 823 TRANSACTION_EXPR 824 825 SSA_NAME_ANTI_RANGE_P in 826 SSA_NAME 827 828 public_flag: 829 830 TREE_OVERFLOW in 831 INTEGER_CST, REAL_CST, COMPLEX_CST, VECTOR_CST 832 833 TREE_PUBLIC in 834 VAR_DECL, FUNCTION_DECL 835 IDENTIFIER_NODE 836 837 CONSTRUCTOR_NO_CLEARING in 838 CONSTRUCTOR 839 840 ASM_VOLATILE_P in 841 ASM_EXPR 842 843 CALL_EXPR_VA_ARG_PACK in 844 CALL_EXPR 845 846 TYPE_CACHED_VALUES_P in 847 all types 848 849 SAVE_EXPR_RESOLVED_P in 850 SAVE_EXPR 851 852 OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE in 853 OMP_CLAUSE_LASTPRIVATE 854 855 OMP_CLAUSE_PRIVATE_DEBUG in 856 OMP_CLAUSE_PRIVATE 857 858 OMP_CLAUSE_LINEAR_NO_COPYIN in 859 OMP_CLAUSE_LINEAR 860 861 OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION in 862 OMP_CLAUSE_MAP 863 864 OMP_CLAUSE_REDUCTION_OMP_ORIG_REF in 865 OMP_CLAUSE_REDUCTION 866 867 TRANSACTION_EXPR_RELAXED in 868 TRANSACTION_EXPR 869 870 private_flag: 871 872 TREE_PRIVATE in 873 all decls 874 875 CALL_EXPR_RETURN_SLOT_OPT in 876 CALL_EXPR 877 878 OMP_SECTION_LAST in 879 OMP_SECTION 880 881 OMP_PARALLEL_COMBINED in 882 OMP_PARALLEL 883 884 OMP_ATOMIC_SEQ_CST in 885 OMP_ATOMIC* 886 887 OMP_CLAUSE_PRIVATE_OUTER_REF in 888 OMP_CLAUSE_PRIVATE 889 890 OMP_CLAUSE_LINEAR_NO_COPYOUT in 891 OMP_CLAUSE_LINEAR 892 893 TYPE_REF_IS_RVALUE in 894 REFERENCE_TYPE 895 896 ENUM_IS_OPAQUE in 897 ENUMERAL_TYPE 898 899 protected_flag: 900 901 TREE_PROTECTED in 902 BLOCK 903 all decls 904 905 CALL_FROM_THUNK_P and 906 CALL_ALLOCA_FOR_VAR_P in 907 CALL_EXPR 908 909 OMP_CLAUSE_LINEAR_VARIABLE_STRIDE in 910 OMP_CLAUSE_LINEAR 911 912 side_effects_flag: 913 914 TREE_SIDE_EFFECTS in 915 all expressions 916 all decls 917 all constants 918 919 FORCED_LABEL in 920 LABEL_DECL 921 922 volatile_flag: 923 924 TREE_THIS_VOLATILE in 925 all expressions 926 all decls 927 928 TYPE_VOLATILE in 929 all types 930 931 readonly_flag: 932 933 TREE_READONLY in 934 all expressions 935 all decls 936 937 TYPE_READONLY in 938 all types 939 940 constant_flag: 941 942 TREE_CONSTANT in 943 all expressions 944 all decls 945 all constants 946 947 TYPE_SIZES_GIMPLIFIED in 948 all types 949 950 unsigned_flag: 951 952 TYPE_UNSIGNED in 953 all types 954 955 DECL_UNSIGNED in 956 all decls 957 958 asm_written_flag: 959 960 TREE_ASM_WRITTEN in 961 VAR_DECL, FUNCTION_DECL, TYPE_DECL 962 RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE 963 BLOCK, STRING_CST 964 965 SSA_NAME_OCCURS_IN_ABNORMAL_PHI in 966 SSA_NAME 967 968 used_flag: 969 970 TREE_USED in 971 all expressions 972 all decls 973 IDENTIFIER_NODE 974 975 nothrow_flag: 976 977 TREE_NOTHROW in 978 CALL_EXPR 979 FUNCTION_DECL 980 981 TYPE_ALIGN_OK in 982 all types 983 984 TREE_THIS_NOTRAP in 985 INDIRECT_REF, MEM_REF, TARGET_MEM_REF, ARRAY_REF, ARRAY_RANGE_REF 986 987 SSA_NAME_IN_FREELIST in 988 SSA_NAME 989 990 DECL_NONALIASED in 991 VAR_DECL 992 993 deprecated_flag: 994 995 TREE_DEPRECATED in 996 all decls 997 all types 998 999 IDENTIFIER_TRANSPARENT_ALIAS in 1000 IDENTIFIER_NODE 1001 1002 visited: 1003 1004 TREE_VISITED in 1005 all trees (used liberally by many passes) 1006 1007 saturating_flag: 1008 1009 TYPE_SATURATING in 1010 all types 1011 1012 VAR_DECL_IS_VIRTUAL_OPERAND in 1013 VAR_DECL 1014 1015 nowarning_flag: 1016 1017 TREE_NO_WARNING in 1018 all expressions 1019 all decls 1020 1021 TYPE_ARTIFICIAL in 1022 all types 1023 1024 default_def_flag: 1025 1026 TYPE_VECTOR_OPAQUE in 1027 VECTOR_TYPE 1028 1029 SSA_NAME_IS_DEFAULT_DEF in 1030 SSA_NAME 1031 1032 DECL_NONLOCAL_FRAME in 1033 VAR_DECL 1034 1035 TYPE_FINAL_P in 1036 RECORD_TYPE, UNION_TYPE and QUAL_UNION_TYPE 1037 */ 1038 1039 struct GTY(()) tree_typed { 1040 struct tree_base base; 1041 tree type; 1042 }; 1043 1044 struct GTY(()) tree_common { 1045 struct tree_typed typed; 1046 tree chain; 1047 }; 1048 1049 struct GTY(()) tree_int_cst { 1050 struct tree_typed typed; 1051 double_int int_cst; 1052 }; 1053 1054 1055 struct GTY(()) tree_real_cst { 1056 struct tree_typed typed; 1057 struct real_value * real_cst_ptr; 1058 }; 1059 1060 struct GTY(()) tree_fixed_cst { 1061 struct tree_typed typed; 1062 struct fixed_value * fixed_cst_ptr; 1063 }; 1064 1065 struct GTY(()) tree_string { 1066 struct tree_typed typed; 1067 int length; 1068 char str[1]; 1069 }; 1070 1071 struct GTY(()) tree_complex { 1072 struct tree_typed typed; 1073 tree real; 1074 tree imag; 1075 }; 1076 1077 struct GTY(()) tree_vector { 1078 struct tree_typed typed; 1079 tree GTY ((length ("TYPE_VECTOR_SUBPARTS (TREE_TYPE ((tree)&%h))"))) elts[1]; 1080 }; 1081 1082 struct GTY(()) tree_identifier { 1083 struct tree_common common; 1084 struct ht_identifier id; 1085 }; 1086 1087 struct GTY(()) tree_list { 1088 struct tree_common common; 1089 tree purpose; 1090 tree value; 1091 }; 1092 1093 struct GTY(()) tree_vec { 1094 struct tree_common common; 1095 tree GTY ((length ("TREE_VEC_LENGTH ((tree)&%h)"))) a[1]; 1096 }; 1097 1098 /* A single element of a CONSTRUCTOR. VALUE holds the actual value of the 1099 element. INDEX can optionally design the position of VALUE: in arrays, 1100 it is the index where VALUE has to be placed; in structures, it is the 1101 FIELD_DECL of the member. */ 1102 struct GTY(()) constructor_elt { 1103 tree index; 1104 tree value; 1105 }; 1106 1107 struct GTY(()) tree_constructor { 1108 struct tree_typed typed; 1109 vec<constructor_elt, va_gc> *elts; 1110 }; 1111 1112 enum omp_clause_depend_kind 1113 { 1114 OMP_CLAUSE_DEPEND_IN, 1115 OMP_CLAUSE_DEPEND_OUT, 1116 OMP_CLAUSE_DEPEND_INOUT, 1117 OMP_CLAUSE_DEPEND_LAST 1118 }; 1119 1120 enum omp_clause_map_kind 1121 { 1122 OMP_CLAUSE_MAP_ALLOC, 1123 OMP_CLAUSE_MAP_TO, 1124 OMP_CLAUSE_MAP_FROM, 1125 OMP_CLAUSE_MAP_TOFROM, 1126 /* The following kind is an internal only map kind, used for pointer based 1127 array sections. OMP_CLAUSE_SIZE for these is not the pointer size, 1128 which is implicitly POINTER_SIZE / BITS_PER_UNIT, but the bias. */ 1129 OMP_CLAUSE_MAP_POINTER, 1130 /* Also internal, behaves like OMP_CLAUS_MAP_TO, but additionally any 1131 OMP_CLAUSE_MAP_POINTER records consecutive after it which have addresses 1132 falling into that range will not be ignored if OMP_CLAUSE_MAP_TO_PSET 1133 wasn't mapped already. */ 1134 OMP_CLAUSE_MAP_TO_PSET, 1135 OMP_CLAUSE_MAP_LAST 1136 }; 1137 1138 enum omp_clause_proc_bind_kind 1139 { 1140 /* Numbers should match omp_proc_bind_t enum in omp.h. */ 1141 OMP_CLAUSE_PROC_BIND_FALSE = 0, 1142 OMP_CLAUSE_PROC_BIND_TRUE = 1, 1143 OMP_CLAUSE_PROC_BIND_MASTER = 2, 1144 OMP_CLAUSE_PROC_BIND_CLOSE = 3, 1145 OMP_CLAUSE_PROC_BIND_SPREAD = 4, 1146 OMP_CLAUSE_PROC_BIND_LAST 1147 }; 1148 1149 struct GTY(()) tree_exp { 1150 struct tree_typed typed; 1151 location_t locus; 1152 tree GTY ((special ("tree_exp"), 1153 desc ("TREE_CODE ((tree) &%0)"))) 1154 operands[1]; 1155 }; 1156 1157 /* Immediate use linking structure. This structure is used for maintaining 1158 a doubly linked list of uses of an SSA_NAME. */ 1159 struct GTY(()) ssa_use_operand_t { 1160 struct ssa_use_operand_t* GTY((skip(""))) prev; 1161 struct ssa_use_operand_t* GTY((skip(""))) next; 1162 /* Immediate uses for a given SSA name are maintained as a cyclic 1163 list. To recognize the root of this list, the location field 1164 needs to point to the original SSA name. Since statements and 1165 SSA names are of different data types, we need this union. See 1166 the explanation in struct imm_use_iterator. */ 1167 union { gimple stmt; tree ssa_name; } GTY((skip(""))) loc; 1168 tree *GTY((skip(""))) use; 1169 }; 1170 1171 struct GTY(()) tree_ssa_name { 1172 struct tree_typed typed; 1173 1174 /* _DECL wrapped by this SSA name. */ 1175 tree var; 1176 1177 /* Statement that defines this SSA name. */ 1178 gimple def_stmt; 1179 1180 /* Value range information. */ 1181 union ssa_name_info_type { 1182 /* Pointer attributes used for alias analysis. */ 1183 struct GTY ((tag ("0"))) ptr_info_def *ptr_info; 1184 /* Value range attributes used for zero/sign extension elimination. */ 1185 struct GTY ((tag ("1"))) range_info_def *range_info; 1186 } GTY ((desc ("%1.typed.type ?" \ 1187 "!POINTER_TYPE_P (TREE_TYPE ((tree)&%1)) : 2"))) info; 1188 1189 /* Immediate uses list for this SSA_NAME. */ 1190 struct ssa_use_operand_t imm_uses; 1191 }; 1192 1193 struct GTY(()) phi_arg_d { 1194 /* imm_use MUST be the first element in struct because we do some 1195 pointer arithmetic with it. See phi_arg_index_from_use. */ 1196 struct ssa_use_operand_t imm_use; 1197 tree def; 1198 location_t locus; 1199 }; 1200 1201 struct GTY(()) tree_omp_clause { 1202 struct tree_common common; 1203 location_t locus; 1204 enum omp_clause_code code; 1205 union omp_clause_subcode { 1206 enum omp_clause_default_kind default_kind; 1207 enum omp_clause_schedule_kind schedule_kind; 1208 enum omp_clause_depend_kind depend_kind; 1209 enum omp_clause_map_kind map_kind; 1210 enum omp_clause_proc_bind_kind proc_bind_kind; 1211 enum tree_code reduction_code; 1212 } GTY ((skip)) subcode; 1213 1214 /* The gimplification of OMP_CLAUSE_REDUCTION_{INIT,MERGE} for omp-low's 1215 usage. */ 1216 gimple_seq gimple_reduction_init; 1217 gimple_seq gimple_reduction_merge; 1218 1219 tree GTY ((length ("omp_clause_num_ops[OMP_CLAUSE_CODE ((tree)&%h)]"))) 1220 ops[1]; 1221 }; 1222 1223 struct GTY(()) tree_block { 1224 struct tree_base base; 1225 tree chain; 1226 1227 unsigned abstract_flag : 1; 1228 unsigned block_num : 31; 1229 1230 location_t locus; 1231 1232 tree vars; 1233 vec<tree, va_gc> *nonlocalized_vars; 1234 1235 tree subblocks; 1236 tree supercontext; 1237 tree abstract_origin; 1238 tree fragment_origin; 1239 tree fragment_chain; 1240 }; 1241 1242 struct GTY(()) tree_type_common { 1243 struct tree_common common; 1244 tree size; 1245 tree size_unit; 1246 tree attributes; 1247 unsigned int uid; 1248 1249 unsigned int precision : 10; 1250 unsigned no_force_blk_flag : 1; 1251 unsigned needs_constructing_flag : 1; 1252 unsigned transparent_aggr_flag : 1; 1253 unsigned restrict_flag : 1; 1254 unsigned contains_placeholder_bits : 2; 1255 1256 ENUM_BITFIELD(machine_mode) mode : 8; 1257 1258 unsigned string_flag : 1; 1259 unsigned lang_flag_0 : 1; 1260 unsigned lang_flag_1 : 1; 1261 unsigned lang_flag_2 : 1; 1262 unsigned lang_flag_3 : 1; 1263 unsigned lang_flag_4 : 1; 1264 unsigned lang_flag_5 : 1; 1265 unsigned lang_flag_6 : 1; 1266 1267 unsigned int align; 1268 alias_set_type alias_set; 1269 tree pointer_to; 1270 tree reference_to; 1271 union tree_type_symtab { 1272 int GTY ((tag ("TYPE_SYMTAB_IS_ADDRESS"))) address; 1273 const char * GTY ((tag ("TYPE_SYMTAB_IS_POINTER"))) pointer; 1274 struct die_struct * GTY ((tag ("TYPE_SYMTAB_IS_DIE"))) die; 1275 } GTY ((desc ("debug_hooks->tree_type_symtab_field"))) symtab; 1276 tree canonical; 1277 tree next_variant; 1278 tree main_variant; 1279 tree context; 1280 tree name; 1281 }; 1282 1283 struct GTY(()) tree_type_with_lang_specific { 1284 struct tree_type_common common; 1285 /* Points to a structure whose details depend on the language in use. */ 1286 struct lang_type *lang_specific; 1287 }; 1288 1289 struct GTY(()) tree_type_non_common { 1290 struct tree_type_with_lang_specific with_lang_specific; 1291 tree values; 1292 tree minval; 1293 tree maxval; 1294 tree binfo; 1295 }; 1296 1297 struct GTY (()) tree_binfo { 1298 struct tree_common common; 1299 1300 tree offset; 1301 tree vtable; 1302 tree virtuals; 1303 tree vptr_field; 1304 vec<tree, va_gc> *base_accesses; 1305 tree inheritance; 1306 1307 tree vtt_subvtt; 1308 tree vtt_vptr; 1309 1310 vec<tree, va_gc> base_binfos; 1311 }; 1312 1313 struct GTY(()) tree_decl_minimal { 1314 struct tree_common common; 1315 location_t locus; 1316 unsigned int uid; 1317 tree name; 1318 tree context; 1319 }; 1320 1321 struct GTY(()) tree_decl_common { 1322 struct tree_decl_minimal common; 1323 tree size; 1324 1325 ENUM_BITFIELD(machine_mode) mode : 8; 1326 1327 unsigned nonlocal_flag : 1; 1328 unsigned virtual_flag : 1; 1329 unsigned ignored_flag : 1; 1330 unsigned abstract_flag : 1; 1331 unsigned artificial_flag : 1; 1332 unsigned preserve_flag: 1; 1333 unsigned debug_expr_is_from : 1; 1334 1335 unsigned lang_flag_0 : 1; 1336 unsigned lang_flag_1 : 1; 1337 unsigned lang_flag_2 : 1; 1338 unsigned lang_flag_3 : 1; 1339 unsigned lang_flag_4 : 1; 1340 unsigned lang_flag_5 : 1; 1341 unsigned lang_flag_6 : 1; 1342 unsigned lang_flag_7 : 1; 1343 unsigned lang_flag_8 : 1; 1344 1345 /* In VAR_DECL and PARM_DECL, this is DECL_REGISTER. */ 1346 unsigned decl_flag_0 : 1; 1347 /* In FIELD_DECL, this is DECL_BIT_FIELD 1348 In VAR_DECL and FUNCTION_DECL, this is DECL_EXTERNAL. 1349 In TYPE_DECL, this is TYPE_DECL_SUPPRESS_DEBUG. */ 1350 unsigned decl_flag_1 : 1; 1351 /* In FIELD_DECL, this is DECL_NONADDRESSABLE_P 1352 In VAR_DECL, PARM_DECL and RESULT_DECL, this is 1353 DECL_HAS_VALUE_EXPR_P. */ 1354 unsigned decl_flag_2 : 1; 1355 /* 1 bit unused. */ 1356 unsigned decl_flag_3 : 1; 1357 /* Logically, these two would go in a theoretical base shared by var and 1358 parm decl. */ 1359 unsigned gimple_reg_flag : 1; 1360 /* In VAR_DECL, PARM_DECL and RESULT_DECL, this is DECL_BY_REFERENCE. */ 1361 unsigned decl_by_reference_flag : 1; 1362 /* In a VAR_DECL and PARM_DECL, this is DECL_READ_P. */ 1363 unsigned decl_read_flag : 1; 1364 /* In a VAR_DECL or RESULT_DECL, this is DECL_NONSHAREABLE. */ 1365 unsigned decl_nonshareable_flag : 1; 1366 1367 /* DECL_OFFSET_ALIGN, used only for FIELD_DECLs. */ 1368 unsigned int off_align : 8; 1369 1370 /* 24 bits unused. */ 1371 1372 /* DECL_ALIGN. It should have the same size as TYPE_ALIGN. */ 1373 unsigned int align; 1374 1375 /* UID for points-to sets, stable over copying from inlining. */ 1376 unsigned int pt_uid; 1377 1378 tree size_unit; 1379 tree initial; 1380 tree attributes; 1381 tree abstract_origin; 1382 1383 /* Points to a structure whose details depend on the language in use. */ 1384 struct lang_decl *lang_specific; 1385 }; 1386 1387 struct GTY(()) tree_decl_with_rtl { 1388 struct tree_decl_common common; 1389 rtx rtl; 1390 }; 1391 1392 struct GTY(()) tree_field_decl { 1393 struct tree_decl_common common; 1394 1395 tree offset; 1396 tree bit_field_type; 1397 tree qualifier; 1398 tree bit_offset; 1399 tree fcontext; 1400 }; 1401 1402 struct GTY(()) tree_label_decl { 1403 struct tree_decl_with_rtl common; 1404 int label_decl_uid; 1405 int eh_landing_pad_nr; 1406 }; 1407 1408 struct GTY(()) tree_result_decl { 1409 struct tree_decl_with_rtl common; 1410 }; 1411 1412 struct GTY(()) tree_const_decl { 1413 struct tree_decl_common common; 1414 }; 1415 1416 struct GTY(()) tree_parm_decl { 1417 struct tree_decl_with_rtl common; 1418 rtx incoming_rtl; 1419 }; 1420 1421 struct GTY(()) tree_decl_with_vis { 1422 struct tree_decl_with_rtl common; 1423 tree assembler_name; 1424 tree section_name; 1425 tree comdat_group; 1426 1427 /* Belong to VAR_DECL exclusively. */ 1428 unsigned defer_output : 1; 1429 unsigned hard_register : 1; 1430 unsigned common_flag : 1; 1431 unsigned in_text_section : 1; 1432 unsigned in_constant_pool : 1; 1433 unsigned dllimport_flag : 1; 1434 /* Don't belong to VAR_DECL exclusively. */ 1435 unsigned weak_flag : 1; 1436 /* When SECTION_NAME is implied by -ffunction-section. */ 1437 unsigned implicit_section_name_p : 1; 1438 1439 unsigned seen_in_bind_expr : 1; 1440 unsigned comdat_flag : 1; 1441 ENUM_BITFIELD(symbol_visibility) visibility : 2; 1442 unsigned visibility_specified : 1; 1443 /* Belongs to VAR_DECL exclusively. */ 1444 ENUM_BITFIELD(tls_model) tls_model : 3; 1445 1446 /* Belong to FUNCTION_DECL exclusively. */ 1447 unsigned init_priority_p : 1; 1448 /* Used by C++ only. Might become a generic decl flag. */ 1449 unsigned shadowed_for_var_p : 1; 1450 /* Belong to FUNCTION_DECL exclusively. */ 1451 unsigned cxx_constructor : 1; 1452 /* Belong to FUNCTION_DECL exclusively. */ 1453 unsigned cxx_destructor : 1; 1454 /* Belong to FUNCTION_DECL exclusively. */ 1455 unsigned final : 1; 1456 /* 11 unused bits. */ 1457 }; 1458 1459 struct GTY(()) tree_var_decl { 1460 struct tree_decl_with_vis common; 1461 }; 1462 1463 struct GTY(()) tree_decl_non_common { 1464 struct tree_decl_with_vis common; 1465 /* C++ uses this in namespaces. */ 1466 tree saved_tree; 1467 /* C++ uses this in templates. */ 1468 tree arguments; 1469 /* Almost all FE's use this. */ 1470 tree result; 1471 /* C++ uses this in namespaces and function_decls. */ 1472 tree vindex; 1473 }; 1474 1475 /* FUNCTION_DECL inherits from DECL_NON_COMMON because of the use of the 1476 arguments/result/saved_tree fields by front ends. It was either inherit 1477 FUNCTION_DECL from non_common, or inherit non_common from FUNCTION_DECL, 1478 which seemed a bit strange. */ 1479 1480 struct GTY(()) tree_function_decl { 1481 struct tree_decl_non_common common; 1482 1483 struct function *f; 1484 1485 /* The personality function. Used for stack unwinding. */ 1486 tree personality; 1487 1488 /* Function specific options that are used by this function. */ 1489 tree function_specific_target; /* target options */ 1490 tree function_specific_optimization; /* optimization options */ 1491 1492 /* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is 1493 DECL_FUNCTION_CODE. Otherwise unused. 1494 ??? The bitfield needs to be able to hold all target function 1495 codes as well. */ 1496 ENUM_BITFIELD(built_in_function) function_code : 11; 1497 ENUM_BITFIELD(built_in_class) built_in_class : 2; 1498 1499 unsigned static_ctor_flag : 1; 1500 unsigned static_dtor_flag : 1; 1501 unsigned uninlinable : 1; 1502 1503 unsigned possibly_inlined : 1; 1504 unsigned novops_flag : 1; 1505 unsigned returns_twice_flag : 1; 1506 unsigned malloc_flag : 1; 1507 unsigned operator_new_flag : 1; 1508 unsigned declared_inline_flag : 1; 1509 unsigned regdecl_flag : 1; 1510 unsigned no_inline_warning_flag : 1; 1511 1512 unsigned no_instrument_function_entry_exit : 1; 1513 unsigned no_limit_stack : 1; 1514 unsigned disregard_inline_limits : 1; 1515 unsigned pure_flag : 1; 1516 unsigned looping_const_or_pure_flag : 1; 1517 unsigned has_debug_args_flag : 1; 1518 unsigned tm_clone_flag : 1; 1519 unsigned versioned_function : 1; 1520 /* No bits left. */ 1521 }; 1522 1523 struct GTY(()) tree_translation_unit_decl { 1524 struct tree_decl_common common; 1525 /* Source language of this translation unit. Used for DWARF output. */ 1526 const char * GTY((skip(""))) language; 1527 /* TODO: Non-optimization used to build this translation unit. */ 1528 /* TODO: Root of a partial DWARF tree for global types and decls. */ 1529 }; 1530 1531 struct GTY(()) tree_type_decl { 1532 struct tree_decl_non_common common; 1533 1534 }; 1535 1536 struct GTY ((chain_next ("%h.next"), chain_prev ("%h.prev"))) tree_statement_list_node 1537 { 1538 struct tree_statement_list_node *prev; 1539 struct tree_statement_list_node *next; 1540 tree stmt; 1541 }; 1542 1543 struct GTY(()) tree_statement_list 1544 { 1545 struct tree_typed typed; 1546 struct tree_statement_list_node *head; 1547 struct tree_statement_list_node *tail; 1548 }; 1549 1550 1551 /* Optimization options used by a function. */ 1552 1553 struct GTY(()) tree_optimization_option { 1554 struct tree_common common; 1555 1556 /* The optimization options used by the user. */ 1557 struct cl_optimization opts; 1558 1559 /* Target optabs for this set of optimization options. This is of 1560 type `struct target_optabs *'. */ 1561 void *GTY ((atomic)) optabs; 1562 1563 /* The value of this_target_optabs against which the optabs above were 1564 generated. */ 1565 struct target_optabs *GTY ((skip)) base_optabs; 1566 }; 1567 1568 /* Forward declaration, defined in target-globals.h. */ 1569 1570 struct GTY(()) target_globals; 1571 1572 /* Target options used by a function. */ 1573 1574 struct GTY(()) tree_target_option { 1575 struct tree_common common; 1576 1577 /* Target globals for the corresponding target option. */ 1578 struct target_globals *globals; 1579 1580 /* The optimization options used by the user. */ 1581 struct cl_target_option opts; 1582 }; 1583 1584 /* Define the overall contents of a tree node. 1585 It may be any of the structures declared above 1586 for various types of node. */ 1587 union GTY ((ptr_alias (union lang_tree_node), 1588 desc ("tree_node_structure (&%h)"), variable_size)) tree_node { 1589 struct tree_base GTY ((tag ("TS_BASE"))) base; 1590 struct tree_typed GTY ((tag ("TS_TYPED"))) typed; 1591 struct tree_common GTY ((tag ("TS_COMMON"))) common; 1592 struct tree_int_cst GTY ((tag ("TS_INT_CST"))) int_cst; 1593 struct tree_real_cst GTY ((tag ("TS_REAL_CST"))) real_cst; 1594 struct tree_fixed_cst GTY ((tag ("TS_FIXED_CST"))) fixed_cst; 1595 struct tree_vector GTY ((tag ("TS_VECTOR"))) vector; 1596 struct tree_string GTY ((tag ("TS_STRING"))) string; 1597 struct tree_complex GTY ((tag ("TS_COMPLEX"))) complex; 1598 struct tree_identifier GTY ((tag ("TS_IDENTIFIER"))) identifier; 1599 struct tree_decl_minimal GTY((tag ("TS_DECL_MINIMAL"))) decl_minimal; 1600 struct tree_decl_common GTY ((tag ("TS_DECL_COMMON"))) decl_common; 1601 struct tree_decl_with_rtl GTY ((tag ("TS_DECL_WRTL"))) decl_with_rtl; 1602 struct tree_decl_non_common GTY ((tag ("TS_DECL_NON_COMMON"))) 1603 decl_non_common; 1604 struct tree_parm_decl GTY ((tag ("TS_PARM_DECL"))) parm_decl; 1605 struct tree_decl_with_vis GTY ((tag ("TS_DECL_WITH_VIS"))) decl_with_vis; 1606 struct tree_var_decl GTY ((tag ("TS_VAR_DECL"))) var_decl; 1607 struct tree_field_decl GTY ((tag ("TS_FIELD_DECL"))) field_decl; 1608 struct tree_label_decl GTY ((tag ("TS_LABEL_DECL"))) label_decl; 1609 struct tree_result_decl GTY ((tag ("TS_RESULT_DECL"))) result_decl; 1610 struct tree_const_decl GTY ((tag ("TS_CONST_DECL"))) const_decl; 1611 struct tree_type_decl GTY ((tag ("TS_TYPE_DECL"))) type_decl; 1612 struct tree_function_decl GTY ((tag ("TS_FUNCTION_DECL"))) function_decl; 1613 struct tree_translation_unit_decl GTY ((tag ("TS_TRANSLATION_UNIT_DECL"))) 1614 translation_unit_decl; 1615 struct tree_type_common GTY ((tag ("TS_TYPE_COMMON"))) type_common; 1616 struct tree_type_with_lang_specific GTY ((tag ("TS_TYPE_WITH_LANG_SPECIFIC"))) 1617 type_with_lang_specific; 1618 struct tree_type_non_common GTY ((tag ("TS_TYPE_NON_COMMON"))) 1619 type_non_common; 1620 struct tree_list GTY ((tag ("TS_LIST"))) list; 1621 struct tree_vec GTY ((tag ("TS_VEC"))) vec; 1622 struct tree_exp GTY ((tag ("TS_EXP"))) exp; 1623 struct tree_ssa_name GTY ((tag ("TS_SSA_NAME"))) ssa_name; 1624 struct tree_block GTY ((tag ("TS_BLOCK"))) block; 1625 struct tree_binfo GTY ((tag ("TS_BINFO"))) binfo; 1626 struct tree_statement_list GTY ((tag ("TS_STATEMENT_LIST"))) stmt_list; 1627 struct tree_constructor GTY ((tag ("TS_CONSTRUCTOR"))) constructor; 1628 struct tree_omp_clause GTY ((tag ("TS_OMP_CLAUSE"))) omp_clause; 1629 struct tree_optimization_option GTY ((tag ("TS_OPTIMIZATION"))) optimization; 1630 struct tree_target_option GTY ((tag ("TS_TARGET_OPTION"))) target_option; 1631 }; 1632 1633 /* Structure describing an attribute and a function to handle it. */ 1634 struct attribute_spec { 1635 /* The name of the attribute (without any leading or trailing __), 1636 or NULL to mark the end of a table of attributes. */ 1637 const char *name; 1638 /* The minimum length of the list of arguments of the attribute. */ 1639 int min_length; 1640 /* The maximum length of the list of arguments of the attribute 1641 (-1 for no maximum). */ 1642 int max_length; 1643 /* Whether this attribute requires a DECL. If it does, it will be passed 1644 from types of DECLs, function return types and array element types to 1645 the DECLs, function types and array types respectively; but when 1646 applied to a type in any other circumstances, it will be ignored with 1647 a warning. (If greater control is desired for a given attribute, 1648 this should be false, and the flags argument to the handler may be 1649 used to gain greater control in that case.) */ 1650 bool decl_required; 1651 /* Whether this attribute requires a type. If it does, it will be passed 1652 from a DECL to the type of that DECL. */ 1653 bool type_required; 1654 /* Whether this attribute requires a function (or method) type. If it does, 1655 it will be passed from a function pointer type to the target type, 1656 and from a function return type (which is not itself a function 1657 pointer type) to the function type. */ 1658 bool function_type_required; 1659 /* Function to handle this attribute. NODE points to the node to which 1660 the attribute is to be applied. If a DECL, it should be modified in 1661 place; if a TYPE, a copy should be created. NAME is the name of the 1662 attribute (possibly with leading or trailing __). ARGS is the TREE_LIST 1663 of the arguments (which may be NULL). FLAGS gives further information 1664 about the context of the attribute. Afterwards, the attributes will 1665 be added to the DECL_ATTRIBUTES or TYPE_ATTRIBUTES, as appropriate, 1666 unless *NO_ADD_ATTRS is set to true (which should be done on error, 1667 as well as in any other cases when the attributes should not be added 1668 to the DECL or TYPE). Depending on FLAGS, any attributes to be 1669 applied to another type or DECL later may be returned; 1670 otherwise the return value should be NULL_TREE. This pointer may be 1671 NULL if no special handling is required beyond the checks implied 1672 by the rest of this structure. */ 1673 tree (*handler) (tree *node, tree name, tree args, 1674 int flags, bool *no_add_attrs); 1675 /* Specifies if attribute affects type's identity. */ 1676 bool affects_type_identity; 1677 }; 1678 1679 /* These functions allow a front-end to perform a manual layout of a 1680 RECORD_TYPE. (For instance, if the placement of subsequent fields 1681 depends on the placement of fields so far.) Begin by calling 1682 start_record_layout. Then, call place_field for each of the 1683 fields. Then, call finish_record_layout. See layout_type for the 1684 default way in which these functions are used. */ 1685 typedef struct record_layout_info_s { 1686 /* The RECORD_TYPE that we are laying out. */ 1687 tree t; 1688 /* The offset into the record so far, in bytes, not including bits in 1689 BITPOS. */ 1690 tree offset; 1691 /* The last known alignment of SIZE. */ 1692 unsigned int offset_align; 1693 /* The bit position within the last OFFSET_ALIGN bits, in bits. */ 1694 tree bitpos; 1695 /* The alignment of the record so far, in bits. */ 1696 unsigned int record_align; 1697 /* The alignment of the record so far, ignoring #pragma pack and 1698 __attribute__ ((packed)), in bits. */ 1699 unsigned int unpacked_align; 1700 /* The previous field laid out. */ 1701 tree prev_field; 1702 /* The static variables (i.e., class variables, as opposed to 1703 instance variables) encountered in T. */ 1704 vec<tree, va_gc> *pending_statics; 1705 /* Bits remaining in the current alignment group */ 1706 int remaining_in_alignment; 1707 /* True if we've seen a packed field that didn't have normal 1708 alignment anyway. */ 1709 int packed_maybe_necessary; 1710 } *record_layout_info; 1711 1712 /* Iterator for going through the function arguments. */ 1713 struct function_args_iterator { 1714 tree next; /* TREE_LIST pointing to the next argument */ 1715 }; 1716 1717 /* Structures to map from a tree to another tree. */ 1718 struct GTY(()) tree_map_base { 1719 tree from; 1720 }; 1721 1722 /* Map from a tree to another tree. */ 1723 1724 struct GTY(()) tree_map { 1725 struct tree_map_base base; 1726 unsigned int hash; 1727 tree to; 1728 }; 1729 1730 /* Map from a decl tree to another tree. */ 1731 struct GTY(()) tree_decl_map { 1732 struct tree_map_base base; 1733 tree to; 1734 }; 1735 1736 /* Map from a tree to an int. */ 1737 struct GTY(()) tree_int_map { 1738 struct tree_map_base base; 1739 unsigned int to; 1740 }; 1741 1742 /* Map from a tree to initialization/finalization priorities. */ 1743 struct GTY(()) tree_priority_map { 1744 struct tree_map_base base; 1745 priority_type init; 1746 priority_type fini; 1747 }; 1748 1749 /* Map from a decl tree to a tree vector. */ 1750 struct GTY(()) tree_vec_map { 1751 struct tree_map_base base; 1752 vec<tree, va_gc> *to; 1753 }; 1754 1755 /* Abstract iterators for CALL_EXPRs. These static inline definitions 1756 have to go towards the end of tree.h so that union tree_node is fully 1757 defined by this point. */ 1758 1759 /* Structure containing iterator state. */ 1760 struct call_expr_arg_iterator { 1761 tree t; /* the call_expr */ 1762 int n; /* argument count */ 1763 int i; /* next argument index */ 1764 }; 1765 1766 struct const_call_expr_arg_iterator { 1767 const_tree t; /* the call_expr */ 1768 int n; /* argument count */ 1769 int i; /* next argument index */ 1770 }; 1771 1772 /* The builtin_info structure holds the FUNCTION_DECL of the standard builtin 1773 function, and a flag that says if the function is available implicitly, or 1774 whether the user has to code explicit calls to __builtin_<xxx>. */ 1775 struct GTY(()) builtin_info_type { 1776 tree decl[(int)END_BUILTINS]; 1777 bool implicit_p[(int)END_BUILTINS]; 1778 }; 1779 1780 1781 /*--------------------------------------------------------------------------- 1782 Global variables 1783 ---------------------------------------------------------------------------*/ 1784 /* Matrix describing the structures contained in a given tree code. */ 1785 extern unsigned char tree_contains_struct[MAX_TREE_CODES][64]; 1786 1787 /* Class of tree given its code. */ 1788 extern const enum tree_code_class tree_code_type[]; 1789 1790 /* Each tree code class has an associated string representation. 1791 These must correspond to the tree_code_class entries. */ 1792 extern const char *const tree_code_class_strings[]; 1793 1794 /* Number of argument-words in each kind of tree-node. */ 1795 extern const unsigned char tree_code_length[]; 1796 1797 /* Vector of all alias pairs for global symbols. */ 1798 extern GTY(()) vec<alias_pair, va_gc> *alias_pairs; 1799 1800 /* Names of all the built_in classes. */ 1801 extern const char *const built_in_class_names[BUILT_IN_LAST]; 1802 1803 /* Names of all the built_in functions. */ 1804 extern const char * built_in_names[(int) END_BUILTINS]; 1805 1806 /* Number of operands and names for each OMP_CLAUSE node. */ 1807 extern unsigned const char omp_clause_num_ops[]; 1808 extern const char * const omp_clause_code_name[]; 1809 1810 /* A vector of all translation-units. */ 1811 extern GTY (()) vec<tree, va_gc> *all_translation_units; 1812 1813 /* Vector of standard trees used by the C compiler. */ 1814 extern GTY(()) tree global_trees[TI_MAX]; 1815 1816 /* The standard C integer types. Use integer_type_kind to index into 1817 this array. */ 1818 extern GTY(()) tree integer_types[itk_none]; 1819 1820 /* Types used to represent sizes. */ 1821 extern GTY(()) tree sizetype_tab[(int) stk_type_kind_last]; 1822 1823 /* Arrays for keeping track of tree node statistics. */ 1824 extern int tree_node_counts[]; 1825 extern int tree_node_sizes[]; 1826 1827 /* True if we are in gimple form and the actions of the folders need to 1828 be restricted. False if we are not in gimple form and folding is not 1829 restricted to creating gimple expressions. */ 1830 extern bool in_gimple_form; 1831 1832 /* Functional interface to the builtin functions. */ 1833 extern GTY(()) builtin_info_type builtin_info; 1834 1835 /* If nonzero, an upper limit on alignment of structure fields, in bits, */ 1836 extern unsigned int maximum_field_alignment; 1837 1838 /* Nonzero means lvalues are limited to those valid in pedantic ANSI C. 1839 Zero means allow extended lvalues. */ 1840 extern int pedantic_lvalues; 1841 1842 /* Points to the FUNCTION_DECL of the function whose body we are reading. */ 1843 extern GTY(()) tree current_function_decl; 1844 1845 /* Nonzero means a FUNC_BEGIN label was emitted. */ 1846 extern GTY(()) const char * current_function_func_begin_label; 1847 1848 #endif // GCC_TREE_CORE_H 1849