aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra-constraints.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-10-26 16:53:43 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-10-26 16:53:43 +0000
commitbd5a2c67cfd636b6c78f213c8ee6dac62323eff9 (patch)
tree793d74fec25534f3062be8641413cfa6430d1cf0 /gcc/lra-constraints.c
parent204d2c03acff4bf3b73cb5d2c9578b50c2aac703 (diff)
downloadgcc-bd5a2c67cfd636b6c78f213c8ee6dac62323eff9.zip
gcc-bd5a2c67cfd636b6c78f213c8ee6dac62323eff9.tar.gz
gcc-bd5a2c67cfd636b6c78f213c8ee6dac62323eff9.tar.bz2
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 <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> 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 <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r254115
Diffstat (limited to 'gcc/lra-constraints.c')
-rw-r--r--gcc/lra-constraints.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index c3bbfd7..a423f06 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -1772,10 +1772,9 @@ uses_hard_regs_p (rtx x, HARD_REG_SET set)
mode = GET_MODE (x);
if (code == SUBREG)
{
+ mode = wider_subreg_mode (x);
x = SUBREG_REG (x);
code = GET_CODE (x);
- if (GET_MODE_SIZE (GET_MODE (x)) > GET_MODE_SIZE (mode))
- mode = GET_MODE (x);
}
if (REG_P (x))
@@ -1953,10 +1952,8 @@ process_alt_operands (int only_alternative)
biggest_mode[nop] = GET_MODE (op);
if (GET_CODE (op) == SUBREG)
{
+ biggest_mode[nop] = wider_subreg_mode (op);
operand_reg[nop] = reg = SUBREG_REG (op);
- if (GET_MODE_SIZE (biggest_mode[nop])
- < GET_MODE_SIZE (GET_MODE (reg)))
- biggest_mode[nop] = GET_MODE (reg);
}
if (! REG_P (reg))
operand_reg[nop] = NULL_RTX;
@@ -5659,8 +5656,7 @@ invariant_p (const_rtx x)
{
x = SUBREG_REG (x);
code = GET_CODE (x);
- if (GET_MODE_SIZE (GET_MODE (x)) > GET_MODE_SIZE (mode))
- mode = GET_MODE (x);
+ mode = wider_subreg_mode (mode, GET_MODE (x));
}
if (MEM_P (x))