PATCH: Darwin FP constant peephole (again)

Dale Johannesen dalej@apple.com
Tue Dec 18 18:03:00 GMT 2001


On Tuesday, December 18, 2001, at 05:55 PM, Aldy Hernandez wrote:

>>>>>> "Dale" == Dale Johannesen <dalej@apple.com> writes:
>
> it looks much better as a function :)
>
>> +/* The convention appears to be to define this wherever it is used.
>> +   With legitimize_reload_address now defined here, 
>> REG_MODE_OK_FOR_BASE_P
>> +   is now used here.  */
>> +#ifndef REG_MODE_OK_FOR_BASE_P
>> +#define REG_MODE_OK_FOR_BASE_P(REGNO, MODE) REG_OK_FOR_BASE_P (REGNO)
>> +#endif
>
> perhaps this should go either in reload.h or in rs6000.h.  IMO we
> shouldn't be defining target macros in the .c file.

Yeah.  But see reload.c, which is where I got this.

>> +#if TARGET_MACHO
>> +  if (DEFAULT_ABI == ABI_DARWIN && flag_pic
>> +      && GET_CODE (x) == LO_SUM
>> +      && GET_CODE (XEXP (x, 0)) == PLUS
>> +      && XEXP (XEXP (x, 0), 0) == pic_offset_table_rtx
>> +      && GET_CODE (XEXP (XEXP (x, 0), 1)) == HIGH
>> +      && GET_CODE (XEXP (XEXP (XEXP (x, 0), 1), 0)) == CONST
>> +      && XEXP (XEXP (XEXP (x, 0), 1), 0) == XEXP (x, 1)
>> +      && GET_CODE (XEXP (XEXP (x, 1), 0)) == MINUS
>> +      && GET_CODE (XEXP (XEXP (XEXP (x, 1), 0), 0)) == SYMBOL_REF
>> +      && GET_CODE (XEXP (XEXP (XEXP (x, 1), 0), 1)) == SYMBOL_REF)
>> +    {
>> +      /* Result of previous invocation of this function on Darwin
>> +        floating point constant. */
>> +      push_reload (XEXP (x, 0), NULL_RTX, &XEXP (x, 0), NULL,
>> +               BASE_REG_CLASS, Pmode, VOIDmode, 0, 0,
>> +               opnum, (enum reload_type)type);
>> +      *win = 1;
>> +      return x;
>> +    }
>> +#endif
>
> do these have to be conditionally compiled?  We're trying to cut down
> on conditionally compiled code when possible.

The other one has to be because of machopic_function_base_name(), at
least that's the easiest way to deal with it and consistent with all
the other places where it's referenced.  This one doesn't have to, but
they go together, so it seems cleaner to me to have this one conditional
also.



More information about the Gcc-patches mailing list