From c619e9823eb70134db45642968eb815bf270bd58 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 27 Mar 2009 22:25:36 +0000 Subject: [PATCH] jump.c (rtx_renumbered_equal_p): Use subreg_get_info. 2009-03-27 H.J. Lu * jump.c (rtx_renumbered_equal_p): Use subreg_get_info. (true_regnum): Likewise. * rtlanal.c (subreg_info): Moved to ... * rtl.h (subreg_info): Here. New. (subreg_get_info): New. * rtlanal.c (subreg_get_info): Make it extern. From-SVN: r145134 --- gcc/ChangeLog | 11 +++++++++++ gcc/jump.c | 45 ++++++++++++++++++++++----------------------- gcc/rtl.h | 16 ++++++++++++++++ gcc/rtlanal.c | 17 +---------------- 4 files changed, 50 insertions(+), 39 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d874d24670a..f4da0b99375 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2009-03-27 H.J. Lu + + * jump.c (rtx_renumbered_equal_p): Use subreg_get_info. + (true_regnum): Likewise. + + * rtlanal.c (subreg_info): Moved to ... + * rtl.h (subreg_info): Here. New. + (subreg_get_info): New. + + * rtlanal.c (subreg_get_info): Make it extern. + 2009-03-27 H.J. Lu PR target/39472 diff --git a/gcc/jump.c b/gcc/jump.c index 2b9a9545223..1189f812fef 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -1536,6 +1536,7 @@ rtx_renumbered_equal_p (const_rtx x, const_rtx y) { int reg_x = -1, reg_y = -1; int byte_x = 0, byte_y = 0; + struct subreg_info info; if (GET_MODE (x) != GET_MODE (y)) return 0; @@ -1552,15 +1553,12 @@ rtx_renumbered_equal_p (const_rtx x, const_rtx y) if (reg_renumber[reg_x] >= 0) { - if (!subreg_offset_representable_p (reg_renumber[reg_x], - GET_MODE (SUBREG_REG (x)), - byte_x, - GET_MODE (x))) + subreg_get_info (reg_renumber[reg_x], + GET_MODE (SUBREG_REG (x)), byte_x, + GET_MODE (x), &info); + if (!info.representable_p) return 0; - reg_x = subreg_regno_offset (reg_renumber[reg_x], - GET_MODE (SUBREG_REG (x)), - byte_x, - GET_MODE (x)); + reg_x = info.offset; byte_x = 0; } } @@ -1578,15 +1576,12 @@ rtx_renumbered_equal_p (const_rtx x, const_rtx y) if (reg_renumber[reg_y] >= 0) { - if (!subreg_offset_representable_p (reg_renumber[reg_y], - GET_MODE (SUBREG_REG (y)), - byte_y, - GET_MODE (y))) + subreg_get_info (reg_renumber[reg_y], + GET_MODE (SUBREG_REG (y)), byte_y, + GET_MODE (y), &info); + if (!info.representable_p) return 0; - reg_y = subreg_regno_offset (reg_renumber[reg_y], - GET_MODE (SUBREG_REG (y)), - byte_y, - GET_MODE (y)); + reg_y = info.offset; byte_y = 0; } } @@ -1728,13 +1723,17 @@ true_regnum (const_rtx x) { int base = true_regnum (SUBREG_REG (x)); if (base >= 0 - && base < FIRST_PSEUDO_REGISTER - && subreg_offset_representable_p (REGNO (SUBREG_REG (x)), - GET_MODE (SUBREG_REG (x)), - SUBREG_BYTE (x), GET_MODE (x))) - return base + subreg_regno_offset (REGNO (SUBREG_REG (x)), - GET_MODE (SUBREG_REG (x)), - SUBREG_BYTE (x), GET_MODE (x)); + && base < FIRST_PSEUDO_REGISTER) + { + struct subreg_info info; + + subreg_get_info (REGNO (SUBREG_REG (x)), + GET_MODE (SUBREG_REG (x)), + SUBREG_BYTE (x), GET_MODE (x), &info); + + if (info.representable_p) + return base + info.offset; + } } return -1; } diff --git a/gcc/rtl.h b/gcc/rtl.h index e8d42c8cc61..bdb41d62b55 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1806,6 +1806,22 @@ extern rtx canonicalize_condition (rtx, rtx, int, rtx *, rtx, int, int); being made. */ extern rtx get_condition (rtx, rtx *, int, int); +/* Information about a subreg of a hard register. */ +struct subreg_info +{ + /* Offset of first hard register involved in the subreg. */ + int offset; + /* Number of hard registers involved in the subreg. */ + int nregs; + /* Whether this subreg can be represented as a hard reg with the new + mode. */ + bool representable_p; +}; + +extern void subreg_get_info (unsigned int, enum machine_mode, + unsigned int, enum machine_mode, + struct subreg_info *); + /* lists.c */ extern void free_EXPR_LIST_list (rtx *); diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index b35d774859c..73d3b08d940 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -39,18 +39,6 @@ along with GCC; see the file COPYING3. If not see #include "df.h" #include "tree.h" -/* Information about a subreg of a hard register. */ -struct subreg_info -{ - /* Offset of first hard register involved in the subreg. */ - int offset; - /* Number of hard registers involved in the subreg. */ - int nregs; - /* Whether this subreg can be represented as a hard reg with the new - mode. */ - bool representable_p; -}; - /* Forward declarations */ static void set_of_1 (rtx, const_rtx, void *); static bool covers_regno_p (const_rtx, unsigned int); @@ -58,9 +46,6 @@ static bool covers_regno_no_parallel_p (const_rtx, unsigned int); static int rtx_referenced_p_1 (rtx *, void *); static int computed_jump_p_1 (const_rtx); static void parms_set (rtx, const_rtx, void *); -static void subreg_get_info (unsigned int, enum machine_mode, - unsigned int, enum machine_mode, - struct subreg_info *); static unsigned HOST_WIDE_INT cached_nonzero_bits (const_rtx, enum machine_mode, const_rtx, enum machine_mode, @@ -3090,7 +3075,7 @@ subreg_lsb (const_rtx x) offset - The byte offset. ymode - The mode of a top level SUBREG (or what may become one). info - Pointer to structure to fill in. */ -static void +void subreg_get_info (unsigned int xregno, enum machine_mode xmode, unsigned int offset, enum machine_mode ymode, struct subreg_info *info) -- 2.30.2