summaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-20 19:50:38 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-20 19:50:38 +0000
commitbf4652ac2b3d27b528c7cf95a205f2be548c52c1 (patch)
treed2712a2600e01b99ea494a11870796fdeedfb4c6 /gcc/combine.c
parentdbcc4ee56a7223de4edccf73f50ff127710ec390 (diff)
downloadgcc-bf4652ac2b3d27b528c7cf95a205f2be548c52c1.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153037 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c76
1 files changed, 21 insertions, 55 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index af9cea2fe2a..129cd4dff39 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2264,68 +2264,33 @@ cleanup_auto_inc_dec (rtx src, bool after, enum machine_mode mem_mode)
return x;
}
-#endif
/* Auxiliary data structure for propagate_for_debug_stmt. */
struct rtx_subst_pair
{
- rtx from, to;
- bool changed;
-#ifdef AUTO_INC_DEC
+ rtx to;
bool adjusted;
bool after;
-#endif
};
-/* Clean up any auto-updates in PAIR->to the first time it is called
- for a PAIR. PAIR->adjusted is used to tell whether we've cleaned
- up before. */
+/* DATA points to an rtx_subst_pair. Return the value that should be
+ substituted. */
-static void
-auto_adjust_pair (struct rtx_subst_pair *pair ATTRIBUTE_UNUSED)
+static rtx
+propagate_for_debug_subst (rtx from ATTRIBUTE_UNUSED, void *data)
{
-#ifdef AUTO_INC_DEC
+ struct rtx_subst_pair *pair = (struct rtx_subst_pair *)data;
+
if (!pair->adjusted)
{
pair->adjusted = true;
pair->to = cleanup_auto_inc_dec (pair->to, pair->after, VOIDmode);
+ return pair->to;
}
-#endif
-}
-
-/* If *LOC is the same as FROM in the struct rtx_subst_pair passed as
- DATA, replace it with a copy of TO. Handle SUBREGs of *LOC as
- well. */
-
-static int
-propagate_for_debug_subst (rtx *loc, void *data)
-{
- struct rtx_subst_pair *pair = (struct rtx_subst_pair *)data;
- rtx from = pair->from, to = pair->to;
- rtx x = *loc, s = x;
-
- if (rtx_equal_p (x, from)
- || (GET_CODE (x) == SUBREG && rtx_equal_p ((s = SUBREG_REG (x)), from)))
- {
- auto_adjust_pair (pair);
- if (pair->to != to)
- to = pair->to;
- else
- to = copy_rtx (to);
- if (s != x)
- {
- gcc_assert (GET_CODE (x) == SUBREG && SUBREG_REG (x) == s);
- to = simplify_gen_subreg (GET_MODE (x), to,
- GET_MODE (from), SUBREG_BYTE (x));
- }
- *loc = wrap_constant (GET_MODE (x), to);
- pair->changed = true;
- return -1;
- }
-
- return 0;
+ return copy_rtx (pair->to);
}
+#endif
/* Replace occurrences of DEST with SRC in DEBUG_INSNs between INSN
and LAST. If MOVE holds, debug insns must also be moved past
@@ -2334,14 +2299,11 @@ propagate_for_debug_subst (rtx *loc, void *data)
static void
propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, bool move)
{
- struct rtx_subst_pair p;
- rtx next, move_pos = move ? last : NULL_RTX;
-
- p.from = dest;
- p.to = src;
- p.changed = false;
+ rtx next, move_pos = move ? last : NULL_RTX, loc;
#ifdef AUTO_INC_DEC
+ struct rtx_subst_pair p;
+ p.to = src;
p.adjusted = false;
p.after = move;
#endif
@@ -2353,11 +2315,15 @@ propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, bool move)
next = NEXT_INSN (insn);
if (DEBUG_INSN_P (insn))
{
- for_each_rtx (&INSN_VAR_LOCATION_LOC (insn),
- propagate_for_debug_subst, &p);
- if (!p.changed)
+#ifdef AUTO_INC_DEC
+ loc = simplify_replace_fn_rtx (INSN_VAR_LOCATION_LOC (insn),
+ dest, propagate_for_debug_subst, &p);
+#else
+ loc = simplify_replace_rtx (INSN_VAR_LOCATION_LOC (insn), dest, src);
+#endif
+ if (loc == INSN_VAR_LOCATION_LOC (insn))
continue;
- p.changed = false;
+ INSN_VAR_LOCATION_LOC (insn) = loc;
if (move_pos)
{
remove_insn (insn);