This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Plan for cleaning up the "Addressing Modes" macros
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Dave Korn <dave dot korn at artimi dot com>
- Cc: 'Zack Weinberg' <zack at codesourcery dot com>, gcc at gcc dot gnu dot org
- Date: Mon, 28 Feb 2005 09:30:01 -0500 (EST)
- Subject: RE: Plan for cleaning up the "Addressing Modes" macros
- References: <SERRANOcBxdV3yEN2yn0000001a@SERRANO.CAM.ARTIMI.COM>
On Mon, 28 Feb 2005, Dave Korn wrote:
> Hmmm, actually, I would say that moving these macro definitions into the
> cpu.c files is a fairly mechanical and trivial transformation. Given:
WRONG!
> ${CPU}.h:
> #define GO_IF_LEGITIMATE_ADDRESS(MODE,X,ADDR) \
> if ( .... some very hairy conditional depending on REG_OK_STRICT ) \
> goto ADDR;
>
> you just redefine it as
>
> ${CPU}.h
> #define GO_IF_LEGITIMATE_ADDRESS(MODE,X,ADDR) \
> if (${CPU}_go_if_legitimate_address ((MODE), (X), (REG_OK_STRICT)) \
> goto ADDR;
>
> ${CPU}.c
> int ${CPU}_go_if_legitimate_address (enum machine_mode mode, rtx x, int
> reg_ok_strict)
> {
> return ( ... same conditional s/REG_OK_STRICT/reg_ok_strict/g );
> }
And then, much later on, perhaps not even from the GCC
test-suite, you find that a helper macro of a helper macro used
in the GO_IF_LEGITIMATE_ADDRESS (said helper macro still being
defined in cpu.h) is dependent on REG_OK_STRICT.
As a port mauthor/maintainer, you do this *once*. Then you stay
alert about moving REG_OK_STRICT-dependent things into cpu.c.
brgds, H-P