Symtab cleanup 10/17 remove unnecesary DECL_ARGUMENTS and DECL_RESULT

Jan Hubicka hubicka@ucw.cz
Thu Aug 1 15:09:00 GMT 2013


Hi,
Now when we have abstract origins tracked, this patch makes DECL_ARGUMENTS and
DECL_RESULT to be removed from FUNCTION_DECLs that are never passed to symbol
table.  This reduces LTO streaming effort (by about 1/3rd of PARM_DECls)

Bootstrapped/regtested ppc64-linux, will commit it after further testing on x86_64-linux.

Honza

	* cgraph.h (release_function_body): Declare.
	* tree.c (free_lang_data_in_decl): Free, parameters and return values
	of unused delcarations.
Index: cgraph.h
===================================================================
--- cgraph.h	(revision 201408)
+++ cgraph.h	(working copy)
@@ -606,6 +606,7 @@ void debug_cgraph_node (struct cgraph_no
 void cgraph_remove_edge (struct cgraph_edge *);
 void cgraph_remove_node (struct cgraph_node *);
 void cgraph_release_function_body (struct cgraph_node *);
+void release_function_body (tree);
 void cgraph_node_remove_callees (struct cgraph_node *node);
 struct cgraph_edge *cgraph_create_edge (struct cgraph_node *,
 					struct cgraph_node *,
Index: tree.c
===================================================================
--- tree.c	(revision 201367)
+++ tree.c	(working copy)
@@ -4886,6 +4886,20 @@ free_lang_data_in_decl (tree decl)
 
  if (TREE_CODE (decl) == FUNCTION_DECL)
     {
+      struct cgraph_node *node;
+      if (!(node = cgraph_get_node (decl))
+	  || (!node->symbol.definition && !node->clones))
+	{
+	  if (node)
+	    cgraph_release_function_body (node);
+	  else
+	    {
+	      release_function_body (decl);
+	      DECL_ARGUMENTS (decl) = NULL;
+	      DECL_RESULT (decl) = NULL;
+	      DECL_INITIAL (decl) = error_mark_node;
+	    }
+	}
       if (gimple_has_body_p (decl))
 	{
 	  tree t;



More information about the Gcc-patches mailing list