diff gcc/tree-streamer-out.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line diff
--- a/gcc/tree-streamer-out.c	Fri Oct 27 22:46:09 2017 +0900
+++ b/gcc/tree-streamer-out.c	Thu Oct 25 07:37:49 2018 +0900
@@ -1,6 +1,6 @@
 /* Routines for emitting trees to a file stream.
 
-   Copyright (C) 2011-2017 Free Software Foundation, Inc.
+   Copyright (C) 2011-2018 Free Software Foundation, Inc.
    Contributed by Diego Novillo <dnovillo@google.com>
 
 This file is part of GCC.
@@ -211,6 +211,7 @@
     {
       bp_pack_value (bp, DECL_PACKED (expr), 1);
       bp_pack_value (bp, DECL_NONADDRESSABLE_P (expr), 1);
+      bp_pack_value (bp, DECL_PADDING_P (expr), 1);
       bp_pack_value (bp, expr->decl_common.off_align, 8);
     }
 
@@ -330,6 +331,7 @@
     bp_pack_value (bp, TYPE_NONALIASED_COMPONENT (expr), 1);
   if (AGGREGATE_TYPE_P (expr))
     bp_pack_value (bp, TYPE_TYPELESS_STORAGE (expr), 1);
+  bp_pack_value (bp, TYPE_EMPTY_P (expr), 1);
   bp_pack_var_len_unsigned (bp, TYPE_PRECISION (expr));
   bp_pack_var_len_unsigned (bp, TYPE_ALIGN (expr));
 }
@@ -342,7 +344,6 @@
 pack_ts_block_value_fields (struct output_block *ob,
 			    struct bitpack_d *bp, tree expr)
 {
-  bp_pack_value (bp, BLOCK_ABSTRACT (expr), 1);
   /* BLOCK_NUMBER is recomputed.  */
   /* Stream BLOCK_SOURCE_LOCATION for the limited cases we can handle - those
      that represent inlined function scopes.
@@ -464,10 +465,7 @@
     pack_ts_translation_unit_decl_value_fields (ob, &bp, expr);
 
   if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
-    cl_optimization_stream_out (&bp, TREE_OPTIMIZATION (expr));
-
-  if (CODE_CONTAINS_STRUCT (code, TS_BINFO))
-    bp_pack_var_len_unsigned (&bp, vec_safe_length (BINFO_BASE_ACCESSES (expr)));
+    cl_optimization_stream_out (ob, &bp, TREE_OPTIMIZATION (expr));
 
   if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
     bp_pack_var_len_unsigned (&bp, CONSTRUCTOR_NELTS (expr));
@@ -495,14 +493,10 @@
     {
       /* We avoid outputting external vars or functions by reference
 	 to the global decls section as we do not want to have them
-	 enter decl merging.  This is, of course, only for the call
-	 for streaming BLOCK_VARS, but other callers are safe.
-	 See also lto-streamer-out.c:DFS_write_tree_body.  */
-      if (VAR_OR_FUNCTION_DECL_P (t)
-	  && DECL_EXTERNAL (t))
-	stream_write_tree_shallow_non_ref (ob, t, ref_p);
-      else
-	stream_write_tree (ob, t, ref_p);
+	 enter decl merging.  We should not need to do this anymore because
+	 free_lang_data removes them from block scopes.  */
+      gcc_assert (!VAR_OR_FUNCTION_DECL_P (t) || !DECL_EXTERNAL (t));
+      stream_write_tree (ob, t, ref_p);
 
       t = TREE_CHAIN (t);
     }
@@ -531,11 +525,23 @@
 static void
 write_ts_vector_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
 {
-  unsigned i;
   /* Note that the number of elements for EXPR has already been emitted
      in EXPR's header (see streamer_write_tree_header).  */
-  for (i = 0; i < VECTOR_CST_NELTS (expr); ++i)
-    stream_write_tree (ob, VECTOR_CST_ELT (expr, i), ref_p);
+  unsigned int count = vector_cst_encoded_nelts (expr);
+  for (unsigned int i = 0; i < count; ++i)
+    stream_write_tree (ob, VECTOR_CST_ENCODED_ELT (expr, i), ref_p);
+}
+
+
+/* Write all pointer fields in the TS_POLY_INT_CST structure of EXPR to
+   output block OB.  If REF_P is true, write a reference to EXPR's pointer
+   fields.  */
+
+static void
+write_ts_poly_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
+{
+  for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
+    stream_write_tree (ob, POLY_INT_CST_COEFF (expr, i), ref_p);
 }
 
 
@@ -595,7 +601,8 @@
       && DECL_HAS_VALUE_EXPR_P (expr))
     stream_write_tree (ob, DECL_VALUE_EXPR (expr), ref_p);
 
-  if (VAR_P (expr))
+  if (VAR_P (expr)
+      && DECL_HAS_DEBUG_EXPR_P (expr))
     stream_write_tree (ob, DECL_DEBUG_EXPR (expr), ref_p);
 }
 
@@ -605,11 +612,8 @@
    pointer fields.  */
 
 static void
-write_ts_decl_non_common_tree_pointers (struct output_block *ob, tree expr,
-				        bool ref_p)
+write_ts_decl_non_common_tree_pointers (struct output_block *, tree, bool)
 {
-  if (TREE_CODE (expr) == TYPE_DECL)
-    stream_write_tree (ob, DECL_ORIGINAL_TYPE (expr), ref_p);
 }
 
 
@@ -641,7 +645,6 @@
   stream_write_tree (ob, DECL_BIT_FIELD_TYPE (expr), ref_p);
   stream_write_tree (ob, DECL_BIT_FIELD_REPRESENTATIVE (expr), ref_p);
   stream_write_tree (ob, DECL_FIELD_BIT_OFFSET (expr), ref_p);
-  stream_write_tree (ob, DECL_FCONTEXT (expr), ref_p);
 }
 
 
@@ -653,7 +656,6 @@
 write_ts_function_decl_tree_pointers (struct output_block *ob, tree expr,
 				      bool ref_p)
 {
-  stream_write_tree (ob, DECL_VINDEX (expr), ref_p);
   /* DECL_STRUCT_FUNCTION is handled by lto_output_function.  */
   stream_write_tree (ob, DECL_FUNCTION_PERSONALITY (expr), ref_p);
   /* Don't stream these when passing things to a different target.  */
@@ -683,7 +685,9 @@
   stream_write_tree (ob, TYPE_CONTEXT (expr), ref_p);
   /* TYPE_CANONICAL is re-computed during type merging, so no need
      to stream it here.  */
-  stream_write_tree (ob, TYPE_STUB_DECL (expr), ref_p);
+  /* Do not stream TYPE_STUB_DECL; it is not needed by LTO but currently
+     it can not be freed by free_lang_data without triggering ICEs in
+     langhooks.  */
 }
 
 /* Write all pointer fields in the TS_TYPE_NON_COMMON structure of EXPR
@@ -764,20 +768,8 @@
   streamer_write_chain (ob, BLOCK_VARS (expr), ref_p);
 
   stream_write_tree (ob, BLOCK_SUPERCONTEXT (expr), ref_p);
+  stream_write_tree (ob, BLOCK_ABSTRACT_ORIGIN (expr), ref_p);
 
-  /* Stream BLOCK_ABSTRACT_ORIGIN for the limited cases we can handle - those
-     that represent inlined function scopes.
-     For the rest them on the floor instead of ICEing in dwarf2out.c, but
-     keep the notion of whether the block is an inlined block by refering
-     to itself for the sake of tree_nonartificial_location.  */
-  if (inlined_function_outer_scope_p (expr))
-    {
-      tree ultimate_origin = block_ultimate_origin (expr);
-      stream_write_tree (ob, ultimate_origin, ref_p);
-    }
-  else
-    stream_write_tree (ob, (BLOCK_ABSTRACT_ORIGIN (expr)
-			    ? expr : NULL_TREE), ref_p);
   /* Do not stream BLOCK_NONLOCALIZED_VARS.  We cannot handle debug information
      for early inlined BLOCKs so drop it on the floor instead of ICEing in
      dwarf2out.c.  */
@@ -809,15 +801,9 @@
 
   stream_write_tree (ob, BINFO_OFFSET (expr), ref_p);
   stream_write_tree (ob, BINFO_VTABLE (expr), ref_p);
-  stream_write_tree (ob, BINFO_VPTR_FIELD (expr), ref_p);
 
-  /* The number of BINFO_BASE_ACCESSES has already been emitted in
-     EXPR's bitfield section.  */
-  FOR_EACH_VEC_SAFE_ELT (BINFO_BASE_ACCESSES (expr), i, t)
-    stream_write_tree (ob, t, ref_p);
-
-  /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
-     and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
+  /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX,
+     BINFO_BASE_ACCESSES and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
 }
 
 
@@ -880,6 +866,9 @@
   if (CODE_CONTAINS_STRUCT (code, TS_VECTOR))
     write_ts_vector_tree_pointers (ob, expr, ref_p);
 
+  if (CODE_CONTAINS_STRUCT (code, TS_POLY_INT_CST))
+    write_ts_poly_tree_pointers (ob, expr, ref_p);
+
   if (CODE_CONTAINS_STRUCT (code, TS_COMPLEX))
     write_ts_complex_tree_pointers (ob, expr, ref_p);
 
@@ -958,7 +947,12 @@
   else if (CODE_CONTAINS_STRUCT (code, TS_IDENTIFIER))
     write_identifier (ob, ob->main_stream, expr);
   else if (CODE_CONTAINS_STRUCT (code, TS_VECTOR))
-    streamer_write_hwi (ob, VECTOR_CST_NELTS (expr));
+    {
+      bitpack_d bp = bitpack_create (ob->main_stream);
+      bp_pack_value (&bp, VECTOR_CST_LOG2_NPATTERNS (expr), 8);
+      bp_pack_value (&bp, VECTOR_CST_NELTS_PER_PATTERN (expr), 8);
+      streamer_write_bitpack (&bp);
+    }
   else if (CODE_CONTAINS_STRUCT (code, TS_VEC))
     streamer_write_hwi (ob, TREE_VEC_LENGTH (expr));
   else if (CODE_CONTAINS_STRUCT (code, TS_BINFO))