CONSTANT_ADDRESS_P for i386/x86-64
Jan Hubicka
jh@suse.cz
Wed Apr 2 23:37:00 GMT 2003
> On Tue, Mar 25, 2003 at 08:06:39PM +0100, Jan Hubicka wrote:
> > What makes this beast different from calling legitimate_address_p on the
> > operand?
>
> I don't know. If you regression test that change, I expect
> it'll be ok.
It is not so easy to do in general as CONSTANT_ADDRESS_P is often used
from legitimate_address_p and sometimes it accepts constructs that are
not CONSTANT_P, but for i386 the attached patch works for i386 and I am
testing it right now for x86-64. It removes some of
-fpic/-mcode-model=medium artefacts I've seen in the code.
I am also now refulsing CONST_DOUBLES as addresses in 64bit mode as we
now always do use 64bit HOST_WIDE_INT.
Honza
Thu Apr 3 00:45:01 CEST 2003 Jan Hubicka <jh@suse.cz>
* i386.c (constant_address_p): Use legitimate_constant_p.
(legitimate_address_p): Do not use CONSTANT_ADDRESS_P.
Index: i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.555
diff -c -3 -p -r1.555 i386.c
*** i386.c 2 Apr 2003 22:42:59 -0000 1.555
--- i386.c 2 Apr 2003 22:43:50 -0000
*************** bool
*** 5710,5735 ****
constant_address_p (x)
rtx x;
{
! switch (GET_CODE (x))
! {
! case LABEL_REF:
! case CONST_INT:
! return true;
!
! case CONST_DOUBLE:
! return TARGET_64BIT;
!
! case CONST:
! /* For Mach-O, really believe the CONST. */
! if (TARGET_MACHO)
! return true;
! /* Otherwise fall through. */
! case SYMBOL_REF:
! return !flag_pic && legitimate_constant_p (x);
!
! default:
! return false;
! }
}
/* Nonzero if the constant value X is a legitimate general operand
--- 5710,5716 ----
constant_address_p (x)
rtx x;
{
! return CONSTANT_P (x) && legitimate_address_p (Pmode, x, 1);
}
/* Nonzero if the constant value X is a legitimate general operand
*************** legitimate_address_p (mode, addr, strict
*** 6080,6086 ****
that never results in lea, this seems to be easier and
correct fix for crash to disable this test. */
}
! else if (!CONSTANT_ADDRESS_P (disp))
{
reason = "displacement is not constant";
goto report_error;
--- 6061,6072 ----
that never results in lea, this seems to be easier and
correct fix for crash to disable this test. */
}
! else if (GET_CODE (disp) != LABEL_REF
! && GET_CODE (disp) != CONST_INT
! && (GET_CODE (disp) != CONST
! || !legitimate_constant_p (disp))
! && (GET_CODE (disp) != SYMBOL_REF
! || !legitimate_constant_p (disp)))
{
reason = "displacement is not constant";
goto report_error;
*************** legitimate_address_p (mode, addr, strict
*** 6088,6098 ****
else if (TARGET_64BIT && !x86_64_sign_extended_value (disp))
{
reason = "displacement is out of range";
- goto report_error;
- }
- else if (!TARGET_64BIT && GET_CODE (disp) == CONST_DOUBLE)
- {
- reason = "displacement is a const_double";
goto report_error;
}
}
--- 6074,6079 ----
More information about the Gcc
mailing list