Commit 8e093270 by Nathan Sidwell Committed by Nathan Sidwell

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
parent d0015633
2017-08-16 Nathan Sidwell <nathan@acm.org>
* 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 <dmalcolm@redhat.com> 2017-08-16 David Malcolm <dmalcolm@redhat.com>
* diagnostic-show-locus.c (colorizer::m_caret): Remove unused * diagnostic-show-locus.c (colorizer::m_caret): Remove unused
......
...@@ -837,8 +837,6 @@ DFS::DFS_write_tree_body (struct output_block *ob, ...@@ -837,8 +837,6 @@ DFS::DFS_write_tree_body (struct output_block *ob,
if (!POINTER_TYPE_P (expr)) if (!POINTER_TYPE_P (expr))
DFS_follow_tree_edge (TYPE_MIN_VALUE_RAW (expr)); DFS_follow_tree_edge (TYPE_MIN_VALUE_RAW (expr));
DFS_follow_tree_edge (TYPE_MAX_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)) if (CODE_CONTAINS_STRUCT (code, TS_LIST))
...@@ -1273,8 +1271,6 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map<tree, hashval_t> *map, ...@@ -1273,8 +1271,6 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map<tree, hashval_t> *map,
if (!POINTER_TYPE_P (t)) if (!POINTER_TYPE_P (t))
visit (TYPE_MIN_VALUE_RAW (t)); visit (TYPE_MIN_VALUE_RAW (t));
visit (TYPE_MAX_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)) if (CODE_CONTAINS_STRUCT (code, TS_LIST))
......
2017-08-16 Nathan Sidwell <nathan@acm.org>
* 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 <tom@codesourcery.com> 2017-08-08 Tom de Vries <tom@codesourcery.com>
* lto.c: Include attribs.h. * lto.c: Include attribs.h.
......
...@@ -651,7 +651,7 @@ mentions_vars_p_type (tree t) ...@@ -651,7 +651,7 @@ mentions_vars_p_type (tree t)
CHECK_VAR (TYPE_MAX_VALUE_RAW (t)); CHECK_VAR (TYPE_MAX_VALUE_RAW (t));
/* Accessor is for derived node types only. */ /* 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_VAR (TYPE_CONTEXT (t));
CHECK_NO_VAR (TYPE_CANONICAL (t)); CHECK_NO_VAR (TYPE_CANONICAL (t));
...@@ -1410,7 +1410,6 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map) ...@@ -1410,7 +1410,6 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map)
f1 || f2; f1 || f2;
f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2)) f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2))
compare_tree_edges (f1, f2); compare_tree_edges (f1, f2);
compare_tree_edges (TYPE_BINFO (t1), TYPE_BINFO (t2));
} }
else if (code == FUNCTION_TYPE else if (code == FUNCTION_TYPE
|| code == METHOD_TYPE) || code == METHOD_TYPE)
...@@ -2584,7 +2583,7 @@ lto_fixup_prevailing_decls (tree t) ...@@ -2584,7 +2583,7 @@ lto_fixup_prevailing_decls (tree t)
LTO_SET_PREVAIL (TYPE_MIN_VALUE_RAW (t)); LTO_SET_PREVAIL (TYPE_MIN_VALUE_RAW (t));
LTO_SET_PREVAIL (TYPE_MAX_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)); LTO_SET_PREVAIL (TYPE_CONTEXT (t));
......
...@@ -1552,7 +1552,7 @@ struct GTY(()) tree_type_non_common { ...@@ -1552,7 +1552,7 @@ struct GTY(()) tree_type_non_common {
tree values; tree values;
tree minval; tree minval;
tree maxval; tree maxval;
tree binfo; tree lang_1;
}; };
struct GTY (()) tree_binfo { struct GTY (()) tree_binfo {
......
...@@ -841,8 +841,6 @@ lto_input_ts_type_non_common_tree_pointers (struct lto_input_block *ib, ...@@ -841,8 +841,6 @@ lto_input_ts_type_non_common_tree_pointers (struct lto_input_block *ib,
if (!POINTER_TYPE_P (expr)) if (!POINTER_TYPE_P (expr))
TYPE_MIN_VALUE_RAW (expr) = stream_read_tree (ib, data_in); TYPE_MIN_VALUE_RAW (expr) = stream_read_tree (ib, data_in);
TYPE_MAX_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);
} }
......
...@@ -706,8 +706,6 @@ write_ts_type_non_common_tree_pointers (struct output_block *ob, tree expr, ...@@ -706,8 +706,6 @@ write_ts_type_non_common_tree_pointers (struct output_block *ob, tree expr,
if (!POINTER_TYPE_P (expr)) if (!POINTER_TYPE_P (expr))
stream_write_tree (ob, TYPE_MIN_VALUE_RAW (expr), ref_p); stream_write_tree (ob, TYPE_MIN_VALUE_RAW (expr), ref_p);
stream_write_tree (ob, TYPE_MAX_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);
} }
......
...@@ -4890,9 +4890,7 @@ free_lang_data_in_type (tree type) ...@@ -4890,9 +4890,7 @@ free_lang_data_in_type (tree type)
leading to false ODR violation errors when merging two leading to false ODR violation errors when merging two
instances of the same function signature compiled by instances of the same function signature compiled by
different front ends. */ different front ends. */
tree p; for (tree p = TYPE_ARG_TYPES (type); p; p = TREE_CHAIN (p))
for (p = TYPE_ARG_TYPES (type); p; p = TREE_CHAIN (p))
{ {
tree arg_type = TREE_VALUE (p); tree arg_type = TREE_VALUE (p);
...@@ -4908,69 +4906,30 @@ free_lang_data_in_type (tree type) ...@@ -4908,69 +4906,30 @@ free_lang_data_in_type (tree type)
TREE_PURPOSE (p) = NULL; TREE_PURPOSE (p) = NULL;
} }
} }
if (TREE_CODE (type) == METHOD_TYPE) else if (TREE_CODE (type) == METHOD_TYPE)
{ for (tree p = TYPE_ARG_TYPES (type); p; p = TREE_CHAIN (p))
tree p;
for (p = TYPE_ARG_TYPES (type); p; p = TREE_CHAIN (p))
{
/* C++ FE uses TREE_PURPOSE to store initial values. */ /* C++ FE uses TREE_PURPOSE to store initial values. */
TREE_PURPOSE (p) = NULL; TREE_PURPOSE (p) = NULL;
} else if (RECORD_OR_UNION_TYPE_P (type))
}
/* 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)
{ {
/* 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 if (TREE_CODE (member) == FIELD_DECL
|| (TREE_CODE (member) == TYPE_DECL || (TREE_CODE (member) == TYPE_DECL
&& !DECL_IGNORED_P (member) && !DECL_IGNORED_P (member)
&& debug_info_level > DINFO_LEVEL_TERSE && debug_info_level > DINFO_LEVEL_TERSE
&& !is_redundant_typedef (member))) && !is_redundant_typedef (member)))
{ prev = &DECL_CHAIN (member);
if (prev)
TREE_CHAIN (prev) = member;
else else
TYPE_FIELDS (type) = member; *prev = DECL_CHAIN (member);
prev = member;
}
member = TREE_CHAIN (member);
}
if (prev)
TREE_CHAIN (prev) = NULL_TREE;
else
TYPE_FIELDS (type) = NULL_TREE;
/* FIXME: C FE uses TYPE_VFIELD to record C_TYPE_INCOMPLETE_VARS /* FIXME: C FE uses TYPE_VFIELD to record C_TYPE_INCOMPLETE_VARS
and danagle the pointer from time to time. */ and danagle the pointer from time to time. */
if (TYPE_VFIELD (type) && TREE_CODE (TYPE_VFIELD (type)) != FIELD_DECL) if (TYPE_VFIELD (type) && TREE_CODE (TYPE_VFIELD (type)) != FIELD_DECL)
TYPE_VFIELD (type) = NULL_TREE; 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)) if (TYPE_BINFO (type))
{ {
free_lang_data_in_binfo (TYPE_BINFO (type)); free_lang_data_in_binfo (TYPE_BINFO (type));
...@@ -4987,20 +4946,15 @@ free_lang_data_in_type (tree type) ...@@ -4987,20 +4946,15 @@ free_lang_data_in_type (tree type)
TYPE_BINFO (type) = NULL; TYPE_BINFO (type) = NULL;
} }
} }
else else if (INTEGRAL_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) || SCALAR_FLOAT_TYPE_P (type)
|| FIXED_POINT_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_MIN_VALUE (type));
free_lang_data_in_one_sizepos (&TYPE_MAX_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 (type));
free_lang_data_in_one_sizepos (&TYPE_SIZE_UNIT (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) ...@@ -5382,6 +5336,7 @@ find_decls_types_r (tree *tp, int *ws, void *data)
this way. */ this way. */
if (!POINTER_TYPE_P (t)) if (!POINTER_TYPE_P (t))
fld_worklist_push (TYPE_MIN_VALUE_RAW (t), fld); 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)) if (!RECORD_OR_UNION_TYPE_P (t))
fld_worklist_push (TYPE_MAX_VALUE_RAW (t), fld); fld_worklist_push (TYPE_MAX_VALUE_RAW (t), fld);
fld_worklist_push (TYPE_MAIN_VARIANT (t), fld); fld_worklist_push (TYPE_MAIN_VARIANT (t), fld);
...@@ -13267,9 +13222,23 @@ verify_type (const_tree t) ...@@ -13267,9 +13222,23 @@ verify_type (const_tree t)
but does not for C sizetypes in LTO. */ 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 (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) else if (TREE_CODE (t) == FUNCTION_TYPE || TREE_CODE (t) == METHOD_TYPE)
{ {
...@@ -13318,19 +13287,7 @@ verify_type (const_tree t) ...@@ -13318,19 +13287,7 @@ verify_type (const_tree t)
error_found = true; error_found = true;
} }
/* Check various uses of TYPE_BINFO. */ if (TYPE_LANG_SLOT_1 (t) && in_lto_p)
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)
{ {
error ("TYPE_LANG_SLOT_1 (binfo) field is non-NULL"); error ("TYPE_LANG_SLOT_1 (binfo) field is non-NULL");
debug_tree (TYPE_LANG_SLOT_1 (t)); debug_tree (TYPE_LANG_SLOT_1 (t));
......
...@@ -2129,14 +2129,13 @@ extern machine_mode element_mode (const_tree t); ...@@ -2129,14 +2129,13 @@ extern machine_mode element_mode (const_tree t);
#define TYPE_ARRAY_MAX_SIZE(ARRAY_TYPE) \ #define TYPE_ARRAY_MAX_SIZE(ARRAY_TYPE) \
(ARRAY_TYPE_CHECK (ARRAY_TYPE)->type_non_common.maxval) (ARRAY_TYPE_CHECK (ARRAY_TYPE)->type_non_common.maxval)
#define TYPE_MAX_VALUE_RAW(NODE) (TYPE_CHECK (NODE)->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 record and union types, information about this type, as a base type
for itself. */ 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) \ #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 /* Define accessor macros for information about type inheritance
and basetypes. and basetypes.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment