Patchwork [lra] some cleaning up to speed up LRA

login
register
mail settings
Submitter Vladimir Makarov
Date June 23, 2011, 7:32 p.m.
Message ID <4E0394C3.4060203@redhat.com>
Download mbox | patch
Permalink /patch/101678/
State New
Headers show

Comments

Vladimir Makarov - June 23, 2011, 7:32 p.m.
The following patch removes a code used for some experiments in pseudo 
live range splitting during the assignment sub-pass and, as consequence, 
speeds LRA up.

The patch was successfully bootstrapped on x86-64.

2011-06-23  Vladimir Makarov <vmakarov@redhat.com>

         * lra-int.h (struct lra_bb_info, lra_bb_info): Remove.

         * lra.c (lra_bb_info, init_bb_info, finish_bb_info): Remove.
         (lra): Remove calls of init_bb_info and finish_bb_info.

         * lra-lives.c (live_regs): Remove.
         (make_hard_regno_born, make_pseudo_live, make_pseudo_dead): Don't
         update live_regs.
         (process_bb_lives): Ditto.  Don't set up lra_bb_info.
         (lra_create_live_ranges): Don't initialize/finalize live_regs.

Patch

Index: lra.c
===================================================================
--- lra.c	(revision 175313)
+++ lra.c	(working copy)
@@ -45,35 +45,6 @@  along with GCC; see the file COPYING3.  
 #include "lra-int.h"
 #include "df.h"
 
-/* Info about BBs used by several LRA files.  Remember that we never
-   create new BBs during LRA.  */
-struct lra_bb_info *lra_bb_info;
-
-/* Allocate and initialize the BB info.  */
-static void
-init_bb_info (void)
-{
-  basic_block bb;
-
-  lra_bb_info = (struct lra_bb_info *) xmalloc (sizeof (struct lra_bb_info)
-						* last_basic_block);
-  FOR_EACH_BB (bb)
-    bitmap_initialize (&lra_bb_info[bb->index].live_in_regs, &reg_obstack); 
-}
-
-/* Finish and free the BB info.  */
-static void
-finish_bb_info (void)
-{
-  basic_block bb;
-
-  FOR_EACH_BB (bb)
-    bitmap_clear (&lra_bb_info[bb->index].live_in_regs); 
-  free (lra_bb_info);
-}
-
-
-
 /* Hard registers currently not available for allocation.  It can
    changed after some registers become not eliminable.  */
 HARD_REG_SET lra_no_alloc_regs;
@@ -2041,7 +2012,6 @@  lra (FILE *f)
   lra_dump_file = f;
 
 
-  init_bb_info ();
   init_insn_recog_data ();
 
 #ifdef ENABLE_CHECKING
@@ -2141,7 +2111,6 @@  lra (FILE *f)
   lra_live_ranges_finish ();
   lra_contraints_finish ();
   finish_reg_info ();
-  finish_bb_info ();
   bitmap_clear (&lra_constraint_insn_stack_bitmap);
   VEC_free (rtx, heap, lra_constraint_insn_stack);
   finish_insn_recog_data ();
Index: lra-int.h
===================================================================
--- lra-int.h	(revision 175313)
+++ lra-int.h	(working copy)
@@ -48,19 +48,6 @@  lra_get_preferred_class (int regno)
   return reg_preferred_class (regno);
 }
 
-/* Info about BBs used by several LRA files.  */
-struct lra_bb_info
-{
-  /* DFA creates a bit different data (DF_LR_IN) than we need for LRA
-     live range splitting.  E.g. DF_LR_IN might be not accurate for BB
-     having EH predecessors.  */
-  bitmap_head live_in_regs;
-};
-
-/* Info about BBs used by several LRA files.  Remember that we never
-   create new BBs during LRA.  */
-extern struct lra_bb_info *lra_bb_info;
-
 typedef struct lra_live_range *lra_live_range_t;
 
 /* The structure describes program points where a given pseudo lives.
Index: lra-lives.c
===================================================================
--- lra-lives.c	(revision 175313)
+++ lra-lives.c	(working copy)
@@ -72,10 +72,6 @@  static sparseset pseudos_live;
 /* Set of hard regs (except eliminable ones) currently live.  */
 static HARD_REG_SET hard_regs_live;
 
-/* Another representation of living pseudos and hard registers at the
-   current point.  */
-static bitmap_head live_regs;
-
 /* Set of pseudos and hard registers start living/dying.  */
 static sparseset start_living, start_dying;
 
@@ -283,7 +279,6 @@  make_hard_regno_born (int regno)
       || TEST_HARD_REG_BIT (hard_regs_live, regno))
     return;
   SET_HARD_REG_BIT (hard_regs_live, regno);
-  bitmap_set_bit (&live_regs, regno);
   sparseset_set_bit (start_living, regno);
   EXECUTE_IF_SET_IN_SPARSESET (pseudos_live, i)
     SET_HARD_REG_BIT (lra_reg_info[i].conflict_hard_regs, regno);
@@ -300,7 +295,6 @@  make_hard_regno_dead (int regno)
   gcc_assert (regno < FIRST_PSEUDO_REGISTER);
   sparseset_set_bit (start_dying, regno);
   CLEAR_HARD_REG_BIT (hard_regs_live, regno);
-  bitmap_clear_bit (&live_regs, regno);
 }
 
 /* Mark pseudo REGNO as currently living, update conflicting hard
@@ -314,7 +308,6 @@  mark_pseudo_live (int regno)
   gcc_assert (regno >= FIRST_PSEUDO_REGISTER);
   gcc_assert (! sparseset_bit_p (pseudos_live, regno));
   sparseset_set_bit (pseudos_live, regno);
-  bitmap_set_bit (&live_regs, regno);
   IOR_HARD_REG_SET (lra_reg_info[regno].conflict_hard_regs, hard_regs_live);
   
   if ((complete_info_p || lra_get_regno_hard_regno (regno) < 0)
@@ -335,7 +328,6 @@  mark_pseudo_dead (int regno)
   gcc_assert (regno >= FIRST_PSEUDO_REGISTER);
   gcc_assert (sparseset_bit_p (pseudos_live, regno));
   sparseset_clear_bit (pseudos_live, regno);
-  bitmap_clear_bit (&live_regs, regno);
   sparseset_set_bit (start_dying, regno);
   if (complete_info_p || lra_get_regno_hard_regno (regno) < 0)
     {
@@ -488,16 +480,12 @@  process_bb_lives (basic_block bb)
 
   reg_live_out = DF_LR_OUT (bb);
   sparseset_clear (pseudos_live);
-  bitmap_clear (&live_regs);
   REG_SET_TO_HARD_REG_SET (hard_regs_live, reg_live_out);
   AND_COMPL_HARD_REG_SET (hard_regs_live, eliminable_regset);
   AND_COMPL_HARD_REG_SET (hard_regs_live, lra_no_alloc_regs);
   EXECUTE_IF_SET_IN_BITMAP (reg_live_out, 0, j, bi)
     if (j >= FIRST_PSEUDO_REGISTER)
       mark_pseudo_live (j);
-    else if (! TEST_HARD_REG_BIT (lra_no_alloc_regs, j)
-	     && ! TEST_HARD_REG_BIT (eliminable_regset, j))
-      bitmap_set_bit (&live_regs, j);
       
   freq = REG_FREQ_FROM_BB (bb);
 
@@ -679,10 +667,6 @@  process_bb_lives (basic_block bb)
 	add_reg_note (curr_insn, REG_UNUSED, regno_reg_rtx[j]);
     }
   
-  /* It is important to call it before processing EH return data
-     regnos.  */
-  bitmap_copy (&lra_bb_info[bb->index].live_in_regs, &live_regs);
-
 #ifdef EH_RETURN_DATA_REGNO
   if (bb_has_eh_pred (bb))
     for (j = 0; ; ++j)
@@ -947,7 +931,6 @@  lra_create_live_ranges (bool all_p)
 	lra_hard_reg_usage[hard_regno] += lra_reg_info[i].freq;
     }
   lra_free_copies ();
-  bitmap_initialize (&live_regs, &reg_obstack);
   pseudos_live = sparseset_alloc (max_regno);
   start_living = sparseset_alloc (max_regno);
   start_dying = sparseset_alloc (max_regno);
@@ -968,7 +951,6 @@  lra_create_live_ranges (bool all_p)
   sparseset_free (start_dying);
   sparseset_free (start_living);
   sparseset_free (pseudos_live);
-  bitmap_clear (&live_regs);
   compress_live_ranges ();
 }