With 638 macros documented by @defmac, and 475 files that include tm.h ,
our current approach to hookization is too slow to get the tree optimizers
and front ends independent of target macros in any useful timeframe.

Therefore, I propose the following approach:
The target macros currently required by tree optimizers and frontends
get wrapper hooks, and these wrapper hooks get wrapper macros, to look
like the original target macros, defined in the auto-generated
header-file target-wrap.h .  cc1/cc1plus etc. source
files that currently include "tm.h", but have no business to do so, will
be changed to include target-wrap.h instead; if they include "tm_p.h",
this include will also be removed.

The @defmac definitions from tm.texi.in give a tentative list of macros,
although that is probably incomplete, while some macros are already wrapped
or not needed outside of rtl-centric code.
So I'll convert or generate (in the undocumented case) hook wrapper
definitions for the functional macros definitions that are evidently needed
to perform a bootstrap and various cross-builds.  In particular, I'll
have to fill in argument and return types for each required hook.
I use @wrapper for a syntax similar to @hook, except that no default
definition is specified; instead, it is auto-generated, with a new
auto-generated file target-wrappers.c to implement the hook wrappers.

I'll create all the wrapper hooks initially as sub-members of a new
targetm.wrapper member; If people would like them somewhere else, we can
move them around later, but discussing individual placement of some
sixhundred hooks beforehand would just slow down things too much.

Reply via email to