From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20333 invoked by alias); 5 Apr 2012 13:55:11 -0000 Received: (qmail 20313 invoked by uid 22791); 5 Apr 2012 13:55:09 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 05 Apr 2012 13:54:46 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 444969D8A6 for ; Thu, 5 Apr 2012 15:54:45 +0200 (CEST) Date: Thu, 05 Apr 2012 13:55:00 -0000 From: Richard Guenther To: gcc-patches@gcc.gnu.org Cc: Jan Hubicka Subject: [PATCH][1/n] Cleanup global pass execution flow Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-04/txt/msg00283.txt.bz2 I'm trying to get an idea where and why we execute what part of the pass pipeline (yeah, a two-line patch doing -Og should be possible after this series ...). This patch removes an odd caller of execute_pass_list (pass_early_local_passes.pass.sub), named tree_lowering_passes, which is even undocumented. The two callers will end up executing distinct parts of the function and the function performs unnecessary setup. Thus I inlined the function into its two callers. I'm not sure about the history of tree_lowering_passes but freeing up stuff and compacting blocks is not done consistently at least ;) The idea is obviously to save memory. I'll give this the usual bootstrap & regtest testing. Honza, does this look ok? I am going to continue this way until I can re-architect the toplevel pass structure in a way that we hand control more to the pass manager. Well, hopefully ;) Thanks, Richard. 2012-04-05 Richard Guenther * tree-pass.h (tree_lowering_passes): Remove. * tree-optimize.c (tree_lowering_passes): Remove. * cgraph.c (cgraph_add_new_function): Inline relevant parts of tree_lowering_passes, avoid redundant call of early local passes. * cgraphunit.c (cgraph_lower_function): Fold into ... (cgraph_analyze_function): ... its single caller. Inline relevant parts of tree_lowering_passes. Index: gcc/tree-pass.h =================================================================== *** gcc/tree-pass.h (revision 186163) --- gcc/tree-pass.h (working copy) *************** struct register_pass_info *** 349,356 **** enum pass_positioning_ops pos_op; /* how to insert the new pass. */ }; - extern void tree_lowering_passes (tree decl); - extern struct gimple_opt_pass pass_mudflap_1; extern struct gimple_opt_pass pass_mudflap_2; extern struct gimple_opt_pass pass_lower_cf; --- 349,354 ---- Index: gcc/tree-optimize.c =================================================================== *** gcc/tree-optimize.c (revision 186163) --- gcc/tree-optimize.c (working copy) *************** struct gimple_opt_pass pass_init_datastr *** 366,391 **** 0 /* todo_flags_finish */ } }; - - void - tree_lowering_passes (tree fn) - { - tree saved_current_function_decl = current_function_decl; - - current_function_decl = fn; - push_cfun (DECL_STRUCT_FUNCTION (fn)); - gimple_register_cfg_hooks (); - bitmap_obstack_initialize (NULL); - execute_pass_list (all_lowering_passes); - if (optimize && cgraph_global_info_ready) - execute_pass_list (pass_early_local_passes.pass.sub); - free_dominance_info (CDI_POST_DOMINATORS); - free_dominance_info (CDI_DOMINATORS); - compact_blocks (); - current_function_decl = saved_current_function_decl; - bitmap_obstack_release (NULL); - pop_cfun (); - } /* For functions-as-trees languages, this performs all optimization and compilation for FNDECL. */ --- 366,371 ---- Index: gcc/cgraph.c =================================================================== *** gcc/cgraph.c (revision 186163) --- gcc/cgraph.c (working copy) *************** cgraph_add_new_function (tree fndecl, bo *** 2437,2446 **** push_cfun (DECL_STRUCT_FUNCTION (fndecl)); current_function_decl = fndecl; gimple_register_cfg_hooks (); - tree_lowering_passes (fndecl); bitmap_obstack_initialize (NULL); ! if (!gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl))) ! execute_pass_list (pass_early_local_passes.pass.sub); bitmap_obstack_release (NULL); pop_cfun (); current_function_decl = NULL; --- 2437,2445 ---- push_cfun (DECL_STRUCT_FUNCTION (fndecl)); current_function_decl = fndecl; gimple_register_cfg_hooks (); bitmap_obstack_initialize (NULL); ! execute_pass_list (all_lowering_passes); ! execute_pass_list (pass_early_local_passes.pass.sub); bitmap_obstack_release (NULL); pop_cfun (); current_function_decl = NULL; Index: gcc/cgraphunit.c =================================================================== *** gcc/cgraphunit.c (revision 186163) --- gcc/cgraphunit.c (working copy) *************** cgraph_reset_node (struct cgraph_node *n *** 313,332 **** cgraph_node_remove_callees (node); } - static void - cgraph_lower_function (struct cgraph_node *node) - { - if (node->lowered) - return; - - if (node->nested) - lower_nested_functions (node->decl); - gcc_assert (!node->nested); - - tree_lowering_passes (node->decl); - node->lowered = true; - } - /* DECL has been parsed. Take it, queue it, compile it at the whim of the logic in effect. If NESTED is true, then our caller cannot stand to have the garbage collector run at the moment. We would need to either create --- 313,318 ---- *************** cgraph_analyze_function (struct cgraph_n *** 915,921 **** gimplify_function_tree (decl); dump_function (TDI_generic, decl); ! cgraph_lower_function (node); pop_cfun (); } node->analyzed = true; --- 901,923 ---- gimplify_function_tree (decl); dump_function (TDI_generic, decl); ! /* Lower the function. */ ! if (!node->lowered) ! { ! if (node->nested) ! lower_nested_functions (node->decl); ! gcc_assert (!node->nested); ! ! gimple_register_cfg_hooks (); ! bitmap_obstack_initialize (NULL); ! execute_pass_list (all_lowering_passes); ! free_dominance_info (CDI_POST_DOMINATORS); ! free_dominance_info (CDI_DOMINATORS); ! compact_blocks (); ! bitmap_obstack_release (NULL); ! node->lowered = true; ! } ! pop_cfun (); } node->analyzed = true;