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: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Hans-Peter Nilsson'" <hp at bitrange dot com>
- Cc: "'Zack Weinberg'" <zack at codesourcery dot com>,<gcc at gcc dot gnu dot org>
- Date: Mon, 28 Feb 2005 18:00:44 -0000
- Subject: RE: Plan for cleaning up the "Addressing Modes" macros
----Original Message----
>From: Hans-Peter Nilsson
>Sent: 28 February 2005 14:30
> 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.
Heh, yeh, I learnt that one the hard way myself once. :-/
Point taken: you do indeed have to do the exact same for any helper
sub-macros. Pardon my oversight; but it's basically the same procedure for
them as it is for GO_IF_LEGIT et. al, and (in my experience) it's
straightforward to function-ify them all in one swell foop.
cheers,
DaveK
--
Can't think of a witty .sigline today....