aboutsummaryrefslogtreecommitdiff
path: root/gcc/cselib.c
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2009-10-20 19:50:38 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2009-10-20 19:50:38 +0000
commit3af4ba41cc98aa2c50c2a5c3ebcb7197b736994a (patch)
treed2712a2600e01b99ea494a11870796fdeedfb4c6 /gcc/cselib.c
parent6a1868c766cec7ccaa1073f1b9d0ff30da8169d3 (diff)
downloadgcc-3af4ba41cc98aa2c50c2a5c3ebcb7197b736994a.zip
gcc-3af4ba41cc98aa2c50c2a5c3ebcb7197b736994a.tar.gz
gcc-3af4ba41cc98aa2c50c2a5c3ebcb7197b736994a.tar.bz2
rtl.h (simplify_replace_fn_rtx): Declare.
gcc/ * rtl.h (simplify_replace_fn_rtx): Declare. (wrap_constant, unwrap_constant): Delete. * cfgexpand.c (unwrap_constant, wrap_constant): Delete. (expand_debug_expr): Don't call wrap_constant. * combine.c (rtx_subst_pair): Only define for AUTO_INC_DEC. (auto_adjust_pair): Fold into... (propagate_for_debug_subst): ...here. Only define for AUTO_INC_DEC. Just return a new value. (propagate_for_debug): Use simplify_replace_fn_rtx for AUTO_INC_DEC, otherwise use simplify_replace_rtx. * cselib.c (wrap_constant): Reinstate old definition. (cselib_expand_value_rtx_1): Don't wrap constants. * gcse.c (try_replace_reg): Don't use copy_rtx in the call to simplify_replace_rtx. (bypass_block): Fix formatting in calls to simplify_replace_rtx. * reload1.c (reload): Skip all uses for an insn before adjusting it. Use simplify_replace_rtx. * simplify-rtx.c (simplify_replace_fn_rtx): New function, adapted from... (simplify_replace_rtx): ...here. Turn into a wrapper for simplify_replace_fn_rtx. (simplify_unary_operation): Don't unwrap CONSTs. * var-tracking.c (check_wrap_constant): Delete. (vt_expand_loc_callback): Don't call it. (vt_expand_loc): Likewise. From-SVN: r153037
Diffstat (limited to 'gcc/cselib.c')
-rw-r--r--gcc/cselib.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/gcc/cselib.c b/gcc/cselib.c
index 2bf4662..aa5f7b0 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -662,6 +662,19 @@ rtx_equal_for_cselib_p (rtx x, rtx y)
return 1;
}
+/* We need to pass down the mode of constants through the hash table
+ functions. For that purpose, wrap them in a CONST of the appropriate
+ mode. */
+static rtx
+wrap_constant (enum machine_mode mode, rtx x)
+{
+ if (!CONST_INT_P (x) && GET_CODE (x) != CONST_FIXED
+ && (GET_CODE (x) != CONST_DOUBLE || GET_MODE (x) != VOIDmode))
+ return x;
+ gcc_assert (mode != VOIDmode);
+ return gen_rtx_CONST (mode, x);
+}
+
/* Hash an rtx. Return 0 if we couldn't hash the rtx.
For registers and memory locations, we look up their cselib_val structure
and return its VALUE element.
@@ -1340,21 +1353,9 @@ cselib_expand_value_rtx_1 (rtx orig, struct expand_value_data *evd,
default:
break;
}
- if (scopy == NULL_RTX)
- {
- XEXP (copy, 0)
- = gen_rtx_CONST (GET_MODE (XEXP (orig, 0)), XEXP (copy, 0));
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, " wrapping const_int result in const to preserve mode %s\n",
- GET_MODE_NAME (GET_MODE (XEXP (copy, 0))));
- }
scopy = simplify_rtx (copy);
if (scopy)
- {
- if (GET_MODE (copy) != GET_MODE (scopy))
- scopy = wrap_constant (GET_MODE (copy), scopy);
- return scopy;
- }
+ return scopy;
return copy;
}