From: Nathan Sidwell Date: Wed, 16 Aug 2017 19:42:28 +0000 (+0000) Subject: tree-core.h (tree_type_non_common): Rename binfo to lang_1. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8e093270e1cc952291c76a72b11aef538ed2830d;p=gcc.git tree-core.h (tree_type_non_common): Rename binfo to lang_1. * tree-core.h (tree_type_non_common): Rename binfo to lang_1. * tree.h (TYPE_BINFO): Use type_non_common.maxval. (TYPE_LANG_SLOT_1): Use type_non_common.lang_1, for any type. * tree.c (free_lang_data_in_type): Use else-if chain. Always clear TYPE_LANG_1. Remove obsolete member-function stripping. (find_decls_types_r): Comment about TYPE_MAX_VALUES_RAW. (verify_type): Adjust for TYPE_BINFO move. * lto-streamer-out.c (DFS::DFS_write_tree_body): No need to process TYPE_BINFO directly. (hash_tree): Likewise. * tree-streamer-in.c (lto_input_ts_type_non_common_tree_pointers): Likewise. * tree-streamer-out.c (write_ts_type_non_common_tree_pointers): Likewise. lto/ * lto.c (mentions_vars_p_type): Use TYPE_LANG_SLOT_1. (compare_tree_sccs_1): No need to compare TYPE_BINFO directly. (lto_fixup_prevailing_decls): Use TYPE_LANG_SLOT_1. From-SVN: r251129 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 340d4304593..f4ef9ad8791 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +2017-08-16 Nathan Sidwell + + * tree-core.h (tree_type_non_common): Rename binfo to lang_1. + * tree.h (TYPE_BINFO): Use type_non_common.maxval. + (TYPE_LANG_SLOT_1): Use type_non_common.lang_1, for any type. + * tree.c (free_lang_data_in_type): Use else-if chain. Always + clear TYPE_LANG_1. Remove obsolete member-function stripping. + (find_decls_types_r): Comment about TYPE_MAX_VALUES_RAW. + (verify_type): Adjust for TYPE_BINFO move. + * lto-streamer-out.c (DFS::DFS_write_tree_body): No need to + process TYPE_BINFO directly. + (hash_tree): Likewise. + * tree-streamer-in.c (lto_input_ts_type_non_common_tree_pointers): + Likewise. + * tree-streamer-out.c (write_ts_type_non_common_tree_pointers): + Likewise. + + lto/ + * lto.c (mentions_vars_p_type): Use TYPE_LANG_SLOT_1. + (compare_tree_sccs_1): No need to compare TYPE_BINFO directly. + (lto_fixup_prevailing_decls): Use TYPE_LANG_SLOT_1. + 2017-08-16 David Malcolm * diagnostic-show-locus.c (colorizer::m_caret): Remove unused diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 41fba318cb5..5988af52b2a 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -837,8 +837,6 @@ DFS::DFS_write_tree_body (struct output_block *ob, if (!POINTER_TYPE_P (expr)) DFS_follow_tree_edge (TYPE_MIN_VALUE_RAW (expr)); DFS_follow_tree_edge (TYPE_MAX_VALUE_RAW (expr)); - if (RECORD_OR_UNION_TYPE_P (expr)) - DFS_follow_tree_edge (TYPE_BINFO (expr)); } if (CODE_CONTAINS_STRUCT (code, TS_LIST)) @@ -1273,8 +1271,6 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map *map, if (!POINTER_TYPE_P (t)) visit (TYPE_MIN_VALUE_RAW (t)); visit (TYPE_MAX_VALUE_RAW (t)); - if (RECORD_OR_UNION_TYPE_P (t)) - visit (TYPE_BINFO (t)); } if (CODE_CONTAINS_STRUCT (code, TS_LIST)) diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index baeeb393d9b..eb2a5daad99 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2017-08-16 Nathan Sidwell + + * lto.c (mentions_vars_p_type): Use TYPE_LANG_SLOT_1. + (compare_tree_sccs_1): No need to compare TYPE_BINFO directly. + (lto_fixup_prevailing_decls): Use TYPE_LANG_SLOT_1. + 2017-08-08 Tom de Vries * lto.c: Include attribs.h. diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 31d1488dc86..2064423418d 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -651,7 +651,7 @@ mentions_vars_p_type (tree t) CHECK_VAR (TYPE_MAX_VALUE_RAW (t)); /* Accessor is for derived node types only. */ - CHECK_NO_VAR (t->type_non_common.binfo); + CHECK_NO_VAR (TYPE_LANG_SLOT_1 (t)); CHECK_VAR (TYPE_CONTEXT (t)); CHECK_NO_VAR (TYPE_CANONICAL (t)); @@ -1410,7 +1410,6 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map) f1 || f2; f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2)) compare_tree_edges (f1, f2); - compare_tree_edges (TYPE_BINFO (t1), TYPE_BINFO (t2)); } else if (code == FUNCTION_TYPE || code == METHOD_TYPE) @@ -2584,7 +2583,7 @@ lto_fixup_prevailing_decls (tree t) LTO_SET_PREVAIL (TYPE_MIN_VALUE_RAW (t)); LTO_SET_PREVAIL (TYPE_MAX_VALUE_RAW (t)); - LTO_NO_PREVAIL (t->type_non_common.binfo); + LTO_NO_PREVAIL (TYPE_LANG_SLOT_1 (t)); LTO_SET_PREVAIL (TYPE_CONTEXT (t)); diff --git a/gcc/tree-core.h b/gcc/tree-core.h index 278d0c9b8f8..5b9ca387565 100644 --- a/gcc/tree-core.h +++ b/gcc/tree-core.h @@ -1552,7 +1552,7 @@ struct GTY(()) tree_type_non_common { tree values; tree minval; tree maxval; - tree binfo; + tree lang_1; }; struct GTY (()) tree_binfo { diff --git a/gcc/tree-streamer-in.c b/gcc/tree-streamer-in.c index 600470080aa..4a49d924e7b 100644 --- a/gcc/tree-streamer-in.c +++ b/gcc/tree-streamer-in.c @@ -841,8 +841,6 @@ lto_input_ts_type_non_common_tree_pointers (struct lto_input_block *ib, if (!POINTER_TYPE_P (expr)) TYPE_MIN_VALUE_RAW (expr) = stream_read_tree (ib, data_in); TYPE_MAX_VALUE_RAW (expr) = stream_read_tree (ib, data_in); - if (RECORD_OR_UNION_TYPE_P (expr)) - TYPE_BINFO (expr) = stream_read_tree (ib, data_in); } diff --git a/gcc/tree-streamer-out.c b/gcc/tree-streamer-out.c index ec47a9b8040..32b23461dfd 100644 --- a/gcc/tree-streamer-out.c +++ b/gcc/tree-streamer-out.c @@ -706,8 +706,6 @@ write_ts_type_non_common_tree_pointers (struct output_block *ob, tree expr, if (!POINTER_TYPE_P (expr)) stream_write_tree (ob, TYPE_MIN_VALUE_RAW (expr), ref_p); stream_write_tree (ob, TYPE_MAX_VALUE_RAW (expr), ref_p); - if (RECORD_OR_UNION_TYPE_P (expr)) - stream_write_tree (ob, TYPE_BINFO (expr), ref_p); } diff --git a/gcc/tree.c b/gcc/tree.c index c493edd561d..31fe31fb537 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4890,9 +4890,7 @@ free_lang_data_in_type (tree type) leading to false ODR violation errors when merging two instances of the same function signature compiled by different front ends. */ - tree p; - - for (p = TYPE_ARG_TYPES (type); p; p = TREE_CHAIN (p)) + for (tree p = TYPE_ARG_TYPES (type); p; p = TREE_CHAIN (p)) { tree arg_type = TREE_VALUE (p); @@ -4908,69 +4906,30 @@ free_lang_data_in_type (tree type) TREE_PURPOSE (p) = NULL; } } - if (TREE_CODE (type) == METHOD_TYPE) - { - tree p; - - for (p = TYPE_ARG_TYPES (type); p; p = TREE_CHAIN (p)) - { - /* C++ FE uses TREE_PURPOSE to store initial values. */ - TREE_PURPOSE (p) = NULL; - } - } - - /* Remove members that are not actually FIELD_DECLs from the field - list of an aggregate. These occur in C++. */ - if (RECORD_OR_UNION_TYPE_P (type)) - { - tree prev, member; - - /* Note that TYPE_FIELDS can be shared across distinct - TREE_TYPEs. Therefore, if the first field of TYPE_FIELDS is - to be removed, we cannot set its TREE_CHAIN to NULL. - Otherwise, we would not be able to find all the other fields - in the other instances of this TREE_TYPE. - - This was causing an ICE in testsuite/g++.dg/lto/20080915.C. */ - prev = NULL_TREE; - member = TYPE_FIELDS (type); - while (member) - { - if (TREE_CODE (member) == FIELD_DECL - || (TREE_CODE (member) == TYPE_DECL - && !DECL_IGNORED_P (member) - && debug_info_level > DINFO_LEVEL_TERSE - && !is_redundant_typedef (member))) - { - if (prev) - TREE_CHAIN (prev) = member; - else - TYPE_FIELDS (type) = member; - prev = member; - } - - member = TREE_CHAIN (member); - } - - if (prev) - TREE_CHAIN (prev) = NULL_TREE; - else - TYPE_FIELDS (type) = NULL_TREE; + else if (TREE_CODE (type) == METHOD_TYPE) + for (tree p = TYPE_ARG_TYPES (type); p; p = TREE_CHAIN (p)) + /* C++ FE uses TREE_PURPOSE to store initial values. */ + TREE_PURPOSE (p) = NULL; + else if (RECORD_OR_UNION_TYPE_P (type)) + { + /* Remove members that are not FIELD_DECLs (and maybe + TYPE_DECLs) from the field list of an aggregate. These occur + in C++. */ + for (tree *prev = &TYPE_FIELDS (type), member; (member = *prev);) + if (TREE_CODE (member) == FIELD_DECL + || (TREE_CODE (member) == TYPE_DECL + && !DECL_IGNORED_P (member) + && debug_info_level > DINFO_LEVEL_TERSE + && !is_redundant_typedef (member))) + prev = &DECL_CHAIN (member); + else + *prev = DECL_CHAIN (member); /* FIXME: C FE uses TYPE_VFIELD to record C_TYPE_INCOMPLETE_VARS and danagle the pointer from time to time. */ if (TYPE_VFIELD (type) && TREE_CODE (TYPE_VFIELD (type)) != FIELD_DECL) TYPE_VFIELD (type) = NULL_TREE; - /* Splice out FUNCTION_DECLS and TEMPLATE_DECLS from - TYPE_FIELDS. So LTO doesn't grow. */ - for (tree probe, *prev= &TYPE_FIELDS (type); (probe = *prev); ) - if (TREE_CODE (probe) == FUNCTION_DECL - || TREE_CODE (probe) == TEMPLATE_DECL) - *prev = probe; - else - prev = &DECL_CHAIN (probe); - if (TYPE_BINFO (type)) { free_lang_data_in_binfo (TYPE_BINFO (type)); @@ -4987,21 +4946,16 @@ free_lang_data_in_type (tree type) TYPE_BINFO (type) = NULL; } } - else + else if (INTEGRAL_TYPE_P (type) + || SCALAR_FLOAT_TYPE_P (type) + || FIXED_POINT_TYPE_P (type)) { - /* For non-aggregate types, clear out the language slot (which - overloads TYPE_BINFO). */ - TYPE_LANG_SLOT_1 (type) = NULL_TREE; - - if (INTEGRAL_TYPE_P (type) - || SCALAR_FLOAT_TYPE_P (type) - || FIXED_POINT_TYPE_P (type)) - { - free_lang_data_in_one_sizepos (&TYPE_MIN_VALUE (type)); - free_lang_data_in_one_sizepos (&TYPE_MAX_VALUE (type)); - } + free_lang_data_in_one_sizepos (&TYPE_MIN_VALUE (type)); + free_lang_data_in_one_sizepos (&TYPE_MAX_VALUE (type)); } + TYPE_LANG_SLOT_1 (type) = NULL_TREE; + free_lang_data_in_one_sizepos (&TYPE_SIZE (type)); free_lang_data_in_one_sizepos (&TYPE_SIZE_UNIT (type)); @@ -5382,6 +5336,7 @@ find_decls_types_r (tree *tp, int *ws, void *data) this way. */ if (!POINTER_TYPE_P (t)) fld_worklist_push (TYPE_MIN_VALUE_RAW (t), fld); + /* TYPE_MAX_VALUE_RAW is TYPE_BINFO for record types. */ if (!RECORD_OR_UNION_TYPE_P (t)) fld_worklist_push (TYPE_MAX_VALUE_RAW (t), fld); fld_worklist_push (TYPE_MAIN_VARIANT (t), fld); @@ -13267,9 +13222,23 @@ verify_type (const_tree t) but does not for C sizetypes in LTO. */ } - /* Check various uses of TYPE_MAXVAL. */ + /* Check various uses of TYPE_MAXVAL_RAW. */ if (RECORD_OR_UNION_TYPE_P (t)) { + if (!TYPE_BINFO (t)) + ; + else if (TREE_CODE (TYPE_BINFO (t)) != TREE_BINFO) + { + error ("TYPE_BINFO is not TREE_BINFO"); + debug_tree (TYPE_BINFO (t)); + error_found = true; + } + else if (TREE_TYPE (TYPE_BINFO (t)) != TYPE_MAIN_VARIANT (t)) + { + error ("TYPE_BINFO type is not TYPE_MAIN_VARIANT"); + debug_tree (TREE_TYPE (TYPE_BINFO (t))); + error_found = true; + } } else if (TREE_CODE (t) == FUNCTION_TYPE || TREE_CODE (t) == METHOD_TYPE) { @@ -13318,19 +13287,7 @@ verify_type (const_tree t) error_found = true; } - /* Check various uses of TYPE_BINFO. */ - if (RECORD_OR_UNION_TYPE_P (t)) - { - if (!TYPE_BINFO (t)) - ; - else if (TREE_CODE (TYPE_BINFO (t)) != TREE_BINFO) - { - error ("TYPE_BINFO is not TREE_BINFO"); - debug_tree (TYPE_BINFO (t)); - error_found = true; - } - } - else if (TYPE_LANG_SLOT_1 (t) && in_lto_p) + if (TYPE_LANG_SLOT_1 (t) && in_lto_p) { error ("TYPE_LANG_SLOT_1 (binfo) field is non-NULL"); debug_tree (TYPE_LANG_SLOT_1 (t)); diff --git a/gcc/tree.h b/gcc/tree.h index 46debc12a84..1f3cf1a1159 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2129,14 +2129,13 @@ extern machine_mode element_mode (const_tree t); #define TYPE_ARRAY_MAX_SIZE(ARRAY_TYPE) \ (ARRAY_TYPE_CHECK (ARRAY_TYPE)->type_non_common.maxval) #define TYPE_MAX_VALUE_RAW(NODE) (TYPE_CHECK (NODE)->type_non_common.maxval) - /* For record and union types, information about this type, as a base type for itself. */ -#define TYPE_BINFO(NODE) (RECORD_OR_UNION_CHECK (NODE)->type_non_common.binfo) +#define TYPE_BINFO(NODE) (RECORD_OR_UNION_CHECK (NODE)->type_non_common.maxval) -/* For non record and union types, used in a language-dependent way. */ +/* For types, used in a language-dependent way. */ #define TYPE_LANG_SLOT_1(NODE) \ - (NOT_RECORD_OR_UNION_CHECK (NODE)->type_non_common.binfo) + (TYPE_CHECK (NODE)->type_non_common.lang_1) /* Define accessor macros for information about type inheritance and basetypes.