This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Remove streaming of some tree flags and fields


On Wed, 28 Aug 2013, Jan Hubicka wrote:

> Hi,
> this patch removes streaming of DECL_DEFER_OUTPUT, BINFO_INHERITANCE_CHAIN.
> BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, DECL_IN_TEXT_SECTION.
> and DECL_ERROR_ISSUED.
> 
> I originally intended to remove DECL_DEFER_OUTPUT completely (it is pointless
> ever since we are unit-at-a-time), but that is bit harder because of java
> frontend relying on it in a strange (and accidental) way.  I think DECL_DEFER_OUTPUT
> may be random in between units preventing merging, but I did not verify this
> assumption.
> 
> Other flag I would like to go since it is not really part of IL and represents
> just an bookeeping is DECL_SEEN_IN_BIND_EXPR_P, but that one is used by gimplfier
> sanity checks.
> 
> While working on it, I noticed that DECL_ERROR_ISSUED is unused in compiler.
> Moreover BINFO_INHERITANCE_CHAIN.  BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX are
> unused by backend (and always NULL, cleared by free-lang-data).
> DECL_IN_TEXT_SECTION is removed on a basis that it is set only at a time
> we output variable into an assembly file.
> 
> I will send separate patch to remove DECL_DEFER_OUTPUT.
> 
> Boostrapped/regtested ppc64-linux, OK?

Ok.

Thanks,
Richard.

> 	* lto.c (compare_tree_sccs_1): Drop DECL_ERROR_ISSUED,
> 	DECL_DEFER_OUTPUT and DECL_IN_TEXT_SECTION.
> 	(unify_scc): Do checking assert.
> 
> 	* lto-streamer-out.c (DFS_write_tree_body): Drop
> 	BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX and BINFO_VPTR_INDEX.
> 	(hash_tree): Do not hash DECL_DEFER_OUTPUT, BINFO_INHERITANCE_CHAIN,
> 	BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, DECL_IN_TEXT_SECTION.
> 	* tree-streamer-in.c (unpack_ts_decl_common_value_fields):
> 	Do not read DECL_ERROR_ISSUED.
> 	(unpack_ts_decl_with_vis_value_fields): Do not read
> 	DECL_DEFER_OUTPUT.
> 	(lto_input_ts_binfo_tree_pointers): Do not read BINFO_INHERITANCE_CHAIN,
>         BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX
> 	* tree-streamer-out.c (pack_ts_decl_common_value_fields): Do not
> 	write DECL_ERROR_ISSUED..
> 	(pack_ts_decl_with_vis_value_fields): Do not write
> 	DECL_DEFER_OUTPUT.
> 	(write_ts_binfo_tree_pointers): Do not read BINFO_INHERITANCE_CHAIN,
>         BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX
> 	* print-tree.c (print_node): Do not print DECL_ERROR_ISSUED.
> 	* tree.h (tree_decl_common): Update comment.
> 	(DECL_ERROR_ISSUED): Remove.
> Index: lto-streamer-out.c
> ===================================================================
> --- lto-streamer-out.c	(revision 202000)
> +++ lto-streamer-out.c	(working copy)
> @@ -642,9 +642,8 @@ DFS_write_tree_body (struct output_block
>        FOR_EACH_VEC_SAFE_ELT (BINFO_BASE_ACCESSES (expr), i, t)
>  	DFS_follow_tree_edge (t);
>  
> -      DFS_follow_tree_edge (BINFO_INHERITANCE_CHAIN (expr));
> -      DFS_follow_tree_edge (BINFO_SUBVTT_INDEX (expr));
> -      DFS_follow_tree_edge (BINFO_VPTR_INDEX (expr));
> +      /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
> +	 and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
>      }
>  
>    if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
> @@ -748,7 +747,6 @@ hash_tree (struct streamer_tree_cache_d
>        v = iterative_hash_host_wide_int (DECL_ALIGN (t), v);
>        if (code == LABEL_DECL)
>  	{
> -	  v = iterative_hash_host_wide_int (DECL_ERROR_ISSUED (t), v);
>  	  v = iterative_hash_host_wide_int (EH_LANDING_PAD_NR (t), v);
>  	  v = iterative_hash_host_wide_int (LABEL_DECL_UID (t), v);
>  	}
> @@ -781,20 +779,19 @@ hash_tree (struct streamer_tree_cache_d
>  
>    if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
>      {
> -      v = iterative_hash_host_wide_int (DECL_DEFER_OUTPUT (t)
> -					| (DECL_COMMON (t) << 1)
> -					| (DECL_DLLIMPORT_P (t) << 2)
> -					| (DECL_WEAK (t) << 3)
> -					| (DECL_SEEN_IN_BIND_EXPR_P (t) << 4)
> -					| (DECL_COMDAT (t) << 5)
> +      v = iterative_hash_host_wide_int ((DECL_COMMON (t))
> +					| (DECL_DLLIMPORT_P (t) << 1)
> +					| (DECL_WEAK (t) << 2)
> +					| (DECL_SEEN_IN_BIND_EXPR_P (t) << 3)
> +					| (DECL_COMDAT (t) << 4)
>  					| (DECL_VISIBILITY_SPECIFIED (t) << 6),
>  					v);
>        v = iterative_hash_host_wide_int (DECL_VISIBILITY (t), v);
>        if (code == VAR_DECL)
>  	{
> +	  /* DECL_IN_TEXT_SECTION is set during final asm output only.  */
>  	  v = iterative_hash_host_wide_int (DECL_HARD_REGISTER (t)
> -					    | (DECL_IN_TEXT_SECTION (t) << 1)
> -					    | (DECL_IN_CONSTANT_POOL (t) << 2),
> +					    | (DECL_IN_CONSTANT_POOL (t) << 1),
>  					    v);
>  	  v = iterative_hash_host_wide_int (DECL_TLS_MODEL (t), v);
>  	}
> @@ -1021,9 +1018,8 @@ hash_tree (struct streamer_tree_cache_d
>        visit (BINFO_VPTR_FIELD (t));
>        FOR_EACH_VEC_SAFE_ELT (BINFO_BASE_ACCESSES (t), i, b)
>  	visit (b);
> -      visit (BINFO_INHERITANCE_CHAIN (t));
> -      visit (BINFO_SUBVTT_INDEX (t));
> -      visit (BINFO_VPTR_INDEX (t));
> +      /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
> +	 and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
>      }
>  
>    if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
> Index: print-tree.c
> ===================================================================
> --- print-tree.c	(revision 202000)
> +++ print-tree.c	(working copy)
> @@ -409,8 +409,6 @@ print_node (FILE *file, const char *pref
>        if (code == FIELD_DECL && DECL_NONADDRESSABLE_P (node))
>  	fputs (" nonaddressable", file);
>  
> -      if (code == LABEL_DECL && DECL_ERROR_ISSUED (node))
> -	fputs (" error-issued", file);
>        if (code == LABEL_DECL && EH_LANDING_PAD_NR (node))
>  	fprintf (file, " landing-pad:%d", EH_LANDING_PAD_NR (node));
>  
> Index: tree-streamer-in.c
> ===================================================================
> --- tree-streamer-in.c	(revision 202000)
> +++ tree-streamer-in.c	(working copy)
> @@ -209,7 +209,6 @@ unpack_ts_decl_common_value_fields (stru
>  
>    if (TREE_CODE (expr) == LABEL_DECL)
>      {
> -      DECL_ERROR_ISSUED (expr) = (unsigned) bp_unpack_value (bp, 1);
>        EH_LANDING_PAD_NR (expr) = (int) bp_unpack_var_len_unsigned (bp);
>  
>        /* Always assume an initial value of -1 for LABEL_DECL_UID to
> @@ -258,7 +257,6 @@ unpack_ts_decl_wrtl_value_fields (struct
>  static void
>  unpack_ts_decl_with_vis_value_fields (struct bitpack_d *bp, tree expr)
>  {
> -  DECL_DEFER_OUTPUT (expr) = (unsigned) bp_unpack_value (bp, 1);
>    DECL_COMMON (expr) = (unsigned) bp_unpack_value (bp, 1);
>    DECL_DLLIMPORT_P (expr) = (unsigned) bp_unpack_value (bp, 1);
>    DECL_WEAK (expr) = (unsigned) bp_unpack_value (bp, 1);
> @@ -270,7 +267,7 @@ unpack_ts_decl_with_vis_value_fields (st
>    if (TREE_CODE (expr) == VAR_DECL)
>      {
>        DECL_HARD_REGISTER (expr) = (unsigned) bp_unpack_value (bp, 1);
> -      DECL_IN_TEXT_SECTION (expr) = (unsigned) bp_unpack_value (bp, 1);
>        DECL_IN_CONSTANT_POOL (expr) = (unsigned) bp_unpack_value (bp, 1);
>        DECL_TLS_MODEL (expr) = (enum tls_model) bp_unpack_value (bp,  3);
>      }
> @@ -923,10 +921,8 @@ lto_input_ts_binfo_tree_pointers (struct
>        tree a = stream_read_tree (ib, data_in);
>        (*BINFO_BASE_ACCESSES (expr))[i] = a;
>      }
> -
> -  BINFO_INHERITANCE_CHAIN (expr) = stream_read_tree (ib, data_in);
> -  BINFO_SUBVTT_INDEX (expr) = stream_read_tree (ib, data_in);
> -  BINFO_VPTR_INDEX (expr) = stream_read_tree (ib, data_in);
> +  /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
> +     and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
>  }
>  
>  
> Index: tree-streamer-out.c
> ===================================================================
> --- tree-streamer-out.c	(revision 202000)
> +++ tree-streamer-out.c	(working copy)
> @@ -180,7 +180,6 @@ pack_ts_decl_common_value_fields (struct
>        /* Note that we do not write LABEL_DECL_UID.  The reader will
>  	 always assume an initial value of -1 so that the
>  	 label_to_block_map is recreated by gimple_set_bb.  */
> -      bp_pack_value (bp, DECL_ERROR_ISSUED (expr), 1);
>        bp_pack_var_len_unsigned (bp, EH_LANDING_PAD_NR (expr));
>      }
>  
> @@ -225,7 +224,6 @@ pack_ts_decl_wrtl_value_fields (struct b
>  static void
>  pack_ts_decl_with_vis_value_fields (struct bitpack_d *bp, tree expr)
>  {
> -  bp_pack_value (bp, DECL_DEFER_OUTPUT (expr), 1);
>    bp_pack_value (bp, DECL_COMMON (expr), 1);
>    bp_pack_value (bp, DECL_DLLIMPORT_P (expr), 1);
>    bp_pack_value (bp, DECL_WEAK (expr), 1);
> @@ -237,7 +235,7 @@ pack_ts_decl_with_vis_value_fields (stru
>    if (TREE_CODE (expr) == VAR_DECL)
>      {
>        bp_pack_value (bp, DECL_HARD_REGISTER (expr), 1);
> -      bp_pack_value (bp, DECL_IN_TEXT_SECTION (expr), 1);
> +      /* DECL_IN_TEXT_SECTION is set during final asm output only. */
>        bp_pack_value (bp, DECL_IN_CONSTANT_POOL (expr), 1);
>        bp_pack_value (bp, DECL_TLS_MODEL (expr),  3);
>      }
> @@ -815,9 +813,8 @@ write_ts_binfo_tree_pointers (struct out
>    FOR_EACH_VEC_SAFE_ELT (BINFO_BASE_ACCESSES (expr), i, t)
>      stream_write_tree (ob, t, ref_p);
>  
> -  stream_write_tree (ob, BINFO_INHERITANCE_CHAIN (expr), ref_p);
> -  stream_write_tree (ob, BINFO_SUBVTT_INDEX (expr), ref_p);
> -  stream_write_tree (ob, BINFO_VPTR_INDEX (expr), ref_p);
> +  /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
> +     and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
>  }
>  
>  
> Index: tree.h
> ===================================================================
> --- tree.h	(revision 202000)
> +++ tree.h	(working copy)
> @@ -2843,8 +2843,7 @@ struct GTY(()) tree_decl_common {
>    unsigned lang_flag_7 : 1;
>    unsigned lang_flag_8 : 1;
>  
> -  /* In LABEL_DECL, this is DECL_ERROR_ISSUED.
> -     In VAR_DECL and PARM_DECL, this is DECL_REGISTER.  */
> +  /* In VAR_DECL and PARM_DECL, this is DECL_REGISTER.  */
>    unsigned decl_flag_0 : 1;
>    /* In FIELD_DECL, this is DECL_BIT_FIELD
>       In VAR_DECL and FUNCTION_DECL, this is DECL_EXTERNAL.
> @@ -3036,11 +3035,6 @@ struct GTY(()) tree_field_decl {
>  #define EH_LANDING_PAD_NR(NODE) \
>    (LABEL_DECL_CHECK (NODE)->label_decl.eh_landing_pad_nr)
>  
> -/* In LABEL_DECL nodes, nonzero means that an error message about
> -   jumping into such a binding contour has been printed for this label.  */
> -#define DECL_ERROR_ISSUED(NODE) \
> -  (LABEL_DECL_CHECK (NODE)->decl_common.decl_flag_0)
> -
>  struct GTY(()) tree_label_decl {
>    struct tree_decl_with_rtl common;
>    int label_decl_uid;
> Index: lto/lto.c
> ===================================================================
> --- lto/lto.c	(revision 202040)
> +++ lto/lto.c	(working copy)
> @@ -1431,9 +1431,8 @@ maybe_remember_with_vars_binfo (tree t)
>    n = vec_safe_length (BINFO_BASE_ACCESSES (t));
>    for (i = 0; i < n; i++)
>      MAYBE_REMEMBER_WITH_VARS (BINFO_BASE_ACCESS (t, i));
> -  MAYBE_REMEMBER_WITH_VARS (BINFO_INHERITANCE_CHAIN (t));
> -  MAYBE_REMEMBER_WITH_VARS (BINFO_SUBVTT_INDEX (t));
> -  MAYBE_REMEMBER_WITH_VARS (BINFO_VPTR_INDEX (t));
> +  /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
> +     and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
>    n = BINFO_N_BASE_BINFOS (t);
>    for (i = 0; i < n; i++)
>      MAYBE_REMEMBER_WITH_VARS (BINFO_BASE_BINFO (t, i));
> @@ -1823,7 +1822,6 @@ compare_tree_sccs_1 (tree t1, tree t2, t
>        compare_values (DECL_ALIGN);
>        if (code == LABEL_DECL)
>  	{
> -	  compare_values (DECL_ERROR_ISSUED);
>  	  compare_values (EH_LANDING_PAD_NR);
>  	  compare_values (LABEL_DECL_UID);
>  	}
> @@ -1854,7 +1852,6 @@ compare_tree_sccs_1 (tree t1, tree t2, t
>  
>    if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
>      {
> -      compare_values (DECL_DEFER_OUTPUT);
>        compare_values (DECL_COMMON);
>        compare_values (DECL_DLLIMPORT_P);
>        compare_values (DECL_WEAK);
> @@ -1865,7 +1862,7 @@ compare_tree_sccs_1 (tree t1, tree t2, t
>        if (code == VAR_DECL)
>  	{
>  	  compare_values (DECL_HARD_REGISTER);
> -	  compare_values (DECL_IN_TEXT_SECTION);
> +          /* DECL_IN_TEXT_SECTION is set during final asm output only.  */
>  	  compare_values (DECL_IN_CONSTANT_POOL);
>  	  compare_values (DECL_TLS_MODEL);
>  	}
> @@ -2167,12 +2164,8 @@ compare_tree_sccs_1 (tree t1, tree t2, t
>        compare_tree_edges (BINFO_OFFSET (t1), BINFO_OFFSET (t2));
>        compare_tree_edges (BINFO_VTABLE (t1), BINFO_VTABLE (t2));
>        compare_tree_edges (BINFO_VPTR_FIELD (t1), BINFO_VPTR_FIELD (t2));
> -      compare_tree_edges (BINFO_INHERITANCE_CHAIN (t1),
> -			  BINFO_INHERITANCE_CHAIN (t2));
> -      compare_tree_edges (BINFO_SUBVTT_INDEX (t1),
> -			  BINFO_SUBVTT_INDEX (t2));
> -      compare_tree_edges (BINFO_VPTR_INDEX (t1),
> -			  BINFO_VPTR_INDEX (t2));
> +      /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
> +	 and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
>      }
>  
>    if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
> @@ -2284,7 +2277,7 @@ unify_scc (struct streamer_tree_cache_d
>        for (unsigned i = 0; i < scc->len; ++i)
>  	{
>  	  TREE_VISITED (scc->entries[i]) = 1;
> -	  gcc_assert (!TREE_ASM_WRITTEN (scc->entries[i]));
> +	  gcc_checking_assert (!TREE_ASM_WRITTEN (scc->entries[i]));
>  	}
>  
>        tree *map = XALLOCAVEC (tree, 2 * len);
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]