This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix PR44281 (bad RA with global regs)
- From: Bernd Schmidt <bschmidt at redhat dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 29 Feb 2016 18:13:23 +0100
- Subject: Re: Fix PR44281 (bad RA with global regs)
- Authentication-results: sourceware.org; auth=none
- References: <56C78C62 dot 7050204 at t-online dot de> <56C79116 dot 2050503 at redhat dot com> <CAFiYyc3xBcxLfO0Rm2v0v-LPfAAGtiapPtF=eF33BTfey8bccQ at mail dot gmail dot com> <56D0723E dot 20805 at redhat dot com> <alpine dot LSU dot 2 dot 20 dot 1602291725400 dot 20277 at wotan dot suse dot de>
On 02/29/2016 06:07 PM, Michael Matz wrote:
%rbx would have to be implicitly used/clobbered by the asm. In addition
it would have to be used by all function entries and exits (so that a
function body where the global reg var is merely visible but not used
doesn't accidentally clobber that register) and of course by calls.
Nearly all this exists as of today. From df-scan.c:
static void
df_get_call_refs (struct df_collection_rec *collection_rec,
[...]
else if (global_regs[i])
{
/* Calls to const functions cannot access any global
registers and
calls to pure functions cannot set them. All other calls may
reference any of the global registers, so they are recorded as
used. */
if (!RTL_CONST_CALL_P (insn_info->insn))
and
static void
df_get_entry_block_def_set (bitmap entry_block_defs)
{
[...]
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
{
if (global_regs[i])
bitmap_set_bit (entry_block_defs, i);
and
/* Mark all global registers, and all registers used by the
epilogue as being live at the end of the function since they
may be referenced by our caller. */
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (global_regs[i] || EPILOGUE_USES (i))
bitmap_set_bit (exit_block_uses, i);
FWIW: signal handlers need no consideration (if they were allowed to
inspect/alter global reg vars we would have lost and no improvement on
fixed_regs[] could be done). They are explicitely documented to not be
able to access global reg vars. (They already can't accidentally clobber
the register in question because signal handlers don't do that)
Oh, they can't modify the register in question because the OS would
restore it? Hadn't thought of that.
Ok so maybe reopen and apply my patch for gcc-7, with a tweak for asms.
Bernd