summaryrefslogtreecommitdiff
path: root/gcc/rtlanal.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-21 09:10:08 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-21 09:10:08 +0000
commit3aba99c86f63f7415e4dbb959f207af8881e84e5 (patch)
treedcedf9b4a8071779c736674a2898f51cb3a47948 /gcc/rtlanal.c
parent18201739542830855d4e2f0e546ec1ea458b37dc (diff)
downloadgcc-3aba99c86f63f7415e4dbb959f207af8881e84e5.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123106 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r--gcc/rtlanal.c24
1 files changed, 24 insertions, 0 deletions
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. */