RFC: Defining and using target vectors
Joseph S. Myers
joseph@codesourcery.com
Thu Nov 18 17:19:00 GMT 2010
On Thu, 18 Nov 2010, Joern Rennecke wrote:
> 1: At the end, target-def.h initalizes targetm, and whatever vectors we
> might want to split out of it nor or in the future.
Disapprove, in the form in which you describe it. A key point of
splitting vectors is that different vectors are linked into different
programs and so need to be initialized in different places because each
vector references functions only present in certain programs. See the
sets of hooks I proposed in
<http://gcc.gnu.org/ml/gcc/2010-10/msg00294.html>, for core compiler,
driver and shared between the two. There are also the C-family hooks.
If you put the initialization in the header, you need different headers
for each set of programs in which hooks are used.
> 2: genhooks is changed so that is creates accessor macros for the target
> vector members, which are placed in a file included by target.h .
Disapprove. I consider it cleaner to refer directly to the hook at the
sites where it is used rather than adding macros; we want to reduce the
number of layers of macros, and have such macros as there are visible in
as narrow a range of places as possible (for example, only where the hook
vectors are initialized and nowhere else), rather than adding to them.
> 3: Hook call sites get changed to use the accessor macros, than can be
> staged split by affectde hook and/or affected files.
Disapprove. See above.
> 4: Once all call site of a hook have been converted to the accessor macros,
> the hook can be moved around painlessly.
Moving of hooks should be infrequent enough - if you think about proper
placement in the first place - that the need for mechanical search and
replace when you move them is not a problem. I'll be moving some hooks in
due course to share them between the driver and the compilers proper, and
the renaming will be one of the easiest parts of the long patch series.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc
mailing list