* [PATCH] Fix dumps for IPA passes
@ 2012-10-18 8:39 Sharad Singhai
2012-10-20 1:42 ` Sharad Singhai
0 siblings, 1 reply; 3+ messages in thread
From: Sharad Singhai @ 2012-10-18 8:39 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard Biener, Martin Jambor, David Li
Hi,
This patch fixes a problem with the new dump infrastructure as discussed in
http://gcc.gnu.org/ml/gcc/2012-10/msg00227.html.
It removes a check for current_function_decl so that dumps will work
for IPA passes. In addition, this patch also adds a new inline
function to check if any dump files are available.
I have bootstrapped and tested on x86_64. Okay for trunk?
Thanks,
Sharad
2012-10-18 Sharad Singhai <singhai@google.com>
* dumpfile.c (dump_enabled_phase): New function.
(dump_enabled_p): Rename to dump_enabled_phase. Update all callers.
A new function with the same name to check if any of the dump files
is available.
(dump_kind_p): Remove check for current_function_decl. Add check for
dumpfile and alt_dump_file.
* dumpfile.h: Add declaration of dump_enabled_p.
Index: dumpfile.c
===================================================================
--- dumpfile.c (revision 192549)
+++ dumpfile.c (working copy)
@@ -35,7 +35,7 @@ static int alt_flags; /* current op
static FILE *alt_dump_file = NULL;
static void dump_loc (int, FILE *, source_location);
-static int dump_enabled_p (int);
+static int dump_enabled_phase (int);
static FILE *dump_open_alternate_stream (struct dump_file_info *);
/* Table of tree dump switches. This must be consistent with the
@@ -380,7 +380,7 @@ dump_start (int phase, int *flag_ptr)
char *name;
struct dump_file_info *dfi;
FILE *stream;
- if (phase == TDI_none || !dump_enabled_p (phase))
+ if (phase == TDI_none || !dump_enabled_phase (phase))
return 0;
dfi = get_dump_file_info (phase);
@@ -461,7 +461,7 @@ dump_begin (int phase, int *flag_ptr)
struct dump_file_info *dfi;
FILE *stream;
- if (phase == TDI_none || !dump_enabled_p (phase))
+ if (phase == TDI_none || !dump_enabled_phase (phase))
return NULL;
name = get_dump_file_name (phase);
@@ -493,8 +493,8 @@ dump_begin (int phase, int *flag_ptr)
If PHASE is TDI_tree_all, return nonzero if any dump is enabled for
any phase. */
-int
-dump_enabled_p (int phase)
+static int
+dump_enabled_phase (int phase)
{
if (phase == TDI_tree_all)
{
@@ -514,6 +514,14 @@ dump_begin (int phase, int *flag_ptr)
}
}
+/* Return true if any of the dumps are enabled, false otherwise. */
+
+inline bool
+dump_enabled_p (void)
+{
+ return (dump_file || alt_dump_file);
+}
+
/* Returns nonzero if tree dump PHASE has been initialized. */
int
@@ -834,9 +842,8 @@ opt_info_switch_p (const char *arg)
bool
dump_kind_p (int msg_type)
{
- if (!current_function_decl)
- return 0;
- return ((msg_type & pflags) || (msg_type & alt_flags));
+ return (dump_file && (msg_type & pflags))
+ || (alt_dump_file && (msg_type & alt_flags));
}
/* Print basic block on the dump streams. */
Index: dumpfile.h
===================================================================
--- dumpfile.h (revision 192549)
+++ dumpfile.h (working copy)
@@ -121,6 +121,7 @@ extern int dump_switch_p (const char *);
extern int opt_info_switch_p (const char *);
extern const char *dump_flag_name (int);
extern bool dump_kind_p (int);
+extern inline bool dump_enabled_p (void);
extern void dump_printf (int, const char *, ...) ATTRIBUTE_PRINTF_2;
extern void dump_printf_loc (int, source_location,
const char *, ...) ATTRIBUTE_PRINTF_3;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix dumps for IPA passes
2012-10-18 8:39 [PATCH] Fix dumps for IPA passes Sharad Singhai
@ 2012-10-20 1:42 ` Sharad Singhai
2012-10-22 8:08 ` Richard Biener
0 siblings, 1 reply; 3+ messages in thread
From: Sharad Singhai @ 2012-10-20 1:42 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard Biener, Martin Jambor, David Li
As suggested in http://gcc.gnu.org/ml/gcc/2012-10/msg00285.html, I
have updated the attached patch to rename 'dump_enabled_phase' to
'dump_enabled_phase_p'. The 'dump_enabled_p ()' doesn't take any
argument and can be used as a predicate for the dump calls.
Once this patch gets in, the plan is to update the existing calls (in
vectorizer passes) of the form
if (dump_kind_p (flags))
dump_printf(flags, ...)
to
if (dump_enabled_p ())
dump_printf(flags, ...)
Bootstrapped and tested on x86_64 and didn't observe any new test
failures. Okay for trunk?
Thanks,
Sharad
2012-10-19 Sharad Singhai <singhai@google.com>
* dumpfile.c (dump_phase_enabled_p): Renamed dump_enabled_p. Update
all callers.
(dump_enabled_p): A new function to check if any of the dump files
is available.
(dump_kind_p): Remove check for current_function_decl. Add check for
dumpfile and alt_dump_file.
* dumpfile.h: Add declaration of dump_enabled_p.
Index: dumpfile.c
===================================================================
--- dumpfile.c (revision 192623)
+++ dumpfile.c (working copy)
@@ -35,7 +35,7 @@ static int alt_flags; /* current op
static FILE *alt_dump_file = NULL;
static void dump_loc (int, FILE *, source_location);
-static int dump_enabled_p (int);
+static int dump_phase_enabled_p (int);
static FILE *dump_open_alternate_stream (struct dump_file_info *);
/* Table of tree dump switches. This must be consistent with the
@@ -380,7 +380,7 @@ dump_start (int phase, int *flag_ptr)
char *name;
struct dump_file_info *dfi;
FILE *stream;
- if (phase == TDI_none || !dump_enabled_p (phase))
+ if (phase == TDI_none || !dump_phase_enabled_p (phase))
return 0;
dfi = get_dump_file_info (phase);
@@ -461,7 +461,7 @@ dump_begin (int phase, int *flag_ptr)
struct dump_file_info *dfi;
FILE *stream;
- if (phase == TDI_none || !dump_enabled_p (phase))
+ if (phase == TDI_none || !dump_phase_enabled_p (phase))
return NULL;
name = get_dump_file_name (phase);
@@ -493,8 +493,8 @@ dump_begin (int phase, int *flag_ptr)
If PHASE is TDI_tree_all, return nonzero if any dump is enabled for
any phase. */
-int
-dump_enabled_p (int phase)
+static int
+dump_phase_enabled_p (int phase)
{
if (phase == TDI_tree_all)
{
@@ -514,6 +514,14 @@ dump_begin (int phase, int *flag_ptr)
}
}
+/* Return true if any of the dumps are enabled, false otherwise. */
+
+inline bool
+dump_enabled_p (void)
+{
+ return (dump_file || alt_dump_file);
+}
+
/* Returns nonzero if tree dump PHASE has been initialized. */
int
@@ -834,9 +842,8 @@ opt_info_switch_p (const char *arg)
bool
dump_kind_p (int msg_type)
{
- if (!current_function_decl)
- return 0;
- return ((msg_type & pflags) || (msg_type & alt_flags));
+ return (dump_file && (msg_type & pflags))
+ || (alt_dump_file && (msg_type & alt_flags));
}
/* Print basic block on the dump streams. */
Index: dumpfile.h
===================================================================
--- dumpfile.h (revision 192623)
+++ dumpfile.h (working copy)
@@ -121,6 +121,7 @@ extern int dump_switch_p (const char *);
extern int opt_info_switch_p (const char *);
extern const char *dump_flag_name (int);
extern bool dump_kind_p (int);
+extern inline bool dump_enabled_p (void);
extern void dump_printf (int, const char *, ...) ATTRIBUTE_PRINTF_2;
extern void dump_printf_loc (int, source_location,
const char *, ...) ATTRIBUTE_PRINTF_3;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix dumps for IPA passes
2012-10-20 1:42 ` Sharad Singhai
@ 2012-10-22 8:08 ` Richard Biener
0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2012-10-22 8:08 UTC (permalink / raw)
To: Sharad Singhai; +Cc: gcc-patches, Martin Jambor, David Li
On Sat, Oct 20, 2012 at 3:24 AM, Sharad Singhai <singhai@google.com> wrote:
> As suggested in http://gcc.gnu.org/ml/gcc/2012-10/msg00285.html, I
> have updated the attached patch to rename 'dump_enabled_phase' to
> 'dump_enabled_phase_p'. The 'dump_enabled_p ()' doesn't take any
> argument and can be used as a predicate for the dump calls.
>
> Once this patch gets in, the plan is to update the existing calls (in
> vectorizer passes) of the form
> if (dump_kind_p (flags))
> dump_printf(flags, ...)
>
> to
>
> if (dump_enabled_p ())
> dump_printf(flags, ...)
>
> Bootstrapped and tested on x86_64 and didn't observe any new test
> failures. Okay for trunk?
Ok.
Thanks,
Richard.
> Thanks,
> Sharad
>
> 2012-10-19 Sharad Singhai <singhai@google.com>
>
> * dumpfile.c (dump_phase_enabled_p): Renamed dump_enabled_p. Update
> all callers.
> (dump_enabled_p): A new function to check if any of the dump files
> is available.
> (dump_kind_p): Remove check for current_function_decl. Add check for
> dumpfile and alt_dump_file.
> * dumpfile.h: Add declaration of dump_enabled_p.
>
> Index: dumpfile.c
> ===================================================================
> --- dumpfile.c (revision 192623)
> +++ dumpfile.c (working copy)
> @@ -35,7 +35,7 @@ static int alt_flags; /* current op
> static FILE *alt_dump_file = NULL;
>
> static void dump_loc (int, FILE *, source_location);
> -static int dump_enabled_p (int);
> +static int dump_phase_enabled_p (int);
> static FILE *dump_open_alternate_stream (struct dump_file_info *);
>
> /* Table of tree dump switches. This must be consistent with the
> @@ -380,7 +380,7 @@ dump_start (int phase, int *flag_ptr)
> char *name;
> struct dump_file_info *dfi;
> FILE *stream;
> - if (phase == TDI_none || !dump_enabled_p (phase))
> + if (phase == TDI_none || !dump_phase_enabled_p (phase))
> return 0;
>
> dfi = get_dump_file_info (phase);
> @@ -461,7 +461,7 @@ dump_begin (int phase, int *flag_ptr)
> struct dump_file_info *dfi;
> FILE *stream;
>
> - if (phase == TDI_none || !dump_enabled_p (phase))
> + if (phase == TDI_none || !dump_phase_enabled_p (phase))
> return NULL;
>
> name = get_dump_file_name (phase);
> @@ -493,8 +493,8 @@ dump_begin (int phase, int *flag_ptr)
> If PHASE is TDI_tree_all, return nonzero if any dump is enabled for
> any phase. */
>
> -int
> -dump_enabled_p (int phase)
> +static int
> +dump_phase_enabled_p (int phase)
> {
> if (phase == TDI_tree_all)
> {
> @@ -514,6 +514,14 @@ dump_begin (int phase, int *flag_ptr)
> }
> }
>
> +/* Return true if any of the dumps are enabled, false otherwise. */
> +
> +inline bool
> +dump_enabled_p (void)
> +{
> + return (dump_file || alt_dump_file);
> +}
> +
> /* Returns nonzero if tree dump PHASE has been initialized. */
>
> int
> @@ -834,9 +842,8 @@ opt_info_switch_p (const char *arg)
> bool
> dump_kind_p (int msg_type)
> {
> - if (!current_function_decl)
> - return 0;
> - return ((msg_type & pflags) || (msg_type & alt_flags));
> + return (dump_file && (msg_type & pflags))
> + || (alt_dump_file && (msg_type & alt_flags));
> }
>
> /* Print basic block on the dump streams. */
> Index: dumpfile.h
> ===================================================================
> --- dumpfile.h (revision 192623)
> +++ dumpfile.h (working copy)
> @@ -121,6 +121,7 @@ extern int dump_switch_p (const char *);
> extern int opt_info_switch_p (const char *);
> extern const char *dump_flag_name (int);
> extern bool dump_kind_p (int);
> +extern inline bool dump_enabled_p (void);
> extern void dump_printf (int, const char *, ...) ATTRIBUTE_PRINTF_2;
> extern void dump_printf_loc (int, source_location,
> const char *, ...) ATTRIBUTE_PRINTF_3;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-10-22 8:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-18 8:39 [PATCH] Fix dumps for IPA passes Sharad Singhai
2012-10-20 1:42 ` Sharad Singhai
2012-10-22 8:08 ` Richard Biener
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).