From 737d6a1a1745bdd4041e73800a842a1086967d5d Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 30 Sep 2019 16:20:04 +0000 Subject: Pass an ABI to choose_hard_reg_mode choose_hard_reg_mode previously took a boolean saying whether the mode needed to be call-preserved. This patch replaces it with an optional ABI pointer instead, so that the function can use that to test whether a value is call-saved. default_dwarf_frame_reg_mode uses eh_edge_abi because that's the ABI that matters for unwinding. Targets need to override the hook if they want something different. 2019-09-30 Richard Sandiford gcc/ * rtl.h (predefined_function_abi): Declare. (choose_hard_reg_mode): Take a pointer to a predefined_function_abi instead of a boolean call_save flag. * config/gcn/gcn.c (gcn_hard_regno_caller_save_mode): Update call accordingly. * config/i386/i386.h (HARD_REGNO_CALLER_SAVE_MODE): Likewise. * config/ia64/ia64.h (HARD_REGNO_CALLER_SAVE_MODE): Likewise. * config/mips/mips.c (mips_hard_regno_caller_save_mode): Likewise. * config/msp430/msp430.h (HARD_REGNO_CALLER_SAVE_MODE): Likewise. * config/rs6000/rs6000.h (HARD_REGNO_CALLER_SAVE_MODE): Likewise. * config/sh/sh.c (sh_hard_regno_caller_save_mode): Likewise. * reginfo.c (init_reg_modes_target): Likewise. (choose_hard_reg_mode): Take a pointer to a predefined_function_abi instead of a boolean call_save flag. * targhooks.c: Include function-abi.h. (default_dwarf_frame_reg_mode): Update call to choose_hard_reg_mode, using eh_edge_abi to choose the mode. From-SVN: r276312 --- gcc/reginfo.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'gcc/reginfo.c') diff --git a/gcc/reginfo.c b/gcc/reginfo.c index f084c0e..265157f 100644 --- a/gcc/reginfo.c +++ b/gcc/reginfo.c @@ -442,7 +442,7 @@ init_reg_modes_target (void) for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) { - reg_raw_mode[i] = choose_hard_reg_mode (i, 1, false); + reg_raw_mode[i] = choose_hard_reg_mode (i, 1, NULL); /* If we couldn't find a valid mode, just use the previous mode if it is suitable, otherwise fall back on word_mode. */ @@ -550,10 +550,11 @@ memory_move_secondary_cost (machine_mode mode, reg_class_t rclass, /* 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. */ + If ABI is nonnull, only consider modes that are preserved across + calls that use ABI. */ machine_mode choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED, - unsigned int nregs, bool call_saved) + unsigned int nregs, const predefined_function_abi *abi) { unsigned int /* machine_mode */ m; machine_mode found_mode = VOIDmode, mode; @@ -567,32 +568,28 @@ choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED, FOR_EACH_MODE_IN_CLASS (mode, MODE_INT) if (hard_regno_nregs (regno, mode) == nregs && targetm.hard_regno_mode_ok (regno, mode) - && (!call_saved - || !targetm.hard_regno_call_part_clobbered (0, regno, mode)) + && (!abi || !abi->clobbers_reg_p (mode, regno)) && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode))) found_mode = mode; FOR_EACH_MODE_IN_CLASS (mode, MODE_FLOAT) if (hard_regno_nregs (regno, mode) == nregs && targetm.hard_regno_mode_ok (regno, mode) - && (!call_saved - || !targetm.hard_regno_call_part_clobbered (0, regno, mode)) + && (!abi || !abi->clobbers_reg_p (mode, regno)) && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode))) found_mode = mode; FOR_EACH_MODE_IN_CLASS (mode, MODE_VECTOR_FLOAT) if (hard_regno_nregs (regno, mode) == nregs && targetm.hard_regno_mode_ok (regno, mode) - && (!call_saved - || !targetm.hard_regno_call_part_clobbered (0, regno, mode)) + && (!abi || !abi->clobbers_reg_p (mode, regno)) && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode))) found_mode = mode; FOR_EACH_MODE_IN_CLASS (mode, MODE_VECTOR_INT) if (hard_regno_nregs (regno, mode) == nregs && targetm.hard_regno_mode_ok (regno, mode) - && (!call_saved - || !targetm.hard_regno_call_part_clobbered (0, regno, mode)) + && (!abi || !abi->clobbers_reg_p (mode, regno)) && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode))) found_mode = mode; @@ -605,8 +602,7 @@ choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED, mode = (machine_mode) m; if (hard_regno_nregs (regno, mode) == nregs && targetm.hard_regno_mode_ok (regno, mode) - && (!call_saved - || !targetm.hard_regno_call_part_clobbered (0, regno, mode))) + && (!abi || !abi->clobbers_reg_p (mode, regno))) return mode; } -- cgit v1.1