reload.c (push_reload): Handle subregs and secondary memory.
authorJan Hubicka <jh@suse.cz>
Mon, 30 Sep 2002 19:35:17 +0000 (21:35 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 30 Sep 2002 19:35:17 +0000 (19:35 +0000)
* reload.c (push_reload): Handle subregs and secondary memory.
* reload1.c (gen_reload): Likewise.

* jump.c (reg_or_subregno): New function.
* rtl.h (reg_or_subregno): Declare
* unroll.c (find_splittable_givs): Handle subregs.

From-SVN: r57663

gcc/ChangeLog
gcc/jump.c
gcc/reload.c
gcc/reload1.c
gcc/rtl.h
gcc/unroll.c

index 7413d67..ef6c2ca 100644 (file)
@@ -1,3 +1,12 @@
+Mon Sep 30 21:33:23 CEST 2002  Jan Hubicka  <jh@suse.cz>
+
+       * reload.c (push_reload): Handle subregs and secondary memory.
+       * reload1.c (gen_reload): Likewise.
+
+       * jump.c (reg_or_subregno): New function.
+       * rtl.h (reg_or_subregno): Declare
+       * unroll.c (find_splittable_givs): Handle subregs.
+
 2002-09-30  Mark Mitchell  <mark@codesourcery.com>
 
        * store-layout.c (finish_record_layout): Add free_p parameter.
index 5fef7b7..3b75110 100644 (file)
@@ -2410,3 +2410,15 @@ true_regnum (x)
     }
   return -1;
 }
+
+/* Return regno of the register REG and handle subregs too.  */
+unsigned int
+reg_or_subregno (reg)
+     rtx reg;
+{
+  if (REG_P (reg))
+    return REGNO (reg);
+  if (GET_CODE (reg) == SUBREG)
+    return REGNO (SUBREG_REG (reg));
+  abort ();
+}
index ba5d075..2b42722 100644 (file)
@@ -1285,9 +1285,9 @@ push_reload (in, out, inloc, outloc, class,
 
 #ifdef SECONDARY_MEMORY_NEEDED
       /* If a memory location is needed for the copy, make one.  */
-      if (in != 0 && GET_CODE (in) == REG
-         && REGNO (in) < FIRST_PSEUDO_REGISTER
-         && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (REGNO (in)),
+      if (in != 0 && (GET_CODE (in) == REG || GET_CODE (in) == SUBREG)
+         && reg_or_subregno (in) < FIRST_PSEUDO_REGISTER
+         && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (reg_or_subregno (in)),
                                      class, inmode))
        get_secondary_mem (in, inmode, opnum, type);
 #endif
@@ -1315,9 +1315,10 @@ push_reload (in, out, inloc, outloc, class,
       n_reloads++;
 
 #ifdef SECONDARY_MEMORY_NEEDED
-      if (out != 0 && GET_CODE (out) == REG
-         && REGNO (out) < FIRST_PSEUDO_REGISTER
-         && SECONDARY_MEMORY_NEEDED (class, REGNO_REG_CLASS (REGNO (out)),
+      if (out != 0 && (GET_CODE (out) == REG || GET_CODE (out) == SUBREG)
+         && reg_or_subregno (out) < FIRST_PSEUDO_REGISTER
+         && SECONDARY_MEMORY_NEEDED (class,
+                                     REGNO_REG_CLASS (reg_or_subregno (out)),
                                      outmode))
        get_secondary_mem (out, outmode, opnum, type);
 #endif
index 726a4bf..ea703f1 100644 (file)
@@ -7532,10 +7532,12 @@ gen_reload (out, in, opnum, type)
 
 #ifdef SECONDARY_MEMORY_NEEDED
   /* If we need a memory location to do the move, do it that way.  */
-  else if (GET_CODE (in) == REG && REGNO (in) < FIRST_PSEUDO_REGISTER
-          && GET_CODE (out) == REG && REGNO (out) < FIRST_PSEUDO_REGISTER
-          && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (REGNO (in)),
-                                      REGNO_REG_CLASS (REGNO (out)),
+  else if ((GET_CODE (in) == REG || GET_CODE (in) == SUBREG)
+          && reg_or_subregno (in) < FIRST_PSEUDO_REGISTER
+          && (GET_CODE (out) == REG || GET_CODE (out) == SUBREG)
+          && reg_or_subregno (out) < FIRST_PSEUDO_REGISTER
+          && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (reg_or_subregno (in)),
+                                      REGNO_REG_CLASS (reg_or_subregno (out)),
                                       GET_MODE (out)))
     {
       /* Get the memory to use and rewrite both registers to its mode.  */
index e2afd90..d4147c2 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1943,6 +1943,7 @@ extern int invert_jump_1          PARAMS ((rtx, rtx));
 extern int invert_jump                 PARAMS ((rtx, rtx, int));
 extern int rtx_renumbered_equal_p      PARAMS ((rtx, rtx));
 extern int true_regnum                 PARAMS ((rtx));
+extern unsigned int reg_or_subregno    PARAMS ((rtx));
 extern int redirect_jump_1             PARAMS ((rtx, rtx));
 extern int redirect_jump               PARAMS ((rtx, rtx, int));
 extern void rebuild_jump_labels                PARAMS ((rtx));
index 126b586..a1b0287 100644 (file)
@@ -2822,7 +2822,7 @@ find_splittable_givs (loop, bl, unroll_type, increment, unroll_number)
                  value = tem;
                }
 
-             splittable_regs[REGNO (v->new_reg)] = value;
+             splittable_regs[reg_or_subregno (v->new_reg)] = value;
            }
          else
            continue;
@@ -2856,7 +2856,7 @@ find_splittable_givs (loop, bl, unroll_type, increment, unroll_number)
          if (! v->ignore)
            count = REG_IV_CLASS (ivs, REGNO (v->src_reg))->biv_count;
 
-         splittable_regs_updates[REGNO (v->new_reg)] = count;
+         splittable_regs_updates[reg_or_subregno (v->new_reg)] = count;
        }
 
       result++;