This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Expunge mark_referenced (needs testing on Darwin/OSX)


mark_referenced has two callers: assemble_name, and darwin.c's
machopic_validate_stub_or_non_lazy_ptr.  The latter is exclusively
called from ASM_OUTPUT_LABELREF, and ASM_OUTPUT_LABELREF is
exclusively called from assemble_name.  It is obviously unnecessary to
call mark_referenced twice on the same symbol.  mvsonlp also applies
mark_referenced to the stub or non-lazy pointer symbol itself, but
that is also unnecessary; nothing looks at that, only at the TREE_USED
bit on the list entry.  So all of that code can be killed off.

Then we note that the only thing that mark_referenced still does, is
set TREE_SYMBOL_REFERENCED.  So I inlined that into assemble_name.

There are something like 300 references to TREE_SYMBOL_REFERENCED, and
I suspect that many of them are broken in the face of cgraph not
looking at DECL_ASSEMBLER_NAME anymore.  But that's another audit for
another day.

I do not have access to a Darwin system; I would appreciate testing.
This patch has not even been compiled.

(Tangentially, this is a very inefficient algorithm darwin.c is using
to decide when to emit stubs.  But that's a problemn for another day.)

zw

        * tree.h: Remove prototype of mark_referenced.
        * varasm.c (mark_referenced): Delete function.
        (assemble_name): Set TREE_SYMBOL_REFERENCED instead of calling
        mark_referenced.
        * config/darwin.c (machopic_validate_stub_or_non_lazy_ptr):
        Just set TREE_USED on the list entry; don't call
        mark_referenced on anything.

===================================================================
Index: tree.h
--- tree.h	22 May 2004 18:16:39 -0000	1.498
+++ tree.h	22 May 2004 22:00:57 -0000
@@ -3643,7 +3643,6 @@ extern int supports_one_only (void);
 extern void variable_section (tree, int);
 enum tls_model decl_tls_model (tree);
 extern void resolve_unique_section (tree, int, int);
-extern void mark_referenced (tree);
 extern void mark_decl_referenced (tree);
 extern void notice_global_symbol (tree);
 
===================================================================
Index: varasm.c
--- varasm.c	19 May 2004 02:11:41 -0000	1.426
+++ varasm.c	22 May 2004 22:00:57 -0000
@@ -1685,13 +1685,6 @@ assemble_label (const char *name)
   ASM_OUTPUT_LABEL (asm_out_file, name);
 }
 
-/* Set the symbol_referenced flag for ID.  */
-void
-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)
@@ -1720,7 +1713,7 @@ assemble_name (FILE *file, const char *n
 
   id = maybe_get_identifier (real_name);
   if (id)
-    mark_referenced (id);
+    TREE_SYMBOL_REFERENCED (id) = 1;
 
   if (name[0] == '*')
     fputs (&name[1], file);
===================================================================
Index: config/darwin.c
--- config/darwin.c	19 May 2004 02:11:42 -0000	1.67
+++ config/darwin.c	22 May 2004 22:00:57 -0000
@@ -410,25 +410,14 @@ machopic_stub_name (const char *name)
 void
 machopic_validate_stub_or_non_lazy_ptr (const char *name, int validate_stub)
 {
-  const char *real_name;
-  tree temp, ident = get_identifier (name), id2;
+  tree temp, ident = get_identifier (name);
 
     for (temp = (validate_stub ? machopic_stubs : machopic_non_lazy_pointers);
          temp != NULL_TREE;
          temp = TREE_CHAIN (temp))
       if (ident == TREE_PURPOSE (temp))
-	{
-	  /* Mark both the stub or non-lazy pointer as well as the
-	     original symbol as being referenced.  */
-          TREE_USED (temp) = 1;
-	  if (TREE_CODE (TREE_VALUE (temp)) == IDENTIFIER_NODE)
-	    mark_referenced (TREE_VALUE (temp));
-	  real_name = IDENTIFIER_POINTER (TREE_VALUE (temp));
-	  real_name = darwin_strip_name_encoding (real_name);
-	  id2 = maybe_get_identifier (real_name);
-	  if (id2)
-	    mark_referenced (id2);
-	}
+	/* Yes, we need this one.  */
+        TREE_USED (temp) = 1;
 }
 
 /* Transform ORIG, which may be any data source, to the corresponding


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]