public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Allow plugin-specific dumps
@ 2023-05-17 23:38 Nathan Sidwell
  2023-05-19 17:56 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Sidwell @ 2023-05-17 23:38 UTC (permalink / raw)
  To: GCC Patches, Richard Guenther

[-- Attachment #1: Type: text/plain, Size: 232 bytes --]

PR 99451 is about the inability to name tree and rtl dumps by plugin name.  And 
includes a patch.  But then I worked around the problem and forgot about it. 
Here it is again, retested against trunk.

ok?

nathan
-- 
Nathan Sidwell

[-- Attachment #2: 0001-Allow-plugin-dumps.patch --]
[-- Type: text/x-patch, Size: 2475 bytes --]

From e54518bc5e59ef5cdc21c652ceac41bd0c0f436c Mon Sep 17 00:00:00 2001
From: Nathan Sidwell <nathan@acm.org>
Date: Wed, 17 May 2023 19:27:13 -0400
Subject: [PATCH] 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.
---
 gcc/opts-global.cc | 20 +++++++++++++++++++-
 gcc/opts.h         |  1 +
 gcc/toplev.cc      |  4 ++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/gcc/opts-global.cc b/gcc/opts-global.cc
index 054169158b1..a61c701621d 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);
+}
diff --git a/gcc/opts.h b/gcc/opts.h
index 9959a440ca1..00f377f9ca7 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -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 d53b5e78ae3..c606a0697b7 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);
 
-- 
2.40.1


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

* Re: [patch] Allow plugin-specific dumps
  2023-05-17 23:38 [patch] Allow plugin-specific dumps Nathan Sidwell
@ 2023-05-19 17:56 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2023-05-19 17:56 UTC (permalink / raw)
  To: Nathan Sidwell, GCC Patches, Richard Guenther



On 5/17/23 17:38, Nathan Sidwell via Gcc-patches wrote:
> PR 99451 is about the inability to name tree and rtl dumps by plugin 
> name.  And includes a patch.  But then I worked around the problem and 
> forgot about it. Here it is again, retested against trunk.
> 
> ok?
> 
> nathan
> -- 
> Nathan Sidwell
> 
> 0001-Allow-plugin-dumps.patch
> 
>  From e54518bc5e59ef5cdc21c652ceac41bd0c0f436c Mon Sep 17 00:00:00 2001
> From: Nathan Sidwell<nathan@acm.org>
> Date: Wed, 17 May 2023 19:27:13 -0400
> Subject: [PATCH] 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.
OK.
jeff

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

end of thread, other threads:[~2023-05-19 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-17 23:38 [patch] Allow plugin-specific dumps Nathan Sidwell
2023-05-19 17:56 ` Jeff Law

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).