This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for dwarf2 EH on ARM
- To: gcc-patches at gcc dot gnu dot org
- Subject: Re: Patch for dwarf2 EH on ARM
- From: Jason Merrill <jason at cygnus dot com>
- Date: 23 Mar 2000 04:09:27 -0800
- References: <200003230027.QAA00826@casey.cygnus.com>
I've changed my mind about how to deal with the ARM saving the CFA register
to the stack; rather than assume that the epilogue will restore it
appropriately, don't record anything about that particular register save.
I also defined DWARF_FRAME_RETURN_COLUMN to match the return address
register on alpha, rs6000 and SPARC, as on the ARM. This saves us from
needing the REG_SAVED_REG indirection on the earlier two; the SPARC still
gets it because of register windows. This won't affect backward
compatibility.
2000-03-22 Jason Merrill <jason@casey.cygnus.com>
* config/rs6000/rs6000.h (DWARF_FRAME_RETURN_COLUMN): Define.
* config/alpha/alpha.h (DWARF_FRAME_RETURN_COLUMN): Define.
* config/sparc/sparc.h (DWARF_FRAME_RETURN_COLUMN): Define.
* frame.h (frame_state): Revert last change.
* frame.c (execute_cfa_insn): Just don't record the save of a CFA reg.
* libgcc2.c (throw_helper): Revert last change.
Index: frame.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/frame.c,v
retrieving revision 1.33
diff -c -p -r1.33 frame.c
*** frame.c 2000/03/23 00:29:54 1.33
--- frame.c 2000/03/23 11:24:44
*************** execute_cfa_insn (void *p, struct frame_
*** 694,704 ****
{
reg = (insn & 0x3f);
p = decode_uleb128 (p, &offset);
- offset *= info->data_align;
- state->s.saved[reg] = REG_SAVED_OFFSET;
- state->s.reg_or_offset[reg] = offset;
if (reg == state->s.cfa_reg)
! state->s.cfa_saved = 1;
}
else if (insn & DW_CFA_restore)
{
--- 694,709 ----
{
reg = (insn & 0x3f);
p = decode_uleb128 (p, &offset);
if (reg == state->s.cfa_reg)
! /* Don't record anything about this register; it's only used to
! reload SP in the epilogue. We don't want to copy in SP
! values for outer frames; we handle restoring SP specially. */;
! else
! {
! offset *= info->data_align;
! state->s.saved[reg] = REG_SAVED_OFFSET;
! state->s.reg_or_offset[reg] = offset;
! }
}
else if (insn & DW_CFA_restore)
{
*************** execute_cfa_insn (void *p, struct frame_
*** 727,737 ****
case DW_CFA_offset_extended:
p = decode_uleb128 (p, ®);
p = decode_uleb128 (p, &offset);
- offset *= info->data_align;
- state->s.saved[reg] = REG_SAVED_OFFSET;
- state->s.reg_or_offset[reg] = offset;
if (reg == state->s.cfa_reg)
! state->s.cfa_saved = 1;
break;
case DW_CFA_restore_extended:
p = decode_uleb128 (p, ®);
--- 732,745 ----
case DW_CFA_offset_extended:
p = decode_uleb128 (p, ®);
p = decode_uleb128 (p, &offset);
if (reg == state->s.cfa_reg)
! /* Don't record anything; see above. */;
! else
! {
! offset *= info->data_align;
! state->s.saved[reg] = REG_SAVED_OFFSET;
! state->s.reg_or_offset[reg] = offset;
! }
break;
case DW_CFA_restore_extended:
p = decode_uleb128 (p, ®);
Index: frame.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/frame.h,v
retrieving revision 1.10
diff -c -p -r1.10 frame.h
*** frame.h 2000/03/23 00:29:54 1.10
--- frame.h 2000/03/23 11:24:44
***************
*** 1,6 ****
/* Header file for unwinding stack frames for exception handling. */
/* Compile this one with gcc. */
! /* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
Contributed by Jason Merrill <jason@cygnus.com>.
This file is part of GNU CC.
--- 1,6 ----
/* Header file for unwinding stack frames for exception handling. */
/* Compile this one with gcc. */
! /* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
Contributed by Jason Merrill <jason@cygnus.com>.
This file is part of GNU CC.
*************** typedef struct frame_state
*** 34,40 ****
long reg_or_offset[DWARF_FRAME_REGISTERS+1];
unsigned short cfa_reg;
unsigned short retaddr_column;
- char cfa_saved;
char saved[DWARF_FRAME_REGISTERS+1];
} frame_state;
--- 34,39 ----
Index: libgcc2.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/libgcc2.c,v
retrieving revision 1.88
diff -c -p -r1.88 libgcc2.c
*** libgcc2.c 2000/03/23 00:29:54 1.88
--- libgcc2.c 2000/03/23 11:24:46
*************** throw_helper (struct eh_context *eh, voi
*** 3679,3685 ****
void *handler;
void *handler_p = 0;
void *pc_p = 0;
- void *restored_cfa = 0;
frame_state saved_ustruct;
int new_eh_model;
int cleanup = 0;
--- 3679,3684 ----
*************** throw_helper (struct eh_context *eh, voi
*** 3789,3799 ****
pc = saved_pc;
memcpy (udata, my_udata, sizeof (*udata));
- if (udata->cfa_saved)
- /* We saved the CFA register into the stack in this frame, so we
- will restore it in the __throw epilogue. Remember the value. */
- restored_cfa = udata->cfa;
-
while (pc != handler_pc)
{
frame_state *p = udata;
--- 3788,3793 ----
*************** throw_helper (struct eh_context *eh, voi
*** 3814,3822 ****
copy_reg (i, udata, my_udata);
}
- if (udata->cfa_saved)
- restored_cfa = udata->cfa;
-
pc = get_return_addr (udata, sub_udata) - 1;
}
--- 3808,3813 ----
*************** throw_helper (struct eh_context *eh, voi
*** 3831,3843 ****
}
}
/* udata now refers to the frame called by the handler frame. */
-
- if (my_udata->cfa_saved)
- /* If we saved the CFA register into the stack (after it became the
- CFA register), we'll restore that value into SP in the epilogue,
- as on the ARM. So calculate the adjustment based on the value that
- will be restored. */
- my_udata->cfa = restored_cfa;
/* We adjust SP by the difference between __throw's CFA and the CFA for
the frame called by the handler frame, because those CFAs correspond
--- 3822,3827 ----
Index: config/alpha/alpha.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/alpha/alpha.h,v
retrieving revision 1.93
diff -c -p -r1.93 alpha.h
*** config/alpha/alpha.h 2000/03/17 22:41:25 1.93
--- config/alpha/alpha.h 2000/03/23 11:24:50
*************** config/alpha/alpha.h \
*** 1328,1333 ****
--- 1328,1334 ----
/* Before the prologue, RA lives in $26. */
#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 26)
+ #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (26)
/* Addressing modes, and classification of registers for them. */
Index: config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.69
diff -c -p -r1.69 rs6000.h
*** config/rs6000/rs6000.h 2000/03/16 03:16:40 1.69
--- config/rs6000/rs6000.h 2000/03/23 11:24:53
*************** config/rs6000/rs6000.h \
*** 2670,2675 ****
--- 2670,2676 ----
mechanism. */
#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM)
+ #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (LINK_REGISTER_REGNUM)
/* Define results of standard character escape sequences. */
#define TARGET_BELL 007
Index: config/sparc/sparc.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/sparc/sparc.h,v
retrieving revision 1.106
diff -c -p -r1.106 sparc.h
*** config/sparc/sparc.h 2000/03/23 00:29:55 1.106
--- config/sparc/sparc.h 2000/03/23 11:24:56
*************** LFLGRET"ID":\n\
*** 2184,2189 ****
--- 2184,2190 ----
is something you can return to. */
#define INCOMING_RETURN_ADDR_RTX \
plus_constant (gen_rtx_REG (word_mode, 15), 8)
+ #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (15)
/* The offset from the incoming value of %sp to the top of the stack frame
for the current function. On sparc64, we have to account for the stack