+2015-05-19 Richard Sandiford <richard.sandiford@arm.com>
+
+ * rtl.h (REG_NREGS): New macro
+ * alias.c (record_set): Use it.
+ * cfgcleanup.c (mark_effect): Likewise.
+ * combine.c (likely_spilled_retval_1): Likewise.
+ (likely_spilled_retval_p, can_change_dest_mode): Likewise.
+ (move_deaths, distribute_notes): Likewise.
+ * cselib.c (cselib_record_set): Likewise.
+ * df-problems.c (df_simulate_one_insn_forwards): Likewise.
+ * df-scan.c (df_mark_reg): Likewise.
+ * dse.c (look_for_hardregs): Likewise.
+ * dwarf2out.c (reg_loc_descriptor): Likewise.
+ (multiple_reg_loc_descriptor): Likewise.
+ * expr.c (write_complex_part, read_complex_part): Likewise.
+ (emit_move_complex): Likewise.
+ * haifa-sched.c (setup_ref_regs): Likewise.
+ * ira-lives.c (mark_hard_reg_live): Likewise.
+ * lra.c (lra_set_insn_recog_data): Likewise.
+ * mode-switching.c (create_pre_exit): Likewise.
+ * postreload.c (reload_combine_recognize_const_pattern): Likewise.
+ (reload_combine_recognize_pattern): Likewise.
+ (reload_combine_note_use, move2add_record_mode): Likewise.
+ (reload_cse_move2add): Likewise.
+ * reg-stack.c (subst_stack_regs_pat): Likewise.
+ * regcprop.c (kill_value, copy_value): Likewise.
+ (copyprop_hardreg_forward_1): Likewise.
+ * regrename.c (verify_reg_in_set, scan_rtx_reg): Likewise.
+ (build_def_use): Likewise.
+ * sched-deps.c (mark_insn_reg_birth, mark_reg_death): Likewise.
+ (deps_analyze_insn): Likewise.
+ * sched-rgn.c (check_live_1, update_live_1): Likewise.
+ * sel-sched.c (count_occurrences_equiv): Likewise.
+ * valtrack.c (dead_debug_insert_temp): Likewise.
+
2015-05-19 Richard Sandiford <richard.sandiford@arm.com>
* cfgcleanup.c (mentions_nonequal_regs): Use END_REGNO.
gcc_checking_assert (regno < reg_base_value->length ());
- /* If this spans multiple hard registers, then we must indicate that every
- register has an unusable value. */
- if (regno < FIRST_PSEUDO_REGISTER)
- n = hard_regno_nregs[regno][GET_MODE (dest)];
- else
- n = 1;
+ n = REG_NREGS (dest);
if (n != 1)
{
while (--n >= 0)
dest = XEXP (exp, 0);
regno = REGNO (dest);
if (HARD_REGISTER_NUM_P (regno))
- bitmap_clear_range (nonequal, regno,
- hard_regno_nregs[regno][GET_MODE (dest)]);
+ bitmap_clear_range (nonequal, regno, REG_NREGS (dest));
else
bitmap_clear_bit (nonequal, regno);
}
return true;
regno = REGNO (dest);
if (HARD_REGISTER_NUM_P (regno))
- bitmap_set_range (nonequal, regno,
- hard_regno_nregs[regno][GET_MODE (dest)]);
+ bitmap_set_range (nonequal, regno, REG_NREGS (dest));
else
bitmap_set_bit (nonequal, regno);
return false;
regno = REGNO (x);
if (regno >= info->regno + info->nregs)
return;
- nregs = hard_regno_nregs[regno][GET_MODE (x)];
+ nregs = REG_NREGS (x);
if (regno + nregs <= info->regno)
return;
new_mask = (2U << (nregs - 1)) - 1;
if (!REG_P (reg) || !targetm.calls.function_value_regno_p (REGNO (reg)))
return 0;
regno = REGNO (reg);
- nregs = hard_regno_nregs[regno][GET_MODE (reg)];
+ nregs = REG_NREGS (reg);
if (nregs == 1)
return 0;
mask = (2U << (nregs - 1)) - 1;
registers than the old mode. */
if (regno < FIRST_PSEUDO_REGISTER)
return (HARD_REGNO_MODE_OK (regno, mode)
- && (hard_regno_nregs[regno][GET_MODE (x)]
- >= hard_regno_nregs[regno][mode]));
+ && REG_NREGS (x) >= hard_regno_nregs[regno][mode]);
/* Or a pseudo that is only used once. */
return (regno < reg_n_sets_max
&& (GET_MODE_SIZE (GET_MODE (XEXP (note, 0)))
< GET_MODE_SIZE (GET_MODE (x)))))
&& regno < FIRST_PSEUDO_REGISTER
- && hard_regno_nregs[regno][GET_MODE (x)] > 1)
+ && REG_NREGS (x) > 1)
{
unsigned int ourend = END_HARD_REGNO (x);
unsigned int i, offset;
be dead; so we recourse, and the recursive call then finds
the previous insn that used this register. */
- if (place && regno < FIRST_PSEUDO_REGISTER
- && hard_regno_nregs[regno][GET_MODE (XEXP (note, 0))] > 1)
+ if (place && REG_NREGS (XEXP (note, 0)) > 1)
{
unsigned int endregno = END_HARD_REGNO (XEXP (note, 0));
bool all_used = true;
static void
cselib_record_set (rtx dest, cselib_val *src_elt, cselib_val *dest_addr_elt)
{
- int dreg = REG_P (dest) ? (int) REGNO (dest) : -1;
-
if (src_elt == 0 || side_effects_p (dest))
return;
- if (dreg >= 0)
+ if (REG_P (dest))
{
+ unsigned int dreg = REGNO (dest);
if (dreg < FIRST_PSEUDO_REGISTER)
{
- unsigned int n = hard_regno_nregs[dreg][GET_MODE (dest)];
+ unsigned int n = REG_NREGS (dest);
if (n > max_value_regs)
max_value_regs = n;
rtx reg = XEXP (link, 0);
int regno = REGNO (reg);
if (HARD_REGISTER_NUM_P (regno))
- bitmap_clear_range (live, regno,
- hard_regno_nregs[regno][GET_MODE (reg)]);
+ bitmap_clear_range (live, regno, REG_NREGS (reg));
else
bitmap_clear_bit (live, regno);
}
gcc_assert (GET_MODE (reg) != BLKmode);
if (regno < FIRST_PSEUDO_REGISTER)
- {
- int n = hard_regno_nregs[regno][GET_MODE (reg)];
- bitmap_set_range (set, regno, n);
- }
+ bitmap_set_range (set, regno, REG_NREGS (reg));
else
bitmap_set_bit (set, regno);
}
if (REG_P (x)
&& HARD_REGISTER_P (x))
- {
- unsigned int regno = REGNO (x);
- bitmap_set_range (regs_set, regno,
- hard_regno_nregs[regno][GET_MODE (x)]);
- }
+ bitmap_set_range (regs_set, REGNO (x), REG_NREGS (x));
}
/* Helper function for replace_read and record_store.
regs = targetm.dwarf_register_span (rtl);
- if (hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)] > 1 || regs)
+ if (REG_NREGS (rtl) > 1 || regs)
return multiple_reg_loc_descriptor (rtl, regs, initialized);
else
{
#endif
gcc_assert ((unsigned) DBX_REGISTER_NUMBER (reg) == dbx_reg_number (rtl));
- nregs = hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)];
+ nregs = REG_NREGS (rtl);
size = GET_MODE_SIZE (GET_MODE (rtl)) / nregs;
where the natural size of floating-point regs is 32-bit. */
|| (REG_P (cplx)
&& REGNO (cplx) < FIRST_PSEUDO_REGISTER
- && hard_regno_nregs[REGNO (cplx)][cmode] % 2 == 0))
+ && REG_NREGS (cplx) % 2 == 0))
{
rtx part = simplify_gen_subreg (imode, cplx, cmode,
imag_p ? GET_MODE_SIZE (imode) : 0);
where the natural size of floating-point regs is 32-bit. */
|| (REG_P (cplx)
&& REGNO (cplx) < FIRST_PSEUDO_REGISTER
- && hard_regno_nregs[REGNO (cplx)][cmode] % 2 == 0))
+ && REG_NREGS (cplx) % 2 == 0))
{
rtx ret = simplify_gen_subreg (imode, cplx, cmode,
imag_p ? GET_MODE_SIZE (imode) : 0);
&& optab_handler (mov_optab, GET_MODE_INNER (mode)) != CODE_FOR_nothing
&& !(REG_P (x)
&& HARD_REGISTER_P (x)
- && hard_regno_nregs[REGNO (x)][mode] == 1)
+ && REG_NREGS (x) == 1)
&& !(REG_P (y)
&& HARD_REGISTER_P (y)
- && hard_regno_nregs[REGNO (y)][mode] == 1))
+ && REG_NREGS (y) == 1))
try_int = false;
/* Not possible if the values are inherently not adjacent. */
else if (GET_CODE (x) == CONCAT || GET_CODE (y) == CONCAT)
{
regno = REGNO (x);
if (HARD_REGISTER_NUM_P (regno))
- bitmap_set_range (region_ref_regs, regno,
- hard_regno_nregs[regno][GET_MODE (x)]);
+ bitmap_set_range (region_ref_regs, regno, REG_NREGS (x));
else
bitmap_set_bit (region_ref_regs, REGNO (x));
return;
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)
regno = REGNO (XEXP (XEXP (link, 0), 0));
lra_assert (regno < FIRST_PSEUDO_REGISTER);
/* It is an argument register. */
- for (i = (hard_regno_nregs
- [regno][GET_MODE (XEXP (XEXP (link, 0), 0))]) - 1;
- i >= 0;
- i--)
+ for (i = REG_NREGS (XEXP (XEXP (link, 0), 0)) - 1; i >= 0; i--)
arg_hard_regs[n_hard_regs++] = regno + i;
}
if (n_hard_regs != 0)
&& GET_CODE ((ret_reg = XEXP (PATTERN (last_insn), 0))) == REG)
{
int ret_start = REGNO (ret_reg);
- int nregs = hard_regno_nregs[ret_start][GET_MODE (ret_reg)];
+ int nregs = REG_NREGS (ret_reg);
int ret_end = ret_start + nregs;
bool short_block = false;
bool multi_reg_return = false;
reg = SET_DEST (set);
src = SET_SRC (set);
if (!REG_P (reg)
- || hard_regno_nregs[REGNO (reg)][GET_MODE (reg)] != 1
+ || REG_NREGS (reg) != 1
|| GET_MODE (reg) != Pmode
|| reg == stack_pointer_rtx)
return false;
reg = SET_DEST (set);
src = SET_SRC (set);
- if (!REG_P (reg)
- || hard_regno_nregs[REGNO (reg)][GET_MODE (reg)] != 1)
+ if (!REG_P (reg) || REG_NREGS (reg) != 1)
return false;
regno = REGNO (reg);
/* No spurious USEs of pseudo registers may remain. */
gcc_assert (regno < FIRST_PSEUDO_REGISTER);
- nregs = hard_regno_nregs[regno][GET_MODE (x)];
+ nregs = REG_NREGS (x);
/* We can't substitute into multi-hard-reg uses. */
if (nregs > 1)
else if (REG_P (reg))
{
regno = REGNO (reg);
- nregs = hard_regno_nregs[regno][mode];
+ nregs = REG_NREGS (reg);
}
else
gcc_unreachable ();
number of calls to gen_rtx_SET to avoid memory
allocation if possible. */
&& SCALAR_INT_MODE_P (GET_MODE (XEXP (cnd, 0)))
- && hard_regno_nregs[REGNO (XEXP (cnd, 0))][GET_MODE (XEXP (cnd, 0))] == 1
+ && REG_NREGS (XEXP (cnd, 0)) == 1
&& CONST_INT_P (XEXP (cnd, 1)))
{
rtx implicit_set =
case CALL:
{
int count;
- for (count = hard_regno_nregs[REGNO (*dest)][GET_MODE (*dest)];
- --count >= 0;)
+ for (count = REG_NREGS (*dest); --count >= 0;)
{
regstack->reg[++regstack->top] = REGNO (*dest) + count;
SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest) + count);
x = tmp ? tmp : SUBREG_REG (x);
}
if (REG_P (x))
- {
- unsigned int regno = REGNO (x);
- unsigned int n = hard_regno_nregs[regno][GET_MODE (x)];
-
- kill_value_regno (regno, n, vd);
- }
+ kill_value_regno (REGNO (x), REG_NREGS (x), vd);
}
/* Remember that REGNO is valid in MODE. */
return;
/* If SRC and DEST overlap, don't record anything. */
- dn = hard_regno_nregs[dr][GET_MODE (dest)];
- sn = hard_regno_nregs[sr][GET_MODE (dest)];
+ dn = REG_NREGS (dest);
+ sn = REG_NREGS (src);
if ((dr > sr && dr < sr + sn)
|| (sr > dr && sr < dr + dn))
return;
copy_value (dest, SET_SRC (x), vd);
ksvd.ignore_set_reg = dest;
set_regno = REGNO (dest);
- set_nregs
- = hard_regno_nregs[set_regno][GET_MODE (dest)];
+ set_nregs = REG_NREGS (dest);
break;
}
}
return false;
regno = REGNO (op);
- nregs = hard_regno_nregs[regno][GET_MODE (op)];
+ nregs = REG_NREGS (op);
all_live = all_dead = true;
while (nregs-- > 0)
if (TEST_HARD_REG_BIT (*pset, regno + nregs))
{
struct du_head **p;
rtx x = *loc;
- machine_mode mode = GET_MODE (x);
unsigned this_regno = REGNO (x);
- int this_nregs = hard_regno_nregs[this_regno][mode];
+ int this_nregs = REG_NREGS (x);
if (action == mark_write)
{
&& !(untracked_operands & (1 << i))
&& REG_P (op)
&& !verify_reg_tracked (op))
- {
- machine_mode mode = GET_MODE (op);
- unsigned this_regno = REGNO (op);
- unsigned this_nregs = hard_regno_nregs[this_regno][mode];
- create_new_chain (this_regno, this_nregs, NULL, NULL,
- NO_REGS);
- }
+ create_new_chain (REGNO (op), REG_NREGS (op), NULL, NULL,
+ NO_REGS);
}
if (fail_current_block)
(df_ref_change_reg_with_loc (REGNO (RTX), N, RTX), XCUINT (RTX, 0, REG) = N)
#define SET_REGNO_RAW(RTX,N) (XCUINT (RTX, 0, REG) = N)
+/* Return the number of consecutive registers in a REG. This is always
+ 1 for pseudo registers and is determined by HARD_REGNO_NREGS for
+ hard registers. */
+#define REG_NREGS(RTX) \
+ (REGNO (RTX) < FIRST_PSEUDO_REGISTER \
+ ? (unsigned int) hard_regno_nregs[REGNO (RTX)][GET_MODE (RTX)] \
+ : 1)
+
/* ORIGINAL_REGNO holds the number the register originally had; for a
pseudo register turned into a hard reg this will hold the old pseudo
register number. */
regno = REGNO (reg);
if (regno < FIRST_PSEUDO_REGISTER)
- mark_insn_hard_regno_birth (insn, regno,
- hard_regno_nregs[regno][GET_MODE (reg)],
+ mark_insn_hard_regno_birth (insn, regno, REG_NREGS (reg),
clobber_p, unused_p);
else
mark_insn_pseudo_birth (insn, regno, clobber_p, unused_p);
regno = REGNO (reg);
if (regno < FIRST_PSEUDO_REGISTER)
- mark_hard_regno_death (regno, hard_regno_nregs[regno][GET_MODE (reg)]);
+ mark_hard_regno_death (regno, REG_NREGS (reg));
else
mark_pseudo_death (regno);
}
rtx_insn_list *cond_deps = NULL;
t = XEXP (t, 0);
regno = REGNO (t);
- nregs = hard_regno_nregs[regno][GET_MODE (t)];
+ nregs = REG_NREGS (t);
while (nregs-- > 0)
{
struct deps_reg *reg_last = &deps->reg_last[regno + nregs];
if (regno < FIRST_PSEUDO_REGISTER)
{
/* Check for hard registers. */
- int j = hard_regno_nregs[regno][GET_MODE (reg)];
+ int j = REG_NREGS (reg);
while (--j >= 0)
{
for (i = 0; i < candidate_table[src].split_bbs.nr_members; i++)
basic_block b = candidate_table[src].update_bbs.first_member[i];
if (HARD_REGISTER_NUM_P (regno))
- bitmap_set_range (df_get_live_in (b), regno,
- hard_regno_nregs[regno][GET_MODE (reg)]);
+ bitmap_set_range (df_get_live_in (b), regno, REG_NREGS (reg));
else
bitmap_set_bit (df_get_live_in (b), regno);
}
{
/* Bail out if mode is different or more than one register is
used. */
- if (GET_MODE (x) != GET_MODE (what)
- || (HARD_REGISTER_P (x)
- && hard_regno_nregs[REGNO (x)][GET_MODE (x)] > 1))
+ if (GET_MODE (x) != GET_MODE (what) || REG_NREGS (x) > 1)
return 0;
count += 1;
}
the debug temp to. ??? We could bind the debug_expr to a
CONCAT or PARALLEL with the split multi-registers, and
replace them as we found the corresponding sets. */
- else if (REGNO (reg) < FIRST_PSEUDO_REGISTER
- && (hard_regno_nregs[REGNO (reg)][GET_MODE (reg)]
- != hard_regno_nregs[REGNO (reg)][GET_MODE (dest)]))
+ else if (REG_NREGS (reg) != REG_NREGS (dest))
breg = NULL;
/* Ok, it's the same (hardware) REG, but with a different
mode, so SUBREG it. */
setting REG in its mode would, we won't know what to bind
the debug temp to. */
else if (REGNO (reg) < FIRST_PSEUDO_REGISTER
- && (hard_regno_nregs[REGNO (reg)][GET_MODE (reg)]
+ && (REG_NREGS (reg)
!= hard_regno_nregs[REGNO (reg)][GET_MODE (dest)]))
breg = NULL;
/* Yay, we can use SRC, just adjust its mode. */