summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2017-09-12 13:28:27 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2017-09-12 13:28:27 +0000
commit16b9e38b7e3e0acb5826b47822543218f2df8986 (patch)
treecb773aeb0a0539470b01a2b8d572da3b6dfe2742
parentb4104dfde5420687243b8bf067c89b244759eb1c (diff)
downloadgcc-16b9e38b7e3e0acb5826b47822543218f2df8986.tar.gz
Make more use of end_hard_regno
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 can use end_hard_regno instead. 2017-09-12 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * config/aarch64/aarch64.c (aarch64_hard_regno_mode_ok): Use end_hard_regno instead of hard_regno_nregs. * config/s390/s390.c (s390_reg_clobbered_rtx): Likewise. * config/sparc/sparc.h (ASM_DECLARE_REGISTER_GLOBAL): Likewise. * config/visium/visium.c (visium_hard_regno_mode_ok): Likewise. * ira-color.c (improve_allocation): Likewise. * lra-assigns.c (find_hard_regno_for_1): Likewise. * lra-lives.c (mark_regno_live): Likewise. (mark_regno_dead): Likewise. * lra-remat.c (operand_to_remat): Likewise. * lra.c (collect_non_operand_hard_regs): Likewise. * postreload.c (reload_combine_note_store): Likewise. (move2add_valid_value_p): Likewise. * reload.c (regno_clobbered_p): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252012 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/config/aarch64/aarch64.c3
-rw-r--r--gcc/config/s390/s390.c2
-rw-r--r--gcc/config/sparc/sparc.h2
-rw-r--r--gcc/config/visium/visium.c2
-rw-r--r--gcc/ira-color.c2
-rw-r--r--gcc/lra-assigns.c2
-rw-r--r--gcc/lra-lives.c8
-rw-r--r--gcc/lra-remat.c3
-rw-r--r--gcc/lra.c4
-rw-r--r--gcc/postreload.c8
-rw-r--r--gcc/reload.c5
12 files changed, 32 insertions, 26 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1b398c8983f..1652e723e60 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,22 @@
2017-09-12 Richard Sandiford <richard.sandiford@linaro.org>
+ * config/aarch64/aarch64.c (aarch64_hard_regno_mode_ok): Use
+ end_hard_regno instead of hard_regno_nregs.
+ * config/s390/s390.c (s390_reg_clobbered_rtx): Likewise.
+ * config/sparc/sparc.h (ASM_DECLARE_REGISTER_GLOBAL): Likewise.
+ * config/visium/visium.c (visium_hard_regno_mode_ok): Likewise.
+ * ira-color.c (improve_allocation): Likewise.
+ * lra-assigns.c (find_hard_regno_for_1): Likewise.
+ * lra-lives.c (mark_regno_live): Likewise.
+ (mark_regno_dead): Likewise.
+ * lra-remat.c (operand_to_remat): Likewise.
+ * lra.c (collect_non_operand_hard_regs): Likewise.
+ * postreload.c (reload_combine_note_store): Likewise.
+ (move2add_valid_value_p): Likewise.
+ * reload.c (regno_clobbered_p): Likewise.
+
+2017-09-12 Richard Sandiford <richard.sandiford@linaro.org>
+
* config/frv/frv.c (FOR_EACH_REGNO): Use END_REGNO instead of
hard_regno_nregs.
* config/v850/v850.c (v850_reorg): Likewise.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 64c03da63a7..3b1c9ef6000 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -1106,8 +1106,7 @@ aarch64_hard_regno_mode_ok (unsigned regno, machine_mode mode)
if (FP_REGNUM_P (regno))
{
if (aarch64_vect_struct_mode_p (mode))
- return
- (regno + aarch64_hard_regno_nregs (regno, mode) - 1) <= V31_REGNUM;
+ return end_hard_regno (mode, regno) - 1 <= V31_REGNUM;
else
return true;
}
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index de7f3e577d0..53082ecca64 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -9630,7 +9630,7 @@ s390_reg_clobbered_rtx (rtx setreg, const_rtx set_insn ATTRIBUTE_UNUSED, void *d
return;
for (i = regno;
- i < regno + HARD_REGNO_NREGS (regno, mode);
+ i < end_hard_regno (mode, regno);
i++)
regs_ever_clobbered[i] = 1;
}
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index 3c71a3fe156..2ea539ebc23 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -1248,7 +1248,7 @@ extern GTY(()) char sparc_hard_reg_printed[8];
do { \
if (TARGET_ARCH64) \
{ \
- int end = HARD_REGNO_NREGS ((REGNO), DECL_MODE (decl)) + (REGNO); \
+ int end = end_hard_regno (DECL_MODE (decl), REGNO); \
int reg; \
for (reg = (REGNO); reg < 8 && reg < end; reg++) \
if ((reg & ~1) == 2 || (reg & ~1) == 6) \
diff --git a/gcc/config/visium/visium.c b/gcc/config/visium/visium.c
index 5478d232ef1..f3016f9bda7 100644
--- a/gcc/config/visium/visium.c
+++ b/gcc/config/visium/visium.c
@@ -857,7 +857,7 @@ static bool
visium_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
{
if (GP_REGISTER_P (regno))
- return GP_REGISTER_P (regno + HARD_REGNO_NREGS (regno, mode) - 1);
+ return GP_REGISTER_P (end_hard_regno (mode, regno) - 1);
if (FP_REGISTER_P (regno))
return mode == SFmode || (mode == SImode && TARGET_FPU_IEEE);
diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index f08bf37b4c5..c0b0155ed53 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -2893,7 +2893,7 @@ improve_allocation (void)
conflict_nregs
= hard_regno_nregs[conflict_hregno][ALLOCNO_MODE (conflict_a)];
for (r = conflict_hregno;
- r >= 0 && r + hard_regno_nregs[r][mode] > conflict_hregno;
+ r >= 0 && (int) end_hard_regno (mode, r) > conflict_hregno;
r--)
if (check_hard_reg_p (a, r,
conflicting_regs, profitable_hard_regs))
diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c
index ca458ff2df0..d9000b9f6b2 100644
--- a/gcc/lra-assigns.c
+++ b/gcc/lra-assigns.c
@@ -578,7 +578,7 @@ find_hard_regno_for_1 (int regno, int *cost, int try_only_hard_regno,
hr++)
SET_HARD_REG_BIT (impossible_start_hard_regs, hr);
for (hr = conflict_hr - 1;
- hr >= 0 && hr + hard_regno_nregs[hr][biggest_mode] > conflict_hr;
+ hr >= 0 && (int) end_hard_regno (biggest_mode, hr) > conflict_hr;
hr--)
SET_HARD_REG_BIT (impossible_start_hard_regs, hr);
}
diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index f29dd049bad..0a8f00b84a0 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -314,9 +314,7 @@ mark_regno_live (int regno, machine_mode mode, int point)
if (regno < FIRST_PSEUDO_REGISTER)
{
- for (last = regno + hard_regno_nregs[regno][mode];
- regno < last;
- regno++)
+ for (last = end_hard_regno (mode, regno); regno < last; regno++)
make_hard_regno_born (regno, false);
}
else
@@ -343,9 +341,7 @@ mark_regno_dead (int regno, machine_mode mode, int point)
if (regno < FIRST_PSEUDO_REGISTER)
{
- for (last = regno + hard_regno_nregs[regno][mode];
- regno < last;
- regno++)
+ for (last = end_hard_regno (mode, regno); regno < last; regno++)
make_hard_regno_dead (regno);
}
else
diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c
index 50582dc68ff..efc9ae2d715 100644
--- a/gcc/lra-remat.c
+++ b/gcc/lra-remat.c
@@ -367,8 +367,7 @@ operand_to_remat (rtx_insn *insn)
if (reg2->type == OP_OUT
&& reg->regno <= reg2->regno
&& (reg2->regno
- < (reg->regno
- + hard_regno_nregs[reg->regno][reg->biggest_mode])))
+ < (int) end_hard_regno (reg->biggest_mode, reg->regno)))
return -1;
}
/* Check hard coded insn registers. */
diff --git a/gcc/lra.c b/gcc/lra.c
index 61e40eebe3f..a4737773b6e 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -846,9 +846,7 @@ collect_non_operand_hard_regs (rtx *x, lra_insn_recog_data_t data,
return list;
/* Process all regs even unallocatable ones as we need info
about all regs for rematerialization pass. */
- for (last = regno + hard_regno_nregs[regno][mode];
- regno < last;
- regno++)
+ for (last = end_hard_regno (mode, regno); regno < last; regno++)
{
for (curr = list; curr != NULL; curr = curr->next)
if (curr->regno == regno && curr->subreg_p == subreg_p
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 39eebf7877b..21312df0915 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -1453,7 +1453,7 @@ reload_combine_note_store (rtx dst, const_rtx set, void *data ATTRIBUTE_UNUSED)
if (GET_CODE (SET_DEST (set)) == ZERO_EXTRACT
|| GET_CODE (SET_DEST (set)) == STRICT_LOW_PART)
{
- for (i = hard_regno_nregs[regno][mode] - 1 + regno; i >= regno; i--)
+ for (i = end_hard_regno (mode, regno) - 1; i >= regno; i--)
{
reg_state[i].use_index = -1;
reg_state[i].store_ruid = reload_combine_ruid;
@@ -1462,7 +1462,7 @@ reload_combine_note_store (rtx dst, const_rtx set, void *data ATTRIBUTE_UNUSED)
}
else
{
- for (i = hard_regno_nregs[regno][mode] - 1 + regno; i >= regno; i--)
+ for (i = end_hard_regno (mode, regno) - 1; i >= regno; i--)
{
reg_state[i].store_ruid = reload_combine_ruid;
if (GET_CODE (set) == SET)
@@ -1717,8 +1717,8 @@ move2add_valid_value_p (int regno, scalar_int_mode mode)
return false;
}
- for (int i = hard_regno_nregs[regno][mode] - 1; i > 0; i--)
- if (reg_mode[regno + i] != BLKmode)
+ for (int i = end_hard_regno (mode, regno) - 1; i > regno; i--)
+ if (reg_mode[i] != BLKmode)
return false;
return true;
}
diff --git a/gcc/reload.c b/gcc/reload.c
index 21efdcbcaaf..141d53ad09c 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -7180,13 +7180,10 @@ int
regno_clobbered_p (unsigned int regno, rtx_insn *insn, machine_mode mode,
int sets)
{
- unsigned int nregs, endregno;
-
/* regno must be a hard register. */
gcc_assert (regno < FIRST_PSEUDO_REGISTER);
- nregs = hard_regno_nregs[regno][mode];
- endregno = regno + nregs;
+ unsigned int endregno = end_hard_regno (mode, regno);
if ((GET_CODE (PATTERN (insn)) == CLOBBER
|| (sets == 1 && GET_CODE (PATTERN (insn)) == SET))