From 29b54a9d2d9fbefe57589a69d8e992d3e3b4bd99 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 28 Jun 2018 14:55:42 +0000 Subject: Hide alt_dump_file within dumpfile.c This patch removes alt_dump_file from dumpfile.h, making it static within dumpfile.c. This allows for changing how -fopt-info is implemented, and potentially adding other kinds of dump target, such as remarks or optimization records. Doing so requires changing the implementation of dump_enabled_p, so the patch changes this to a simple lookup of a boolean global, which is updated any time dump_file or alt_dump_file change. gcc/ChangeLog: * cgraph.c (cgraph_node::get_body): Replace assignments to "dump_file" with calls to set_dump_file. * dumpfile.c (alt_dump_file): Make static, and group with... (alt_flags): ...this definition. (dumps_are_enabled): New variable. (refresh_dumps_are_enabled): New function. (set_dump_file): New function. (set_alt_dump_file): New function. (gcc::dump_manager::dump_start): Replace assignments to "dump_file" and "alt_dump_file" with calls to set_dump_file and set_alt_dump_file. (gcc::dump_manager::dump_finish): Likewise. * dumpfile.h (alt_dump_file): Delete decl. (dumps_are_enabled): New variable decl. (set_dump_file): New function decl. (dump_enabled_p): Rewrite in terms of new "dumps_are_enabled" global. * tree-nested.c (lower_nested_functions): Replace assignments to "dump_file" with calls to set_dump_file. From-SVN: r262220 --- gcc/dumpfile.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc/dumpfile.h') diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h index 90d8930..489f92e 100644 --- a/gcc/dumpfile.h +++ b/gcc/dumpfile.h @@ -445,15 +445,18 @@ extern void dump_bb (FILE *, basic_block, int, dump_flags_t); /* Global variables used to communicate with passes. */ extern FILE *dump_file; -extern FILE *alt_dump_file; extern dump_flags_t dump_flags; extern const char *dump_file_name; +extern bool dumps_are_enabled; + +extern void set_dump_file (FILE *new_dump_file); + /* Return true if any of the dumps is enabled, false otherwise. */ static inline bool dump_enabled_p (void) { - return (dump_file || alt_dump_file); + return dumps_are_enabled; } namespace gcc { -- cgit v1.1