Remove first call to prune_unmark_dies

Geoffrey Keating gkeating@apple.com
Tue Apr 25 05:56:00 GMT 2006


die_mark is cleared after every place where it's used, so it should be
clear here, and doesn't need to be cleared again.

That's pretty important since this first call to prune_unmark_dies is
doing more work than any other part of the final dwarf output code.
The later call only applies to the DWARF information that's
actually going to be output, which is typically much less than what
was generated.

So, this patch produces a small speed improvement; but really it's
useful as documentation to ensure that the mark is always cleared.

Bootstrapped & tested (GCC dejagnu and GDB dejagnu) on powerpc-darwin8
with DWARF on by default.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-dwarf-verifymarks.patch===============
2006-04-24  Geoffrey Keating  <geoffk@apple.com>

	* dwarf2out.c (verify_marks_clear): New.
	(prune_unused_types): Call verify_marks_clear initially, not
	prune_unmark_dies.

Index: dwarf2out.c
===================================================================
--- dwarf2out.c	(revision 113171)
+++ dwarf2out.c	(working copy)
@@ -13830,7 +13830,18 @@
   return 1;
 }
 
+#if ENABLE_ASSERT_CHECKING
+/* Verify that all marks are clear.  */
 
+static void
+verify_marks_clear (dw_die_ref die)
+{
+  dw_die_ref c;
+  
+  gcc_assert (! die->die_mark);
+  FOR_EACH_CHILD (die, c, verify_marks_clear (c));
+}
+#endif /* ENABLE_ASSERT_CHECKING */
 
 /* Clear the marks for a die and its children.
    Be cool if the mark isn't set.  */
@@ -13845,7 +13856,6 @@
   FOR_EACH_CHILD (die, c, prune_unmark_dies (c));
 }
 
-
 /* Given DIE that we're marking as used, find any other dies
    it references as attributes and mark them as used.  */
 
@@ -14046,10 +14056,12 @@
   unsigned int i;
   limbo_die_node *node;
 
-  /* Clear all the marks.  */
-  prune_unmark_dies (comp_unit_die);
+#if ENABLE_ASSERT_CHECKING
+  /* All the marks should already be clear.  */
+  verify_marks_clear (comp_unit_die);
   for (node = limbo_die_list; node; node = node->next)
-    prune_unmark_dies (node->die);
+    verify_marks_clear (node->die);
+#endif /* ENABLE_ASSERT_CHECKING */
 
   /* Set the mark on nodes that are actually used.  */
   prune_unused_types_walk (comp_unit_die);
============================================================



More information about the Gcc-patches mailing list