This is the mail archive of the gcc@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]

Re: Converting tm.h macros to functions



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


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