aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2014-08-28 06:24:03 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2014-08-28 06:24:03 +0000
commit6c0cda9157f9cf2b2394e99a0be9079e9743eb7c (patch)
tree25f0805d73871b5eb9bd6d14cc30a8e59f40de80
parenta36a1928e2b23355618c68a2d8d7e5a17b827df8 (diff)
downloadgcc-6c0cda9157f9cf2b2394e99a0be9079e9743eb7c.zip
gcc-6c0cda9157f9cf2b2394e99a0be9079e9743eb7c.tar.gz
gcc-6c0cda9157f9cf2b2394e99a0be9079e9743eb7c.tar.bz2
reg-stack.c: Include rtl-iter.h.
gcc/ * reg-stack.c: Include rtl-iter.h. (subst_stack_regs_in_debug_insn): Delete. (subst_all_stack_regs_in_debug_insn): Use FOR_EACH_SUBRTX_PTR instead of for_each_rtx. From-SVN: r214650
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/reg-stack.c53
2 files changed, 28 insertions, 32 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1c5aaf9..20dedc9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
+ * reg-stack.c: Include rtl-iter.h.
+ (subst_stack_regs_in_debug_insn): Delete.
+ (subst_all_stack_regs_in_debug_insn): Use FOR_EACH_SUBRTX_PTR
+ instead of for_each_rtx.
+
+2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
+
* lower-subreg.c (find_decomposable_subregs): Turn from being
a for_each_rtx callback to being a function that examines each
subrtx itself. Remove handling of null rtxes.
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 3dabe30..af8e3cd 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -170,6 +170,7 @@
#include "target.h"
#include "df.h"
#include "emit-rtl.h" /* FIXME: Can go away once crtl is moved to rtl.h. */
+#include "rtl-iter.h"
#ifdef STACK_REGS
@@ -1308,31 +1309,6 @@ compare_for_stack_reg (rtx_insn *insn, stack_ptr regstack, rtx pat_src)
}
}
-/* Substitute new registers in LOC, which is part of a debug insn.
- REGSTACK is the current register layout. */
-
-static int
-subst_stack_regs_in_debug_insn (rtx *loc, void *data)
-{
- stack_ptr regstack = (stack_ptr)data;
- int hard_regno;
-
- if (!STACK_REG_P (*loc))
- return 0;
-
- hard_regno = get_hard_regnum (regstack, *loc);
-
- /* If we can't find an active register, reset this debug insn. */
- if (hard_regno == -1)
- return 1;
-
- gcc_assert (hard_regno >= FIRST_STACK_REG);
-
- replace_reg (loc, hard_regno);
-
- return -1;
-}
-
/* Substitute hardware stack regs in debug insn INSN, using stack
layout REGSTACK. If we can't find a hardware stack reg for any of
the REGs in it, reset the debug insn. */
@@ -1340,14 +1316,27 @@ subst_stack_regs_in_debug_insn (rtx *loc, void *data)
static void
subst_all_stack_regs_in_debug_insn (rtx_insn *insn, struct stack_def *regstack)
{
- int ret = for_each_rtx (&INSN_VAR_LOCATION_LOC (insn),
- subst_stack_regs_in_debug_insn,
- regstack);
+ subrtx_ptr_iterator::array_type array;
+ FOR_EACH_SUBRTX_PTR (iter, array, &INSN_VAR_LOCATION_LOC (insn), NONCONST)
+ {
+ rtx *loc = *iter;
+ rtx x = *loc;
+ if (STACK_REG_P (x))
+ {
+ int hard_regno = get_hard_regnum (regstack, x);
- if (ret == 1)
- INSN_VAR_LOCATION_LOC (insn) = gen_rtx_UNKNOWN_VAR_LOC ();
- else
- gcc_checking_assert (ret == 0);
+ /* If we can't find an active register, reset this debug insn. */
+ if (hard_regno == -1)
+ {
+ INSN_VAR_LOCATION_LOC (insn) = gen_rtx_UNKNOWN_VAR_LOC ();
+ return;
+ }
+
+ gcc_assert (hard_regno >= FIRST_STACK_REG);
+ replace_reg (loc, hard_regno);
+ iter.skip_subrtxes ();
+ }
+ }
}
/* Substitute new registers in PAT, which is part of INSN. REGSTACK