From bd5a2c67cfd636b6c78f213c8ee6dac62323eff9 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 26 Oct 2017 16:53:43 +0000 Subject: Add wider_subreg_mode helper functions This patch adds helper functions that say which of the two modes involved in a subreg is the larger, preferring the outer mode in the event of a tie. It also converts IRA and reload to track modes instead of byte sizes, since this is slightly more convenient when variable-sized modes are added later. 2017-10-26 Richard Sandiford Alan Hayward David Sherwood gcc/ * rtl.h (wider_subreg_mode): New function. * ira.h (ira_sort_regnos_for_alter_reg): Take a machine_mode * rather than an unsigned int *. * ira-color.c (regno_max_ref_width): Replace with... (regno_max_ref_mode): ...this new variable. (coalesced_pseudo_reg_slot_compare): Update accordingly. Use wider_subreg_mode. (ira_sort_regnos_for_alter_reg): Likewise. Take a machine_mode * rather than an unsigned int *. * lra-constraints.c (uses_hard_regs_p): Use wider_subreg_mode. (process_alt_operands): Likewise. (invariant_p): Likewise. * lra-spills.c (assign_mem_slot): Likewise. (add_pseudo_to_slot): Likewise. * lra.c (collect_non_operand_hard_regs): Likewise. (add_regs_to_insn_regno_info): Likewise. * reload1.c (regno_max_ref_width): Replace with... (regno_max_ref_mode): ...this new variable. (reload): Update accordingly. Update call to ira_sort_regnos_for_alter_reg. (alter_reg): Update to use regno_max_ref_mode. Call wider_subreg_mode. (init_eliminable_invariants): Update to use regno_max_ref_mode. (scan_paradoxical_subregs): Likewise. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r254115 --- gcc/lra-spills.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'gcc/lra-spills.c') diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c index 5997b1e..9abcda4 100644 --- a/gcc/lra-spills.c +++ b/gcc/lra-spills.c @@ -134,8 +134,7 @@ assign_mem_slot (int i) machine_mode mode = GET_MODE (regno_reg_rtx[i]); HOST_WIDE_INT inherent_size = PSEUDO_REGNO_BYTES (i); machine_mode wider_mode - = (GET_MODE_SIZE (mode) >= GET_MODE_SIZE (lra_reg_info[i].biggest_mode) - ? mode : lra_reg_info[i].biggest_mode); + = wider_subreg_mode (mode, lra_reg_info[i].biggest_mode); HOST_WIDE_INT total_size = GET_MODE_SIZE (wider_mode); HOST_WIDE_INT adjust = 0; @@ -312,10 +311,8 @@ add_pseudo_to_slot (int regno, int slot_num) and a total size which provides room for paradoxical subregs. We need to make sure the size and alignment of the slot are sufficient for both. */ - machine_mode mode = (GET_MODE_SIZE (PSEUDO_REGNO_MODE (regno)) - >= GET_MODE_SIZE (lra_reg_info[regno].biggest_mode) - ? PSEUDO_REGNO_MODE (regno) - : lra_reg_info[regno].biggest_mode); + machine_mode mode = wider_subreg_mode (PSEUDO_REGNO_MODE (regno), + lra_reg_info[regno].biggest_mode); unsigned int align = spill_slot_alignment (mode); slots[slot_num].align = MAX (slots[slot_num].align, align); slots[slot_num].size = MAX (slots[slot_num].size, GET_MODE_SIZE (mode)); -- cgit v1.1