varasm.c (mark_decl_referenced): Revert the removal until targets are fixed.
authorJan Hubicka <jh@suse.cz>
Wed, 5 Jun 2013 15:29:12 +0000 (17:29 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 5 Jun 2013 15:29:12 +0000 (15:29 +0000)
* varasm.c (mark_decl_referenced): Revert the removal until targets
are fixed.

From-SVN: r199699

gcc/ChangeLog
gcc/varasm.c

index 6082b510d36fd8ef62a746d516db349a05018179..1eba4643cd1ecab14d57eeeb5923f95177ca89b4 100644 (file)
@@ -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
@@ -31,7 +36,6 @@
        (function_and_variable_visibility): Clear forced_by_abi as needed.
        * trans-mem.c (ipa_tm_mark_forced_by_abi_node): New functoin.
        (ipa_tm_create_version_alias, ipa_tm_create_version): Update.
-       * varasm.c (mark_decl_referenced): Remove.
        * symtab.c (dump_symtab_base): Dump forced_by_abi.
        * varpool.c (decide_is_variable_needed): Remove.
 
index 4c4178f61996fcfedb94b96bab9b8c386ffa7907..c088ebf90080eb97182b6ca6c8d45c7623a5464c 100644 (file)
@@ -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