public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* $target.h vs $target-protos.h
@ 2018-02-18 17:53 Sandra Loosemore
  2018-02-18 19:10 ` Joseph Myers
  2018-02-25 19:24 ` Georg-Johann Lay
  0 siblings, 2 replies; 8+ messages in thread
From: Sandra Loosemore @ 2018-02-18 17:53 UTC (permalink / raw)
  To: gcc

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-02-25 19:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-18 17:53 $target.h vs $target-protos.h Sandra Loosemore
2018-02-18 19:10 ` Joseph Myers
2018-02-18 22:55   ` Sandra Loosemore
2018-02-19 16:45     ` Joseph Myers
2018-02-19 17:35       ` Sandra Loosemore
2018-02-19 17:51         ` Joseph Myers
2018-02-23 18:12           ` Richard Sandiford
2018-02-25 19:24 ` Georg-Johann Lay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).