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]

RFA: Quickly discard pseudo lifeness information after reload


In flow2 we still have most of the pseudo register lifeness information sitting around. We call split_all_insns, which calls find_many_sub_basic_blocks, thus often duplicating this pseudo lifeness information for lats of basic blocks. Eventually we get rid of the pseudo information by doing a life update.
I think it makes more sense to get rid of the pseudo lifeness information straight away.


regtesting on i686-pc-linux-gnu native and X sh-elf.
2005-12-02  J"orn Rennecke <joern.rennecke@st.com>

	* bitmap.c (bitmap_clear_from): New function.
	* bitmap.h (bitmap_clear_from): Declare.
	* flow.c (rest_of_handle_flow2): Discard pseudo lifeness information.

Index: bitmap.c
===================================================================
/usr/bin/diff -dup -F'^(' -u -L bitmap.c	(revision 107723) -L bitmap.c	(working copy) .svn/text-base/bitmap.c.svn-base bitmap.c
--- bitmap.c	(revision 107723)
+++ bitmap.c	(working copy)
@@ -1209,6 +1209,49 @@ bitmap_ior_and_compl_into (bitmap a, bit
 
   return changed;
 }
+
+/* Clear all bits with positions greater or equal to FROM.  */
+
+void
+bitmap_clear_from (bitmap head, unsigned from)
+{
+  bitmap_element *ptr = bitmap_find_bit (head, from);
+
+  if (ptr != 0)
+    {
+      unsigned bit_num  = from % BITMAP_WORD_BITS;
+      unsigned word_num = from / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
+      ptr->bits[word_num] &= ~ (((BITMAP_WORD) -1) << bit_num);
+      while (++word_num < BITMAP_ELEMENT_WORDS)
+	 ptr->bits[word_num] = 0;
+
+      /* If we cleared the entire word, include this element in the list to
+	 be freed up.  */
+      if (!bitmap_element_zerop (ptr))
+	ptr = ptr->next;
+    }
+  /* Even if the exact bit was not found, the call to bitmap_find_bit should
+     have left head->current 'adjacent' to the required position.  */
+  else if (head->current)
+    {
+      ptr = head->current;
+      if (head->indx < from)
+	{
+	  ptr = ptr->next;
+	  if (!ptr)
+	    return;
+	  gcc_assert (ptr->indx >= from);
+	}
+      else
+	gcc_assert (!ptr->prev || ptr->prev->indx < from);
+    }
+  else
+    {
+      gcc_assert (!head->first);
+      return;
+    }
+  bitmap_elt_clear_from (head, ptr);
+}
 
 /* Debugging function to print out the contents of a bitmap.  */
 
Index: bitmap.h
===================================================================
/usr/bin/diff -dup -F'^(' -u -L bitmap.h	(revision 107723) -L bitmap.h	(working copy) .svn/text-base/bitmap.h.svn-base bitmap.h
--- bitmap.h	(revision 107723)
+++ bitmap.h	(working copy)
@@ -129,6 +129,9 @@ extern void bitmap_set_bit (bitmap, int)
 /* Return true if a register is set in a register set.  */
 extern int bitmap_bit_p (bitmap, int);
 
+/* Clear all bits greater or equal to from.  */
+extern void bitmap_clear_from (bitmap head, unsigned from);
+
 /* Debug functions to print a bitmap linked list.  */
 extern void debug_bitmap (bitmap);
 extern void debug_bitmap_file (FILE *, bitmap);
Index: flow.c
===================================================================
/usr/bin/diff -dup -F'^(' -u -L flow.c	(revision 107723) -L flow.c	(working copy) .svn/text-base/flow.c.svn-base flow.c
--- flow.c	(revision 107723)
+++ flow.c	(working copy)
@@ -4614,6 +4614,21 @@ struct tree_opt_pass pass_life =
 static void
 rest_of_handle_flow2 (void)
 {
+  basic_block bb;
+
+  /* We got lots of pseudo registers sitting around in the live information.
+     This contains irrelevant insonsistencies that confuse the sanity checks,
+     constitute data that is unnecessarily duplicated as we call
+     find_many_sub_basic_blocks, and also slow down the convergence of the
+     global live update.  */
+  if (optimize)
+    FOR_EACH_BB (bb)
+      {
+	bitmap_clear_from (bb->il.rtl->global_live_at_start,
+			   FIRST_PSEUDO_REGISTER);
+	bitmap_clear_from (bb->il.rtl->global_live_at_end,
+			   FIRST_PSEUDO_REGISTER);
+      }
   /* If optimizing, then go ahead and split insns now.  */
 #ifndef STACK_REGS
   if (optimize > 0)

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