This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: give the return column a size (Was: Re: RFA: Use _Unwind_Ptr)
- From: Joern Rennecke <joern dot rennecke at superh dot com>
- To: rth at redhat dot com (Richard Henderson)
- Cc: amylaar at fairadsl dot co dot uk (Joern Rennecke), gcc-patches at gcc dot gnu dot org, joern dot rennecke at superh dot com, wilson at tuliptree dot org
- Date: Fri, 11 Jul 2003 16:08:28 +0100 (BST)
- Subject: RFA: give the return column a size (Was: Re: RFA: Use _Unwind_Ptr)
> > http://gcc.gnu.org/ml/gcc-patches/2003-07/msg01053.html
>
> Ok.
I've checked this patch in, as it is rather safe - we only do
something different when we see that HARD_REGNO_CALL_PART_CLOBBERED
indicates that we'd do something wrong otherwise.
The regression tests with this patch and the unwind-dw2.c patch showed
about 120 less regressions for sh64-elf -m5-32media (both big and little
endian), but about the same regression increase for i686-linux-gnu native.
Analysis shows that _Unwind_GetGR aborts when it is instructed to read
the return address, because dwarf_reg_size_table[8] is 0.
( i386.h says:
/* PC is dbx register 8; let's use that column for RA. */
#define DWARF_FRAME_RETURN_COLUMN (TARGET_64BIT ? 16 : 8)
)
So, before we can use dwarf_reg_size_table in _Unwind_GetGR, we need
another patch to dwarf2out.c to make sure that the return address has
a size, even if it does not live in a register with a valid mode.
I've tested that it fixes the first new i686-linux-gnu regression,
and doing a full bootstrap / regression test now.
2003-07-11 J"orn Rennecke <joern.rennecke@superh.com>
* dwarf2out.c (expand_builtin_init_dwarf_reg_sizes):
If DWARF_FRAME_RETURN_COLUMN doesn't have a register mode,
look at RETURN_ADDR_RTX.
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.441
diff -p -r1.441 dwarf2out.c
*** dwarf2out.c 11 Jul 2003 14:09:29 -0000 1.441
--- dwarf2out.c 11 Jul 2003 15:02:18 -0000
*************** expand_builtin_init_dwarf_reg_sizes (tre
*** 443,448 ****
--- 443,449 ----
enum machine_mode mode = TYPE_MODE (char_type_node);
rtx addr = expand_expr (address, NULL_RTX, VOIDmode, 0);
rtx mem = gen_rtx_MEM (BLKmode, addr);
+ bool wrote_return_column = false;
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (DWARF_FRAME_REGNUM (i) < DWARF_FRAME_REGISTERS)
*************** expand_builtin_init_dwarf_reg_sizes (tre
*** 453,464 ****
--- 454,483 ----
if (HARD_REGNO_CALL_PART_CLOBBERED (i, save_mode))
save_mode = choose_hard_reg_mode (i, 1, true);
+ if (DWARF_FRAME_REGNUM (i) == DWARF_FRAME_RETURN_COLUMN)
+ {
+ if (save_mode == VOIDmode)
+ continue;
+ wrote_return_column = true;
+ }
size = GET_MODE_SIZE (save_mode);
if (offset < 0)
continue;
emit_move_insn (adjust_address (mem, mode, offset), GEN_INT (size));
}
+ if (! wrote_return_column)
+ {
+ enum machine_mode save_mode;
+ HOST_WIDE_INT offset = DWARF_FRAME_RETURN_COLUMN * GET_MODE_SIZE (mode);
+ HOST_WIDE_INT size;
+
+ start_sequence ();
+ save_mode = GET_MODE (RETURN_ADDR_RTX (0, frame_pointer_rtx));
+ end_sequence ();
+ size = GET_MODE_SIZE (save_mode);
+ emit_move_insn (adjust_address (mem, mode, offset), GEN_INT (size));
+ }
}
/* Convert a DWARF call frame info. operation to its string name */