]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-core.h (tree_type_non_common): Rename binfo to lang_1.
authorNathan Sidwell <nathan@acm.org>
Wed, 16 Aug 2017 19:42:28 +0000 (19:42 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 16 Aug 2017 19:42:28 +0000 (19:42 +0000)
* 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

gcc/ChangeLog
gcc/lto-streamer-out.c
gcc/lto/ChangeLog
gcc/lto/lto.c
gcc/tree-core.h
gcc/tree-streamer-in.c
gcc/tree-streamer-out.c
gcc/tree.c
gcc/tree.h

index 340d4304593691369fdfc18105ef9d1eb0fdcd4b..f4ef9ad8791c63043044445df3c080b54f12a69b 100644 (file)
@@ -1,3 +1,25 @@
+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>
 
        * diagnostic-show-locus.c (colorizer::m_caret): Remove unused
index 41fba318cb5b2018844f0cf94067aaa9200e9959..5988af52b2adb52d25ad2b26eb743cb49cb20ca7 100644 (file)
@@ -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<tree, hashval_t> *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))
index baeeb393d9b610a2f13c780799e9e68c090124be..eb2a5daad999e719bf1047f0fbde5cde22e2a66e 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        * lto.c: Include attribs.h.
index 31d1488dc8661a0c13753930e574996242c427ed..2064423418df13d84fbc0d4c5e31c5726e5de541 100644 (file)
@@ -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));
 
index 278d0c9b8f887f4242e8230f7934d18e6f8db0e8..5b9ca387565c363dceb996ce2c207632d56d141d 100644 (file)
@@ -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 {
index 600470080aadad638bf95b3ee7d8ce32dc1a3ac3..4a49d924e7b7c6e5953a8a459a20f2619dc6d71b 100644 (file)
@@ -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);
 }
 
 
index ec47a9b804013525df8c4f58abad7db8e537ed1c..32b23461dfdfe607c45d52625f6195191e647472 100644 (file)
@@ -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);
 }
 
 
index c493edd561d5400bf37b0baaad84d281c3a65a88..31fe31fb537527d041cdef5f96472777bc9903dc 100644 (file)
@@ -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));
index 46debc12a845300d36965f175744a0389d82225b..1f3cf1a115989a08835d07f061597598f67c1c49 100644 (file)
@@ -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.