Patchwork Symtab cleanups 4/17

login
register
mail settings
Submitter Jan Hubicka
Date June 5, 2013, 3:32 p.m.
Message ID <20130605153231.GB8018@atrey.karlin.mff.cuni.cz>
Download mbox | patch
Permalink /patch/249117/
State New
Headers show

Comments

Jan Hubicka - June 5, 2013, 3:32 p.m.
> Honza,
> 
> Also, you did not remove the declaration of mark_decl_referenced() in tree.h

Sorry for the breakage. It was change in final version of patch where I noticed
that mark_decl_referenced is dead and I did not get into idea that targets may
use it.

Looking at the use cases, I think it may be completely removed or replaced
by DECL_PRESERVE_P as you do, but I will try to do this case by case.
For this reason I just commited patch reverting removal of this function.

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 199698)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2013-06-05  Jan Hubicka  <jh@suse.cz>
+
+	* varasm.c (mark_decl_referenced): Revert the removal until targets
+	are fixed.
+
 2013-06-05  David Edelsohn  <dje.gcc@gmail.com>
 
 	* config/rs6000/rs6000.c (print_operand, 'z'): Use DECL_PRESERVE_P
Index: varasm.c
===================================================================
--- varasm.c	(revision 199698)
+++ varasm.c	(working copy)
@@ -2244,6 +2244,33 @@  mark_referenced (tree id)
   TREE_SYMBOL_REFERENCED (id) = 1;
 }
 
+/* Set the symbol_referenced flag for DECL and notify callgraph.  */
+void
+mark_decl_referenced (tree decl)
+{
+  if (TREE_CODE (decl) == FUNCTION_DECL)
+    {
+      /* Extern inline functions don't become needed when referenced.
+	 If we know a method will be emitted in other TU and no new
+	 functions can be marked reachable, just use the external
+	 definition.  */
+      struct cgraph_node *node = cgraph_get_create_node (decl);
+      if (!DECL_EXTERNAL (decl)
+	  && !node->symbol.definition)
+	cgraph_mark_force_output_node (node);
+    }
+  else if (TREE_CODE (decl) == VAR_DECL)
+    {
+      struct varpool_node *node = varpool_node_for_decl (decl);
+      /* C++ frontend use mark_decl_references to force COMDAT variables
+         to be output that might appear dead otherwise.  */
+      node->symbol.force_output = true;
+    }
+  /* else do nothing - we can get various sorts of CST nodes here,
+     which do not need to be marked.  */
+}
+
+
 /* Follow the IDENTIFIER_TRANSPARENT_ALIAS chain starting at *ALIAS
    until we find an identifier that is not itself a transparent alias.
    Modify the alias passed to it by reference (and all aliases on the