summaryrefslogtreecommitdiff
path: root/gcc/reload1.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-09-12 13:28:08 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-09-12 13:28:08 +0000
commit462a99aa98416135d2675d07d32f7ce234287983 (patch)
tree6a0d7b2184713f09474d42070b1f6e4fa7670a38 /gcc/reload1.c
parente0bd6c9f0aa67d88bbb20019362a4572fc5fac3c (diff)
Make more use of REG_NREGS
An upcoming patch will convert hard_regno_nregs into an inline function, which in turn allows hard_regno_nregs to be used as the name of a targetm field. This patch rewrites uses that are more easily (and efficiently) written as REG_NREGS. 2017-09-12 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * caller-save.c (add_used_regs): Use REG_NREGS instead of hard_regno_nregs. * config/aarch64/aarch64.c (aarch64_split_combinev16qi): Likewise. * config/arm/arm.c (output_move_neon): Likewise. (arm_attr_length_move_neon): Likewise. (neon_split_vcombine): Likewise. * config/c6x/c6x.c (c6x_mark_reg_read): Likewise. (c6x_mark_reg_written): Likewise. (c6x_dwarf_register_span): Likewise. * config/i386/i386.c (ix86_save_reg): Likewise. * config/ia64/ia64.c (mark_reg_gr_used_mask): Likewise. (rws_access_reg): Likewise. * config/s390/s390.c (s390_call_saved_register_used): Likewise. * mode-switching.c (create_pre_exit): Likewise. * ree.c (combine_reaching_defs): Likewise. (add_removable_extension): Likewise. * regcprop.c (find_oldest_value_reg): Likewise. (copyprop_hardreg_forward_1): Likewise. * reload.c (reload_inner_reg_of_subreg): Likewise. (push_reload): Likewise. (combine_reloads): Likewise. (find_dummy_reload): Likewise. (reload_adjust_reg_for_mode): Likewise. * reload1.c (find_reload_regs): Likewise. (forget_old_reloads_1): Likewise. (reload_reg_free_for_value_p): Likewise. (reload_adjust_reg_for_temp): Likewise. (emit_reload_insns): Likewise. (delete_output_reload): Likewise. * sel-sched.c (choose_best_reg_1): Likewise. (choose_best_pseudo_reg): Likewise. From-SVN: r252010
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r--gcc/reload1.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 647a97bb958..092995138a6 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -1965,10 +1965,8 @@ find_reload_regs (struct insn_chain *chain)
/* Show whether this reload already has a hard reg. */
if (chain->rld[i].reg_rtx)
{
- int regno = REGNO (chain->rld[i].reg_rtx);
- chain->rld[i].regno = regno;
- chain->rld[i].nregs
- = hard_regno_nregs[regno][GET_MODE (chain->rld[i].reg_rtx)];
+ chain->rld[i].regno = REGNO (chain->rld[i].reg_rtx);
+ chain->rld[i].nregs = REG_NREGS (chain->rld[i].reg_rtx);
}
else
chain->rld[i].regno = -1;
@@ -4910,7 +4908,7 @@ forget_old_reloads_1 (rtx x, const_rtx ignored ATTRIBUTE_UNUSED,
{
unsigned int i;
- nr = hard_regno_nregs[regno][GET_MODE (x)];
+ nr = REG_NREGS (x);
/* Storing into a spilled-reg invalidates its contents.
This can happen if a block-local pseudo is allocated to that reg
and it wasn't spilled because this block's total need is 0.
@@ -5874,8 +5872,7 @@ reload_reg_free_for_value_p (int start_regno, int regno, int opnum,
{
rtx reg = rld[i].reg_rtx;
if (reg && REG_P (reg)
- && ((unsigned) regno - true_regnum (reg)
- <= hard_regno_nregs[REGNO (reg)][GET_MODE (reg)] - (unsigned) 1)
+ && (unsigned) regno - true_regnum (reg) < REG_NREGS (reg)
&& i != reloadnum)
{
rtx other_input = rld[i].in;
@@ -7155,8 +7152,7 @@ reload_adjust_reg_for_temp (rtx *reload_reg, rtx alt_reload_reg,
{
if (!targetm.hard_regno_mode_ok (regno, new_mode))
continue;
- if (hard_regno_nregs[regno][new_mode]
- > hard_regno_nregs[regno][GET_MODE (reg)])
+ if (hard_regno_nregs[regno][new_mode] > REG_NREGS (reg))
continue;
reg = reload_adjust_reg_for_mode (reg, new_mode);
}
@@ -8236,7 +8232,7 @@ emit_reload_insns (struct insn_chain *chain)
{
machine_mode mode = GET_MODE (reg);
int regno = REGNO (reg);
- int nregs = hard_regno_nregs[regno][mode];
+ int nregs = REG_NREGS (reg);
rtx out = (REG_P (rld[r].out)
? rld[r].out
: rld[r].out_reg
@@ -8315,7 +8311,7 @@ emit_reload_insns (struct insn_chain *chain)
mode = GET_MODE (reg);
regno = REGNO (reg);
- nregs = hard_regno_nregs[regno][mode];
+ nregs = REG_NREGS (reg);
if (REG_P (rld[r].in)
&& REGNO (rld[r].in) >= FIRST_PSEUDO_REGISTER)
in = rld[r].in;
@@ -8837,10 +8833,7 @@ delete_output_reload (rtx_insn *insn, int j, int last_reload_reg,
return;
regno = REGNO (reg);
- if (regno >= FIRST_PSEUDO_REGISTER)
- nregs = 1;
- else
- nregs = hard_regno_nregs[regno][GET_MODE (reg)];
+ nregs = REG_NREGS (reg);
/* If the pseudo-reg we are reloading is no longer referenced
anywhere between the store into it and here,