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]

Re: [patch]: To cause dataflow to speed up and use less mem.


Committed as revision 125857.

The committed patch does not have the frv.c changes as these were
already committed by Rask <rask@sygehus.dk>

Kenny

2007-06-15 Kenneth Zadeck <zadeck@naturalbridge.com>

* df.h (DF_FIRST_OPTIONAL_PROBLEM): Removed.
(struct df_problem.free_blocks_on_set_blocks): New field.
(struct dataflow.optional_p): New field.
(df_bb_regno_last_use_find, df_insn_regno_def_p): Removed.
(df_live_set_all_dirty): New function.
* df-scan.c (df_scan_alloc): Initialize optional_p.
(problem_SCAN): Initialize free_blocks_on_set_blocks.
* df-core.c (df_set_blocks): Removed use of
DF_FIRST_OPTIONAL_PROBLEM. Now uses
df_problem.free_blocks_on_set_blocks to determine which blocks are
recycled.
(df_remove_problem): Removed use of DF_FIRST_OPTIONAL_PROBLEM.
(df_finish_pass): Removed use of DF_FIRST_OPTIONAL_PROBLEM. Now
uses dataflow.optional_p to determine if problem should be
deleted.
(rest_of_handle_df_initialize): Only start live problem if
-02 or above.
(df_bb_regno_last_use_find, df_insn_regno_def_p): Removed.
* df-problems.c (df_ru_alloc, df_rd_alloc, df_lr_alloc,
df_live_alloc, df_urec_alloc, df_note_alloc): set optional_p.
(problem_RU, problem_RD, problem_LR, problem_UREC, problem_CHAIN,
problem_NOTE): Initialize free_blocks_on_set_blocks.
(df_lr_bb_local_compute): Recompute luids if df_live problem is
not active.
(df_live_set_all_dirty, df_note_alloc): New function.
* regrename.c (merge_overlapping_regs): Change DF_LIVE_* to
df_get_live_*.
* sched_ebb.c (compute_jump_reg_dependencies): Ditto.
* postreload.c (reload_combine): Ditto.
* cse.c (cse_extended_basic_block): Ditto.
* regmove.c (mark_flags_life_zones): Ditto.
* rtlfactoring.c (split_blocks_after_seqs, split_pattern_seq,
erase_matching_seqs): Ditto.
* bt-load.c (compute_defs_uses_and_gen): Ditto.
* integrate (allocate_initial_values): Ditto.
* combine.c (reg_dead_at_p): Ditto.
* resource.c (mark_target_live_regs): Ditto.
* sched-rgn.c (check_live_1, update_live_1): Ditto.
* config/sh/sh.c (find_r0_life_regions): Ditto.
* global.c (rest_of_handle_global_alloc): Only add back df_live
for -O > 1.
* local-alloc.c (rest_of_handle_local_alloc): Only remove
df_live for -O > 1.
* ifcvt.c (dead_or_predicable): Change DF_LIVE_* to
df_get_live_*.
(if_convert): Make sure df_live is there at -O == 1.
(pass_if_after_combine): Cleanup flags.
* init-regs.c (initialize_uninitialized_regs): Make sure df_live
is there at -O == 1.

Seongbae Park (???, ???) wrote:
> These hunks:
>
> @@ -3958,6 +3958,12 @@ if_convert (bool recompute_dominance)
> basic_block bb;
> int pass;
>
> + if (optimize == 1)
> + {
> + df_live_add_problem ();
> + df_live_set_all_dirty ();
> + }
> +
> num_possible_if_blocks = 0;
> num_updated_if_blocks = 0;
> num_true_changes = 0;
> @@ -4039,6 +4045,9 @@ if_convert (bool recompute_dominance)
> num_true_changes);
> }
>
> + if (optimize == 1)
> + df_remove_problem (df_live);
> +
> Index: init-regs.c
> ===================================================================
> --- init-regs.c (revision 125730)
> +++ init-regs.c (working copy)
> @@ -53,6 +53,12 @@ initialize_uninitialized_regs (void)
> basic_block bb;
> bitmap already_genned = BITMAP_ALLOC (NULL);
>
> + if (optimize == 1)
> + {
> + df_live_add_problem ();
> + df_live_set_all_dirty ();
> + }
> +
> df_analyze ();
>
> FOR_EACH_BB (bb)
> @@ -111,6 +117,9 @@ initialize_uninitialized_regs (void)
> }
> }
>
> + if (optimize == 1)
> + df_remove_problem (df_live);
> +
> BITMAP_FREE (already_genned);
> }
>
>
>
> Why check for only optimize == 1 ?
> This looks fragile fragle. Shouldn't you check optimize <= 1 ?
> I know those optimizations are not turned on at 0,
> but still.
> Maybe we want to introduce a global function
> something like df_is_doing_live() or something along those lines
> to common up the checks.
> Basically I don't like to see this check scattered throughout the code.
> This applies equally to other checking against optimize outside
> gate_* functions.
> Other than that, the rest looks fine.
>
> Seongbae
>
>
> On 6/15/07, Kenneth Zadeck <zadeck@naturalbridge.com> wrote:
>> The original purpose of this patch was to turn off df_live when running
>> at -O1. This means that at -O1, there would only be the old backwards
>> df_lr problem (the info available before the dataflow merge).
>>
>> The effect of doing that appears to be about 1% compile time improvement
>> and most likely some space improvement. This required changing some
>> amount of plumbing to make sure that df_live was not added to the
>> problem stack and changing all of the instances of DF_LIVE_{in|out} to
>> df_get_live_{in|out}.
>>
>> However, it was not as easy as I had hoped. A couple of passes have
>> been changed so that they now really do require the better info. These
>> passes are
>> init-regs and ifcvt.
>>
>> Along the way I discovered a bug, where the code that automatically
>> removes optional passes was not correct. This had the effect of holding
>> on to the df_urec problem for longer than necessary. This has both
>> adverse time and space consequences.
>>
>> On compiling all of the .i files for gcc, this second fix cuts 2 seconds
>> off -O1, -O2, and -O3 out of times of 3:20, 5:10, and 6:15 respectively.
>> The first fix cuts another 2 secs off the -O1 time but has no effect at
>> other levels. All of these times were measured on my x86-64.
>>
>> I do not know how to measure the space. We can look at honza's report
>> after this gets in. I also removed a couple of functions that were
>> never called.
>>
>> This was bootstrapped and regression tested on x86-32, x86-64, ppc-32
>> and ia-64.
>>
>> OK to commit?
>>
>> Kenny
>>
>>
>>
>> 2007-06-15 Kenneth Zadeck <zadeck@naturalbridge.com>
>>
>> * df.h (DF_FIRST_OPTIONAL_PROBLEM): Removed.
>> (struct df_problem.free_blocks_on_set_blocks): New field.
>> (struct dataflow.optional_p): New field.
>> (df_bb_regno_last_use_find, df_insn_regno_def_p): Removed.
>> (df_live_set_all_dirty): New function.
>> * df-scan.c (df_scan_alloc): Initialize optional_p.
>> (problem_SCAN): Initialize free_blocks_on_set_blocks.
>> * df-core.c (df_set_blocks): Removed use of
>> DF_FIRST_OPTIONAL_PROBLEM. Now uses
>> df_problem.free_blocks_on_set_blocks to determine which blocks are
>> recycled.
>> (df_remove_problem): Removed use of DF_FIRST_OPTIONAL_PROBLEM.
>> (df_finish_pass): Removed use of DF_FIRST_OPTIONAL_PROBLEM. Now
>> uses dataflow.optional_p to determine if problem should be
>> deleted.
>> (rest_of_handle_df_initialize): Only start live problem if
>> -02 or above.
>> (df_bb_regno_last_use_find, df_insn_regno_def_p): Removed.
>> * df-problems.c (df_ru_alloc, df_rd_alloc, df_lr_alloc,
>> df_live_alloc, df_urec_alloc, df_note_alloc): set optional_p.
>> (problem_RU, problem_RD, problem_LR, problem_UREC, problem_CHAIN,
>> problem_NOTE): Initialize free_blocks_on_set_blocks.
>> (df_lr_bb_local_compute): Recompute luids if df_live problem is
>> not active.
>> (df_live_set_all_dirty, df_note_alloc): New function.
>> * regrename.c (merge_overlapping_regs): Change DF_LIVE_* to
>> df_get_live_*.
>> * sched_ebb.c (compute_jump_reg_dependencies): Ditto.
>> * postreload.c (reload_combine): Ditto.
>> * cse.c (cse_extended_basic_block): Ditto.
>> * regmove.c (mark_flags_life_zones): Ditto.
>> * rtlfactoring.c (split_blocks_after_seqs, split_pattern_seq,
>> erase_matching_seqs): Ditto.
>> * bt-load.c (compute_defs_uses_and_gen): Ditto.
>> * integrate (allocate_initial_values): Ditto.
>> * combine.c (reg_dead_at_p): Ditto.
>> * resource.c (mark_target_live_regs): Ditto.
>> * sched-rgn.c (check_live_1, update_live_1): Ditto.
>> * config/frv/frv.c (frv_ifcvt_modify_tests,
>> frv_ifcvt_modify_insn): Ditto.
>> * config/sh/sh.c (find_r0_life_regions): Ditto.
>> * global.c (rest_of_handle_global_alloc): Only add back df_live
>> for -O > 1.
>> * local-alloc.c (rest_of_handle_local_alloc): Only remove
>> df_live for -O > 1.
>> * ifcvt.c (dead_or_predicable): Change DF_LIVE_* to
>> df_get_live_*.
>> (if_convert): Make sure df_live is there at -O == 1.
>> (pass_if_after_combine): Cleanup flags.
>> * init-regs.c (initialize_uninitialized_regs): Make sure df_live
>> is there at -O == 1.
>>
>>
>>
>>
>>
>
>

Index: df.h
===================================================================
--- df.h	(revision 125730)
+++ df.h	(working copy)
@@ -52,7 +52,6 @@ struct df_link;
 #define DF_NOTE  7      /* REG_DEF and REG_UNUSED notes. */
 
 #define DF_LAST_PROBLEM_PLUS1 (DF_NOTE + 1)
-#define DF_FIRST_OPTIONAL_PROBLEM DF_RU
 
 /* Dataflow direction.  */
 enum df_flow_dir
@@ -249,8 +248,13 @@ struct df_problem {
   df_verify_solution_start verify_start_fun;
   df_verify_solution_end verify_end_fun;
   struct df_problem *dependent_problem;
+
   /* The timevar id associated with this pass.  */
   unsigned int tv_id;
+
+  /* True if the df_set_blocks should null out the basic block info if
+     this block drops out of df->blocks_to_analyze.  */
+  bool free_blocks_on_set_blocks;
 };
 
 
@@ -293,6 +297,11 @@ struct dataflow
      solutions.  Note that this bit is always true for all problems except 
      lr and live.  */
   bool solutions_dirty;
+
+  /* If true, this pass is deleted by df_finish_pass.  This is never
+     true for DF_SCAN and DF_LR.  It is true for DF_LIVE if optimize >
+     1.  It is always true for the other problems.  */
+  bool optional_p;
 };
 
 
@@ -837,10 +846,8 @@ extern void df_verify (void);
 #ifdef DF_DEBUG_CFG
 extern void df_check_cfg_clean (void);
 #endif
-extern struct df_ref *df_bb_regno_last_use_find (basic_block, unsigned int);
 extern struct df_ref *df_bb_regno_first_def_find (basic_block, unsigned int);
 extern struct df_ref *df_bb_regno_last_def_find (basic_block, unsigned int);
-extern bool df_insn_regno_def_p (rtx, unsigned int);
 extern struct df_ref *df_find_def (rtx, rtx);
 extern bool df_reg_defined (rtx, rtx);
 extern struct df_ref *df_find_use (rtx, rtx);
@@ -882,6 +889,7 @@ extern void df_lr_add_problem (void);
 extern void df_lr_verify_transfer_functions (void);
 extern void df_live_verify_transfer_functions (void);
 extern void df_live_add_problem (void);
+extern void df_live_set_all_dirty (void);
 extern void df_urec_add_problem (void);
 extern void df_chain_add_problem (enum df_chain_flags);
 extern void df_note_add_problem (void);
Index: df-scan.c
===================================================================
--- df-scan.c	(revision 125730)
+++ df-scan.c	(working copy)
@@ -341,6 +341,7 @@ df_scan_alloc (bitmap all_blocks ATTRIBU
   df->insns_to_delete = BITMAP_ALLOC (&problem_data->insn_bitmaps);
   df->insns_to_rescan = BITMAP_ALLOC (&problem_data->insn_bitmaps);
   df->insns_to_notes_rescan = BITMAP_ALLOC (&problem_data->insn_bitmaps);
+  df_scan->optional_p = false;
 }
 
 
@@ -434,7 +435,8 @@ static struct df_problem problem_SCAN =
   NULL,                       /* Incremental solution verify start.  */
   NULL,                       /* Incremental solution verfiy end.  */
   NULL,                       /* Dependent problem.  */
-  TV_DF_SCAN                  /* Timing variable.  */
+  TV_DF_SCAN,                 /* Timing variable.  */
+  false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
 
 
Index: df-core.c
===================================================================
--- df-core.c	(revision 125730)
+++ df-core.c	(working copy)
@@ -506,15 +506,17 @@ df_set_blocks (bitmap blocks)
 	bitmap_print (dump_file, blocks, "setting blocks to analyze ", "\n");
       if (df->blocks_to_analyze)
 	{
+	  /* This block is called to change the focus from one subset
+	     to another.  */
 	  int p;
 	  bitmap diff = BITMAP_ALLOC (&df_bitmap_obstack);
 	  bitmap_and_compl (diff, df->blocks_to_analyze, blocks);
-	  for (p = df->num_problems_defined - 1; p >= DF_FIRST_OPTIONAL_PROBLEM ;p--)
+	  for (p = 0; p < df->num_problems_defined; p++)
 	    {
 	      struct dataflow *dflow = df->problems_in_order[p];
-	      if (dflow->problem->reset_fun)
+	      if (dflow->optional_p && dflow->problem->reset_fun)
 		dflow->problem->reset_fun (df->blocks_to_analyze);
-	      else if (dflow->problem->free_bb_fun)
+	      else if (dflow->problem->free_blocks_on_set_blocks)
 		{
 		  bitmap_iterator bi;
 		  unsigned int bb_index;
@@ -539,33 +541,31 @@ df_set_blocks (bitmap blocks)
 	}
       else
 	{
-	  /* If we have not actually run scanning before, do not try
-	     to clear anything.  */
-	  if (df_scan->problem_data)
+	  /* This block of code is executed to change the focus from
+	     the entire function to a subset.  */
+	  bitmap blocks_to_reset = NULL;
+	  int p;
+	  for (p = 0; p < df->num_problems_defined; p++)
 	    {
-	      bitmap blocks_to_reset = NULL;
-	      int p;
-	      for (p = df->num_problems_defined - 1; p >= DF_FIRST_OPTIONAL_PROBLEM ;p--)
+	      struct dataflow *dflow = df->problems_in_order[p];
+	      if (dflow->optional_p && dflow->problem->reset_fun)
 		{
-		  struct dataflow *dflow = df->problems_in_order[p];
-		  if (dflow->problem->reset_fun)
+		  if (!blocks_to_reset)
 		    {
-		      if (!blocks_to_reset)
+		      basic_block bb;
+		      blocks_to_reset =
+			BITMAP_ALLOC (&df_bitmap_obstack);
+		      FOR_ALL_BB(bb)
 			{
-			  basic_block bb;
-			  blocks_to_reset =
-			    BITMAP_ALLOC (&df_bitmap_obstack);
-			  FOR_ALL_BB(bb)
-			    {
-			      bitmap_set_bit (blocks_to_reset, bb->index); 
-			    }
+			  bitmap_set_bit (blocks_to_reset, bb->index); 
 			}
-		      dflow->problem->reset_fun (blocks_to_reset);
 		    }
+		  dflow->problem->reset_fun (blocks_to_reset);
 		}
-	      if (blocks_to_reset)
-		BITMAP_FREE (blocks_to_reset);
 	    }
+	  if (blocks_to_reset)
+	    BITMAP_FREE (blocks_to_reset);
+
 	  df->blocks_to_analyze = BITMAP_ALLOC (&df_bitmap_obstack);
 	}
       bitmap_copy (df->blocks_to_analyze, blocks);
@@ -573,8 +573,10 @@ df_set_blocks (bitmap blocks)
     }
   else
     {
+      /* This block is executed to reset the focus to the entire
+	 function.  */
       if (dump_file)
-	fprintf (dump_file, "clearing blocks to analyze\n");
+	fprintf (dump_file, "clearing blocks_to_analyze\n");
       if (df->blocks_to_analyze)
 	{
 	  BITMAP_FREE (df->blocks_to_analyze);
@@ -599,7 +601,6 @@ df_remove_problem (struct dataflow *dflo
 {
   struct df_problem *problem;
   int i;
-  int start = 0;
 
   if (!dflow)
     return;
@@ -607,18 +608,13 @@ df_remove_problem (struct dataflow *dflo
   problem = dflow->problem;
   gcc_assert (problem->remove_problem_fun);
 
-  /* Normally only optional problems are removed, but during global,
-     we remove ur and live and replace it with urec.  */
-  if (problem->id >= DF_FIRST_OPTIONAL_PROBLEM)
-    start = DF_FIRST_OPTIONAL_PROBLEM;
-
   /* Delete any problems that depended on this problem first.  */
-  for (i = start; i < df->num_problems_defined; i++)
+  for (i = 0; i < df->num_problems_defined; i++)
     if (df->problems_in_order[i]->problem->dependent_problem == problem)
       df_remove_problem (df->problems_in_order[i]);
 
   /* Now remove this problem.  */
-  for (i = start; i < df->num_problems_defined; i++)
+  for (i = 0; i < df->num_problems_defined; i++)
     if (df->problems_in_order[i] == dflow)
       {
 	int j;
@@ -658,16 +654,19 @@ df_finish_pass (void)
   saved_flags = df->changeable_flags;
 #endif
 
-  for (i = DF_FIRST_OPTIONAL_PROBLEM; i < df->num_problems_defined; i++)
+  for (i = 0; i < df->num_problems_defined; i++)
     {
       struct dataflow *dflow = df->problems_in_order[i];
       struct df_problem *problem = dflow->problem;
 
-      gcc_assert (problem->remove_problem_fun);
-      (problem->remove_problem_fun) ();
-      df->problems_in_order[i] = NULL;
-      df->problems_by_index[problem->id] = NULL;
-      removed++;
+      if (dflow->optional_p)
+	{
+	  gcc_assert (problem->remove_problem_fun);
+	  (problem->remove_problem_fun) ();
+	  df->problems_in_order[i] = NULL;
+	  df->problems_by_index[problem->id] = NULL;
+	  removed++;
+	}
     }
   df->num_problems_defined -= removed;
 
@@ -720,7 +719,7 @@ rest_of_handle_df_initialize (void)
 
   /* These three problems are permanent.  */
   df_lr_add_problem ();
-  if (optimize)
+  if (optimize > 1)
     df_live_add_problem ();
 
   df->postorder = XNEWVEC (int, last_basic_block);
@@ -1600,40 +1599,6 @@ df_set_clean_cfg (void)
 ----------------------------------------------------------------------------*/
 
 
-/* Return last use of REGNO within BB.  */
-
-struct df_ref *
-df_bb_regno_last_use_find (basic_block bb, unsigned int regno)
-{
-  rtx insn;
-  struct df_ref **use_rec;
-  unsigned int uid;
-
-  FOR_BB_INSNS_REVERSE (bb, insn)
-    {
-      if (!INSN_P (insn))
-	continue;
-
-      uid = INSN_UID (insn);
-      for (use_rec = DF_INSN_UID_USES (uid); *use_rec; use_rec++)
-	{
-	  struct df_ref *use = *use_rec;
-	  if (DF_REF_REGNO (use) == regno)
-	    return use;
-	}
-
-      if (df->changeable_flags & DF_EQ_NOTES)
-	for (use_rec = DF_INSN_UID_EQ_USES (uid); *use_rec; use_rec++)
-	  {
-	    struct df_ref *use = *use_rec;
-	    if (DF_REF_REGNO (use) == regno)
-	      return use;
-	  }
-    }
-  return NULL;
-}
-
-
 /* Return first def of REGNO within BB.  */
 
 struct df_ref *
@@ -1686,26 +1651,6 @@ df_bb_regno_last_def_find (basic_block b
   return NULL;
 }
 
-/* Return true if INSN defines REGNO.  */
-
-bool
-df_insn_regno_def_p (rtx insn, unsigned int regno)
-{
-  unsigned int uid;
-  struct df_ref **def_rec;
-
-  uid = INSN_UID (insn);
-  for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
-    {
-      struct df_ref *def = *def_rec;
-      if (DF_REF_REGNO (def) == regno)
-	return true;
-    }
-  
-  return false;
-}
-
-
 /* Finds the reference corresponding to the definition of REG in INSN.
    DF is the dataflow object.  */
 
Index: df-problems.c
===================================================================
--- df-problems.c	(revision 125730)
+++ df-problems.c	(working copy)
@@ -331,6 +331,7 @@ df_ru_alloc (bitmap all_blocks)
 	  bb_info->out = BITMAP_ALLOC (&problem_data->ru_bitmaps);
 	}
     }
+  df_ru->optional_p = true;
 }
 
 
@@ -711,7 +712,8 @@ static struct df_problem problem_RU =
   NULL,                       /* Incremental solution verify start.  */
   NULL,                       /* Incremental solution verfiy end.  */
   NULL,                       /* Dependent problem.  */
-  TV_DF_RU                    /* Timing variable.  */ 
+  TV_DF_RU,                   /* Timing variable.  */
+  true                        /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
 
 
@@ -841,6 +843,7 @@ df_rd_alloc (bitmap all_blocks)
 	  bb_info->out = BITMAP_ALLOC (&problem_data->rd_bitmaps);
 	}
     }
+  df_rd->optional_p = true;
 }
 
 
@@ -1207,7 +1210,8 @@ static struct df_problem problem_RD =
   NULL,                       /* Incremental solution verify start.  */
   NULL,                       /* Incremental solution verfiy end.  */
   NULL,                       /* Dependent problem.  */
-  TV_DF_RD                    /* Timing variable.  */ 
+  TV_DF_RD,                   /* Timing variable.  */ 
+  true                        /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
 
 
@@ -1320,6 +1324,8 @@ df_lr_alloc (bitmap all_blocks ATTRIBUTE
           bb_info->ause = NULL;
 	}
     }
+
+  df_lr->optional_p = false;
 }
 
 
@@ -1478,6 +1484,13 @@ df_lr_bb_local_compute (unsigned int bb_
 	}
     }
 #endif
+
+  /* If the df_live problem is not defined, such as at -O0 and -O1, we
+     still need to keep the luids up to date.  This is normally done
+     in the df_live problem since this problem has a forwards
+     scan.  */
+  if (!df_live)
+    df_recompute_luids (bb);
 }
 
 
@@ -1818,7 +1831,8 @@ static struct df_problem problem_LR =
   df_lr_verify_solution_start,/* Incremental solution verify start.  */
   df_lr_verify_solution_end,  /* Incremental solution verify end.  */
   NULL,                       /* Dependent problem.  */
-  TV_DF_LR                    /* Timing variable.  */ 
+  TV_DF_LR,                   /* Timing variable.  */ 
+  false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
 
 
@@ -2016,6 +2030,7 @@ df_live_alloc (bitmap all_blocks ATTRIBU
 	  bb_info->out = BITMAP_ALLOC (NULL);
 	}
     }
+  df_live->optional_p = (optimize <= 1);
 }
 
 
@@ -2368,7 +2383,8 @@ static struct df_problem problem_LIVE =
   df_live_verify_solution_start,/* Incremental solution verify start.  */
   df_live_verify_solution_end,  /* Incremental solution verify end.  */
   &problem_LR,                  /* Dependent problem.  */
-  TV_DF_LIVE                    /* Timing variable.  */ 
+  TV_DF_LIVE,                   /* Timing variable.  */
+  false                         /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
 
 
@@ -2386,6 +2402,19 @@ df_live_add_problem (void)
 }
 
 
+/* Set all of the blocks as dirty.  This needs to be done if this
+   problem is added after all of the insns have been scanned.  */
+
+void
+df_live_set_all_dirty (void)
+{
+  basic_block bb;
+  FOR_ALL_BB (bb)
+    bitmap_set_bit (df_live->out_of_date_transfer_functions, 
+		    bb->index);
+}
+
+
 /* Verify that all of the lr related info is consistent and
    correct.  */
 
@@ -2555,6 +2584,7 @@ df_urec_alloc (bitmap all_blocks)
 	  bb_info->earlyclobber = BITMAP_ALLOC (NULL);
 	}
     }
+  df_urec->optional_p = true;
 }
 
 
@@ -3041,7 +3071,8 @@ static struct df_problem problem_UREC =
   NULL,                       /* Incremental solution verify start.  */
   NULL,                       /* Incremental solution verfiy end.  */
   &problem_LR,                /* Dependent problem.  */
-  TV_DF_UREC                  /* Timing variable.  */ 
+  TV_DF_UREC,                 /* Timing variable.  */ 
+  false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
 
 
@@ -3213,6 +3244,7 @@ df_chain_alloc (bitmap all_blocks ATTRIB
   df_chain_remove_problem ();
   df_chain->block_pool = create_alloc_pool ("df_chain_block pool", 
 					 sizeof (struct df_link), 50);
+  df_chain->optional_p = true;
 }
 
 
@@ -3520,7 +3552,8 @@ static struct df_problem problem_CHAIN =
   NULL,                       /* Incremental solution verify start.  */
   NULL,                       /* Incremental solution verfiy end.  */
   &problem_RD,                /* Dependent problem.  */
-  TV_DF_CHAIN                 /* Timing variable.  */ 
+  TV_DF_CHAIN,                /* Timing variable.  */
+  false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
 
 
@@ -3543,6 +3576,12 @@ df_chain_add_problem (enum df_chain_flag
    This pass computes REG_DEAD and REG_UNUSED notes.
    ----------------------------------------------------------------------------*/
 
+static void 
+df_note_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
+{
+  df_note->optional_p = true;
+}
+
 #ifdef REG_DEAD_DEBUGGING
 static void 
 df_print_note (const char *prefix, rtx insn, rtx note)
@@ -4075,7 +4114,7 @@ static struct df_problem problem_NOTE =
 {
   DF_NOTE,                    /* Problem id.  */
   DF_NONE,                    /* Direction.  */
-  NULL,                       /* Allocate the problem specific data.  */
+  df_note_alloc,              /* Allocate the problem specific data.  */
   NULL,                       /* Reset global information.  */
   NULL,                       /* Free basic block info.  */
   df_note_compute,            /* Local compute function.  */
@@ -4097,7 +4136,8 @@ static struct df_problem problem_NOTE =
      but it will produce information if built one of uninitialized
      register problems (UR, UREC) is also run.  */
   &problem_LR,                /* Dependent problem.  */
-  TV_DF_NOTE                  /* Timing variable.  */ 
+  TV_DF_NOTE,                 /* Timing variable.  */
+  false                       /* Reset blocks on dropping out of blocks_to_analyze.  */
 };
 
 
Index: regrename.c
===================================================================
--- regrename.c	(revision 125730)
+++ regrename.c	(working copy)
@@ -139,7 +139,7 @@ merge_overlapping_regs (basic_block b, H
   rtx insn;
   HARD_REG_SET live;
 
-  REG_SET_TO_HARD_REG_SET (live, DF_LIVE_IN (b));
+  REG_SET_TO_HARD_REG_SET (live, df_get_live_in (b));
   insn = BB_HEAD (b);
   while (t)
     {
Index: sched-ebb.c
===================================================================
--- sched-ebb.c	(revision 125730)
+++ sched-ebb.c	(working copy)
@@ -252,9 +252,9 @@ compute_jump_reg_dependencies (rtx insn,
 	 it may guard the fallthrough block from using a value that has
 	 conditionally overwritten that of the main codepath.  So we
 	 consider that it restores the value of the main codepath.  */
-      bitmap_and (set, DF_LIVE_IN (e->dest), cond_set);
+      bitmap_and (set, df_get_live_in (e->dest), cond_set);
     else
-      bitmap_ior_into (used, DF_LIVE_IN (e->dest));
+      bitmap_ior_into (used, df_get_live_in (e->dest));
 }
 
 /* Used in schedule_insns to initialize current_sched_info for scheduling
Index: postreload.c
===================================================================
--- postreload.c	(revision 125730)
+++ postreload.c	(working copy)
@@ -743,9 +743,10 @@ reload_combine (void)
       if (LABEL_P (insn))
 	{
 	  HARD_REG_SET live;
+	  bitmap live_in = df_get_live_in (bb);
 
-	  REG_SET_TO_HARD_REG_SET (live, DF_LIVE_IN (bb));
-	  compute_use_by_pseudos (&live, DF_LIVE_IN (bb));
+	  REG_SET_TO_HARD_REG_SET (live, live_in);
+	  compute_use_by_pseudos (&live, live_in);
 	  COPY_HARD_REG_SET (LABEL_LIVE (insn), live);
 	  IOR_HARD_REG_SET (ever_live_at_start, live);
 	}
Index: cse.c
===================================================================
--- cse.c	(revision 125730)
+++ cse.c	(working copy)
@@ -6001,8 +6001,8 @@ cse_extended_basic_block (struct cse_bas
   qty_table = XNEWVEC (struct qty_table_elem, max_qty);
 
   new_basic_block ();
-  cse_ebb_live_in = DF_LIVE_IN (ebb_data->path[0].bb);
-  cse_ebb_live_out = DF_LIVE_OUT (ebb_data->path[path_size - 1].bb);
+  cse_ebb_live_in = df_get_live_in (ebb_data->path[0].bb);
+  cse_ebb_live_out = df_get_live_out (ebb_data->path[path_size - 1].bb);
   for (path_entry = 0; path_entry < path_size; path_entry++)
     {
       basic_block bb;
Index: regmove.c
===================================================================
--- regmove.c	(revision 125730)
+++ regmove.c	(working copy)
@@ -325,7 +325,7 @@ mark_flags_life_zones (rtx flags)
       {
 	int i;
 	for (i = 0; i < flags_nregs; ++i)
-	  live |= REGNO_REG_SET_P (DF_LIVE_IN (block), flags_regno + i);
+	  live |= REGNO_REG_SET_P (df_get_live_in (block), flags_regno + i);
       }
 #endif
 
Index: rtl-factoring.c
===================================================================
--- rtl-factoring.c	(revision 125730)
+++ rtl-factoring.c	(working copy)
@@ -978,8 +978,8 @@ split_blocks_after_seqs (void)
       for (mseq = sb->matching_seqs; mseq; mseq = mseq->next_matching_seq)
         {
           block_label_after (mseq->insn);
-          IOR_REG_SET (DF_LIVE_OUT (BLOCK_FOR_INSN (pattern_seqs->insn)),
-                       DF_LIVE_OUT (BLOCK_FOR_INSN (mseq->insn)));
+          IOR_REG_SET (df_get_live_out (BLOCK_FOR_INSN (pattern_seqs->insn)),
+                       df_get_live_out (BLOCK_FOR_INSN (mseq->insn)));
         }
     }
 }
@@ -1033,7 +1033,7 @@ split_pattern_seq (void)
                               gen_symbol_ref_rtx_for_label
                               (retlabel)), BB_END (bb));
   /* Update liveness info.  */
-  SET_REGNO_REG_SET (DF_LIVE_OUT (bb),
+  SET_REGNO_REG_SET (df_get_live_out (bb),
                      REGNO (pattern_seqs->link_reg));
 }
 
@@ -1085,12 +1085,12 @@ erase_matching_seqs (void)
           BB_END (bb) = callinsn;
 
           /* Maintain control flow and liveness information.  */
-          SET_REGNO_REG_SET (DF_LIVE_OUT (bb),
+          SET_REGNO_REG_SET (df_get_live_out (bb),
                              REGNO (pattern_seqs->link_reg));
           emit_barrier_after (BB_END (bb));
           make_single_succ_edge (bb, BLOCK_FOR_INSN (sb->label), 0);
-          IOR_REG_SET (DF_LIVE_OUT (bb),
-		       DF_LIVE_IN (BLOCK_FOR_INSN (sb->label)));
+          IOR_REG_SET (df_get_live_out (bb),
+		       df_get_live_in (BLOCK_FOR_INSN (sb->label)));
 
           make_edge (BLOCK_FOR_INSN (seq_blocks->label),
                      BLOCK_FOR_INSN (retlabel), EDGE_ABNORMAL);
Index: bt-load.c
===================================================================
--- bt-load.c	(revision 125730)
+++ bt-load.c	(working copy)
@@ -478,7 +478,7 @@ compute_defs_uses_and_gen (fibheap_t all
       CLEAR_HARD_REG_SET (info.btrs_written_in_block);
       for (reg = first_btr; reg <= last_btr; reg++)
 	if (TEST_HARD_REG_BIT (all_btrs, reg)
-	    && REGNO_REG_SET_P (DF_LIVE_IN (bb), reg))
+	    && REGNO_REG_SET_P (df_get_live_in (bb), reg))
 	  SET_HARD_REG_BIT (info.btrs_live_in_block, reg);
 
       for (insn = BB_HEAD (bb), last = NEXT_INSN (BB_END (bb));
@@ -579,7 +579,7 @@ compute_defs_uses_and_gen (fibheap_t all
       COPY_HARD_REG_SET (btrs_live[i], info.btrs_live_in_block);
       COPY_HARD_REG_SET (btrs_written[i], info.btrs_written_in_block);
 
-      REG_SET_TO_HARD_REG_SET (btrs_live_at_end[i], DF_LIVE_OUT (bb));
+      REG_SET_TO_HARD_REG_SET (btrs_live_at_end[i], df_get_live_out (bb));
       /* If this block ends in a jump insn, add any uses or even clobbers
 	 of branch target registers that it might have.  */
       for (insn = BB_END (bb); insn != BB_HEAD (bb) && ! INSN_P (insn); )
Index: integrate.c
===================================================================
--- integrate.c	(revision 125730)
+++ integrate.c	(working copy)
@@ -352,10 +352,10 @@ allocate_initial_values (rtx *reg_equiv_
 		  /* Update global register liveness information.  */
 		  FOR_EACH_BB (bb)
 		    {
-		      if (REGNO_REG_SET_P(DF_LIVE_IN (bb), regno))
-			SET_REGNO_REG_SET (DF_LIVE_IN (bb), new_regno);
-		      if (REGNO_REG_SET_P(DF_LIVE_OUT (bb), regno))
-			SET_REGNO_REG_SET (DF_LIVE_OUT (bb), new_regno);
+		      if (REGNO_REG_SET_P(df_get_live_in (bb), regno))
+			SET_REGNO_REG_SET (df_get_live_in (bb), new_regno);
+		      if (REGNO_REG_SET_P(df_get_live_out (bb), regno))
+			SET_REGNO_REG_SET (df_get_live_out (bb), new_regno);
 		    }
 		}
 	    }
Index: combine.c
===================================================================
--- combine.c	(revision 125730)
+++ combine.c	(working copy)
@@ -11835,7 +11835,7 @@ reg_dead_at_p (rtx reg, rtx insn)
     }
 
   for (i = reg_dead_regno; i < reg_dead_endregno; i++)
-    if (REGNO_REG_SET_P (DF_LIVE_IN (block), i))
+    if (REGNO_REG_SET_P (df_get_live_in (block), i))
       return 0;
 
   return 1;
Index: resource.c
===================================================================
--- resource.c	(revision 125730)
+++ resource.c	(working copy)
@@ -957,7 +957,7 @@ mark_target_live_regs (rtx insns, rtx ta
      TARGET.  Otherwise, we must assume everything is live.  */
   if (b != -1)
     {
-      regset regs_live = DF_LIVE_IN (BASIC_BLOCK (b));
+      regset regs_live = df_get_live_in (BASIC_BLOCK (b));
       rtx start_insn, stop_insn;
       reg_set_iterator rsi;
 
Index: sched-rgn.c
===================================================================
--- sched-rgn.c	(revision 125730)
+++ sched-rgn.c	(working copy)
@@ -1551,7 +1551,7 @@ check_live_1 (int src, rtx x)
 		  gcc_assert (!t || (CONTAINING_RGN (b->index)
 				     != CONTAINING_RGN (BB_TO_BLOCK (src))));
 
-		  if (t || REGNO_REG_SET_P (DF_LIVE_IN (b), regno + j))
+		  if (t || REGNO_REG_SET_P (df_get_live_in (b), regno + j))
 		    return 0;
 		}
 	    }
@@ -1567,7 +1567,7 @@ check_live_1 (int src, rtx x)
 	      gcc_assert (!t || (CONTAINING_RGN (b->index)
 				 != CONTAINING_RGN (BB_TO_BLOCK (src))));
 
-	      if (t || REGNO_REG_SET_P (DF_LIVE_IN (b), regno))
+	      if (t || REGNO_REG_SET_P (df_get_live_in (b), regno))
 		return 0;
 	    }
 	}
@@ -1624,7 +1624,7 @@ update_live_1 (int src, rtx x)
 		{
 		  basic_block b = candidate_table[src].update_bbs.first_member[i];
 
-		  SET_REGNO_REG_SET (DF_LIVE_IN (b), regno + j);
+		  SET_REGNO_REG_SET (df_get_live_in (b), regno + j);
 		}
 	    }
 	}
@@ -1634,7 +1634,7 @@ update_live_1 (int src, rtx x)
 	    {
 	      basic_block b = candidate_table[src].update_bbs.first_member[i];
 
-	      SET_REGNO_REG_SET (DF_LIVE_IN (b), regno);
+	      SET_REGNO_REG_SET (df_get_live_in (b), regno);
 	    }
 	}
     }
Index: config/sh/sh.c
===================================================================
--- config/sh/sh.c	(revision 125730)
+++ config/sh/sh.c	(working copy)
@@ -9156,7 +9156,7 @@ find_r0_life_regions (basic_block b)
   int set;
   int death = 0;
 
-  if (REGNO_REG_SET_P (DF_LIVE_IN (b), R0_REG))
+  if (REGNO_REG_SET_P (df_get_live_in (b), R0_REG))
     {
       set = 1;
       live = 1;
Index: global.c
===================================================================
--- global.c	(revision 125730)
+++ global.c	(working copy)
@@ -2080,7 +2080,7 @@ rest_of_handle_global_alloc (void)
      going to help here because it does not touch the artificial uses
      and defs.  */
   df_finish_pass ();
-  if (optimize)
+  if (optimize > 1)
     df_live_add_problem ();
   df_scan_alloc (NULL);
   df_scan_blocks ();
Index: local-alloc.c
===================================================================
--- local-alloc.c	(revision 125730)
+++ local-alloc.c	(working copy)
@@ -2509,13 +2509,13 @@ rest_of_handle_local_alloc (void)
   int max_regno = max_reg_num ();
 
   df_note_add_problem ();
+
+  if (optimize > 1)
+    df_remove_problem (df_live);
+  /* Create a new version of df that has the special version of UR if
+     we are doing optimization.  */
   if (optimize)
-    {
-      /* Create a new version of df that has the special version of UR
-	 if we are doing optimization.  */
-      df_remove_problem (df_live);
-      df_urec_add_problem ();
-    }
+    df_urec_add_problem ();
   df_analyze ();
   regstat_init_n_sets_and_refs ();
   regstat_compute_ri ();
Index: ifcvt.c
===================================================================
--- ifcvt.c	(revision 125730)
+++ ifcvt.c	(working copy)
@@ -3836,7 +3836,7 @@ dead_or_predicable (basic_block test_bb,
       
       /* The loop below takes the set of live registers 
          after JUMP, and calculates the live set before EARLIEST. */
-      bitmap_copy (test_live, DF_LIVE_IN (other_bb));
+      bitmap_copy (test_live, df_get_live_in (other_bb));
       df_simulate_artificial_refs_at_end (test_bb, test_live);
       for (insn = jump; ; insn = prev)
 	{
@@ -3858,7 +3858,7 @@ dead_or_predicable (basic_block test_bb,
 
       if (bitmap_intersect_p (test_set, merge_set)
 	  || bitmap_intersect_p (test_live, merge_set)
-	  || bitmap_intersect_p (test_set, DF_LIVE_IN (merge_bb)))
+	  || bitmap_intersect_p (test_set, df_get_live_in (merge_bb)))
 	fail = 1;
 
       BITMAP_FREE (merge_set);
@@ -3958,6 +3958,12 @@ if_convert (bool recompute_dominance)
   basic_block bb;
   int pass;
 
+  if (optimize == 1)
+    {
+      df_live_add_problem ();
+      df_live_set_all_dirty ();
+    }
+
   num_possible_if_blocks = 0;
   num_updated_if_blocks = 0;
   num_true_changes = 0;
@@ -4039,6 +4045,9 @@ if_convert (bool recompute_dominance)
 	       num_true_changes);
     }
 
+  if (optimize == 1)
+    df_remove_problem (df_live);
+
 #ifdef ENABLE_CHECKING
   verify_flow_info ();
 #endif
@@ -4125,14 +4134,13 @@ struct tree_opt_pass pass_if_after_combi
 static bool
 gate_handle_if_after_reload (void)
 {
-  return (optimize > 0);
+  return (optimize > 0 && flag_if_conversion2);
 }
 
 static unsigned int
 rest_of_handle_if_after_reload (void)
 {
-  if (flag_if_conversion2)
-    if_convert (true);
+  if_convert (true);
   return 0;
 }
 
Index: init-regs.c
===================================================================
--- init-regs.c	(revision 125730)
+++ init-regs.c	(working copy)
@@ -53,6 +53,12 @@ initialize_uninitialized_regs (void)
   basic_block bb;
   bitmap already_genned = BITMAP_ALLOC (NULL);
 
+  if (optimize == 1)
+    {
+      df_live_add_problem ();
+      df_live_set_all_dirty ();
+    }
+
   df_analyze ();
 
   FOR_EACH_BB (bb)
@@ -111,6 +117,9 @@ initialize_uninitialized_regs (void)
 	}
     }
 
+  if (optimize == 1)
+    df_remove_problem (df_live);
+
   BITMAP_FREE (already_genned);
 }
 

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