OSDN Git Service

* tree-pass.h (pass_reload): Declare.
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Dec 2011 15:01:25 +0000 (15:01 +0000)
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Dec 2011 15:01:25 +0000 (15:01 +0000)
* ira.c (overall_cost_before, saved_flag_ira_share_spill_slots):
New global variables, moved out of ira.
(do_reload): New static function, split off from the second half
of ...
(ira): ... here.
(gate_ira): Remove.
(pass_ira): Use TV_IRA, set gate to NULL, and set flags to
TODO_dump_func.
(rest_of_handle_reload): New static function.
(pass_reload): New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182624 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/ira.c
gcc/passes.c
gcc/tree-pass.h

index 6c27096..dfb2388 100644 (file)
@@ -1,3 +1,17 @@
+2011-12-22  Bernd Schmidt  <bernds@codesourcery.com>
+
+       * tree-pass.h (pass_reload): Declare.
+       * ira.c (overall_cost_before, saved_flag_ira_share_spill_slots):
+       New global variables, moved out of ira.
+       (do_reload): New static function, split off from the second half
+       of ...
+       (ira): ... here.
+       (gate_ira): Remove.
+       (pass_ira): Use TV_IRA, set gate to NULL, and set flags to
+       TODO_dump_func.
+       (rest_of_handle_reload): New static function.
+       (pass_reload): New.
+
 2011-12-22  Uros Bizjak  <ubizjak@gmail.com>
 
        * common/config/i386/i386-common.c (ix86_option_optimization_table):
index e3d3fe3..e848b35 100644 (file)
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -406,11 +406,12 @@ int ira_spilled_reg_stack_slots_num;
    stack slots used in current function so far.  */
 struct ira_spilled_reg_stack_slot *ira_spilled_reg_stack_slots;
 
-/* Correspondingly overall cost of the allocation, cost of the
-   allocnos assigned to hard-registers, cost of the allocnos assigned
-   to memory, cost of loads, stores and register move insns generated
-   for pseudo-register live range splitting (see ira-emit.c).  */
-int ira_overall_cost;
+/* Correspondingly overall cost of the allocation, overall cost before
+   reload, cost of the allocnos assigned to hard-registers, cost of
+   the allocnos assigned to memory, cost of loads, stores and register
+   move insns generated for pseudo-register live range splitting (see
+   ira-emit.c).  */
+int ira_overall_cost, overall_cost_before;
 int ira_reg_cost, ira_mem_cost;
 int ira_load_cost, ira_store_cost, ira_shuffle_cost;
 int ira_move_loops_num, ira_additional_jumps_num;
@@ -3521,19 +3522,17 @@ struct loops ira_loops;
    mode or when the conflict table is too big.  */
 bool ira_conflicts_p;
 
+/* Saved between IRA and reload.  */
+static int saved_flag_ira_share_spill_slots;
+
 /* This is the main entry of IRA.  */
 static void
 ira (FILE *f)
 {
-  int overall_cost_before, allocated_reg_info_size;
+  int allocated_reg_info_size;
   bool loops_p;
   int max_regno_before_ira, ira_max_point_before_emit;
   int rebuild_p;
-  int saved_flag_ira_share_spill_slots;
-  basic_block bb;
-  bool need_dce;
-
-  timevar_push (TV_IRA);
 
   if (flag_caller_saves)
     init_caller_save ();
@@ -3715,17 +3714,22 @@ ira (FILE *f)
              max_regno * sizeof (struct ira_spilled_reg_stack_slot));
     }
   allocate_initial_values (reg_equivs);
+}
 
-  timevar_pop (TV_IRA);
+static void
+do_reload (void)
+{
+  basic_block bb;
+  bool need_dce;
+
+  if (flag_ira_verbose < 10 && dump_file)
+    ira_dump_file = dump_file;
 
-  timevar_push (TV_RELOAD);
   df_set_flags (DF_NO_INSN_RESCAN);
   build_insn_chain ();
 
   need_dce = reload (get_insns (), ira_conflicts_p);
 
-  timevar_pop (TV_RELOAD);
-
   timevar_push (TV_IRA);
 
   if (ira_conflicts_p)
@@ -3733,7 +3737,6 @@ ira (FILE *f)
       ira_free (ira_spilled_reg_stack_slots);
 
       ira_finish_assign ();
-
     }
   if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL
       && overall_cost_before != ira_overall_cost)
@@ -3782,15 +3785,7 @@ ira (FILE *f)
 
   timevar_pop (TV_IRA);
 }
-
 \f
-
-static bool
-gate_ira (void)
-{
-  return true;
-}
-
 /* Run the integrated register allocator.  */
 static unsigned int
 rest_of_handle_ira (void)
@@ -3804,16 +3799,42 @@ struct rtl_opt_pass pass_ira =
  {
   RTL_PASS,
   "ira",                                /* name */
-  gate_ira,                             /* gate */
+  NULL,                                 /* gate */
   rest_of_handle_ira,                  /* execute */
   NULL,                                 /* sub */
   NULL,                                 /* next */
   0,                                    /* static_pass_number */
-  TV_NONE,                             /* tv_id */
+  TV_IRA,                              /* tv_id */
+  0,                                    /* properties_required */
+  0,                                    /* properties_provided */
+  0,                                    /* properties_destroyed */
+  0,                                    /* todo_flags_start */
+  TODO_dump_func                        /* todo_flags_finish */
+ }
+};
+
+static unsigned int
+rest_of_handle_reload (void)
+{
+  do_reload ();
+  return 0;
+}
+
+struct rtl_opt_pass pass_reload =
+{
+ {
+  RTL_PASS,
+  "reload",                             /* name */
+  NULL,                                 /* gate */
+  rest_of_handle_reload,               /* execute */
+  NULL,                                 /* sub */
+  NULL,                                 /* next */
+  0,                                    /* static_pass_number */
+  TV_RELOAD,                           /* tv_id */
   0,                                    /* properties_required */
   0,                                    /* properties_provided */
   0,                                    /* properties_destroyed */
   0,                                    /* todo_flags_start */
-  TODO_ggc_collect                      /* todo_flags_finish */
+  TODO_dump_func | TODO_ggc_collect     /* todo_flags_finish */
  }
 };
index 1125cfe..e21971c 100644 (file)
@@ -1484,6 +1484,7 @@ init_optimization_passes (void)
       NEXT_PASS (pass_sms);
       NEXT_PASS (pass_sched);
       NEXT_PASS (pass_ira);
+      NEXT_PASS (pass_reload);
       NEXT_PASS (pass_postreload);
        {
          struct opt_pass **p = &pass_postreload.pass.sub;
index 984df37..6f1fd6a 100644 (file)
@@ -541,6 +541,7 @@ extern struct rtl_opt_pass pass_mode_switching;
 extern struct rtl_opt_pass pass_sms;
 extern struct rtl_opt_pass pass_sched;
 extern struct rtl_opt_pass pass_ira;
+extern struct rtl_opt_pass pass_reload;
 extern struct rtl_opt_pass pass_postreload;
 extern struct rtl_opt_pass pass_clean_state;
 extern struct rtl_opt_pass pass_branch_prob;