This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
subreg validation, part 2
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 23 Nov 2004 15:12:22 -0800
- Subject: subreg validation, part 2
After part 1, the validate argument to subreg_hard_regno is always true.
Further, all of the validation here except for the actual hard-reg-ness
overlaps with the validation to be added to gen_rtx_SUBREG. Given that
I don't think the hard-reg-ness check is valuable by itself, this is all
dead code.
r~
* emit-rtl.c, rtl.h (subreg_hard_regno): Remove.
* caller-save.c (mark_set_regs): Use subreg_regno instead.
* final.c (alter_subreg): Likewise.
* local-alloc.c (reg_is_born): Likewise.
Index: caller-save.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/caller-save.c,v
retrieving revision 1.70
diff -c -p -d -u -r1.70 caller-save.c
--- caller-save.c 22 Nov 2004 12:23:43 -0000 1.70
+++ caller-save.c 23 Nov 2004 23:07:45 -0000
@@ -500,8 +500,7 @@ mark_set_regs (rtx reg, rtx setter ATTRI
rtx inner = SUBREG_REG (reg);
if (!REG_P (inner) || REGNO (inner) >= FIRST_PSEUDO_REGISTER)
return;
-
- regno = subreg_hard_regno (reg, 1);
+ regno = subreg_regno (reg);
}
else if (REG_P (reg)
&& REGNO (reg) < FIRST_PSEUDO_REGISTER)
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.426
diff -c -p -d -u -r1.426 emit-rtl.c
--- emit-rtl.c 23 Nov 2004 02:15:16 -0000 1.426
+++ emit-rtl.c 23 Nov 2004 23:07:49 -0000
@@ -1018,34 +1018,6 @@ maybe_set_first_label_num (rtx x)
first_label_num = CODE_LABEL_NUMBER (x);
}
-/* Return the final regno of X, which is a SUBREG of a hard
- register. */
-int
-subreg_hard_regno (rtx x, int check_mode)
-{
- enum machine_mode mode = GET_MODE (x);
- unsigned int byte_offset, base_regno, final_regno;
- rtx reg = SUBREG_REG (x);
-
- /* This is where we attempt to catch illegal subregs
- created by the compiler. */
- gcc_assert (GET_CODE (x) == SUBREG && REG_P (reg));
- base_regno = REGNO (reg);
- gcc_assert (base_regno < FIRST_PSEUDO_REGISTER);
- gcc_assert (!check_mode || HARD_REGNO_MODE_OK (base_regno, GET_MODE (reg)));
-#ifdef ENABLE_CHECKING
- gcc_assert (subreg_offset_representable_p (REGNO (reg), GET_MODE (reg),
- SUBREG_BYTE (x), mode));
-#endif
- /* Catch non-congruent offsets too. */
- byte_offset = SUBREG_BYTE (x);
- gcc_assert (!(byte_offset % GET_MODE_SIZE (mode)));
-
- final_regno = subreg_regno (x);
-
- return final_regno;
-}
-
/* Return a value representing some low-order bits of X, where the number
of low-order bits is given by MODE. Note that no conversion is done
between floating-point and fixed-point values, rather, the bit
Index: final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.342
diff -c -p -d -u -r1.342 final.c
--- final.c 9 Nov 2004 10:12:15 -0000 1.342
+++ final.c 23 Nov 2004 23:07:49 -0000
@@ -2636,8 +2636,7 @@ alter_subreg (rtx *xp)
else
{
/* Simplify_subreg can't handle some REG cases, but we have to. */
- unsigned int regno = subreg_hard_regno (x, 1);
-
+ unsigned int regno = subreg_regno (x);
gcc_assert (REG_P (y));
*xp = gen_rtx_REG_offset (y, GET_MODE (x), regno, SUBREG_BYTE (x));
}
Index: local-alloc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/local-alloc.c,v
retrieving revision 1.142
diff -c -p -d -u -r1.142 local-alloc.c
--- local-alloc.c 22 Nov 2004 12:23:52 -0000 1.142
+++ local-alloc.c 23 Nov 2004 23:07:50 -0000
@@ -2011,7 +2011,7 @@ reg_is_born (rtx reg, int birth)
{
regno = REGNO (SUBREG_REG (reg));
if (regno < FIRST_PSEUDO_REGISTER)
- regno = subreg_hard_regno (reg, 1);
+ regno = subreg_regno (reg);
}
else
regno = REGNO (reg);
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.526
diff -c -p -d -u -r1.526 rtl.h
--- rtl.h 19 Nov 2004 02:55:34 -0000 1.526
+++ rtl.h 23 Nov 2004 23:07:50 -0000
@@ -1375,7 +1375,6 @@ extern rtvec gen_rtvec_v (int, rtx *);
extern rtx gen_reg_rtx (enum machine_mode);
extern rtx gen_rtx_REG_offset (rtx, enum machine_mode, unsigned int, int);
extern rtx gen_label_rtx (void);
-extern int subreg_hard_regno (rtx, int);
extern rtx gen_lowpart_common (enum machine_mode, rtx);
/* In cse.c */