* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123106
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-03-21 Richard Sandiford <richard@codesourcery.com>
+
+ * 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 <richard@codesourcery.com>
* doc/invoke.texi (-fpie, -fPIE): Document __pie__ and __PIE__.
(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.
&& (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)
}
else if (MMX_REG_P (r))
FAIL;
-
- operands[1] = c;
})
(define_split
&& (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)
}
else if (MMX_REG_P (r))
FAIL;
-
- operands[1] = c;
})
(define_insn "swapxf"
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 */
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);
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. */
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;
-}
\f
/* Make a unary operation by first seeing if it folds and otherwise making
the specified operation. */