From 2a450639801b638f5b28d00b1ba0b560d8a2c271 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 21 Mar 2007 09:10:08 +0000 Subject: [PATCH] rtl.h (constant_pool_reference_p): Delete. gcc/ * rtl.h (constant_pool_reference_p): Delete. (find_constant_src): Declare. * rtlanal.c (find_constant_src): New function. * simplify-rtx.c (constant_pool_reference_p): Delete. * config/i386/i386.md: Use find_constant_src instead of constant_pool_reference_p/avoid_constant_pool_reference pairs. From-SVN: r123106 --- gcc/ChangeLog | 9 +++++++++ gcc/config/i386/i386.md | 21 ++++++++------------- gcc/rtl.h | 2 +- gcc/rtlanal.c | 24 ++++++++++++++++++++++++ gcc/simplify-rtx.c | 8 -------- 5 files changed, 42 insertions(+), 22 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c2bcf896c9c..f6edacf979b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2007-03-21 Richard Sandiford + + * rtl.h (constant_pool_reference_p): Delete. + (find_constant_src): Declare. + * rtlanal.c (find_constant_src): New function. + * simplify-rtx.c (constant_pool_reference_p): Delete. + * config/i386/i386.md: Use find_constant_src instead of + constant_pool_reference_p/avoid_constant_pool_reference pairs. + 2007-03-21 Richard Sandiford * doc/invoke.texi (-fpie, -fPIE): Document __pie__ and __PIE__. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index bdf8bef16dd..df1bacfc41b 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -2331,10 +2331,9 @@ (match_operand:SF 1 "memory_operand" ""))] "reload_completed && MEM_P (operands[1]) - && constant_pool_reference_p (operands[1])" + && (operands[2] = find_constant_src (insn))" [(set (match_dup 0) - (match_dup 1))] - "operands[1] = avoid_constant_pool_reference (operands[1]);") + (match_dup 2))]) ;; %%% Kill this when call knows how to work this out. @@ -3078,10 +3077,10 @@ && (GET_MODE (operands[0]) == XFmode || GET_MODE (operands[0]) == SFmode || GET_MODE (operands[0]) == DFmode) - && constant_pool_reference_p (operands[1])" - [(set (match_dup 0) (match_dup 1))] + && (operands[2] = find_constant_src (insn))" + [(set (match_dup 0) (match_dup 2))] { - rtx c = avoid_constant_pool_reference (operands[1]); + rtx c = operands[2]; rtx r = operands[0]; if (GET_CODE (r) == SUBREG) @@ -3099,8 +3098,6 @@ } else if (MMX_REG_P (r)) FAIL; - - operands[1] = c; }) (define_split @@ -3111,10 +3108,10 @@ && (GET_MODE (operands[0]) == XFmode || GET_MODE (operands[0]) == SFmode || GET_MODE (operands[0]) == DFmode) - && constant_pool_reference_p (operands[1])" - [(set (match_dup 0) (match_dup 1))] + && (operands[2] = find_constant_src (insn))" + [(set (match_dup 0) (match_dup 2))] { - rtx c = avoid_constant_pool_reference (SET_SRC (PATTERN (curr_insn))); + rtx c = operands[2]; rtx r = operands[0]; if (GET_CODE (r) == SUBREG) @@ -3132,8 +3129,6 @@ } else if (MMX_REG_P (r)) FAIL; - - operands[1] = c; }) (define_insn "swapxf" diff --git a/gcc/rtl.h b/gcc/rtl.h index 5b0f8f48d27..12f69e815b7 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1641,7 +1641,6 @@ extern rtx simplify_gen_subreg (enum machine_mode, rtx, enum machine_mode, extern rtx simplify_replace_rtx (rtx, rtx, rtx); extern rtx simplify_rtx (rtx); extern rtx avoid_constant_pool_reference (rtx); -extern bool constant_pool_reference_p (rtx x); extern bool mode_signbit_p (enum machine_mode, rtx); /* In regclass.c */ @@ -1703,6 +1702,7 @@ extern int dead_or_set_regno_p (rtx, unsigned int); extern rtx find_reg_note (rtx, enum reg_note, rtx); extern rtx find_regno_note (rtx, enum reg_note, unsigned int); extern rtx find_reg_equal_equiv_note (rtx); +extern rtx find_constant_src (rtx); extern int find_reg_fusage (rtx, enum rtx_code, rtx); extern int find_regno_fusage (rtx, enum rtx_code, unsigned int); extern int pure_call_p (rtx); diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index cf9fd1d65af..ce7018b5987 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -1750,6 +1750,30 @@ find_reg_equal_equiv_note (rtx insn) return NULL; } +/* Check whether INSN is a single_set whose source is known to be + equivalent to a constant. Return that constant if so, otherwise + return null. */ + +rtx +find_constant_src (rtx insn) +{ + rtx note, set, x; + + set = single_set (insn); + if (set) + { + x = avoid_constant_pool_reference (SET_SRC (set)); + if (CONSTANT_P (x)) + return x; + } + + note = find_reg_equal_equiv_note (insn); + if (note && CONSTANT_P (XEXP (note, 0))) + return XEXP (note, 0); + + return NULL_RTX; +} + /* Return true if DATUM, or any overlap of DATUM, of kind CODE is found in the CALL_INSN_FUNCTION_USAGE information of INSN. */ diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 4251df520c8..e4af34d7adf 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -202,14 +202,6 @@ avoid_constant_pool_reference (rtx x) return x; } - -/* Return true if X is a MEM referencing the constant pool. */ - -bool -constant_pool_reference_p (rtx x) -{ - return avoid_constant_pool_reference (x) != x; -} /* Make a unary operation by first seeing if it folds and otherwise making the specified operation. */