aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>2000-07-14 13:40:38 -0400
committerJason Merrill <jason@gcc.gnu.org>2000-07-14 13:40:38 -0400
commit626d1efd40666cee2ff12d2ce2e34322b51c708f (patch)
tree32da8a07edf8cc56d2ae17ccd8ec4c9d715cc4ac /gcc/dwarf2out.c
parent30f747d0772283f8ab408f7c07393d5c54db9f16 (diff)
downloadgcc-626d1efd40666cee2ff12d2ce2e34322b51c708f.zip
gcc-626d1efd40666cee2ff12d2ce2e34322b51c708f.tar.gz
gcc-626d1efd40666cee2ff12d2ce2e34322b51c708f.tar.bz2
dwarf2out.c (dwarf2out_frame_debug_expr): If we store the CFA register in the stack and later in another register...
* dwarf2out.c (dwarf2out_frame_debug_expr): If we store the CFA register in the stack and later in another register, use the new register. From-SVN: r35036
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index c8aff3a..90f6ae8 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -626,7 +626,8 @@ expand_builtin_init_dwarf_reg_sizes (address)
rtx addr = expand_expr (address, NULL_RTX, VOIDmode, 0);
rtx mem = gen_rtx_MEM (mode, addr);
- for (i = 0; i < DWARF_FRAME_REGISTERS; ++i)
+ i = MAX (FIRST_PSEUDO_REGISTER, DWARF_FRAME_REGISTERS);
+ while (i--)
{
int offset = DWARF_FRAME_REGNUM (i) * GET_MODE_SIZE (mode);
int size = GET_MODE_SIZE (reg_raw_mode[i]);
@@ -1208,6 +1209,11 @@ static unsigned cfa_temp_reg;
/* A temporary value used in adjusting SP or setting up the store_reg. */
static long cfa_temp_value;
+/* If we see a store of the CFA register, remember it in case we later also
+ copy it into another register. The ARM saves the old SP in the stack,
+ but it also has a usable FP. */
+static unsigned cfa_old_reg;
+
/* Record call frame debugging information for an expression, which either
sets SP or FP (adjusting how we calculate the frame address) or saves a
register to the stack. */
@@ -1257,7 +1263,10 @@ dwarf2out_frame_debug_expr (expr, label)
{
/* Setting FP from SP. */
case REG:
- if (cfa.reg != (unsigned) REGNO (src))
+ if (cfa.reg == (unsigned) REGNO (src)
+ || (cfa.indirect && cfa_old_reg == (unsigned) REGNO (src)))
+ /* OK */;
+ else
abort ();
/* We used to require that dest be either SP or FP, but the
@@ -1265,6 +1274,7 @@ dwarf2out_frame_debug_expr (expr, label)
FP. So we just rely on the backends to only set
RTX_FRAME_RELATED_P on appropriate insns. */
cfa.reg = REGNO (dest);
+ cfa.indirect = 0;
break;
case PLUS:
@@ -1376,7 +1386,9 @@ dwarf2out_frame_debug_expr (expr, label)
going to have to use an indrect mechanism. */
if (REGNO (src) != STACK_POINTER_REGNUM
&& REGNO (src) != HARD_FRAME_POINTER_REGNUM
- && (unsigned) REGNO (src) == cfa.reg)
+ && (unsigned) REGNO (src) == cfa.reg
+ /* Temporary KLUDGE to make ARM work. */
+ && GET_CODE (XEXP (dest, 0)) != PRE_DEC)
{
/* We currently allow this to be ONLY a MEM or MEM + offset. */
rtx x = XEXP (dest, 0);
@@ -1390,6 +1402,7 @@ dwarf2out_frame_debug_expr (expr, label)
}
if (GET_CODE (x) != REG)
abort ();
+ cfa_old_reg = cfa.reg;
cfa.reg = (unsigned) REGNO (x);
cfa.base_offset = offset;
cfa.indirect = 1;