This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add new memory_address_p target hook


Anatoly Sokolov <aesok@post.ru> writes:

>   As the Zack Weinberg offered in the post:
> http://gcc.gnu.org/ml/gcc-patches/2004-08/msg00511.html, this patch introduce
> new TARGET_MEMORY_ADDRESS_P target hook instead GO_IF_LEGITIMATE_ADDRESS macro.
>
> Outline:
>
>   * Remove uses in machine-independent code memory_address_p and
>   strict_memory_address_p functions and use memory_address_p target hook
>   instead. This allow delete memory_address_p and strict_memory_address_p
>   functions.
>
>   * For all target add  TARGET_MEMORY_ADDRESS_P target hook and delete
>   GO_IF_LEGITIMATE_ADDRESS macro. This allow delete memory_address_1_p and
>   strict_memory_address_1_p functions and simplify default_memory_address_p.

How did you test this?


> 2008-06-27  Anatoly Sokolov <aesok@post.ru>
>
>        * target.h (struct gcc_target): Add memory_address_p field.
>        * target-def.h (TARGET_MEMORY_ADDRESS_P): New.
>        (TARGET_INITIALIZER): Use TARGET_MEMORY_ADDRESS_P.
>        * targhooks.c (default_memory_address_p): New function.
>        * targhooks.h (default_memory_address_p): Declare function.
>        * recog.c (memory_address_1_p): (Ditto.).
>        (memory_address_1_p): (Ditto.).
>        * reload.c (strict_memory_address_1_p): New function.
>        (strict_memory_address_p): Use memory_address_p target hook.
>        * recog.c: Include "target.h".
>        (memory_address_1_p): New function.
>        (memory_address_p): Use memory_address_p target hook.

I don't like the names memory_address_1_p or
strict_memory_address_1_p.  Those names don't seem to indicate what
the functions do.  The functions seem to provide default
implementations of memory_address_p for targets which still define
GO_IF_LEGITIMATE_ADDRESS.  How about default_legitimate_address_p and
default_strict_legitimate_address_p?  Also the new functions need
comments.  Also for future-proofing I think the functions should use
#ifdef GO_IF_LEGITIMATE_ADDRESS and call gcc_unreachable() if it is
not defined.

Please submit an updated patch, with information on how it was tested.

Thanks for tackling this.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]