From f7d0b0fc77b26e5fa6872678099576e875d87ed5 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 28 Aug 2014 06:24:32 +0000 Subject: [PATCH] rtl.h (find_all_hard_regs): Declare. gcc/ * rtl.h (find_all_hard_regs): Declare. * rtlanal.c (find_all_hard_regs): New function. (record_hard_reg_uses_1): Delete. (record_hard_reg_uses): Use find_all_hard_regs. From-SVN: r214656 --- gcc/ChangeLog | 7 +++++++ gcc/rtl.h | 1 + gcc/rtlanal.c | 31 ++++++++++++++----------------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 57a30853dc4..e77f39b93b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-08-28 Richard Sandiford + + * rtl.h (find_all_hard_regs): Declare. + * rtlanal.c (find_all_hard_regs): New function. + (record_hard_reg_uses_1): Delete. + (record_hard_reg_uses): Use find_all_hard_regs. + 2014-08-28 Richard Sandiford * rtl.h (replace_label_data): Delete. diff --git a/gcc/rtl.h b/gcc/rtl.h index 9d27256f42c..087706054c2 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2757,6 +2757,7 @@ extern const_rtx set_of (const_rtx, const_rtx); extern void record_hard_reg_sets (rtx, const_rtx, void *); extern void record_hard_reg_uses (rtx *, void *); #ifdef HARD_CONST +extern void find_all_hard_regs (const_rtx, HARD_REG_SET *); extern void find_all_hard_reg_sets (const_rtx, HARD_REG_SET *, bool); #endif extern void note_stores (const_rtx, void (*) (rtx, const_rtx, void *), void *); diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index f1cb2246d7d..86491669c38 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -1122,6 +1122,19 @@ set_of (const_rtx pat, const_rtx insn) return data.found; } +/* Add all hard register in X to *PSET. */ +void +find_all_hard_regs (const_rtx x, HARD_REG_SET *pset) +{ + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, x, NONCONST) + { + const_rtx x = *iter; + if (REG_P (x) && REGNO (x) < FIRST_PSEUDO_REGISTER) + add_to_hard_reg_set (pset, GET_MODE (x), REGNO (x)); + } +} + /* This function, called through note_stores, collects sets and clobbers of hard registers in a HARD_REG_SET, which is pointed to by DATA. */ @@ -1155,27 +1168,11 @@ find_all_hard_reg_sets (const_rtx insn, HARD_REG_SET *pset, bool implicit) record_hard_reg_sets (XEXP (link, 0), NULL, pset); } -/* A for_each_rtx subroutine of record_hard_reg_uses. */ -static int -record_hard_reg_uses_1 (rtx *px, void *data) -{ - rtx x = *px; - HARD_REG_SET *pused = (HARD_REG_SET *)data; - - if (REG_P (x) && REGNO (x) < FIRST_PSEUDO_REGISTER) - { - int nregs = hard_regno_nregs[REGNO (x)][GET_MODE (x)]; - while (nregs-- > 0) - SET_HARD_REG_BIT (*pused, REGNO (x) + nregs); - } - return 0; -} - /* Like record_hard_reg_sets, but called through note_uses. */ void record_hard_reg_uses (rtx *px, void *data) { - for_each_rtx (px, record_hard_reg_uses_1, data); + find_all_hard_regs (*px, (HARD_REG_SET *) data); } /* Given an INSN, return a SET expression if this insn has only a single SET.