diff options
author | Kito Cheng <kito.cheng@sifive.com> | 2020-11-20 15:52:53 +0800 |
---|---|---|
committer | Kito Cheng <kito.cheng@sifive.com> | 2022-09-02 17:23:50 +0800 |
commit | 5ca9980fc86242505ffdaaf62bca1fd5db26550b (patch) | |
tree | 521cee052ab40f5e473ae4731286addd34f6c678 /gcc/doc/tm.texi | |
parent | 347dec125b662bdeb6d426ead3449e1209c2ce28 (diff) | |
download | gcc-5ca9980fc86242505ffdaaf62bca1fd5db26550b.zip gcc-5ca9980fc86242505ffdaaf62bca1fd5db26550b.tar.gz gcc-5ca9980fc86242505ffdaaf62bca1fd5db26550b.tar.bz2 |
Add TARGET_COMPUTE_MULTILIB hook to override multi-lib result.
Create a new hook to let target could override the multi-lib result,
the motivation is RISC-V might have very complicated multi-lib re-use
rule*, which is hard to maintain and use current multi-lib scripts,
we even hit the "argument list too long" error when we tried to add more
multi-lib reuse rule.
So I think it would be great to have a target specific way to determine
the multi-lib re-use rule, then we could write those rule in C, instead
of expand every possible case in MULTILIB_REUSE.
* Here is an example for RISC-V multi-lib rules:
https://gist.github.com/kito-cheng/0289cd42d9a756382e5afeb77b42b73b
gcc/ChangeLog:
* common/common-target.def (compute_multilib): New.
* common/common-targhooks.h (default_compute_multilib): New.
* common/common-targhooks.cc (default_compute_multilib): New.
* doc/tm.texi.in (TARGET_COMPUTE_MULTILIB): New.
* doc/tm.texi: Regen.
* gcc.cc: Include common/common-target.h.
(set_multilib_dir) Call targetm_common.compute_multilib.
(SWITCH_LIVE): Move to opts.h.
(SWITCH_FALSE): Ditto.
(SWITCH_IGNORE): Ditto.
(SWITCH_IGNORE_PERMANENTLY): Ditto.
(SWITCH_KEEP_FOR_GCC): Ditto.
(struct switchstr): Ditto.
* opts.h (SWITCH_LIVE): Move from gcc.c.
(SWITCH_FALSE): Ditto.
(SWITCH_IGNORE): Ditto.
(SWITCH_IGNORE_PERMANENTLY): Ditto.
(SWITCH_KEEP_FOR_GCC): Ditto.
(struct switchstr): Ditto.
Diffstat (limited to 'gcc/doc/tm.texi')
-rw-r--r-- | gcc/doc/tm.texi | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 431b414..11be5d0 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -778,6 +778,23 @@ options are changed via @code{#pragma GCC optimize} or by using the Set target-dependent initial values of fields in @var{opts}. @end deftypefn +@deftypefn {Common Target Hook} {const char *} TARGET_COMPUTE_MULTILIB (const struct switchstr *@var{switches}, int @var{n_switches}, const char *@var{multilib_dir}, const char *@var{multilib_defaults}, const char *@var{multilib_select}, const char *@var{multilib_matches}, const char *@var{multilib_exclusions}, const char *@var{multilib_reuse}) +Some targets like RISC-V might have complicated multilib reuse rules which +are hard to implement with the current multilib scheme. This hook allows +targets to override the result from the built-in multilib mechanism. +@var{switches} is the raw option list with @var{n_switches} items; +@var{multilib_dir} is the multi-lib result which is computed by the built-in +multi-lib mechanism; +@var{multilib_defaults} is the default options list for multi-lib; +@var{multilib_select} is the string containing the list of supported +multi-libs, and the option checking list. +@var{multilib_matches}, @var{multilib_exclusions}, and @var{multilib_reuse} +are corresponding to @var{MULTILIB_MATCHES}, @var{MULTILIB_EXCLUSIONS}, +and @var{MULTILIB_REUSE}. +The default definition does nothing but return @var{multilib_dir} directly. +@end deftypefn + + @defmac SWITCHABLE_TARGET Some targets need to switch between substantially different subtargets during compilation. For example, the MIPS target has one subtarget for |