]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ira.c (pseudo_move_insn): Delete.
authorRichard Sandiford <r.sandiford@uk.ibm.com>
Wed, 16 May 2012 09:01:54 +0000 (09:01 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 16 May 2012 09:01:54 +0000 (09:01 +0000)
gcc/
* ira.c (pseudo_move_insn): Delete.
(find_moveable_pseudos): Don't set it.
(move_unallocated_pseudos): Use DF_REG_DEF_CHAIN to find
the definitions of the original pseudo.  Delete all of them.

From-SVN: r187582

gcc/ChangeLog
gcc/ira.c

index 690d86c7c41290515f9a9bba79ad3b48f0e63775..24e5a7a251994ae08dafdc5645f15a864125693f 100644 (file)
@@ -1,3 +1,10 @@
+2012-05-16  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+       * ira.c (pseudo_move_insn): Delete.
+       (find_moveable_pseudos): Don't set it.
+       (move_unallocated_pseudos): Use DF_REG_DEF_CHAIN to find
+       the definitions of the original pseudo.  Delete all of them.
+
 2012-05-16  Olivier Hainque  <hainque@adacore.com>
 
        * config/rs6000/rs6000-opts.h (enum processor_type): Add
index c4e2aaac67538a0bf356a3d7a1956b5bc1414399..1809e0da83ac77cdb35966dd85b79b41b5863e71 100644 (file)
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3621,9 +3621,6 @@ int first_moveable_pseudo, last_moveable_pseudo;
    first_moveable_pseudo.  */
 /* The original home register.  */
 static VEC (rtx, heap) *pseudo_replaced_reg;
-/* The move instruction we added to move the value to its original home
-   register.  */
-static VEC (rtx, heap) *pseudo_move_insn;
 
 /* Look for instances where we have an instruction that is known to increase
    register pressure, and whose result is not used immediately.  If it is
@@ -3667,9 +3664,7 @@ find_moveable_pseudos (void)
   bitmap_initialize (&interesting, 0);
 
   first_moveable_pseudo = max_regs;
-  VEC_free (rtx, heap, pseudo_move_insn);
   VEC_free (rtx, heap, pseudo_replaced_reg);
-  VEC_safe_grow (rtx, heap, pseudo_move_insn, max_regs);
   VEC_safe_grow (rtx, heap, pseudo_replaced_reg, max_regs);
 
   df_analyze ();
@@ -3965,10 +3960,8 @@ find_moveable_pseudos (void)
          if (validate_change (def_insn, DF_REF_LOC (def), newreg, 0))
            {
              unsigned nregno = REGNO (newreg);
-             rtx move = emit_insn_before (gen_move_insn (def_reg, newreg),
-                                          use_insn);
+             emit_insn_before (gen_move_insn (def_reg, newreg), use_insn);
              nregno -= max_regs;
-             VEC_replace (rtx, pseudo_move_insn, nregno, move);
              VEC_replace (rtx, pseudo_replaced_reg, nregno, def_reg);
            }
        }
@@ -4011,27 +4004,32 @@ move_unallocated_pseudos (void)
   for (i = first_moveable_pseudo; i < last_moveable_pseudo; i++)
     if (reg_renumber[i] < 0)
       {
-       df_ref def = DF_REG_DEF_CHAIN (i);
        int idx = i - first_moveable_pseudo;
        rtx other_reg = VEC_index (rtx, pseudo_replaced_reg, idx);
-       rtx def_insn = DF_REF_INSN (def);
-       rtx move_insn = VEC_index (rtx, pseudo_move_insn, idx);
-       rtx set;
+       rtx def_insn = DF_REF_INSN (DF_REG_DEF_CHAIN (i));
+       /* The use must follow all definitions of OTHER_REG, so we can
+          insert the new definition immediately after any of them.  */
+       df_ref other_def = DF_REG_DEF_CHAIN (REGNO (other_reg));
+       rtx move_insn = DF_REF_INSN (other_def);
        rtx newinsn = emit_insn_after (PATTERN (def_insn), move_insn);
+       rtx set;
        int success;
 
        if (dump_file)
          fprintf (dump_file, "moving def of %d (insn %d now) ",
                   REGNO (other_reg), INSN_UID (def_insn));
 
+       delete_insn (move_insn);
+       while ((other_def = DF_REG_DEF_CHAIN (REGNO (other_reg))))
+         delete_insn (DF_REF_INSN (other_def));
+       delete_insn (def_insn);
+
        set = single_set (newinsn);
        success = validate_change (newinsn, &SET_DEST (set), other_reg, 0);
        gcc_assert (success);
        if (dump_file)
          fprintf (dump_file, " %d) rather than keep unallocated replacement %d\n",
                   INSN_UID (newinsn), i);
-       delete_insn (move_insn);
-       delete_insn (def_insn);
        SET_REG_N_REFS (i, 0);
       }
 }