On 07/26/2013 09:04 AM, David Malcolm wrote:
gcc/
        * Makefile.in (PIPELINE_H): New.
        (lto-cgraph.o): Depend on CONTEXT_H and PIPELINE_H.
        (passes.o): Likewise.
        (statistics.o): Likewise.
        (cgraphunit.o): Likewise.
        (context.o): Depend on PIPELINE_H.

        * pipeline.h: New.

        * cgraphunit.c (cgraph_add_new_function): Update for moves
        of globals to fields of pipeline.
        (analyze_function): Likewise.
        (expand_function): Likewise.
        (ipa_passes): Likewise.
        (compile): Likewise.

        * context.c (context::context): New.
        * context.h  (context::context): New.
        (context::get_passes): New.
        (context::passes_): New.

        * lto-cgraph.c (input_node): Update for moves of globals to
        fields of pipeline.

        * passes.c (all_passes): Remove, in favor of a field of the
        same name within the new class pipeline.
        (all_small_ipa_passes): Likewise.
        (all_lowering_passes): Likewise.
        (all_regular_ipa_passes): Likewise.
        (all_late_ipa_passes): Likewise.
        (all_lto_gen_passes): Likewise.
        (passes_by_id): Likewise.
        (passes_by_id_size): Likewise.
        (gcc_pass_lists): Remove, in favor of "pass_lists" field within
        the new class pipeline.
        (set_pass_for_id): Convert to...
        (pipeline::set_pass_for_id): ...method.
        (get_pass_for_id): Convert to...
        (pipeline::get_pass_for_id): ...method.
        (register_one_dump_file): Move body of implementation into...
        (pipeline::register_one_dump_file): ...here.
        (register_dump_files_1): Convert to...
        (pipeline::register_dump_files_1): ...method.
        (register_dump_files): Convert to...
        (pipeline::register_dump_files): ...method.
        (create_pass_tab): Update for moves of globals to fields of
        pipeline.
        (dump_passes): Move body of implementation into...
        (pipeline::dump_passes): ...here.
        (register_pass): Move body of implementation into...
        (pipeline::register_pass): ...here.
        (init_optimization_passes): Convert into...
        (pipeline::pipeline): ...constructor for new pipeline class, and
        initialize the pass_lists array.
        (check_profile_consistency): Update for moves of globals to
        fields of pipeline.
        (dump_profile_report): Move body of implementation into...
        (pipeline::dump_profile_report): ...here.
        (ipa_write_summaries_1): Update for moves of pass lists from
        being globals to fields of pipeline.
        (ipa_write_optimization_summaries): Likewise.
        (ipa_read_summaries):  Likewise.
        (ipa_read_optimization_summaries): Likewise.
        (execute_all_ipa_stmt_fixups): Likewise.

        * statistics.c (statistics_fini): Update for moves of globals to
        fields of pipeline.

        * toplev.c (general_init): Replace call to
        init_optimization_passes with construction of the pipeline
        instance.

        * tree-pass.h (all_passes): Remove, in favor of a field of the
        same name within the new class pipeline.
        (all_small_ipa_passes): Likewise.
        (all_lowering_passes): Likewise.
        (all_regular_ipa_passes): Likewise.
        (all_lto_gen_passes): Likewise.
        (all_late_ipa_passes): Likewise.
        (passes_by_id): Likewise.
        (passes_by_id_size): Likewise.
        (gcc_pass_lists): Remove, in favor of "pass_lists" field within
        the new class pipeline.
        (get_pass_for_id): Remove.

gcc/lto/

        * Make-lang.in (lto/lto.o:): Depend on CONTEXT_H and
        PIPELINE_H.

        * lto.c (do_whole_program_analysis): Update for move of
        all_regular_ipa_passes from a global to a field of class
        pipeline.
So as has been discussed elsewhere I'd like to see pipeline changed to pass_manager.

WRT references. Not being a C++ guy, I'd always mentally equated references with pointers. I've done a little reading and it seems that references actually convey more information, which I'm generally a fan of -- with the caveat that they're pointers that act more like values, which might get confusing.

At least in the immediate term, I think we should stick with pointers until we have a clearer sense of whether or not we want to be using references in this way. I doubt it's terribly important, but the non-nullness ought to be expressable via an attribute.

With the pipeline->pass_manager change and using pointers instead of references on the return type, this patch is fine. Pre-approved with those changes.

Jeff

Reply via email to