20 #ifndef GCC_TREE_CORE_H
21 #define GCC_TREE_CORE_H
58 #define ECF_CONST (1 << 0)
63 #define ECF_PURE (1 << 1)
68 #define ECF_LOOPING_CONST_OR_PURE (1 << 2)
71 #define ECF_NORETURN (1 << 3)
74 #define ECF_MALLOC (1 << 4)
77 #define ECF_MAY_BE_ALLOCA (1 << 5)
80 #define ECF_NOTHROW (1 << 6)
83 #define ECF_RETURNS_TWICE (1 << 7)
86 #define ECF_SIBCALL (1 << 8)
90 #define ECF_NOVOPS (1 << 9)
93 #define ECF_LEAF (1 << 10)
96 #define ECF_TM_PURE (1 << 11)
99 #define ECF_TM_BUILTIN (1 << 12)
104 #define EAF_DIRECT (1 << 0)
107 #define EAF_NOCLOBBER (1 << 1)
110 #define EAF_NOESCAPE (1 << 2)
113 #define EAF_UNUSED (1 << 3)
118 #define ERF_RETURN_ARG_MASK (3)
122 #define ERF_RETURNS_ARG (1 << 2)
126 #define ERF_NOALIAS (1 << 3)
133 #define DEFTREECODE(SYM, STRING, TYPE, NARGS) SYM,
134 #define END_OF_BASE_TREE_CODES LAST_AND_UNUSED_TREE_CODE,
137 #include "all-tree.def"
142 #undef END_OF_BASE_TREE_CODES
145 #define NUM_TREE_CODES \
146 ((int) LAST_AND_UNUSED_TREE_CODE)
148 #define CODE_CONTAINS_STRUCT(CODE, STRUCT) \
149 (tree_contains_struct[(CODE)][(STRUCT)])
163 #define BUILT_IN_LAST (BUILT_IN_NORMAL + 1)
167 #define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND) ENUM,
169 #include "builtins.def"
176 + MAX_MODE_COMPLEX_FLOAT
177 - MIN_MODE_COMPLEX_FLOAT,
181 = BUILT_IN_COMPLEX_DIV_MIN
182 + MAX_MODE_COMPLEX_FLOAT
183 - MIN_MODE_COMPLEX_FLOAT,
341 #define DEFTREESTRUCT(ENUM, NAME) ENUM,
343 #include "treestruct.def"
375 #ifndef SYMBOL_VISIBILITY_DEFINED
376 #define SYMBOL_VISIBILITY_DEFINED
383 #endif // SYMBOL_VISIBILITY_DEFINED
706 unsigned side_effects_flag : 1;
707 unsigned constant_flag : 1;
708 unsigned addressable_flag : 1;
709 unsigned volatile_flag : 1;
710 unsigned readonly_flag : 1;
711 unsigned asm_written_flag: 1;
712 unsigned nowarning_flag : 1;
715 unsigned used_flag : 1;
716 unsigned nothrow_flag : 1;
717 unsigned static_flag : 1;
718 unsigned public_flag : 1;
719 unsigned private_flag : 1;
720 unsigned protected_flag : 1;
721 unsigned deprecated_flag : 1;
722 unsigned default_def_flag : 1;
728 unsigned lang_flag_0 : 1;
729 unsigned lang_flag_1 : 1;
730 unsigned lang_flag_2 : 1;
731 unsigned lang_flag_3 : 1;
732 unsigned lang_flag_4 : 1;
733 unsigned lang_flag_5 : 1;
734 unsigned lang_flag_6 : 1;
735 unsigned saturating_flag : 1;
737 unsigned unsigned_flag : 1;
738 unsigned packed_flag : 1;
739 unsigned user_align : 1;
740 unsigned nameless_flag : 1;
748 unsigned address_space : 8;
756 unsigned int version;
1059 tree GTY ((length (
"TYPE_VECTOR_SUBPARTS (TREE_TYPE ((tree)&%h))"))) elts[1];
1064 struct ht_identifier
id;
1075 tree GTY ((length (
"TREE_VEC_LENGTH ((tree)&%h)"))) a[1];
1125 desc (
"TREE_CODE ((tree) &%0)")))
1132 struct ssa_use_operand_d* GTY((skip(
"")))
prev;
1133 struct ssa_use_operand_d* GTY((skip(
"")))
next;
1143 struct GTY(()) tree_ssa_name {
1153 union ssa_name_info_type {
1158 } GTY ((desc (
"%1.typed.type ?" \
1159 "!POINTER_TYPE_P (TREE_TYPE ((tree)&%1)) : 2"))) info;
1162 struct ssa_use_operand_d imm_uses;
1165 struct GTY(()) phi_arg_d {
1168 struct ssa_use_operand_d imm_use;
1173 struct GTY(()) tree_omp_clause {
1177 union omp_clause_subcode {
1184 } GTY ((skip)) subcode;
1199 unsigned abstract_flag : 1;
1200 unsigned block_num : 31;
1209 tree abstract_origin;
1211 tree fragment_chain;
1214 struct GTY(()) tree_type_common {
1221 unsigned int precision : 10;
1222 unsigned no_force_blk_flag : 1;
1223 unsigned needs_constructing_flag : 1;
1224 unsigned transparent_aggr_flag : 1;
1225 unsigned restrict_flag : 1;
1226 unsigned contains_placeholder_bits : 2;
1228 ENUM_BITFIELD(machine_mode) mode : 8;
1230 unsigned string_flag : 1;
1231 unsigned lang_flag_0 : 1;
1232 unsigned lang_flag_1 : 1;
1233 unsigned lang_flag_2 : 1;
1234 unsigned lang_flag_3 : 1;
1235 unsigned lang_flag_4 : 1;
1236 unsigned lang_flag_5 : 1;
1237 unsigned lang_flag_6 : 1;
1243 union tree_type_symtab {
1244 int GTY ((tag (
"TYPE_SYMTAB_IS_ADDRESS"))) address;
1245 const char * GTY ((tag (
"TYPE_SYMTAB_IS_POINTER"))) pointer;
1246 struct die_struct * GTY ((tag (
"TYPE_SYMTAB_IS_DIE"))) die;
1247 } GTY ((desc (
"debug_hooks->tree_type_symtab_field"))) symtab;
1255 struct GTY(()) tree_type_with_lang_specific {
1256 struct tree_type_common common;
1261 struct GTY(()) tree_type_non_common {
1262 struct tree_type_with_lang_specific with_lang_specific;
1269 struct GTY (()) tree_binfo {
1285 struct GTY(()) tree_decl_minimal {
1293 struct GTY(()) tree_decl_common {
1294 struct tree_decl_minimal common;
1297 ENUM_BITFIELD(machine_mode) mode : 8;
1299 unsigned nonlocal_flag : 1;
1300 unsigned virtual_flag : 1;
1301 unsigned ignored_flag : 1;
1302 unsigned abstract_flag : 1;
1303 unsigned artificial_flag : 1;
1304 unsigned preserve_flag: 1;
1305 unsigned debug_expr_is_from : 1;
1307 unsigned lang_flag_0 : 1;
1308 unsigned lang_flag_1 : 1;
1309 unsigned lang_flag_2 : 1;
1310 unsigned lang_flag_3 : 1;
1311 unsigned lang_flag_4 : 1;
1312 unsigned lang_flag_5 : 1;
1313 unsigned lang_flag_6 : 1;
1314 unsigned lang_flag_7 : 1;
1315 unsigned lang_flag_8 : 1;
1318 unsigned decl_flag_0 : 1;
1322 unsigned decl_flag_1 : 1;
1326 unsigned decl_flag_2 : 1;
1328 unsigned decl_flag_3 : 1;
1331 unsigned gimple_reg_flag : 1;
1333 unsigned decl_by_reference_flag : 1;
1335 unsigned decl_read_flag : 1;
1337 unsigned decl_nonshareable_flag : 1;
1340 unsigned int off_align : 8;
1348 unsigned int pt_uid;
1353 tree abstract_origin;
1359 struct GTY(()) tree_decl_with_rtl {
1360 struct tree_decl_common common;
1364 struct GTY(()) tree_field_decl {
1365 struct tree_decl_common common;
1368 tree bit_field_type;
1374 struct GTY(()) tree_label_decl {
1375 struct tree_decl_with_rtl common;
1377 int eh_landing_pad_nr;
1380 struct GTY(()) tree_result_decl {
1381 struct tree_decl_with_rtl common;
1384 struct GTY(()) tree_const_decl {
1385 struct tree_decl_common common;
1388 struct GTY(()) tree_parm_decl {
1389 struct tree_decl_with_rtl common;
1393 struct GTY(()) tree_decl_with_vis {
1394 struct tree_decl_with_rtl common;
1395 tree assembler_name;
1400 unsigned defer_output : 1;
1401 unsigned hard_register : 1;
1402 unsigned common_flag : 1;
1403 unsigned in_text_section : 1;
1404 unsigned in_constant_pool : 1;
1405 unsigned dllimport_flag : 1;
1407 unsigned weak_flag : 1;
1409 unsigned implicit_section_name_p : 1;
1411 unsigned seen_in_bind_expr : 1;
1412 unsigned comdat_flag : 1;
1414 unsigned visibility_specified : 1;
1419 unsigned init_priority_p : 1;
1421 unsigned shadowed_for_var_p : 1;
1423 unsigned cxx_constructor : 1;
1425 unsigned cxx_destructor : 1;
1431 struct GTY(()) tree_var_decl {
1432 struct tree_decl_with_vis common;
1435 struct GTY(()) tree_decl_non_common {
1436 struct tree_decl_with_vis common;
1452 struct GTY(()) tree_function_decl {
1453 struct tree_decl_non_common common;
1461 tree function_specific_target;
1462 tree function_specific_optimization;
1471 unsigned static_ctor_flag : 1;
1472 unsigned static_dtor_flag : 1;
1473 unsigned uninlinable : 1;
1475 unsigned possibly_inlined : 1;
1476 unsigned novops_flag : 1;
1477 unsigned returns_twice_flag : 1;
1478 unsigned malloc_flag : 1;
1479 unsigned operator_new_flag : 1;
1480 unsigned declared_inline_flag : 1;
1481 unsigned regdecl_flag : 1;
1482 unsigned no_inline_warning_flag : 1;
1484 unsigned no_instrument_function_entry_exit : 1;
1485 unsigned no_limit_stack : 1;
1486 unsigned disregard_inline_limits : 1;
1487 unsigned pure_flag : 1;
1488 unsigned looping_const_or_pure_flag : 1;
1489 unsigned has_debug_args_flag : 1;
1490 unsigned tm_clone_flag : 1;
1491 unsigned versioned_function : 1;
1495 struct GTY(()) tree_translation_unit_decl {
1496 struct tree_decl_common common;
1498 const char * GTY((skip(
""))) language;
1503 struct GTY(()) tree_type_decl {
1504 struct tree_decl_non_common common;
1508 struct GTY ((chain_next ("%h.next
"), chain_prev ("%h.prev
"))) tree_statement_list_node
1510 struct tree_statement_list_node *prev;
1511 struct tree_statement_list_node *next;
1515 struct GTY(()) tree_statement_list
1517 struct tree_typed typed;
1518 struct tree_statement_list_node *head;
1519 struct tree_statement_list_node *tail;
1523 /* Optimization options used by a function. */
1525 struct GTY(()) tree_optimization_option {
1526 struct tree_common common;
1528 /* The optimization options used by the user. */
1529 struct cl_optimization opts;
1531 /* Target optabs for this set of optimization options. This is of
1532 type `struct target_optabs *'. */
1533 unsigned char *GTY ((atomic)) optabs;
1535 /* The value of this_target_optabs against which the optabs above were
1537 struct target_optabs *GTY ((skip)) base_optabs;
1540 /* Target options used by a function. */
1542 struct GTY(()) tree_target_option {
1543 struct tree_common common;
1545 /* The optimization options used by the user. */
1546 struct cl_target_option opts;
1549 /* Define the overall contents of a tree node.
1550 It may be any of the structures declared above
1551 for various types of node. */
1552 union GTY ((ptr_alias (union lang_tree_node),
1554 struct tree_base GTY ((tag ("TS_BASE
"))) base;
1555 struct tree_typed GTY ((tag ("TS_TYPED
"))) typed;
1556 struct tree_common GTY ((tag ("TS_COMMON
"))) common;
1557 struct tree_int_cst GTY ((tag ("TS_INT_CST
"))) int_cst;
1558 struct tree_real_cst GTY ((tag ("TS_REAL_CST
"))) real_cst;
1559 struct tree_fixed_cst GTY ((tag ("TS_FIXED_CST
"))) fixed_cst;
1560 struct tree_vector GTY ((tag ("TS_VECTOR
"))) vector;
1561 struct tree_string GTY ((tag ("TS_STRING
"))) string;
1562 struct tree_complex GTY ((tag ("TS_COMPLEX
"))) complex;
1563 struct tree_identifier GTY ((tag ("TS_IDENTIFIER
"))) identifier;
1564 struct tree_decl_minimal GTY((tag ("TS_DECL_MINIMAL
"))) decl_minimal;
1565 struct tree_decl_common GTY ((tag ("TS_DECL_COMMON
"))) decl_common;
1566 struct tree_decl_with_rtl GTY ((tag ("TS_DECL_WRTL
"))) decl_with_rtl;
1567 struct tree_decl_non_common GTY ((tag ("TS_DECL_NON_COMMON
")))
1569 struct tree_parm_decl GTY ((tag ("TS_PARM_DECL
"))) parm_decl;
1570 struct tree_decl_with_vis GTY ((tag ("TS_DECL_WITH_VIS
"))) decl_with_vis;
1571 struct tree_var_decl GTY ((tag ("TS_VAR_DECL
"))) var_decl;
1572 struct tree_field_decl GTY ((tag ("TS_FIELD_DECL
"))) field_decl;
1573 struct tree_label_decl GTY ((tag ("TS_LABEL_DECL
"))) label_decl;
1574 struct tree_result_decl GTY ((tag ("TS_RESULT_DECL
"))) result_decl;
1575 struct tree_const_decl GTY ((tag ("TS_CONST_DECL
"))) const_decl;
1576 struct tree_type_decl GTY ((tag ("TS_TYPE_DECL
"))) type_decl;
1577 struct tree_function_decl GTY ((tag ("TS_FUNCTION_DECL
"))) function_decl;
1578 struct tree_translation_unit_decl GTY ((tag ("TS_TRANSLATION_UNIT_DECL
")))
1579 translation_unit_decl;
1580 struct tree_type_common GTY ((tag ("TS_TYPE_COMMON
"))) type_common;
1581 struct tree_type_with_lang_specific GTY ((tag ("TS_TYPE_WITH_LANG_SPECIFIC
")))
1582 type_with_lang_specific;
1583 struct tree_type_non_common GTY ((tag ("TS_TYPE_NON_COMMON
")))
1585 struct tree_list GTY ((tag ("TS_LIST
"))) list;
1586 struct tree_vec GTY ((tag ("TS_VEC
"))) vec;
1587 struct tree_exp GTY ((tag ("TS_EXP
"))) exp;
1588 struct tree_ssa_name GTY ((tag ("TS_SSA_NAME
"))) ssa_name;
1589 struct tree_block GTY ((tag ("TS_BLOCK
"))) block;
1590 struct tree_binfo GTY ((tag ("TS_BINFO
"))) binfo;
1591 struct tree_statement_list GTY ((tag ("TS_STATEMENT_LIST
"))) stmt_list;
1592 struct tree_constructor GTY ((tag ("TS_CONSTRUCTOR
"))) constructor;
1593 struct tree_omp_clause GTY ((tag ("TS_OMP_CLAUSE
"))) omp_clause;
1594 struct tree_optimization_option GTY ((tag ("TS_OPTIMIZATION
"))) optimization;
1595 struct tree_target_option GTY ((tag ("TS_TARGET_OPTION
"))) target_option;
1598 /* Structure describing an attribute and a function to handle it. */
1599 struct attribute_spec {
1600 /* The name of the attribute (without any leading or trailing __),
1601 or NULL to mark the end of a table of attributes. */
1603 /* The minimum length of the list of arguments of the attribute. */
1605 /* The maximum length of the list of arguments of the attribute
1606 (-1 for no maximum). */
1608 /* Whether this attribute requires a DECL. If it does, it will be passed
1609 from types of DECLs, function return types and array element types to
1610 the DECLs, function types and array types respectively; but when
1611 applied to a type in any other circumstances, it will be ignored with
1612 a warning. (If greater control is desired for a given attribute,
1613 this should be false, and the flags argument to the handler may be
1614 used to gain greater control in that case.) */
1616 /* Whether this attribute requires a type. If it does, it will be passed
1617 from a DECL to the type of that DECL. */
1619 /* Whether this attribute requires a function (or method) type. If it does,
1620 it will be passed from a function pointer type to the target type,
1621 and from a function return type (which is not itself a function
1622 pointer type) to the function type. */
1623 bool function_type_required;
1624 /* Function to handle this attribute. NODE points to the node to which
1625 the attribute is to be applied. If a DECL, it should be modified in
1626 place; if a TYPE, a copy should be created. NAME is the name of the
1627 attribute (possibly with leading or trailing __). ARGS is the TREE_LIST
1628 of the arguments (which may be NULL). FLAGS gives further information
1629 about the context of the attribute. Afterwards, the attributes will
1630 be added to the DECL_ATTRIBUTES or TYPE_ATTRIBUTES, as appropriate,
1631 unless *NO_ADD_ATTRS is set to true (which should be done on error,
1632 as well as in any other cases when the attributes should not be added
1633 to the DECL or TYPE). Depending on FLAGS, any attributes to be
1634 applied to another type or DECL later may be returned;
1635 otherwise the return value should be NULL_TREE. This pointer may be
1636 NULL if no special handling is required beyond the checks implied
1637 by the rest of this structure. */
1638 tree (*handler) (tree *node, tree name, tree args,
1639 int flags, bool *no_add_attrs);
1640 /* Specifies if attribute affects type's identity. */
1641 bool affects_type_identity;
1644 /* These functions allow a front-end to perform a manual layout of a
1645 RECORD_TYPE. (For instance, if the placement of subsequent fields
1646 depends on the placement of fields so far.) Begin by calling
1647 start_record_layout. Then, call place_field for each of the
1648 fields. Then, call finish_record_layout. See layout_type for the
1649 default way in which these functions are used. */
1650 typedef struct record_layout_info_s {
1651 /* The RECORD_TYPE that we are laying out. */
1653 /* The offset into the record so far, in bytes, not including bits in
1656 /* The last known alignment of SIZE. */
1657 unsigned int offset_align;
1658 /* The bit position within the last OFFSET_ALIGN bits, in bits. */
1660 /* The alignment of the record so far, in bits. */
1661 unsigned int record_align;
1662 /* The alignment of the record so far, ignoring #pragma pack and
1663 __attribute__ ((packed)), in bits. */
1664 unsigned int unpacked_align;
1665 /* The previous field laid out. */
1667 /* The static variables (i.e., class variables, as opposed to
1668 instance variables) encountered in T. */
1669 vec<tree, va_gc> *pending_statics;
1670 /* Bits remaining in the current alignment group */
1671 int remaining_in_alignment;
1672 /* True if we've seen a packed field that didn't have normal
1673 alignment anyway. */
1674 int packed_maybe_necessary;
1675 } *record_layout_info;
1677 /* Iterator for going through the function arguments. */
1678 struct function_args_iterator {
1679 tree next; /* TREE_LIST pointing to the next argument */
1682 /* Structures to map from a tree to another tree. */
1683 struct GTY(()) tree_map_base {
1687 /* Map from a tree to another tree. */
1689 struct GTY(()) tree_map {
1690 struct tree_map_base base;
1695 /* Map from a decl tree to another tree. */
1696 struct GTY(()) tree_decl_map {
1697 struct tree_map_base base;
1701 /* Map from a tree to an int. */
1702 struct GTY(()) tree_int_map {
1703 struct tree_map_base base;
1707 /* Map from a tree to initialization/finalization priorities. */
1708 struct GTY(()) tree_priority_map {
1709 struct tree_map_base base;
1714 /* Map from a decl tree to a tree vector. */
1715 struct GTY(()) tree_vec_map {
1716 struct tree_map_base base;
1717 vec<tree, va_gc> *to;
1720 /* Abstract iterators for CALL_EXPRs. These static inline definitions
1721 have to go towards the end of tree.h so that union tree_node is fully
1722 defined by this point. */
1724 /* Structure containing iterator state. */
1725 struct call_expr_arg_iterator {
1726 tree t; /* the call_expr */
1727 int n; /* argument count */
1728 int i; /* next argument index */
1731 struct const_call_expr_arg_iterator {
1732 const_tree t; /* the call_expr */
1733 int n; /* argument count */
1734 int i; /* next argument index */
1737 /* The builtin_info structure holds the FUNCTION_DECL of the standard builtin
1738 function, and a flag that says if the function is available implicitly, or
1739 whether the user has to code explicit calls to __builtin_<xxx>. */
1740 struct GTY(()) builtin_info_type {
1741 tree decl[(int)END_BUILTINS];
1742 bool implicit_p[(int)END_BUILTINS];
1746 /*---------------------------------------------------------------------------
1748 ---------------------------------------------------------------------------*/
1749 /* Matrix describing the structures contained in a given tree code. */
1750 extern unsigned char tree_contains_struct[MAX_TREE_CODES][64];
1752 /* Class of tree given its code. */
1753 extern const enum tree_code_class tree_code_type[];
1755 /* Each tree code class has an associated string representation.
1756 These must correspond to the tree_code_class entries. */
1757 extern const char *const tree_code_class_strings[];
1759 /* Number of argument-words in each kind of tree-node. */
1760 extern const unsigned char tree_code_length[];
1762 /* Vector of all alias pairs for global symbols. */
1763 extern GTY(()) vec<alias_pair, va_gc> *alias_pairs;
1765 /* Names of all the built_in classes. */
1766 extern const char *const built_in_class_names[BUILT_IN_LAST];
1768 /* Names of all the built_in functions. */
1769 extern const char * built_in_names[(int) END_BUILTINS];
1771 /* Number of operands and names for each OMP_CLAUSE node. */
1772 extern unsigned const char omp_clause_num_ops[];
1773 extern const char * const omp_clause_code_name[];
1775 /* A vector of all translation-units. */
1776 extern GTY (()) vec<tree, va_gc> *all_translation_units;
1778 /* Vector of standard trees used by the C compiler. */
1779 extern GTY(()) tree global_trees[TI_MAX];
1781 /* The standard C integer types. Use integer_type_kind to index into
1783 extern GTY(()) tree integer_types[itk_none];
1785 /* Types used to represent sizes. */
1786 extern GTY(()) tree sizetype_tab[(int) stk_type_kind_last];
1788 /* Arrays for keeping track of tree node statistics. */
1789 extern int tree_node_counts[];
1790 extern int tree_node_sizes[];
1792 /* True if we are in gimple form and the actions of the folders need to
1793 be restricted. False if we are not in gimple form and folding is not
1794 restricted to creating gimple expressions. */
1795 extern bool in_gimple_form;
1797 /* Functional interface to the builtin functions. */
1798 extern GTY(()) builtin_info_type builtin_info;
1800 /* If nonzero, an upper limit on alignment of structure fields, in bits, */
1801 extern unsigned int maximum_field_alignment;
1803 /* Nonzero means lvalues are limited to those valid in pedantic ANSI C.
1804 Zero means allow extended lvalues. */
1805 extern int pedantic_lvalues;
1807 /* Points to the FUNCTION_DECL of the function whose body we are reading. */
1808 extern GTY(()) tree current_function_decl;
1810 /* Nonzero means a FUNC_BEGIN label was emitted. */
1811 extern GTY(()) const char * current_function_func_begin_label;
1813 #endif // GCC_TREE_CORE_H