This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/13169] New: asm using r30 or r31 confuses global_alloc
- From: "amodra at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Nov 2003 03:27:35 -0000
- Subject: [Bug optimization/13169] New: asm using r30 or r31 confuses global_alloc
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This testcase demonstrates a problem with global_alloc of registers
that are mentioned as a "from" register in ELIMINATE_REGS.
When compiled with -O0 -fomit-frame-pointer, this testcase returns a
zero status. When compiled with -O1 or higher, it returns 1.
Notes: rs6000.h mentions both r31 and r30 as a "from" register in
ELIMINATE_REGS.
global.c:global_alloc does
for (i = 0; i < ARRAY_SIZE (eliminables); i++)
{
SET_HARD_REG_BIT (eliminable_regset, eliminables[i].from);
if (! CAN_ELIMINATE (eliminables[i].from, eliminables[i].to)
|| (eliminables[i].to == STACK_POINTER_REGNUM && need_fp))
SET_HARD_REG_BIT (no_global_alloc_regs, eliminables[i].from);
}
resulting in both r30 and r31 being set in eliminable_regset,
and *not* in no_global_alloc_regs. Later we have
/* Eliminate conflicts between pseudos and eliminable registers. If
the register is not eliminated, the pseudo won't really be able to
live in the eliminable register, so the conflict doesn't matter.
If we do eliminate the register, the conflict will no longer exist.
So in either case, we can ignore the conflict. Likewise for
preferences. */
for (i = 0; i < (size_t) max_allocno; i++)
{
AND_COMPL_HARD_REG_SET (allocno[i].hard_reg_conflicts,
eliminable_regset);
AND_COMPL_HARD_REG_SET (allocno[i].hard_reg_copy_preferences,
eliminable_regset);
AND_COMPL_HARD_REG_SET (allocno[i].hard_reg_preferences,
eliminable_regset);
}
Removing r30 and r31 from hard_reg_conflicts allows them to be used
willy nilly as global regs, when really they should remain as
conflicts because they're used by the asm. :-(
--
Summary: asm using r30 or r31 confuses global_alloc
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: amodra at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13169