This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CFG transparent inlining


On Friday 29 April 2005 15:42, Jan Hubicka wrote:
> Hi,
> this patch makes the inlining happen on CFG.

And jumbo says: "Ping!"

(The patch is here: http://gcc.gnu.org/ml/gcc-patches/2005-04/msg02956.html)

Gr.
Steven


> 2005-04-28  Jan Hubicka  <jh@suse.cz>
>
> 	* tree-inline.c (execute_fixup_cfg): New function
> 	(pass_fixup_cfg): New variable.
> 	(init_tree_optimization_passes): Add new pass.
>
> 2005-04-26  Steven Bosscher  <stevenb@suse.de>
>
> 	* tree-inline.c: Fix various boring code style and white space issues.
>
> 2005-04-21  Jan Hubicka  <jh@suse.cz>
>
> 	* basic-block.h (FOR_ALL_BB_FN): New macro.
> 	* cfg.c (init_flow): Allocate the CFG.
> 	* cgraphunit.c (cgraph_finalize_function): Modify checking of presence
> 	of cfg.
> 	* except.c (duplicate_eh_regions): New argument outer_region; simplify.
> 	(get_eh_cur_region, set_eh_cur_region): Kill.
> 	* except.h (duplicate_eh_regions): Update prototype.
> 	(get_eh_cur_region, set_eh_cur_region): Kill.
> 	* function.c (allocate_struct_function): Kill creation of CFG object.
> 	* tree-cfg.c (init_empty_tree_cfg): Export.
> 	(label_to_block_fn): Do not crash on dead label never inserted to the
> 	stream.
> 	(dump_function_to_file): Modify checking of CFG presence.
> 	* tree-eh (duplicate_stmt_eh_region_mapping): Get it working after
> 	regions has been copied.
> 	* tree-flow.h (init_empty_tree_cfg): Declare.
> 	* tree-inline.c (inline_data): Kill ret_label, ret_count, original_tsi,
> 	bind_expr,
> 	copy_basic_block, return_block, oic_basic_block fields; add block field.
> 	(remap_decl): Work on block instead of bind_expr.
> 	(copy_body_r): Likewise; do not modify CFG, work after duplicating eh
> 	regions.
> 	(copy_bb): Simplify and use local variables.
> 	(copy_edges_for_bb): Rewrite handling of EH.
> 	(copy_cfg_body): Do not create shadow CFG, allow inserting directly
> 	into other's CFG, simplify.
> 	(copy_body): Update call of copy_cfg_body.
> 	(setup_one_parameter): Insert insns into basic block; simplify.
> 	(initialize_inlined_parameters): Likewise; work on block instead of
> 	bind_expr.
> 	(inline_forbidden_p): Kill abort call.
> 	(estimate_num_insns): Likewise.
> 	(expand_call_inline): Simplify; do not create hords of unnecesary
> 	datastructures.
> 	(gimple_expand_calls_inline): Simplify.
> 	(optimize_inline_calls): Push gimple context; simplify.
> 	(declare_inline_vars): Work on block instead of bind_expr.
> 	(tree_function_versioning): Kill abort; update for new interfaces.
> 	(create_block_annotation): Kill.
> 	* tree-optimize.c: Check presence of saved body by saved_cfg.
>
> 2005-04-19  Jan Hubicka  <jh@suse.cz>
>
> 	* tree-cfg.c (init_empty-tree_cfg): Do not clear basic_block_info size.
> 	(build_tree_cfg): Bring mostly into sync with mainline.
> 	(make_blocks): Likewise.
> 	(create_bb): Likewise.
> 	(tree_verify_flow_info): Likewise.
> 	(tree_forwarder_block_p): Likewise.
> 	* tree-inline.c (inline_data): Kill copy_tsi.
> 	(copy_body_r): Set stmt to NULL if it should not be added.
> 	(copy_bb): Revamp to use BSIs; simplify.
> 	(copy_edges_for_bb): Use BSIs.
>
> 2005-04-18  Jan Hubicka  <jh@suse.cz>
>
> 	* tree-inline.c (copy_bb): Break out from ....
> 	(copy_edges_for_bb): Break out from ....
> 	(copy_cfg): ... here; reorganize way old and new blocks are mapped
> 	together.
>
> 2005-04-16  Jan Hubicka  <jh@suse.cz>
>
> 	* tree-inline.c (remap_decl): Use inlining_p.
> 	(copy_bb): Break out of ....
> 	(copy_cfg_body): ... here.
>
> 	* tree-inline.c (expand_call_inline): Remove if 0 block in
> 	expand_call_inline.
>
> 2005-03-05  Jan Hubicka  <jh@suse.cz>
>
> 	* tree-flow.h (maybe_fold_stmt_indirect): Declare.
> 	* tree-inline.c (copy_body_r): Declare.
> 	(maybe_fold_stmt_indirect): Export.
>
> 2004-12-17  Jan Hubicka  <jh@suse.cz>
>
> 	* tree-inline.c (initialize_inlined_parameters): Do not throw away
> 	DECLs from BIND expr.
>
> 2004-12-08  Jan Hubicka  <jh@suse.cz>
>
> 	* tree-inline.c (optimize_inline_calls): Recount frequencies.
>
> 2004-12-07  Jan Hubicka  <jh@suse.cz>
>
> 	* tree-inline.c (copy_cfg_body, copy_body): New count argument;
> 	update profile.
> 	(copy_body_r, expand_call_inline): Update profiling.
>
> 2004-12-05  Dale Johannesen  <dalej@apple.com>
>
> 	* except.c (get_maybe_saved_eh_throw_stmt_table): Remove.
> 	* except.h (get_maybe_saved_eh_throw_stmt_table): Remove.
> 	* tree-eh.c (duplicate_stmt_eh_region_mapping): Call
> 	get_eh_throw_stmt_table instead of above.
> 	* tree-inline.c (struct inline_data): Add callee_cfun.
> 	(copy_body_r): Use it.
> 	(copy_cfg_body): Set and use it.
> 	(clone_body): Set it.
> 	(save_body): Set it.
>
> 2004-12-02  Steven Bosscher  <stevenb@suse.de>
>
> 	* tree-inline.c: Fix indenting and other style issues.
>
> 2004-12-01  Jan Hubicka  <jh@suse.cz>
>
> 	* tree-inline.c (copy_body_r): Do not alter source stmt when
> 	removing return of void.
> 2004-12-01  Jan Hubicka  <jh@suse.cz>
>
> 	* cgraph.h (cgraph_node): Kill unused fileds brought by cfg inliner
> 	patch.
> 	(cgraph_edge): Add undesirable field.
> 	* cgraphunit.c: Include coverage.h
> 	(cgraph_estimate_size_after_inlining): Rever hack brought by cfg
> 	inliner patch; add sanity check.
> 	(cgraph_decide_recursive_inlining): Don't work hard if function
> 	has no uninlined callees.
> 	(cgraph_maybe_hot_edge_p): New predicate.
> 	(cgraph_desirability): Compute something nonzero.
> 	(cgraph_pick_most_desirable_edge): Don't inline already inlined;
> 	don't bypass inline limits.
> 	(cgraph_analyze_function_inlinability): Compute nonzero function sizes.
> 	* tree-inline.c (estimate_num_insns): Kill bogus void cast.
>
> 2004-11-17  Stuart Hastings <stuarth@apple.com>
> 	    Dale Johannesen  <dalej@apple.com>
>
> 	* Makefile.in (tree-inline.o): Add dependency on $(TREE_FLOW_H) and
> 	on except.h.
> 	(tree-eh.o): Don't depend on gt-tree-eh.h.
> 	(tree-pretty-print.o): Don't depend on tree-iterator.h.
> 	(except.o): Add dependency on $(TREE_FLOW_H).
> 	(cgraph.o): Likewise.
> 	(cgraphunit.o): Add dependency on except.h and coverage.h.
> 	(GTFILES): Remove $(srcdir)/except.c.  Add $(srcdir)/tree-inline.c.
> 	* basic-block.h (FOR_EACH_BB_FN, FOR_EACH_BB_REVERSE_FN): New.
> 	(FOR_EACH_BB, FOR_EACH_BB_REVERSE): Define in terms of the above.
> 	* cfg.c (init_flow): Don't clear n_edges.
> 	* cfglayout.c (flow_obstack): Don't declare.
> 	* cgraph.c: Include basic-block.h.
> 	(cgraph_create_edge): Set edge_count.
> 	(cgraph_remove_node): Remove nodes for inlined nested functions.
> 	* cgraph.h: Include tree.h and basic-block.h.
> 	(struct cgraph_node): Add the fields current_basic_block,
> 	insn_size, and most_desirable.
> 	(cgraph_node, cgraph_edge, cgraph_varpool_node, cgraph_inline_p,
> 	cgraph_mark_inline_edge, cgraph_clone_inlined_nodes,
> 	cgraph_build_static_cdtor): Cleanup prototypes.
> 	* cgraphunit.c: Include basic-block.h, tree-iterator.h, tree-flow.h,
> 	value-prof.h, coverage.h, and except.h.
> 	(cgraph_build_cfg): New.  Build the CFG for a function.
> 	(record_call_1): Don't look at STATEMENT_LIST nodes.
> 	(cgraph_create_edges): Handle FUNCTION_DECLs as special cases when
> 	looking for things to add to the call graph.
> 	(verify_cgraph_node): Use walk_tree with a pointer set instead of
> 	walk_tree_without_duplicates.
> 	(cgraph_varpool_analyze_pending_decls): Only look at DECL_INITIAL
> 	for things to add to the call graph when it is non-NULL.
> 	(cgraph_analyze_function): Build the CFG from here.
> 	(cgraph_expand_function): Make sure there is a CFG at this point.
> 	(cgraph_estimate_growth): Avoid negative size estimates.
> 	(cgraph_clone_inlined_nodes): Avoid cleating duplicate, unnecessary
> 	clones.
> 	(cgraph_clone_inlined_nodes_1): New, callback for the above.
> 	(cgraph_mark_inline_edge): Handle simple recursion.
> 	(cgraph_desirability): New, determine how "desirable" it is for
> 	some given function to be inlined.
> 	(cgraph_pick_most_desirable_edge): New, find the inline candidate
> 	most desirable to be inlined.
> 	(cgraph_profile_driven_inlining): New.
> 	(cgraph_decide_inlining_of_small_function): Don't compute max_insns
> 	from here.
> 	(cgraph_decide_inlining): Do it here.
> 	(cgraph_build_static_cdtor): If all else fails, build a CFG from here,
> 	for irregular functions such as mudflap.
> 	* except.c: Include tree-iterator.h, tree-inline.h, and tree-flow.h.
> 	(struct eh_status): Add per-function throw_stmt_table hash table.
> 	(eh_region_must_not_throw_p): New.
> 	(expand_resx_expr): Add sanity check.
> 	(current_function_has_exception_handlers):
> 	(duplicate_eh_region_1): Rewrite for trees.
> 	(duplicate_eh_region_2): Likewise.
> 	(duplicate_eh_regions): Likewise.
> 	(remove_eh_handler): No longer static.  Make sure there is EH info
> 	for the current function cfun.
> 	(change_to_nothrow): New, fixup EH statements for which we've later
> 	figured out that they don't actually throw.
> 	(set_nothrow_function_flags): Call it.
> 	(set_eh_throw_stmt_table): New.
> 	(get_eh_throw_stmt_table): New.
> 	(get_maybe_saved_eh_throw_stmt_table): New.
> 	(get_eh_last_region_number): New.
> 	(get_eh_cur_region): New.
> 	(set_eh_cur_region): New.
> 	* except.h (duplicate_eh_regions): Adjust prototype after rewrite.
> 	(add_stmt_to_eh_region_fn, remove_stmt_from_eh_region_fn,
> 	lookup_stmt_eh_region_fn): New prototypes.
> 	(struct throw_stmt_node): Moved from tree-eh.c.
> 	(remove_eh_handler, set_eh_throw_stmt_table, get_eh_throw_stmt_table,
> 	get_maybe_saved_eh_throw_stmt_table, get_eh_last_region_number,
> 	get_eh_cur_region, set_eh_cur_region, eh_region_must_not_throw_p):
> 	More new prototypes.
> 	* expr.c (expand_expr_real): Beware of MODIFY_EXPRs and RETURN_EXPRs
> 	that might throw at the end of a function.
> 	* function.c (allocate_struct_function): Clear n_edges here.
> 	* function.h (struct function): Add saved_eh and saved_cfg fields.
> 	* gengtype.c (open_base_files): Remove except.h from headers to
> 	analyze.
> 	* gimple-low.c (lower_function_body): No longer static.
> 	* integrate.c (copy_decl_for_inlining): Clear LABEL_DECL_UID for
> 	copied labels.
> 	* langhooks-def.h (lhd_tree_inlining_add_pending_fn_decls,
> 	lhd_tree_inlining_start_inlining, lhd_tree_inlining_end_inlining):
> 	Remove prototypes.
> 	(lhd_tree_inlining_copy_res_decl_for_inlining): Add prototype.
> 	(LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS,
> 	LANG_HOOKS_TREE_INLINING_START_INLINING,
> 	LANG_HOOKS_TREE_INLINING_END_INLINING): Remove.
> 	(LANG_HOOKS_TREE_INLINING_COPY_RES_DECL_FOR_INLINING): New hook.
> 	(lhd_tree_inlining_disregard_inline_limit):
> 	(lhd_tree_inlining_add_pending_fn_decls):
> 	(lhd_tree_inlining_auto_var_in_fn_p):
> 	(lhd_tree_inlining_copy_res_decl_for_inlining):
> 	(lhd_tree_inlining_anon_aggr_type_p):
> 	(lhd_tree_inlining_start_inlining):
> 	(lhd_tree_inlining_end_inlining):
> 	* langhooks.c (lhd_tree_inlining_add_pending_fn_decls,
> 	lhd_tree_inlining_start_inlining, lhd_tree_inlining_end_inlining):
> 	Remove.
> 	(lhd_tree_inlining_copy_res_decl_for_inlining): New default hook.
> 	* langhooks.h (struct lang_hooks_for_tree_inlining): Adjust.
> 	* passes.c: Don't include alloc-pool.h.
> 	* print-tree.c: Include tree-iterator.h.
> 	(print_node): Print STATEMENT_LIST nodes.
> 	* tree-cfg.c (build_tree_cfg): No longer static.  Create
> 	ENTRY_BLOCK_PTR and EXIT_BLOCK_PTR here.
> 	(make_blocks): Purge basic_block_info.  Rechain split statements.
> 	Let statements in an EH region end a basic block.
> 	(make_edges): Make edges for blocks ending with an EH statement.
> 	(label_to_block): Rename to...
> 	(label_to_block_fn): ... this.  Work per function.
> 	(remove_useless_stmts_warn_notreached): Disable.
> 	(remove_useless_stmts_bind): Likewise.
> 	(remove_useless_stmts_1): Don't use them. Tighten up checks.
> 	(remove_useless_stmts): Rewrite to be basic block aware.
> 	(set_bb_for_stmt): Force the multiply to happen before the divide.
> 	(tree_forwarder_block_p): Don't forward forced labels.
> 	* tree-eh.c (struct throw_stmt_node): Removed here, moved to except.c.
> 	(add_stmt_to_eh_region_fn): New.
> 	(remove_stmt_from_eh_region_fn): New.
> 	(lookup_stmt_eh_region_fn): New.
> 	(record_stmt_eh_region): Get the table from cfun.
> 	(add_stmt_to_eh_region): Likewise.
> 	(remove_stmt_from_eh_region): Likewise.
> 	(lookup_stmt_eh_region): Likewise.
> 	(duplicate_stmt_eh_region_mapping): New function to preserve stmt EH
> 	mapping during inlining.
> 	(honor_protect_cleanup_actions): Use build_resx.
> 	(lower_try_finally_onedest): Likewise.
> 	(lower_try_finally_copy): Likewise.
> 	(lower_try_finally_switch): Likewise.
> 	(lower_eh_constructs): No longer static.
> 	(make_eh_edges): If a MUST_NOT_THROW region contains a call that
> 	throws, don't remove it.
> 	* tree-flow.h (build_tree_cfg): New prototype.
> 	(label_to_block): Make it a define.  Rename prototype to...
> 	(label_to_block_fn): ... this.
> 	(do_tree_profiling): New prototype.
> 	* tree-inline.c: Mostly rewritten for CFG inlining.
> 	* tree-inline.h (remap_decl_v): New prototype.
> 	(push_cfun, pop_cfun): Likewise.
> 	* tree-optimize.c (pass_gimple): Remove.
> 	(pass_lower_cf, pass_lower_eh, pass_build_cfg): Disable, we do
> 	this much earlier.  Needs to be cleaned up.
> 	(pass_tree_profile, pass_profile): Disable for now.
> 	(init_tree_optimization_passes): Hard-code initial properties.
> 	(tree_rest_of_compilation): Register the tree cfg hooks.  Preserve
> 	the CFG and EH data before optimizing.
> 	(pass_ipa_static): Disable for now, see the comments in that pass that
> 	need addressing.
> 	* tree-pass.h (pass_lower_cf): Remove.
> 	* tree-pretty-print.c: Don't include tree-iterator.h.
> 	* tree-profile.c (do_tree_profiling): No longer static.
> 	* tree.c (build_resx): New.
> 	* tree.h (lower_function_body, duplicate_stmt_eh_region_mapping,
> 	lower_eh_constructs): New prototypes.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]