The internals manual says that a backend for $target should have
$target.h and $target-protos.h files, but doesn't say what the
difference between them is or what belongs in which file. Current
practice seems to be a mix of
(1) $target.h contains macro definitions and $target-protos.h contains
extern declarations.
(2) $target.h defines the external interface to the backend (the macros
documented in the internals manual) and $target-protos.h contains things
shared between $target.c and the various .md files.
But some generic source files include $target.h only and some source
files include both, which wouldn't be true if either of the above models
applied. So is there some other logical way to explain the difference
and what goes where?
The thing that got me thinking about this is looking at a new port
originally written by a customer, where it seems like there is too much
stuff in $target.h. Then I started chasing it down....
- FUNCTION_BOUNDARY depends on which arch variant is being compiled for
- Its expansion references some internal target data structures and
enumerators to look up that info
- The default definition of TARGET_PTRMEMFUNC_VBIT_LOCATION uses
FUNCTION_BOUNDARY
- ipa-prop.c uses TARGET_PTRMEMFUNC_VBIT_LOCATION but doesn't include
$target-protos.h
- tree.c also uses FUNCTION_BOUNDARY directly without including
$target-protos.h
- Probably there are many other target macros that potentially have
similar issues
- Presumably this means everything referenced in the expansion of any
target macro in $target.h also needs to be declared in $target.h and not
depend on $target-protos.h also being included at the point of use.
So what is the purpose of having a separate $target-protos.h?
-Sandra the confused