(emit_reload_insns): Add a case to handle
authorJim Wilson <wilson@gcc.gnu.org>
Thu, 1 Oct 1992 19:18:06 +0000 (12:18 -0700)
committerJim Wilson <wilson@gcc.gnu.org>
Thu, 1 Oct 1992 19:18:06 +0000 (12:18 -0700)
SECONDARY_MEMORY_NEEDED in the SECONDARY_OUTPUT_RELOAD_CLASS code.

From-SVN: r2302

gcc/reload1.c

index 2d6b43bce2356e0adc70abbc85d93464e241d9b7..31b1dfa6b900355672728b41bc3c89ed4a06616c 100644 (file)
@@ -5375,6 +5375,35 @@ emit_reload_insns (insn)
                          pat = (GEN_FCN (tertiary_icode)
                                 (reloadreg, second_reloadreg, third_reloadreg));
                        }
+#ifdef SECONDARY_MEMORY_NEEDED
+                     /* If we need a memory location to do the move, do it that way.  */
+                     else if (GET_CODE (reloadreg) == REG
+                              && REGNO (reloadreg) < FIRST_PSEUDO_REGISTER
+                              && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (REGNO (reloadreg)),
+                                          REGNO_REG_CLASS (REGNO (second_reloadreg)),
+                                          GET_MODE (second_reloadreg)))
+                       {
+                         /* Get the memory to use and rewrite both registers
+                            to its mode.  */
+                         rtx loc = get_secondary_mem (reloadreg,
+                                                      GET_MODE (second_reloadreg));
+                         rtx tmp_reloadreg;
+                           
+                         if (GET_MODE (loc) != GET_MODE (second_reloadreg))
+                           second_reloadreg = gen_rtx (REG, GET_MODE (loc),
+                                                       REGNO (second_reloadreg));
+                         
+                         if (GET_MODE (loc) != GET_MODE (reloadreg))
+                           tmp_reloadreg = gen_rtx (REG, GET_MODE (loc),
+                                                    REGNO (reloadreg));
+                         else
+                           tmp_reloadreg = reloadreg;
+                         
+                         emit_insn_before (gen_move_insn (loc, second_reloadreg),
+                                           first_output_reload_insn);
+                         pat = gen_move_insn (tmp_reloadreg, loc);
+                       }
+#endif
                      else
                        pat = gen_move_insn (reloadreg, second_reloadreg);