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


On Mon, 18 Jun 2001, Mark Mitchell wrote:

> I suggest we start with an `an_asm_output' struct, designed to contain
> all the bits that are currently part of the ASM_OUTPUT macros.  That's
> certainly a self-contained unit -- but still large enough to give us
> a real feel for how this would work.  A `a_target' struct could then
> simply contain an `an_asm_output' as a field.

The ASM_OUTPUT macros may be a bad place to start, because there is a lot
of work involved with them, the ones in elfos.h sometimes getting
overridden by individual targets need to be dealt with, etc..

In this scheme (multiple logical structures), would there then be
something like:

target.h
========

typedef struct
{
  void (*asm_output_int) PARAMS ((FILE *, int));
  /* ... */
} an_asm_output;

/* ... */

typedef struct
{
  an_asm_output asm_output;
} a_target;

extern a_target target;

target-def.h
============

#define ASM_OUTPUT_INT default_asm_output_int

#define TARGET_INITIALIZER { { ASM_OUTPUT_INT } }

i386.c
======

#include "target.h"
#include "target-def.h"

#undef ASM_OUTPUT_INT
#define ASM_OUTPUT_INT ix86_asm_output_int

/* ... */

a_target target = TARGET_INITIALIZER;

?

Random source files would then call (*target.asm_output.asm_output_int) -
which does seem a bit more cumbersome than ASM_OUTPUT_INT.

-- 
Joseph S. Myers
jsm28@cam.ac.uk


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