summaryrefslogtreecommitdiff
path: root/gcc/reg-stack.c
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-06 13:25:06 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-06 13:25:06 +0000
commita6aa49aa36be4590e4f5503a8eb538865f318fb5 (patch)
treea367b4f3bc02429f1f4641ec15be75b735d877e1 /gcc/reg-stack.c
parent55b028fe5fca96445e4006f45ca24a4ca6868f19 (diff)
downloadgcc-a6aa49aa36be4590e4f5503a8eb538865f318fb5.tar.gz
* dce.c (reset_unmarked_insns_debug_uses): New.
(delete_unmarked_insns): Skip debug insns. (prescan_insns_for_dce): Likewise. (rest_of_handle_ud_dce): Reset debug uses of removed sets. * reg-stack.c (subst_stack_regs_in_debug_insn): Signal when no active reg can be found. (subst_all_stack_regs_in_debug_insn): New. Reset debug insn then. (convert_regs_1): Use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174699 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reg-stack.c')
-rw-r--r--gcc/reg-stack.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 60835c75528..dcde8920d7e 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -1333,6 +1333,11 @@ subst_stack_regs_in_debug_insn (rtx *loc, void *data)
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);
@@ -1340,6 +1345,23 @@ subst_stack_regs_in_debug_insn (rtx *loc, void *data)
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. */
+
+static void
+subst_all_stack_regs_in_debug_insn (rtx insn, struct stack_def *regstack)
+{
+ int ret = for_each_rtx (&INSN_VAR_LOCATION_LOC (insn),
+ subst_stack_regs_in_debug_insn,
+ regstack);
+
+ if (ret == 1)
+ INSN_VAR_LOCATION_LOC (insn) = gen_rtx_UNKNOWN_VAR_LOC ();
+ else
+ gcc_checking_assert (ret == 0);
+}
+
/* Substitute new registers in PAT, which is part of INSN. REGSTACK
is the current register layout. Return whether a control flow insn
was deleted in the process. */
@@ -2947,8 +2969,7 @@ convert_regs_1 (basic_block block)
debug_insns_with_starting_stack++;
else
{
- for_each_rtx (&PATTERN (insn), subst_stack_regs_in_debug_insn,
- &regstack);
+ subst_all_stack_regs_in_debug_insn (insn, &regstack);
/* Nothing must ever die at a debug insn. If something
is referenced in it that becomes dead, it should have
@@ -2986,8 +3007,7 @@ convert_regs_1 (basic_block block)
continue;
debug_insns_with_starting_stack--;
- for_each_rtx (&PATTERN (insn), subst_stack_regs_in_debug_insn,
- &bi->stack_in);
+ subst_all_stack_regs_in_debug_insn (insn, &bi->stack_in);
}
}