Commit 74911c3c by Sharad Singhai Committed by Sharad Singhai

dumpfile.c (dump_phase_enabled_p): Renamed dump_enabled_p.

2012-10-22  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.

From-SVN: r192692
parent 4caaa462
2012-10-22 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.
2012-10-22 Richard Biener <rguenther@suse.de> 2012-10-22 Richard Biener <rguenther@suse.de>
PR lto/55021 PR lto/55021
...@@ -35,7 +35,7 @@ static int alt_flags; /* current opt_info flags */ ...@@ -35,7 +35,7 @@ static int alt_flags; /* current opt_info flags */
static FILE *alt_dump_file = NULL; static FILE *alt_dump_file = NULL;
static void dump_loc (int, FILE *, source_location); 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 *); static FILE *dump_open_alternate_stream (struct dump_file_info *);
/* Table of tree dump switches. This must be consistent with the /* Table of tree dump switches. This must be consistent with the
...@@ -380,7 +380,7 @@ dump_start (int phase, int *flag_ptr) ...@@ -380,7 +380,7 @@ dump_start (int phase, int *flag_ptr)
char *name; char *name;
struct dump_file_info *dfi; struct dump_file_info *dfi;
FILE *stream; FILE *stream;
if (phase == TDI_none || !dump_enabled_p (phase)) if (phase == TDI_none || !dump_phase_enabled_p (phase))
return 0; return 0;
dfi = get_dump_file_info (phase); dfi = get_dump_file_info (phase);
...@@ -461,7 +461,7 @@ dump_begin (int phase, int *flag_ptr) ...@@ -461,7 +461,7 @@ dump_begin (int phase, int *flag_ptr)
struct dump_file_info *dfi; struct dump_file_info *dfi;
FILE *stream; FILE *stream;
if (phase == TDI_none || !dump_enabled_p (phase)) if (phase == TDI_none || !dump_phase_enabled_p (phase))
return NULL; return NULL;
name = get_dump_file_name (phase); name = get_dump_file_name (phase);
...@@ -493,8 +493,8 @@ dump_begin (int phase, int *flag_ptr) ...@@ -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 If PHASE is TDI_tree_all, return nonzero if any dump is enabled for
any phase. */ any phase. */
int static int
dump_enabled_p (int phase) dump_phase_enabled_p (int phase)
{ {
if (phase == TDI_tree_all) if (phase == TDI_tree_all)
{ {
...@@ -514,6 +514,14 @@ dump_enabled_p (int phase) ...@@ -514,6 +514,14 @@ dump_enabled_p (int phase)
} }
} }
/* 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. */ /* Returns nonzero if tree dump PHASE has been initialized. */
int int
...@@ -834,9 +842,8 @@ opt_info_switch_p (const char *arg) ...@@ -834,9 +842,8 @@ opt_info_switch_p (const char *arg)
bool bool
dump_kind_p (int msg_type) dump_kind_p (int msg_type)
{ {
if (!current_function_decl) return (dump_file && (msg_type & pflags))
return 0; || (alt_dump_file && (msg_type & alt_flags));
return ((msg_type & pflags) || (msg_type & alt_flags));
} }
/* Print basic block on the dump streams. */ /* Print basic block on the dump streams. */
......
...@@ -121,6 +121,7 @@ extern int dump_switch_p (const char *); ...@@ -121,6 +121,7 @@ extern int dump_switch_p (const char *);
extern int opt_info_switch_p (const char *); extern int opt_info_switch_p (const char *);
extern const char *dump_flag_name (int); extern const char *dump_flag_name (int);
extern bool dump_kind_p (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 (int, const char *, ...) ATTRIBUTE_PRINTF_2;
extern void dump_printf_loc (int, source_location, extern void dump_printf_loc (int, source_location,
const char *, ...) ATTRIBUTE_PRINTF_3; const char *, ...) ATTRIBUTE_PRINTF_3;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment