Commit 52053c3b by Richard Sandiford Committed by Richard Sandiford

Remove global call sets: rtlanal.c

The reg_set_p part is simple, since the caller is asking about
a specific REG rtx, with a known register number and mode.

The find_all_hard_reg_sets part emphasises that the "implicit"
behaviour was always a bit suspect, since it includes fully-clobbered
registers but not partially-clobbered registers.  The only current
user of this path is the c6x-specific scheduler predication code,
and c6x doesn't have partly call-clobbered registers, so in practice
it's fine.  I've added a comment to try to disuade future users.
(The !implicit path is OK and useful though.)

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* rtlanal.c: Include function-abi.h.
	(reg_set_p): Use insn_callee_abi to get the ABI of the called
	function and clobbers_reg_p to test whether the register
	is call-clobbered.
	(find_all_hard_reg_sets): When implicit is true, use insn_callee_abi
	to get the ABI of the called function and full_reg_clobbers to
	get the set of fully call-clobbered registers.  Warn about the
	pitfalls of using this mode.

From-SVN: r276334
parent 12e20dde
2019-09-30 Richard Sandiford <richard.sandiford@arm.com> 2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
* rtlanal.c: Include function-abi.h.
(reg_set_p): Use insn_callee_abi to get the ABI of the called
function and clobbers_reg_p to test whether the register
is call-clobbered.
(find_all_hard_reg_sets): When implicit is true, use insn_callee_abi
to get the ABI of the called function and full_reg_clobbers to
get the set of fully call-clobbered registers. Warn about the
pitfalls of using this mode.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
* reload.c: Include function-abi.h. * reload.c: Include function-abi.h.
(find_equiv_reg): Use clobbers_reg_p to test whether either (find_equiv_reg): Use clobbers_reg_p to test whether either
of the equivalent registers is clobbered by a call. of the equivalent registers is clobbered by a call.
......
...@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "addresses.h" #include "addresses.h"
#include "rtl-iter.h" #include "rtl-iter.h"
#include "hard-reg-set.h" #include "hard-reg-set.h"
#include "function-abi.h"
/* Forward declarations */ /* Forward declarations */
static void set_of_1 (rtx, const_rtx, void *); static void set_of_1 (rtx, const_rtx, void *);
...@@ -1270,8 +1271,8 @@ reg_set_p (const_rtx reg, const_rtx insn) ...@@ -1270,8 +1271,8 @@ reg_set_p (const_rtx reg, const_rtx insn)
|| (CALL_P (insn) || (CALL_P (insn)
&& ((REG_P (reg) && ((REG_P (reg)
&& REGNO (reg) < FIRST_PSEUDO_REGISTER && REGNO (reg) < FIRST_PSEUDO_REGISTER
&& overlaps_hard_reg_set_p (regs_invalidated_by_call, && (insn_callee_abi (as_a<const rtx_insn *> (insn))
GET_MODE (reg), REGNO (reg))) .clobbers_reg_p (GET_MODE (reg), REGNO (reg))))
|| MEM_P (reg) || MEM_P (reg)
|| find_reg_fusage (insn, CLOBBER, reg))))) || find_reg_fusage (insn, CLOBBER, reg)))))
return true; return true;
...@@ -1486,7 +1487,11 @@ record_hard_reg_sets (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data) ...@@ -1486,7 +1487,11 @@ record_hard_reg_sets (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data)
} }
/* Examine INSN, and compute the set of hard registers written by it. /* Examine INSN, and compute the set of hard registers written by it.
Store it in *PSET. Should only be called after reload. */ Store it in *PSET. Should only be called after reload.
IMPLICIT is true if we should include registers that are fully-clobbered
by calls. This should be used with caution, since it doesn't include
partially-clobbered registers. */
void void
find_all_hard_reg_sets (const rtx_insn *insn, HARD_REG_SET *pset, bool implicit) find_all_hard_reg_sets (const rtx_insn *insn, HARD_REG_SET *pset, bool implicit)
{ {
...@@ -1495,7 +1500,7 @@ find_all_hard_reg_sets (const rtx_insn *insn, HARD_REG_SET *pset, bool implicit) ...@@ -1495,7 +1500,7 @@ find_all_hard_reg_sets (const rtx_insn *insn, HARD_REG_SET *pset, bool implicit)
CLEAR_HARD_REG_SET (*pset); CLEAR_HARD_REG_SET (*pset);
note_stores (insn, record_hard_reg_sets, pset); note_stores (insn, record_hard_reg_sets, pset);
if (CALL_P (insn) && implicit) if (CALL_P (insn) && implicit)
*pset |= call_used_or_fixed_regs; *pset |= insn_callee_abi (insn).full_reg_clobbers ();
for (link = REG_NOTES (insn); link; link = XEXP (link, 1)) for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
if (REG_NOTE_KIND (link) == REG_INC) if (REG_NOTE_KIND (link) == REG_INC)
record_hard_reg_sets (XEXP (link, 0), NULL, pset); record_hard_reg_sets (XEXP (link, 0), NULL, pset);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment