summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-19 07:08:49 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-19 07:08:49 +0000
commit6a2987418e79962d2dcc49064e70a848b19f5f05 (patch)
tree3d5e0a4f3edc366a0770e5779bd3c7fddedfd8c8
parentd27fe72bf6cec6dcc04b86d1527b7eb2fcbefd3d (diff)
downloadgcc-6a2987418e79962d2dcc49064e70a848b19f5f05.tar.gz
gcc/
* cfgcleanup.c (mentions_nonequal_regs): Use END_REGNO. * dse.c (note_add_store): Likewise. * ira-lives.c (mark_hard_reg_dead): Likewise. * loop-invariant.c (mark_reg_store): Likewise. (mark_reg_death): Likewise. * postreload.c (reload_combine): Likewise. (reload_combine_note_store): Likewise. (reload_combine_note_use): Likewise. * recog.c (peep2_reg_dead_p): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223336 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/cfgcleanup.c14
-rw-r--r--gcc/dse.c12
-rw-r--r--gcc/ira-lives.c2
-rw-r--r--gcc/loop-invariant.c32
-rw-r--r--gcc/postreload.c23
-rw-r--r--gcc/recog.c9
7 files changed, 37 insertions, 67 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1bdee069bbc..4ccebea1016 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2015-05-19 Richard Sandiford <richard.sandiford@arm.com>
+
+ * cfgcleanup.c (mentions_nonequal_regs): Use END_REGNO.
+ * dse.c (note_add_store): Likewise.
+ * ira-lives.c (mark_hard_reg_dead): Likewise.
+ * loop-invariant.c (mark_reg_store): Likewise.
+ (mark_reg_death): Likewise.
+ * postreload.c (reload_combine): Likewise.
+ (reload_combine_note_store): Likewise.
+ (reload_combine_note_use): Likewise.
+ * recog.c (peep2_reg_dead_p): Likewise.
+
2015-05-19 Alan Modra <amodra@gmail.com>
* config/rs6000/predicates.md (gpc_reg_operand): Don't allow all
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 797d14ada5c..f2a831d62a2 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -272,16 +272,10 @@ mentions_nonequal_regs (const_rtx x, regset nonequal)
const_rtx x = *iter;
if (REG_P (x))
{
- unsigned int regno = REGNO (x);
- if (REGNO_REG_SET_P (nonequal, regno))
- return true;
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- int n = hard_regno_nregs[regno][GET_MODE (x)];
- while (--n > 0)
- if (REGNO_REG_SET_P (nonequal, regno + n))
- return true;
- }
+ unsigned int end_regno = END_REGNO (x);
+ for (unsigned int regno = REGNO (x); regno < end_regno; ++regno)
+ if (REGNO_REG_SET_P (nonequal, regno))
+ return true;
}
}
return false;
diff --git a/gcc/dse.c b/gcc/dse.c
index 4c9b6ed7ee9..478984ca8c2 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -855,7 +855,6 @@ note_add_store (rtx loc, const_rtx expr ATTRIBUTE_UNUSED, void *data)
{
rtx_insn *insn;
note_add_store_info *info = (note_add_store_info *) data;
- int r, n;
if (!REG_P (loc))
return;
@@ -874,15 +873,14 @@ note_add_store (rtx loc, const_rtx expr ATTRIBUTE_UNUSED, void *data)
available, fail now. */
if (!info->fixed_regs_live)
{
- info->failure = true;
+ info->failure = true;
return;
}
/* Now check if this is a live fixed register. */
- r = REGNO (loc);
- n = hard_regno_nregs[r][GET_MODE (loc)];
- while (--n >= 0)
- if (REGNO_REG_SET_P (info->fixed_regs_live, r+n))
- info->failure = true;
+ unsigned int end_regno = END_REGNO (loc);
+ for (unsigned int regno = REGNO (loc); regno < end_regno; ++regno)
+ if (REGNO_REG_SET_P (info->fixed_regs_live, regno))
+ info->failure = true;
}
/* Callback for for_each_inc_dec that emits an INSN that sets DEST to
diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c
index 2837349ae8d..60e7dc57ff3 100644
--- a/gcc/ira-lives.c
+++ b/gcc/ira-lives.c
@@ -478,7 +478,7 @@ mark_hard_reg_dead (rtx reg)
if (! TEST_HARD_REG_BIT (ira_no_alloc_regs, regno))
{
- int last = regno + hard_regno_nregs[regno][GET_MODE (reg)];
+ int last = END_REGNO (reg);
enum reg_class aclass, pclass;
while (regno < last)
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index 76a009f8c2c..1c3eae5e965 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -1883,8 +1883,6 @@ static void
mark_reg_store (rtx reg, const_rtx setter ATTRIBUTE_UNUSED,
void *data ATTRIBUTE_UNUSED)
{
- int regno;
-
if (GET_CODE (reg) == SUBREG)
reg = SUBREG_REG (reg);
@@ -1893,20 +1891,9 @@ mark_reg_store (rtx reg, const_rtx setter ATTRIBUTE_UNUSED,
regs_set[n_regs_set++] = reg;
- regno = REGNO (reg);
-
- if (regno >= FIRST_PSEUDO_REGISTER)
+ unsigned int end_regno = END_REGNO (reg);
+ for (unsigned int regno = REGNO (reg); regno < end_regno; ++regno)
mark_regno_live (regno);
- else
- {
- int last = regno + hard_regno_nregs[regno][GET_MODE (reg)];
-
- while (regno < last)
- {
- mark_regno_live (regno);
- regno++;
- }
- }
}
/* Mark clobbering register REG. */
@@ -1921,20 +1908,9 @@ mark_reg_clobber (rtx reg, const_rtx setter, void *data)
static void
mark_reg_death (rtx reg)
{
- int regno = REGNO (reg);
-
- if (regno >= FIRST_PSEUDO_REGISTER)
+ unsigned int end_regno = END_REGNO (reg);
+ for (unsigned int regno = REGNO (reg); regno < end_regno; ++regno)
mark_regno_death (regno);
- else
- {
- int last = regno + hard_regno_nregs[regno][GET_MODE (reg)];
-
- while (regno < last)
- {
- mark_regno_death (regno);
- regno++;
- }
- }
}
/* Mark occurrence of registers in X for the current loop. */
diff --git a/gcc/postreload.c b/gcc/postreload.c
index b12ef5b1028..0144f6046b2 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -1374,12 +1374,8 @@ reload_combine (void)
if ((GET_CODE (setuse) == USE || GET_CODE (setuse) == CLOBBER)
&& REG_P (usage_rtx))
{
- unsigned int i;
- unsigned int start_reg = REGNO (usage_rtx);
- unsigned int num_regs
- = hard_regno_nregs[start_reg][GET_MODE (usage_rtx)];
- unsigned int end_reg = start_reg + num_regs - 1;
- for (i = start_reg; i <= end_reg; i++)
+ unsigned int end_regno = END_REGNO (usage_rtx);
+ for (unsigned int i = REGNO (usage_rtx); i < end_regno; ++i)
if (GET_CODE (XEXP (link, 0)) == CLOBBER)
{
reg_state[i].use_index = RELOAD_COMBINE_MAX_USES;
@@ -1461,9 +1457,8 @@ reload_combine_note_store (rtx dst, const_rtx set, void *data ATTRIBUTE_UNUSED)
|| GET_CODE (dst) == PRE_DEC || GET_CODE (dst) == POST_DEC
|| GET_CODE (dst) == PRE_MODIFY || GET_CODE (dst) == POST_MODIFY)
{
- regno = REGNO (XEXP (dst, 0));
- mode = GET_MODE (XEXP (dst, 0));
- for (i = hard_regno_nregs[regno][mode] - 1 + regno; i >= regno; i--)
+ unsigned int end_regno = END_REGNO (XEXP (dst, 0));
+ for (unsigned int i = REGNO (XEXP (dst, 0)); i < end_regno; ++i)
{
/* We could probably do better, but for now mark the register
as used in an unknown fashion and set/clobbered at this
@@ -1533,13 +1528,11 @@ reload_combine_note_use (rtx *xp, rtx_insn *insn, int ruid, rtx containing_mem)
/* If this is the USE of a return value, we can't change it. */
if (REG_P (XEXP (x, 0)) && REG_FUNCTION_VALUE_P (XEXP (x, 0)))
{
- /* Mark the return register as used in an unknown fashion. */
+ /* Mark the return register as used in an unknown fashion. */
rtx reg = XEXP (x, 0);
- int regno = REGNO (reg);
- int nregs = hard_regno_nregs[regno][GET_MODE (reg)];
-
- while (--nregs >= 0)
- reg_state[regno + nregs].use_index = -1;
+ unsigned int end_regno = END_REGNO (reg);
+ for (unsigned int regno = REGNO (reg); regno < end_regno; ++regno)
+ reg_state[regno].use_index = -1;
return;
}
break;
diff --git a/gcc/recog.c b/gcc/recog.c
index d933364f57b..ffbd7b5c560 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -3128,18 +3128,15 @@ peep2_regno_dead_p (int ofs, int regno)
int
peep2_reg_dead_p (int ofs, rtx reg)
{
- int regno, n;
-
gcc_assert (ofs < MAX_INSNS_PER_PEEP2 + 1);
ofs = peep2_buf_position (peep2_current + ofs);
gcc_assert (peep2_insn_data[ofs].insn != NULL_RTX);
- regno = REGNO (reg);
- n = hard_regno_nregs[regno][GET_MODE (reg)];
- while (--n >= 0)
- if (REGNO_REG_SET_P (peep2_insn_data[ofs].live_before, regno + n))
+ unsigned int end_regno = END_REGNO (reg);
+ for (unsigned int regno = REGNO (reg); regno < end_regno; ++regno)
+ if (REGNO_REG_SET_P (peep2_insn_data[ofs].live_before, regno))
return 0;
return 1;
}