This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA (Was: Re: RFC / RFA): dwarf2 unwinding for targets with
- From: Joern Rennecke <joern dot rennecke at superh dot com>
- To: wilson at tuliptree dot org (Jim Wilson)
- Cc: joern dot rennecke at superh dot com (Joern Rennecke), gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 10 Jul 2003 16:51:06 +0100 (BST)
- Subject: Re: RFA (Was: Re: RFC / RFA): dwarf2 unwinding for targets with
> I don't see why you need the wide_mode stuff in choose_hard_reg_mode.
> It seems like an unnecessary complication. I would expect that for all
> targets that use HARD_REGNO_CALL_PART_CLOBBERED, they would accept the
> same size regardless of mode class, so we only need to return the first
> one we find that isn't VOIDmode.
>
> This is no different than how the current code behaves. If you define a
> register that accepts different max sizes of int and float, then
> reg_raw_mode will return the max int size, regardless of whether this is
> bigger than the max float size. Obviously, we don't handle that case,
> so we don't need to worry about it when HARD_REGNO_CALL_PART_CLOBBER is
> defined either.
I was thinking about the c4x, but on closer inspection, the 24 bit of
integer register that are saved with the float-saved registers still
don't accomodate any integer mode.
So I have followed your suggestion and removed the wide_mode stuff.
2003-07-10 J"orn Rennecke <joern.rennecke@superh.com>
* regclass.c (choose_hard_reg_mode): Add third argument.
Changed all callers.
* rtl.h (choose_hard_reg_mode): Update declaration.
* dwarf2out.c (expand_builtin_init_dwarf_reg_sizes):
Take HARD_REGNO_CALL_PART_CLOBBERED into account.
Index: regclass.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regclass.c,v
retrieving revision 1.174
diff -p -r1.174 regclass.c
*** regclass.c 6 Jul 2003 09:56:07 -0000 1.174
--- regclass.c 10 Jul 2003 15:42:48 -0000
*************** init_reg_modes (void)
*** 553,559 ****
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
{
! reg_raw_mode[i] = choose_hard_reg_mode (i, 1);
/* If we couldn't find a valid mode, just use the previous mode.
??? One situation in which we need to do this is on the mips where
--- 553,559 ----
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
{
! reg_raw_mode[i] = choose_hard_reg_mode (i, 1, false);
/* If we couldn't find a valid mode, just use the previous mode.
??? One situation in which we need to do this is on the mips where
*************** memory_move_secondary_cost (enum machine
*** 653,663 ****
#endif
/* Return a machine mode that is legitimate for hard reg REGNO and large
! enough to save nregs. If we can't find one, return VOIDmode. */
enum machine_mode
choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED,
! unsigned int nregs)
{
unsigned int /* enum machine_mode */ m;
enum machine_mode found_mode = VOIDmode, mode;
--- 653,664 ----
#endif
/* Return a machine mode that is legitimate for hard reg REGNO and large
! enough to save nregs. If we can't find one, return VOIDmode.
! If CALL_SAVED is true, only consider modes that are call saved. */
enum machine_mode
choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED,
! unsigned int nregs, bool call_saved)
{
unsigned int /* enum machine_mode */ m;
enum machine_mode found_mode = VOIDmode, mode;
*************** choose_hard_reg_mode (unsigned int regno
*** 670,676 ****
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs
! && HARD_REGNO_MODE_OK (regno, mode))
found_mode = mode;
if (found_mode != VOIDmode)
--- 671,678 ----
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs
! && HARD_REGNO_MODE_OK (regno, mode)
! && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
found_mode = mode;
if (found_mode != VOIDmode)
*************** choose_hard_reg_mode (unsigned int regno
*** 680,686 ****
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs
! && HARD_REGNO_MODE_OK (regno, mode))
found_mode = mode;
if (found_mode != VOIDmode)
--- 682,689 ----
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs
! && HARD_REGNO_MODE_OK (regno, mode)
! && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
found_mode = mode;
if (found_mode != VOIDmode)
*************** choose_hard_reg_mode (unsigned int regno
*** 690,696 ****
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs
! && HARD_REGNO_MODE_OK (regno, mode))
found_mode = mode;
if (found_mode != VOIDmode)
--- 693,700 ----
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs
! && HARD_REGNO_MODE_OK (regno, mode)
! && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
found_mode = mode;
if (found_mode != VOIDmode)
*************** choose_hard_reg_mode (unsigned int regno
*** 700,706 ****
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs
! && HARD_REGNO_MODE_OK (regno, mode))
found_mode = mode;
if (found_mode != VOIDmode)
--- 704,711 ----
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs
! && HARD_REGNO_MODE_OK (regno, mode)
! && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
found_mode = mode;
if (found_mode != VOIDmode)
*************** choose_hard_reg_mode (unsigned int regno
*** 711,717 ****
{
mode = (enum machine_mode) m;
if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs
! && HARD_REGNO_MODE_OK (regno, mode))
return mode;
}
--- 716,723 ----
{
mode = (enum machine_mode) m;
if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs
! && HARD_REGNO_MODE_OK (regno, mode)
! && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
return mode;
}
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.427
diff -p -r1.427 rtl.h
*** rtl.h 7 Jul 2003 03:42:22 -0000 1.427
--- rtl.h 8 Jul 2003 18:13:17 -0000
*************** extern rtx avoid_constant_pool_reference
*** 1603,1609 ****
extern rtx gen_mem_addressof (rtx, tree, int);
/* In regclass.c */
! extern enum machine_mode choose_hard_reg_mode (unsigned int, unsigned int);
/* In emit-rtl.c */
extern rtx set_unique_reg_note (rtx, enum reg_note, rtx);
--- 1603,1610 ----
extern rtx gen_mem_addressof (rtx, tree, int);
/* In regclass.c */
! extern enum machine_mode choose_hard_reg_mode (unsigned int, unsigned int,
! bool);
/* In emit-rtl.c */
extern rtx set_unique_reg_note (rtx, enum reg_note, rtx);
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.440
diff -p -r1.440 dwarf2out.c
*** dwarf2out.c 1 Jul 2003 12:17:52 -0000 1.440
--- dwarf2out.c 8 Jul 2003 18:13:17 -0000
*************** expand_builtin_init_dwarf_reg_sizes (tre
*** 448,455 ****
if (DWARF_FRAME_REGNUM (i) < DWARF_FRAME_REGISTERS)
{
HOST_WIDE_INT offset = DWARF_FRAME_REGNUM (i) * GET_MODE_SIZE (mode);
! HOST_WIDE_INT size = GET_MODE_SIZE (reg_raw_mode[i]);
if (offset < 0)
continue;
--- 448,459 ----
if (DWARF_FRAME_REGNUM (i) < DWARF_FRAME_REGISTERS)
{
HOST_WIDE_INT offset = DWARF_FRAME_REGNUM (i) * GET_MODE_SIZE (mode);
! enum machine_mode save_mode = reg_raw_mode[i];
! HOST_WIDE_INT size;
+ if (HARD_REGNO_CALL_PART_CLOBBERED (i, save_mode))
+ save_mode = choose_hard_reg_mode (i, 1, true);
+ size = GET_MODE_SIZE (save_mode);
if (offset < 0)
continue;
Index: regs.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regs.h,v
retrieving revision 1.29
diff -p -r1.29 regs.h
*** regs.h 6 Jul 2003 09:56:07 -0000 1.29
--- regs.h 8 Jul 2003 18:13:17 -0000
*************** extern int caller_save_needed;
*** 210,216 ****
/* Select a register mode required for caller save of hard regno REGNO. */
#ifndef HARD_REGNO_CALLER_SAVE_MODE
#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \
! choose_hard_reg_mode (REGNO, NREGS)
#endif
/* Registers that get partially clobbered by a call in a given mode.
--- 210,216 ----
/* Select a register mode required for caller save of hard regno REGNO. */
#ifndef HARD_REGNO_CALLER_SAVE_MODE
#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \
! choose_hard_reg_mode (REGNO, NREGS, false)
#endif
/* Registers that get partially clobbered by a call in a given mode.
Index: config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.349
diff -p -r1.349 i386.h
*** config/i386/i386.h 2 Jul 2003 21:33:54 -0000 1.349
--- config/i386/i386.h 8 Jul 2003 18:13:17 -0000
*************** do { \
*** 1135,1141 ****
#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \
(CC_REGNO_P (REGNO) ? VOIDmode \
: (MODE) == VOIDmode && (NREGS) != 1 ? VOIDmode \
! : (MODE) == VOIDmode ? choose_hard_reg_mode ((REGNO), (NREGS)) \
: (MODE) == HImode && !TARGET_PARTIAL_REG_STALL ? SImode \
: (MODE) == QImode && (REGNO) >= 4 && !TARGET_64BIT ? SImode \
: (MODE))
--- 1135,1141 ----
#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \
(CC_REGNO_P (REGNO) ? VOIDmode \
: (MODE) == VOIDmode && (NREGS) != 1 ? VOIDmode \
! : (MODE) == VOIDmode ? choose_hard_reg_mode ((REGNO), (NREGS), false)\
: (MODE) == HImode && !TARGET_PARTIAL_REG_STALL ? SImode \
: (MODE) == QImode && (REGNO) >= 4 && !TARGET_64BIT ? SImode \
: (MODE))