From fee226d25fc4af5f577cb05386e44e2dd0aa8fc6 Mon Sep 17 00:00:00 2001 From: "J\"orn Rennecke" Date: Fri, 11 Jul 2003 14:09:29 +0000 Subject: [PATCH] regclass.c (choose_hard_reg_mode): Add third argument. * 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. From-SVN: r69234 --- gcc/ChangeLog | 8 ++++++++ gcc/config/i386/i386.h | 2 +- gcc/dwarf2out.c | 6 +++++- gcc/regclass.c | 22 ++++++++++++++-------- gcc/regs.h | 2 +- gcc/rtl.h | 3 ++- 6 files changed, 31 insertions(+), 12 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c6b09e7d29b8..67ac6cb21086 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2003-07-11 J"orn Rennecke + + * 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. + 2003-07-11 Geoffrey Keating * c-decl.c (finish_decl): Handle 'used' here... diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 343cfd17472d..86efe3541b4f 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -1135,7 +1135,7 @@ do { \ #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) == VOIDmode ? choose_hard_reg_mode ((REGNO), (NREGS), false)\ : (MODE) == HImode && !TARGET_PARTIAL_REG_STALL ? SImode \ : (MODE) == QImode && (REGNO) >= 4 && !TARGET_64BIT ? SImode \ : (MODE)) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 7537dd1bdac0..5ad605db8dd7 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -448,8 +448,12 @@ expand_builtin_init_dwarf_reg_sizes (tree address) 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]); + 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; diff --git a/gcc/regclass.c b/gcc/regclass.c index c24dfd4c9523..46f8cb1a6368 100644 --- a/gcc/regclass.c +++ b/gcc/regclass.c @@ -553,7 +553,7 @@ init_reg_modes (void) for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) { - reg_raw_mode[i] = choose_hard_reg_mode (i, 1); + 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 @@ -653,11 +653,12 @@ memory_move_secondary_cost (enum machine_mode mode, enum reg_class class, int in #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. */ + 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) + unsigned int nregs, bool call_saved) { unsigned int /* enum machine_mode */ m; enum machine_mode found_mode = VOIDmode, mode; @@ -670,7 +671,8 @@ choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED, mode != VOIDmode; mode = GET_MODE_WIDER_MODE (mode)) if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs - && HARD_REGNO_MODE_OK (regno, mode)) + && HARD_REGNO_MODE_OK (regno, mode) + && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) found_mode = mode; if (found_mode != VOIDmode) @@ -680,7 +682,8 @@ choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED, mode != VOIDmode; mode = GET_MODE_WIDER_MODE (mode)) if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs - && HARD_REGNO_MODE_OK (regno, mode)) + && HARD_REGNO_MODE_OK (regno, mode) + && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) found_mode = mode; if (found_mode != VOIDmode) @@ -690,7 +693,8 @@ choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED, mode != VOIDmode; mode = GET_MODE_WIDER_MODE (mode)) if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs - && HARD_REGNO_MODE_OK (regno, mode)) + && HARD_REGNO_MODE_OK (regno, mode) + && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) found_mode = mode; if (found_mode != VOIDmode) @@ -700,7 +704,8 @@ choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED, mode != VOIDmode; mode = GET_MODE_WIDER_MODE (mode)) if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs - && HARD_REGNO_MODE_OK (regno, mode)) + && HARD_REGNO_MODE_OK (regno, mode) + && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) found_mode = mode; if (found_mode != VOIDmode) @@ -711,7 +716,8 @@ choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED, { mode = (enum machine_mode) m; if ((unsigned) HARD_REGNO_NREGS (regno, mode) == nregs - && HARD_REGNO_MODE_OK (regno, mode)) + && HARD_REGNO_MODE_OK (regno, mode) + && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) return mode; } diff --git a/gcc/regs.h b/gcc/regs.h index 2206fdcdeb72..b2aeb5fb02c1 100644 --- a/gcc/regs.h +++ b/gcc/regs.h @@ -210,7 +210,7 @@ extern int caller_save_needed; /* 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) + choose_hard_reg_mode (REGNO, NREGS, false) #endif /* Registers that get partially clobbered by a call in a given mode. diff --git a/gcc/rtl.h b/gcc/rtl.h index 065e03ca807d..bc9d5ee2691f 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1602,7 +1602,8 @@ extern rtx avoid_constant_pool_reference (rtx); extern rtx gen_mem_addressof (rtx, tree, int); /* In regclass.c */ -extern enum machine_mode choose_hard_reg_mode (unsigned int, unsigned int); +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); -- 2.43.5