Do not stream DECL_FCONTEXT

Message ID 20180712105129.GD94468@kam.mff.cuni.cz
State New
Headers show
Series
  • Do not stream DECL_FCONTEXT
Related show

Commit Message

Jan Hubicka July 12, 2018, 10:51 a.m.
Hi,
this is another field that I believe needs no streaming.  I however think we are pretty
much done with low hanging fruit.

lto-bootstrapped/regtested x86_64-linux, OK?

Honza

	* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not stream
	DECL_FCONTEXT
	(hash_tree): Do not hash DECL_FCONTEXT
	* tree-streamer-in.c (lto_input_ts_field_decl_tree_pointers):
	Do not stream DECL_FCONTEXT.
	* tree-streamer-out.c (write_ts_field_decl_tree_pointers): Likewise.
	* tree.c (free_lang_data_in_decl): Free DECL_FCONTEXT.

Comments

Richard Biener July 12, 2018, 11:02 a.m. | #1
On Thu, 12 Jul 2018, Jan Hubicka wrote:

> Hi,
> this is another field that I believe needs no streaming.  I however think we are pretty
> much done with low hanging fruit.
> 
> lto-bootstrapped/regtested x86_64-linux, OK?

OK.

Thanks,
Richard.

> Honza
> 
> 	* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not stream
> 	DECL_FCONTEXT
> 	(hash_tree): Do not hash DECL_FCONTEXT
> 	* tree-streamer-in.c (lto_input_ts_field_decl_tree_pointers):
> 	Do not stream DECL_FCONTEXT.
> 	* tree-streamer-out.c (write_ts_field_decl_tree_pointers): Likewise.
> 	* tree.c (free_lang_data_in_decl): Free DECL_FCONTEXT.
> 
> Index: lto-streamer-out.c
> ===================================================================
> --- lto-streamer-out.c	(revision 262560)
> +++ lto-streamer-out.c	(working copy)
> @@ -832,7 +832,7 @@ DFS::DFS_write_tree_body (struct output_
>        DFS_follow_tree_edge (DECL_BIT_FIELD_TYPE (expr));
>        DFS_follow_tree_edge (DECL_BIT_FIELD_REPRESENTATIVE (expr));
>        DFS_follow_tree_edge (DECL_FIELD_BIT_OFFSET (expr));
> -      DFS_follow_tree_edge (DECL_FCONTEXT (expr));
> +      gcc_checking_assert (!DECL_FCONTEXT (expr));
>      }
>  
>    if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
> @@ -1249,7 +1249,6 @@ hash_tree (struct streamer_tree_cache_d
>        visit (DECL_BIT_FIELD_TYPE (t));
>        visit (DECL_BIT_FIELD_REPRESENTATIVE (t));
>        visit (DECL_FIELD_BIT_OFFSET (t));
> -      visit (DECL_FCONTEXT (t));
>      }
>  
>    if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
> Index: tree-streamer-in.c
> ===================================================================
> --- tree-streamer-in.c	(revision 262560)
> +++ tree-streamer-in.c	(working copy)
> @@ -758,7 +758,6 @@ lto_input_ts_field_decl_tree_pointers (s
>    DECL_BIT_FIELD_TYPE (expr) = stream_read_tree (ib, data_in);
>    DECL_BIT_FIELD_REPRESENTATIVE (expr) = stream_read_tree (ib, data_in);
>    DECL_FIELD_BIT_OFFSET (expr) = stream_read_tree (ib, data_in);
> -  DECL_FCONTEXT (expr) = stream_read_tree (ib, data_in);
>  }
>  
>  
> Index: tree-streamer-out.c
> ===================================================================
> --- tree-streamer-out.c	(revision 262560)
> +++ tree-streamer-out.c	(working copy)
> @@ -646,7 +646,6 @@ write_ts_field_decl_tree_pointers (struc
>    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);
>  }
>  
>  
> Index: tree.c
> ===================================================================
> --- tree.c	(revision 262560)
> +++ tree.c	(working copy)
> @@ -5280,6 +5280,7 @@ free_lang_data_in_decl (tree decl)
>    free_lang_data_in_one_sizepos (&DECL_SIZE_UNIT (decl));
>    if (TREE_CODE (decl) == FIELD_DECL)
>      {
> +      DECL_FCONTEXT (decl) = NULL;
>        free_lang_data_in_one_sizepos (&DECL_FIELD_OFFSET (decl));
>        if (TREE_CODE (DECL_CONTEXT (decl)) == QUAL_UNION_TYPE)
>  	DECL_QUALIFIER (decl) = NULL_TREE;
> 
>

Patch

Index: lto-streamer-out.c
===================================================================
--- lto-streamer-out.c	(revision 262560)
+++ lto-streamer-out.c	(working copy)
@@ -832,7 +832,7 @@  DFS::DFS_write_tree_body (struct output_
       DFS_follow_tree_edge (DECL_BIT_FIELD_TYPE (expr));
       DFS_follow_tree_edge (DECL_BIT_FIELD_REPRESENTATIVE (expr));
       DFS_follow_tree_edge (DECL_FIELD_BIT_OFFSET (expr));
-      DFS_follow_tree_edge (DECL_FCONTEXT (expr));
+      gcc_checking_assert (!DECL_FCONTEXT (expr));
     }
 
   if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
@@ -1249,7 +1249,6 @@  hash_tree (struct streamer_tree_cache_d
       visit (DECL_BIT_FIELD_TYPE (t));
       visit (DECL_BIT_FIELD_REPRESENTATIVE (t));
       visit (DECL_FIELD_BIT_OFFSET (t));
-      visit (DECL_FCONTEXT (t));
     }
 
   if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
Index: tree-streamer-in.c
===================================================================
--- tree-streamer-in.c	(revision 262560)
+++ tree-streamer-in.c	(working copy)
@@ -758,7 +758,6 @@  lto_input_ts_field_decl_tree_pointers (s
   DECL_BIT_FIELD_TYPE (expr) = stream_read_tree (ib, data_in);
   DECL_BIT_FIELD_REPRESENTATIVE (expr) = stream_read_tree (ib, data_in);
   DECL_FIELD_BIT_OFFSET (expr) = stream_read_tree (ib, data_in);
-  DECL_FCONTEXT (expr) = stream_read_tree (ib, data_in);
 }
 
 
Index: tree-streamer-out.c
===================================================================
--- tree-streamer-out.c	(revision 262560)
+++ tree-streamer-out.c	(working copy)
@@ -646,7 +646,6 @@  write_ts_field_decl_tree_pointers (struc
   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);
 }
 
 
Index: tree.c
===================================================================
--- tree.c	(revision 262560)
+++ tree.c	(working copy)
@@ -5280,6 +5280,7 @@  free_lang_data_in_decl (tree decl)
   free_lang_data_in_one_sizepos (&DECL_SIZE_UNIT (decl));
   if (TREE_CODE (decl) == FIELD_DECL)
     {
+      DECL_FCONTEXT (decl) = NULL;
       free_lang_data_in_one_sizepos (&DECL_FIELD_OFFSET (decl));
       if (TREE_CODE (DECL_CONTEXT (decl)) == QUAL_UNION_TYPE)
 	DECL_QUALIFIER (decl) = NULL_TREE;