From 626d1efd40666cee2ff12d2ce2e34322b51c708f Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 14 Jul 2000 13:40:38 -0400 Subject: [PATCH] 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 --- gcc/ChangeLog | 7 +++++++ gcc/dwarf2out.c | 19 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2f532f1b9de..e723556f9d9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2000-07-14 Jason Merrill + + * dwarf2out.c (dwarf2out_frame_debug_expr): If we store the CFA + register in the stack and later in another register, use the new + register. + Fri Jul 14 10:25:53 2000 Clinton Popetz * config/mips/mips.md: (absdi2): Handle sign_extend for @@ -391,6 +397,7 @@ Tue Jul 11 16:26:17 2000 Clinton Popetz * cpp.texi: Update. +>>>>>>> 1.7094 2000-07-11 Neil Booth * cppinit.c: (cpp_reader_init): Allow digraphs by default. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index c8aff3ab8af..90f6ae8f32d 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; -- 2.30.2