public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Symtab cleanups 8/17: abstract functions
@ 2013-07-30 14:24 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2013-07-30 14:24 UTC (permalink / raw)
  To: gcc-patches

Hi,
symtab nodes are (ab)used to prevent removal of debug info from functions that appear as
abstract origins of other functions.  I am not sure if this is the best way to do so,
but the code is fundamentaly broken on few places and it seems to make sense to get it working
before thinking what would be really proper representation (for LTO the fact that debug
info has nodes comes handy)

This is first part of the patch that makes us to handle abstract function correctly
in the symtab.

Bootstrapped/regtested x86_64-linux, will commit it shortly.

Honza

	* lto-symtab.c (lto_symtab_merge_symbols): Merge duplicated nodes for abstract functions.
	* cgraph.h (symtab_real_symbol_p): Abstract declarations are not real symbols.

Index: lto-symtab.c
===================================================================
--- lto-symtab.c	(revision 201250)
+++ lto-symtab.c	(working copy)
@@ -599,6 +599,13 @@ lto_symtab_merge_symbols (void)
 		  && (cnode2 = cgraph_get_node (node->symbol.decl))
 		  && cnode2 != cnode)
 		lto_cgraph_replace_node (cnode2, cnode);
+
+	      /* Abstract functions may have duplicated cgraph nodes attached;
+		 remove them.  */
+	      else if (cnode && DECL_ABSTRACT (cnode->symbol.decl)
+		       && (cnode2 = cgraph_get_node (node->symbol.decl))
+		       && cnode2 != cnode)
+		cgraph_remove_node (cnode2);
 	      symtab_insert_node_to_hashtable ((symtab_node)node);
 	    }
 	}
Index: cgraph.h
===================================================================
--- cgraph.h	(revision 201250)
+++ cgraph.h	(working copy)
@@ -1347,13 +1347,13 @@ symtab_real_symbol_p (symtab_node node)
 {
   struct cgraph_node *cnode;
 
+  if (DECL_ABSTRACT (node->symbol.decl))
+    return false;
   if (!is_a <cgraph_node> (node))
     return true;
   cnode = cgraph (node);
   if (cnode->global.inlined_to)
     return false;
-  if (cnode->abstract_and_needed)
-    return false;
   return true;
 }
 #endif  /* GCC_CGRAPH_H  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-07-30 13:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-30 14:24 Symtab cleanups 8/17: abstract functions Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).