This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Introduce gcc::dump_manager class
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: David Malcolm <dmalcolm at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 14 Oct 2013 12:13:09 +0200
- Subject: Re: [PATCH] Introduce gcc::dump_manager class
- Authentication-results: sourceware.org; auth=none
- References: <1381541486 dot 1809 dot 14 dot camel at surprise>
On Sat, Oct 12, 2013 at 3:31 AM, David Malcolm <dmalcolm@redhat.com> wrote:
> When repeatedly compiling within one process, the dumpfile numbering
> doesn't reset, leading to dumpfiles after the initial ones having
> unpredictable numbers like here (-fdump-tree-all at -O0):
>
> fake.c.000i.cgraph
> fake.c.004t.gimple
> fake.c.1477t.omplower
> fake.c.1478t.lower
> (etc)
>
> Note the large (and increasing) leap in the numbering from the base
> dumpfiles which get consistent numbering (000, 004 here) to the
> autonumbered ones (1477 in this example). This was due to this implicit
> state within dump_register:
>
> static int next_dump = FIRST_AUTO_NUMBERED_DUMP;
> int num = next_dump++;
>
> messing up the numbering on subsequent in-process creation of passes.
>
> This patch introduces a new gcc::dump_manager class to hold such state,
> with a singleton owned by the gcc::context, fixing the inconsistent
> dumpfile numbering.
>
> Specifically, the following variables from dumpfile.c are moved from
> being statically allocated to being fields of gcc::dump_manager (gaining
> "m_" prefixes):
>
> * next_dump
> * extra_dump_files
> * extra_dump_files_in_use
> * extra_dump_files_alloced
>
> Potentially other aspects of dumping could be moved here, but this
> seemed like a logically self-contained change.
>
> Successfully bootstrapped and regtested on x86_64-unknown-linux.
>
> OK for trunk?
Why can't we have the dump numbering determined at the same time
we build up the pass pipeline? That is, why are gcc:dump_manager
and gcc:pass_manager separate at all?
That said, the patch is a trivial re-org and thus ok.
Thanks,
Richard.
> (I've already applied this to the "dmalcolm/jit" branch as commits
> 190e9835a3ad4f43abf68aa7e400597d992525be
> 6c1464cdf7c9644383796b0ff5f1756d5279d6cb
> c07d4be4d6e3e732ba36a5ac7b69cce461c44c79)
>
> gcc/
> * dumpfile.h (gcc::dump_manager): New class, to hold state
> relating to dumpfile management.
> (get_dump_file_name): Remove in favor of method of dump_manager.
> (dump_initialized_p): Likewise.
> (dump_start): Likewise.
> (dump_finish): Likewise.
> (dump_switch_p): Likewise.
> (dump_register): Likewise.
> (get_dump_file_info): Likewise.
> * context.c (gcc::context::context): Construct the dump_manager
> instance.
> * context.h (gcc::context::get_dumps): New.
> (gcc::context::m_dumps): New.
> * coverage.c (coverage_init): Port to dump_manager API.
> * dumpfile.c (extra_dump_files): Convert to field of
> gcc::dump_manager.
> (extra_dump_files_in_use): Likewise.
> (extra_dump_files_alloced): Likewise.
> (gcc::dump_manager::dump_manager): New.
> (dump_register): Convert to...
> (gcc::dump_manager::dump_register): ...method, replacing
> function-static next_dump with m_next_dump field.
> (get_dump_file_info): Convert to...
> (gcc::dump_manager::get_dump_file_info): ...method.
> (get_dump_file_name): Convert to...
> (gcc::dump_manager::get_dump_file_name): ...method.
> (dump_start): Convert to...
> (gcc::dump_manager::dump_start): ...method.
> (dump_finish): Convert to...
> (gcc::dump_manager::dump_finish): ...method.
> (dump_begin): Replace body with...
> (gcc::dump_manager::dump_begin): ...new method.
> (dump_phase_enabled_p): Convert to...
> (gcc::dump_manager::dump_phase_enabled_p): ...method.
> (dump_phase_enabled_p): Convert to...
> (gcc::dump_manager::dump_phase_enabled_p): ...method.
> (dump_initialized_p): Convert to...
> (gcc::dump_manager::dump_initialized_p): ...method.
> (dump_flag_name): Replace body with...
> (gcc::dump_manager::dump_flag_name): ...new method.
> (dump_enable_all): Convert to...
> (gcc::dump_manager::dump_enable_all): ...new method.
> (opt_info_enable_passes): Convert to...
> (gcc::dump_manager::opt_info_enable_passes): ...new method.
> (dump_switch_p_1): Convert to...
> (gcc::dump_manager::dump_switch_p_1): ...new method.
> (dump_switch_p): Convert to...
> (gcc::dump_manager::dump_switch_p): ...new method.
> (opt_info_switch_p): Port to dump_manager API.
> (enable_rtl_dump_file): Likewise.
> * opts-global.c (handle_common_deferred_options): Port to new
> dump_manager API.
> * passes.c (pass_manager::finish_optimization_passes): Likewise.
> (pass_manager::register_one_dump_file): Likewise.
> (pass_manager::register_pass): Likewise.
> (pass_init_dump_file): Likewise.
> (pass_fini_dump_file): Likewise.
> * statistics.c (statistics_early_init): Likewise.
>
> gcc/java/
> * lang.c (java_handle_option): Update for introduction of
> gcc::dump_manager.
>