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]

[dataflow]: patch committed to improve -O0 performance.


This patch turns off dataflow for -O0 for a substantial part of the back
end and where it is active, turns off the df_ur, df_live and df_urec
problems.  The should get the space down significantly.

This patch has been bootstrapped and regression tested on x86-64 and pcc.

Kenny


2007-03-28  Kenneth Zadeck <zadeck@naturalbridge.com>
    * tree-pass.h (pass_df_initialize, pass_df_finish): Deleted.
    (pass_df_initialize_opt, pass_df_initialize_no_opt,
    pass_stack_regs_run, pass_df_finish_opt, pass_df_finish_no_opt):
    Added.
    * df-core.c (df_finish_pass): Made ur and live problems condition
    on optimization.
    (pass_df_initialize): Renamed to pass_df_initialize_opt.
    (pass_df_initialize_no_opt): New pass.
    (gate_opt, gate_no_opt): New functions.
    (pass_df_finish): Renamed to pass_df_finish_opt.
    (pass_df_finish_no_opt): New pass.
    * mode-switching.c (optimize_mode_switching): Changed references
    of DF_LIVE_IN to df_get_live_in.
    * global.c (compute_regsets): Only add urec problem when
    optimizing.
    * function.c (regno_clobbered_at_setjmp): Changed references
    of DF_LIVE_OUT to df_get_live_out.
    * regclass.c (regclass_init): Only call df_compute_regs_ever_live
    if optimizing.
    * stack-ptr-mod.c (notice_stack_pointer_modification): Only call
    df_update_exit_block_uses if optimizing.
    * df-problems.c (df_get_live_in, df_get_live_out): Return df_live
    sets if they are there.
    * reg_stack (rest_of_handle_stack_regs_run):
    Added new pass that just runs subpasses.  
    * passes.c (init_optimization_passes): Added passes to turn on df
    at only some parts of the compilation for -O0.  Moved
    pass_split_before_regstack and pass_stack_regs into a subpass of
    the stack regs pass.
   
Index: tree-pass.h
===================================================================
--- tree-pass.h	(revision 123242)
+++ tree-pass.h	(working copy)
@@ -367,7 +367,8 @@ extern struct tree_opt_pass pass_rtl_loo
 
 extern struct tree_opt_pass pass_web;
 extern struct tree_opt_pass pass_cse2;
-extern struct tree_opt_pass pass_df_initialize;
+extern struct tree_opt_pass pass_df_initialize_opt;
+extern struct tree_opt_pass pass_df_initialize_no_opt;
 extern struct tree_opt_pass pass_regclass_init;
 extern struct tree_opt_pass pass_subregs_of_mode_init;
 extern struct tree_opt_pass pass_subregs_of_mode_finish;
@@ -407,7 +408,9 @@ extern struct tree_opt_pass pass_leaf_re
 extern struct tree_opt_pass pass_split_before_sched2;
 extern struct tree_opt_pass pass_sched2;
 extern struct tree_opt_pass pass_stack_regs;
-extern struct tree_opt_pass pass_df_finish;
+extern struct tree_opt_pass pass_stack_regs_run;
+extern struct tree_opt_pass pass_df_finish_opt;
+extern struct tree_opt_pass pass_df_finish_no_opt;
 extern struct tree_opt_pass pass_compute_alignments;
 extern struct tree_opt_pass pass_duplicate_computed_gotos;
 extern struct tree_opt_pass pass_variable_tracking;
Index: df-core.c
===================================================================
--- df-core.c	(revision 123242)
+++ df-core.c	(working copy)
@@ -651,7 +651,8 @@ df_finish_pass (void)
   if (!(saved_flags & DF_NO_INSN_RESCAN))
     {
       df_lr_verify_transfer_functions ();
-      df_ur_verify_transfer_functions ();
+      if (df_ur)
+	df_ur_verify_transfer_functions ();
     }
 
 #ifdef DF_DEBUG_CFG
@@ -679,9 +680,12 @@ rest_of_handle_df_initialize (void)
 
   /* These three problems are permanent.  */
   df_lr_add_problem ();
-  df_ur_add_problem ();
-  df_live_add_problem ();
-  
+  if (optimize)
+    {
+      df_ur_add_problem ();
+      df_live_add_problem ();
+    }
+
   df->postorder = XNEWVEC (int, last_basic_block);
   df->postorder_inverted = XNEWVEC (int, last_basic_block);
   df->n_blocks = post_order_compute (df->postorder, true, true);
@@ -702,10 +706,17 @@ rest_of_handle_df_initialize (void)
 }
 
 
-struct tree_opt_pass pass_df_initialize =
+static bool
+gate_opt (void)
+{
+  return optimize > 0;
+}
+
+
+struct tree_opt_pass pass_df_initialize_opt =
 {
   "dfinit",                             /* name */
-  0,                                    /* gate */
+  gate_opt,                             /* gate */
   rest_of_handle_df_initialize,         /* execute */
   NULL,                                 /* sub */
   NULL,                                 /* next */
@@ -715,7 +726,32 @@ struct tree_opt_pass pass_df_initialize 
   0,                                    /* properties_provided */
   0,                                    /* properties_destroyed */
   0,                                    /* todo_flags_start */
-  TODO_dump_func,                       /* todo_flags_finish */
+  0,                                    /* todo_flags_finish */
+  'z'                                   /* letter */
+};
+
+
+static bool
+gate_no_opt (void)
+{
+  return optimize == 0;
+}
+
+
+struct tree_opt_pass pass_df_initialize_no_opt =
+{
+  "dfinit",                             /* name */
+  gate_no_opt,                          /* gate */
+  rest_of_handle_df_initialize,         /* execute */
+  NULL,                                 /* sub */
+  NULL,                                 /* next */
+  0,                                    /* static_pass_number */
+  0,                                    /* tv_id */
+  0,                                    /* properties_required */
+  0,                                    /* properties_provided */
+  0,                                    /* properties_destroyed */
+  0,                                    /* todo_flags_start */
+  0,                                    /* todo_flags_finish */
   'z'                                   /* letter */
 };
 
@@ -747,10 +783,28 @@ rest_of_handle_df_finish (void)
 }
 
 
-struct tree_opt_pass pass_df_finish =
+struct tree_opt_pass pass_df_finish_opt =
+{
+  "dfinish",                            /* name */
+  gate_opt,                             /* gate */
+  rest_of_handle_df_finish,             /* execute */
+  NULL,                                 /* sub */
+  NULL,                                 /* next */
+  0,                                    /* static_pass_number */
+  0,                                    /* tv_id */
+  0,                                    /* properties_required */
+  0,                                    /* properties_provided */
+  0,                                    /* properties_destroyed */
+  0,                                    /* todo_flags_start */
+  0,                                    /* todo_flags_finish */
+  'z'                                   /* letter */
+};
+
+
+struct tree_opt_pass pass_df_finish_no_opt =
 {
   "dfinish",                            /* name */
-  0,                                    /* gate */
+  gate_no_opt,                          /* gate */
   rest_of_handle_df_finish,             /* execute */
   NULL,                                 /* sub */
   NULL,                                 /* next */
@@ -1632,7 +1686,8 @@ df_verify (void)
 {
   df_scan_verify ();
   df_lr_verify_transfer_functions ();
-  df_ur_verify_transfer_functions ();
+  if (df_ur)
+    df_ur_verify_transfer_functions ();
 }
 
 #ifdef DF_DEBUG_CFG
Index: mode-switching.c
===================================================================
--- mode-switching.c	(revision 123242)
+++ mode-switching.c	(working copy)
@@ -478,7 +478,7 @@ optimize_mode_switching (void)
 	  int last_mode = no_mode;
 	  HARD_REG_SET live_now;
 
-	  REG_SET_TO_HARD_REG_SET (live_now, DF_LIVE_IN (bb));
+	  REG_SET_TO_HARD_REG_SET (live_now, df_get_live_in (bb));
 
 	  /* Pretend the mode is clobbered across abnormal edges.  */
 	  {
@@ -623,7 +623,7 @@ optimize_mode_switching (void)
 	      mode = current_mode[j];
 	      src_bb = eg->src;
 
-	      REG_SET_TO_HARD_REG_SET (live_at_edge, DF_LIVE_OUT (src_bb));
+	      REG_SET_TO_HARD_REG_SET (live_at_edge, df_get_live_out (src_bb));
 
 	      start_sequence ();
 	      EMIT_MODE_SET (entity_map[j], mode, live_at_edge);
Index: global.c
===================================================================
--- global.c	(revision 123242)
+++ global.c	(working copy)
@@ -401,8 +401,10 @@ compute_regsets (HARD_REG_SET *elim_set,
   max_allocno = 0;
   /* Do not recompute the register info.  Local_alloc has played with
      this in a way that global expects.  */
-  /* Create a new version of df that has the special version of UR.  */
-  df_urec_add_problem ();
+  /* Create a new version of df that has the special version of UR if
+     we are doing optimization.  */
+  if (optimize)
+    df_urec_add_problem ();
   df_set_flags (DF_RI_NO_UPDATE);
   df_analyze ();
   df_set_flags (DF_NO_INSN_RESCAN);
Index: function.c
===================================================================
--- function.c	(revision 123242)
+++ function.c	(working copy)
@@ -3486,7 +3486,7 @@ regno_clobbered_at_setjmp (bitmap setjmp
     return 0;
 
   return ((REG_N_SETS (regno) > 1
-	   || REGNO_REG_SET_P (DF_LIVE_OUT (ENTRY_BLOCK_PTR), regno))
+	   || REGNO_REG_SET_P (df_get_live_out (ENTRY_BLOCK_PTR), regno))
 	  && REGNO_REG_SET_P (setjmp_crosses, regno));
 }
 
Index: regclass.c
===================================================================
--- regclass.c	(revision 123242)
+++ regclass.c	(working copy)
@@ -938,7 +938,8 @@ regclass_init (void)
 {
   int i;
 
-  df_compute_regs_ever_live (true);
+  if (df)
+    df_compute_regs_ever_live (true);
 
   init_cost.mem_cost = 10000;
   for (i = 0; i < N_REG_CLASSES; i++)
Index: stack-ptr-mod.c
===================================================================
--- stack-ptr-mod.c	(revision 123242)
+++ stack-ptr-mod.c	(working copy)
@@ -78,7 +78,7 @@ notice_stack_pointer_modification (void)
   /* The value coming into this pass was 0, and the exit block uses
      are based on this.  If the value is now 1, we need to redo the
      exit block uses.  */
-  if (current_function_sp_is_unchanging)
+  if (df && current_function_sp_is_unchanging)
     df_update_exit_block_uses ();
 }
 
Index: df-problems.c
===================================================================
--- df-problems.c	(revision 123242)
+++ df-problems.c	(working copy)
@@ -71,6 +71,8 @@ df_get_live_out (basic_block bb)
 
   if (df_urec)
     return DF_RA_LIVE_OUT (bb);
+  else if (df_live)
+    return DF_LIVE_OUT (bb);
   else 
     return DF_LR_OUT (bb);
 }
@@ -87,6 +89,8 @@ df_get_live_in (basic_block bb)
 
   if (df_urec)
     return DF_RA_LIVE_IN (bb);
+  else if (df_live)
+    return DF_LIVE_IN (bb);
   else 
     return DF_LR_IN (bb);
 }
Index: reg-stack.c
===================================================================
--- reg-stack.c	(revision 123242)
+++ reg-stack.c	(working copy)
@@ -3212,10 +3212,35 @@ gate_handle_stack_regs (void)
 #endif
 }
 
+/* Just run the sub passes which do all of the work.  */
+static unsigned int
+rest_of_handle_stack_regs (void)
+{
+  return 0;
+}
+
+
+struct tree_opt_pass pass_stack_regs =
+{
+  "stack",                              /* name */
+  gate_handle_stack_regs,               /* gate */
+  rest_of_handle_stack_regs,            /* execute */
+  NULL,                                 /* sub */
+  NULL,                                 /* next */
+  0,                                    /* static_pass_number */
+  TV_REG_STACK,                         /* tv_id */
+  0,                                    /* properties_required */
+  0,                                    /* properties_provided */
+  0,                                    /* properties_destroyed */
+  0,                                    /* todo_flags_start */
+  0,                                    /* todo_flags_finish */
+  'k'                                   /* letter */
+};
+
 /* Convert register usage from flat register file usage to a stack
    register file.  */
 static unsigned int
-rest_of_handle_stack_regs (void)
+rest_of_handle_stack_regs_run (void)
 {
 #ifdef STACK_REGS
   reg_to_stack ();
@@ -3224,11 +3249,11 @@ rest_of_handle_stack_regs (void)
   return 0;
 }
 
-struct tree_opt_pass pass_stack_regs =
+struct tree_opt_pass pass_stack_regs_run =
 {
   "stack",                              /* name */
-  gate_handle_stack_regs,               /* gate */
-  rest_of_handle_stack_regs,            /* execute */
+  NULL,                                 /* gate */
+  rest_of_handle_stack_regs_run,        /* execute */
   NULL,                                 /* sub */
   NULL,                                 /* next */
   0,                                    /* static_pass_number */
Index: passes.c
===================================================================
--- passes.c	(revision 123242)
+++ passes.c	(working copy)
@@ -691,7 +691,7 @@ init_optimization_passes (void)
       NEXT_PASS (pass_jump2);
       NEXT_PASS (pass_lower_subreg);
       NEXT_PASS (pass_cse);
-      NEXT_PASS (pass_df_initialize);
+      NEXT_PASS (pass_df_initialize_opt);
       NEXT_PASS (pass_rtl_fwprop);
       NEXT_PASS (pass_gcse);
       NEXT_PASS (pass_jump_bypass);
@@ -728,6 +728,7 @@ init_optimization_passes (void)
       NEXT_PASS (pass_regmove);
       NEXT_PASS (pass_split_all_insns);
       NEXT_PASS (pass_lower_subreg2);
+      NEXT_PASS (pass_df_initialize_no_opt);
       NEXT_PASS (pass_mode_switching);
       NEXT_PASS (pass_see);
       NEXT_PASS (pass_sms);
@@ -757,8 +758,13 @@ init_optimization_passes (void)
 	  NEXT_PASS (pass_leaf_regs);
 	  NEXT_PASS (pass_split_before_sched2);
 	  NEXT_PASS (pass_sched2);
-	  NEXT_PASS (pass_split_before_regstack);
 	  NEXT_PASS (pass_stack_regs);
+	    {
+	      struct tree_opt_pass **p = &pass_stack_regs.sub;
+	      NEXT_PASS (pass_split_before_regstack);
+	      NEXT_PASS (pass_stack_regs_run);
+	    }
+	  NEXT_PASS (pass_df_finish_no_opt);
 	  NEXT_PASS (pass_compute_alignments);
 	  NEXT_PASS (pass_duplicate_computed_gotos);
 	  NEXT_PASS (pass_variable_tracking);
@@ -766,7 +772,7 @@ init_optimization_passes (void)
 	  NEXT_PASS (pass_machine_reorg);
 	  NEXT_PASS (pass_cleanup_barriers);
 	  NEXT_PASS (pass_delay_slots);
-	  NEXT_PASS (pass_df_finish);
+	  NEXT_PASS (pass_df_finish_opt);
 	  NEXT_PASS (pass_split_for_shorten_branches);
 	  NEXT_PASS (pass_convert_to_eh_region_ranges);
 	  NEXT_PASS (pass_shorten_branches);

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