]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
regmove.c (regmove_optimize): Conform to struct rtl_opt_pass execute function prototype.
authorPaolo Bonzini <bonzini@gnu.org>
Wed, 25 Feb 2009 18:12:29 +0000 (18:12 +0000)
committerPaolo Bonzini <bonzini@gcc.gnu.org>
Wed, 25 Feb 2009 18:12:29 +0000 (18:12 +0000)
2009-02-25  Paolo Bonzini  <bonzini@gnu.org>

* regmove.c (regmove_optimize): Conform to struct rtl_opt_pass
execute function prototype.  Get f and nregs from max_reg_num
and get_insns.  Remove the first backward pass as it's dead,
guard the forward pass by flag_expensive_optimizations.
(rest_of_handle_regmove): Delete.
(pass_regmove): Replace it with regmove_optimize.

From-SVN: r144429

gcc/ChangeLog
gcc/regmove.c

index 2aa1030c022ab9d77cd68538063bb5092eadd85a..2b02471d1bd66e89c921abc7ea322f1b8895a63a 100644 (file)
@@ -1,3 +1,12 @@
+2009-02-25  Paolo Bonzini  <bonzini@gnu.org>
+
+       * regmove.c (regmove_optimize): Conform to struct rtl_opt_pass
+       execute function prototype.  Get f and nregs from max_reg_num
+       and get_insns.  Remove the first backward pass as it's dead,
+       guard the forward pass by flag_expensive_optimizations.
+       (rest_of_handle_regmove): Delete.
+       (pass_regmove): Replace it with regmove_optimize.
+
 2009-02-25  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/39259
index 9342cade6249080bced50ae9a3ec43b502b2fdfb..8ce0ea00da71fb22b44ad1670b718de5fe8cfaac 100644 (file)
@@ -882,25 +882,21 @@ fixup_match_2 (rtx insn, rtx dst, rtx src, rtx offset)
   return 0;
 }
 
-/* Main entry for the register move optimization.
-   F is the first instruction.
-   NREGS is one plus the highest pseudo-reg number used in the instruction.
-   REGMOVE_DUMP_FILE is a stream for output of a trace of actions taken
-   (or 0 if none should be output).  */
+/* Main entry for the register move optimization.  */
 
-static void
-regmove_optimize (rtx f, int nregs)
+static unsigned int
+regmove_optimize (void)
 {
   rtx insn;
   struct match match;
-  int pass;
   int i;
   rtx copy_src, copy_dst;
+  int nregs = max_reg_num ();
 
   /* ??? Hack.  Regmove doesn't examine the CFG, and gets mightily
      confused by non-call exceptions ending blocks.  */
   if (flag_non_call_exceptions)
-    return;
+    return 0;
 
   df_note_add_problem ();
   df_analyze ();
@@ -912,35 +908,26 @@ regmove_optimize (rtx f, int nregs)
   for (i = nregs; --i >= 0; )
     regno_src_regno[i] = -1;
 
-  /* A forward/backward pass.  Replace output operands with input operands.  */
+  /* A forward pass.  Replace output operands with input operands.  */
 
-  for (pass = 0; pass <= 2; pass++)
+  if (flag_expensive_optimizations)
     {
-      if (! flag_regmove && pass >= flag_expensive_optimizations)
-       goto done;
-
       if (dump_file)
-       fprintf (dump_file, "Starting %s pass...\n",
-                pass ? "backward" : "forward");
+       fprintf (dump_file, "Starting forward pass...\n");
 
-      for (insn = pass ? get_last_insn () : f; insn;
-          insn = pass ? PREV_INSN (insn) : NEXT_INSN (insn))
+      for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
        {
-         rtx set;
-
-         set = single_set (insn);
+         rtx set = single_set (insn);
          if (! set)
            continue;
 
-         if (flag_expensive_optimizations && ! pass
-             && (GET_CODE (SET_SRC (set)) == SIGN_EXTEND
-                 || GET_CODE (SET_SRC (set)) == ZERO_EXTEND)
+         if ((GET_CODE (SET_SRC (set)) == SIGN_EXTEND
+              || GET_CODE (SET_SRC (set)) == ZERO_EXTEND)
              && REG_P (XEXP (SET_SRC (set), 0))
              && REG_P (SET_DEST (set)))
            optimize_reg_copy_3 (insn, SET_DEST (set), SET_SRC (set));
 
-         if (flag_expensive_optimizations && ! pass
-             && REG_P (SET_SRC (set))
+         if (REG_P (SET_SRC (set))
              && REG_P (SET_DEST (set)))
            {
              /* If this is a register-register copy where SRC is not dead,
@@ -1245,7 +1232,6 @@ regmove_optimize (rtx f, int nregs)
        }
     }
 
- done:
   /* Clean up.  */
   free (regno_src_regno);
   if (reg_set_in_bb)
@@ -1255,6 +1241,7 @@ regmove_optimize (rtx f, int nregs)
     }
   regstat_free_n_sets_and_refs ();
   regstat_free_ri ();
+  return 0;
 }
 
 /* Returns nonzero if INSN's pattern has matching constraints for any operand.
@@ -1356,14 +1343,6 @@ gate_handle_regmove (void)
   return (optimize > 0 && flag_regmove);
 }
 
-/* Register allocation pre-pass, to reduce number of moves necessary
-   for two-address machines.  */
-static unsigned int
-rest_of_handle_regmove (void)
-{
-  regmove_optimize (get_insns (), max_reg_num ());
-  return 0;
-}
 
 struct rtl_opt_pass pass_regmove =
 {
@@ -1371,7 +1350,7 @@ struct rtl_opt_pass pass_regmove =
   RTL_PASS,
   "regmove",                            /* name */
   gate_handle_regmove,                  /* gate */
-  rest_of_handle_regmove,               /* execute */
+  regmove_optimize,                    /* execute */
   NULL,                                 /* sub */
   NULL,                                 /* next */
   0,                                    /* static_pass_number */