This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Converting tm.h macros to functions
- To: Michael Meissner <meissner at cygnus dot com>, Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Subject: Re: Converting tm.h macros to functions
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Mon, 18 Jun 2001 22:12:35 -0700
- cc: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
Cautions about REG_OK_FOR_BASE_P, etc., are definitely useful --
it's easy to forget about these.
> fill in the structure. This way, you don't have to change multiple
> config files every time you add a field. This in turn will help lesson
I think we've already solved that problem.
> This way, gcc_default_target_initialization does all of the standard
> things. If config/elf.h for instance has a bunch of common setup, it
> would use its hook to modify things after the default initialization.
> Then if say config/svr4.h wants to further change things it can. Finally
> the machine is given a chance to override things.
>
I'm not sure I agree with this approach. It more closely mirrors the
contructor-based object-oriented metaphors that we're trying to
simulate in this somewhat simplistic programming language of the late 70s,
but, in my experience, it's hard to make things like this work out.
I built a cross-platform compiler driver using similar techniques (twice!)
and both times I ended up with *way* too many hooks, in the end. I
think the design we tossed around today is no more work, really -- in
fact, you can essentially do what you suggest, simply by doing:
#define ASM_OUTPUT_INT elf_asm_output_int
in `elf.h' and:
#undef ASM_OUTPUT_INT
#define ASM_OUTPUT_INT ix86_asm_output_int
in `i386.h'. The final TARGET_INITIALIZER definition will then handle
the initialization from the currently defined values. I picked this
approach partly to make it easy to transition from the current
system in a mechanical way: turn macros into functions, then you're done,
essentially.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com