diff options
author | Nathan Sidwell <nathan@acm.org> | 2023-05-17 19:27:13 -0400 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2023-05-19 18:48:43 -0400 |
commit | 97a36b466ba1420210294f0a1dd7002054ba3b7e (patch) | |
tree | 730854b5c15bef5b9b46705aebeef88dd4030d16 /gcc | |
parent | 259b4b7d349dd3fd560144bd4617f526458b45dc (diff) | |
download | gcc-97a36b466ba1420210294f0a1dd7002054ba3b7e.zip gcc-97a36b466ba1420210294f0a1dd7002054ba3b7e.tar.gz gcc-97a36b466ba1420210294f0a1dd7002054ba3b7e.tar.bz2 |
Allow plugin dumps
Defer dump option parsing until plugins are initialized. This allows one to
use plugin names for dumps.
PR other/99451
gcc/
* opts.h (handle_deferred_dump_options): Declare.
* opts-global.cc (handle_common_deferred_options): Do not handle
dump options here.
(handle_deferred_dump_options): New.
* toplev.cc (toplev::main): Call it after plugin init.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/opts-global.cc | 20 | ||||
-rw-r--r-- | gcc/opts.h | 1 | ||||
-rw-r--r-- | gcc/toplev.cc | 4 |
3 files changed, 24 insertions, 1 deletions
diff --git a/gcc/opts-global.cc b/gcc/opts-global.cc index 0541691..a61c701 100644 --- a/gcc/opts-global.cc +++ b/gcc/opts-global.cc @@ -401,7 +401,7 @@ handle_common_deferred_options (void) break; case OPT_fdump_: - g->get_dumps ()->dump_switch_p (opt->arg); + /* Deferred until plugins initialized. */ break; case OPT_fopt_info_: @@ -494,3 +494,21 @@ handle_common_deferred_options (void) } } } + +/* Handle deferred dump options. */ + +void +handle_deferred_dump_options (void) +{ + unsigned int i; + cl_deferred_option *opt; + vec<cl_deferred_option> v; + + if (common_deferred_options) + v = *((vec<cl_deferred_option> *) common_deferred_options); + else + v = vNULL; + FOR_EACH_VEC_ELT (v, i, opt) + if (opt->opt_index == OPT_fdump_) + g->get_dumps ()->dump_switch_p (opt->arg); +} @@ -425,6 +425,7 @@ extern void control_warning_option (unsigned int opt_index, int kind, extern char *write_langs (unsigned int mask); extern void print_ignored_options (void); extern void handle_common_deferred_options (void); +extern void handle_deferred_dump_options (void); unsigned int parse_sanitizer_options (const char *, location_t, int, unsigned int, int, bool); diff --git a/gcc/toplev.cc b/gcc/toplev.cc index 8aec9a2..6c1a6f4 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -2253,6 +2253,10 @@ toplev::main (int argc, char **argv) initialize_plugins (); + /* Handle the dump options now that plugins have had a chance to install new + passes. */ + handle_deferred_dump_options (); + if (version_flag) print_version (stderr, "", true); |