This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
REG_CLASS_CONTENTS, >32 registers and 64-bit hosts
- From: Marek Michalkiewicz <marekm at amelek dot gda dot pl>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 8 Jul 2002 20:27:23 +0200 (CEST)
- Subject: REG_CLASS_CONTENTS, >32 registers and 64-bit hosts
Hello,
thanks to the Debian people, I learned that there are problems with
the AVR target (possibly others too?) when building on (some?) 64-bit
hosts. The same problem exists with GCC 3.0, 3.1 and mainline...
STACK_POINTER_REGNUM is 32 (so it's bit 0 of the second value in the
REG_CLASS_CONTENTS initializer), and without the small patch below,
test_hard_reg_class (STACK_REG, X) returns false when it should
return true (because X is the stack pointer register), resulting
in assembler errors. Please help me - I don't immediately see what
is wrong (this is just a workaround, the real bug is elsewhere),
and I don't have access to any 64-bit box to debug it myself...
It seems that TEST_HARD_REG_BIT (reg_class_contents[CLASS], REGNO)
gives wrong result for REGNO >= 32. Works fine on ia32 though...
Thanks,
Marek
Index: avr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/avr/avr.c,v
retrieving revision 1.55.6.2
diff -c -3 -p -r1.55.6.2 avr.c
*** avr.c 25 May 2002 22:15:26 -0000 1.55.6.2
--- avr.c 6 Jul 2002 09:48:46 -0000
*************** test_hard_reg_class (class, x)
*** 5182,5187 ****
--- 5182,5192 ----
int regno = true_regnum (x);
if (regno < 0)
return 0;
+
+ /* XXX - TEST_HARD_REG_CLASS fails on 64-bit machines? */
+ if (class == STACK_REG)
+ return (regno == STACK_POINTER_REGNUM);
+
return TEST_HARD_REG_CLASS (class, regno);
}