diff options
author | Jan Hubicka <jh@suse.cz> | 2020-10-23 21:44:23 +0200 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2020-10-23 21:44:23 +0200 |
commit | 67f3791f7d133214b112bd831ff2876822c665d0 (patch) | |
tree | 48c1ccff315d09fcce1ec1e9f2b998367140e45a /gcc/cgraphclones.c | |
parent | 83f83ddfe0fe41c9b553850d4ababd5089df8332 (diff) | |
download | gcc-67f3791f7d133214b112bd831ff2876822c665d0.zip gcc-67f3791f7d133214b112bd831ff2876822c665d0.tar.gz gcc-67f3791f7d133214b112bd831ff2876822c665d0.tar.bz2 |
Move thunks out of cgraph_node
this patch moves thunk_info out of cgraph_node into a symbol summary.
I also moved it to separate hearder file since cgraph.h became really too
fat. I plan to contiue with similar breakup in order to cleanup interfaces
and reduce WPA memory footprint (symbol table now consumes more memory than
trees)
gcc/ChangeLog:
2020-10-23 Jan Hubicka <hubicka@ucw.cz>
* Makefile.in: Add symtab-thunks.o
(GTFILES): Add symtab-thunks.h and symtab-thunks.cc; remove cgraphunit.c
* cgraph.c: Include symtab-thunks.h.
(cgraph_node::create_thunk): Update
(symbol_table::create_edge): Update
(cgraph_node::dump): Update
(cgraph_node::call_for_symbol_thunks_and_aliases): Update
(set_nothrow_flag_1): Update
(set_malloc_flag_1): Update
(set_const_flag_1): Update
(collect_callers_of_node_1): Update
(clone_of_p): Update
(cgraph_node::verify_node): Update
(cgraph_node::function_symbol): Update
(cgraph_c_finalize): Call thunk_info::release.
(cgraph_node::has_thunk_p): Update
(cgraph_node::former_thunk_p): Move here from cgraph.h; reimplement.
* cgraph.h (struct cgraph_thunk_info): Rename to symtab-thunks.h.
(cgraph_node): Remove thunk field; add thunk bitfield.
(cgraph_node::expand_thunk): Move to symtab-thunks.h
(symtab_thunks_cc_finalize): Declare.
(cgraph_node::has_gimple_body_p): Update.
(cgraph_node::former_thunk_p): Update.
* cgraphclones.c: Include symtab-thunks.h.
(duplicate_thunk_for_node): Update.
(cgraph_edge::redirect_callee_duplicating_thunks): Update.
(cgraph_node::expand_all_artificial_thunks): Update.
(cgraph_node::create_edge_including_clones): Update.
* cgraphunit.c: Include symtab-thunks.h.
(vtable_entry_type): Move to symtab-thunks.c.
(cgraph_node::analyze): Update.
(analyze_functions): Update.
(mark_functions_to_output): Update.
(thunk_adjust): Move to symtab-thunks.c
(cgraph_node::expand_thunk): Move to symtab-thunks.c
(cgraph_node::assemble_thunks_and_aliases): Update.
(output_in_order): Update.
(cgraphunit_c_finalize): Do not clear vtable_entry_type.
(cgraph_node::create_wrapper): Update.
* gengtype.c (open_base_files): Add symtab-thunks.h
* ipa-comdats.c (propagate_comdat_group): UPdate.
(ipa_comdats): Update.
* ipa-cp.c (determine_versionability): UPdate.
(gather_caller_stats): Update.
(count_callers): Update
(set_single_call_flag): Update
(initialize_node_lattices): Update
(call_passes_through_thunk_p): Update
(call_passes_through_thunk): Update
(propagate_constants_across_call): Update
(find_more_scalar_values_for_callers_subset): Update
(has_undead_caller_from_outside_scc_p): Update
* ipa-fnsummary.c (evaluate_properties_for_edge): Update.
(compute_fn_summary): Update.
(inline_analyze_function): Update.
* ipa-icf.c: Include symtab-thunks.h.
(sem_function::equals_wpa): Update.
(redirect_all_callers): Update.
(sem_function::init): Update.
(sem_function::parse): Update.
* ipa-inline-transform.c: Include symtab-thunks.h.
(inline_call): Update.
(save_inline_function_body): Update.
(preserve_function_body_p): Update.
* ipa-inline.c (inline_small_functions): Update.
* ipa-polymorphic-call.c: Include alloc-pool.h, symbol-summary.h,
symtab-thunks.h
(ipa_polymorphic_call_context::ipa_polymorphic_call_context): Update.
* ipa-pure-const.c: Include symtab-thunks.h.
(analyze_function): Update.
* ipa-sra.c (check_for_caller_issues): Update.
* ipa-utils.c (ipa_reverse_postorder): Update.
(ipa_merge_profiles): Update.
* ipa-visibility.c (non_local_p): Update.
(cgraph_node::local_p): Update.
(function_and_variable_visibility): Update.
* ipa.c (symbol_table::remove_unreachable_nodes): Update.
* lto-cgraph.c: Include alloc-pool.h, symbol-summary.h and
symtab-thunks.h
(lto_output_edge): Update.
(lto_output_node): Update.
(compute_ltrans_boundary): Update.
(output_symtab): Update.
(verify_node_partition): Update.
(input_overwrite_node): Update.
(input_node): Update.
* lto-streamer-in.c (fixup_call_stmt_edges): Update.
* symtab-thunks.cc: New file.
* symtab-thunks.h: New file.
* toplev.c (toplev::finalize): Call symtab_thunks_cc_finalize.
* trans-mem.c (ipa_tm_mayenterirr_function): Update.
(ipa_tm_execute): Update.
* tree-inline.c (expand_call_inline): Update.
* tree-nested.c (create_nesting_tree): Update.
(convert_all_function_calls): Update.
(gimplify_all_functions): Update.
* tree-profile.c (tree_profiling): Update.
* tree-ssa-structalias.c (associate_varinfo_to_alias): Update.
* tree.c (free_lang_data_in_decl): Update.
* value-prof.c (init_node_map): Update.
gcc/c-family/ChangeLog:
2020-10-23 Jan Hubicka <hubicka@ucw.cz>
* c-common.c (c_common_finalize_early_debug): Update for new thunk api.
gcc/d/ChangeLog:
2020-10-23 Jan Hubicka <hubicka@ucw.cz>
* decl.cc (finish_thunk): Update for new thunk api.
gcc/lto/ChangeLog:
2020-10-23 Jan Hubicka <hubicka@ucw.cz>
* lto-partition.c (add_symbol_to_partition_1): Update for new thunk
api.
Diffstat (limited to 'gcc/cgraphclones.c')
-rw-r--r-- | gcc/cgraphclones.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c index 07a51a5..41c6efb 100644 --- a/gcc/cgraphclones.c +++ b/gcc/cgraphclones.c @@ -85,6 +85,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-vrp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" +#include "symtab-thunks.h" /* Create clone of edge in the node N represented by CALL_EXPR the callgraph. */ @@ -183,28 +184,28 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node) cgraph_node *new_thunk, *thunk_of; thunk_of = thunk->callees->callee->ultimate_alias_target (); - if (thunk_of->thunk.thunk_p) + if (thunk_of->thunk) node = duplicate_thunk_for_node (thunk_of, node); if (!DECL_ARGUMENTS (thunk->decl)) thunk->get_untransformed_body (); + thunk_info *i = thunk_info::get (thunk); cgraph_edge *cs; for (cs = node->callers; cs; cs = cs->next_caller) - if (cs->caller->thunk.thunk_p - && cs->caller->thunk.fixed_offset == thunk->thunk.fixed_offset - && cs->caller->thunk.virtual_value == thunk->thunk.virtual_value - && cs->caller->thunk.indirect_offset == thunk->thunk.indirect_offset - && cs->caller->thunk.this_adjusting == thunk->thunk.this_adjusting - && cs->caller->thunk.virtual_offset_p == thunk->thunk.virtual_offset_p) - return cs->caller; + if (cs->caller->thunk) + { + thunk_info *i2 = thunk_info::get (cs->caller); + if (*i2 == *i) + return cs->caller; + } tree new_decl; if (node->clone.param_adjustments) { /* We do not need to duplicate this_adjusting thunks if we have removed this. */ - if (thunk->thunk.this_adjusting + if (i->this_adjusting && !node->clone.param_adjustments->first_param_intact_p ()) return node; @@ -256,7 +257,7 @@ void cgraph_edge::redirect_callee_duplicating_thunks (cgraph_node *n) { cgraph_node *orig_to = callee->ultimate_alias_target (); - if (orig_to->thunk.thunk_p) + if (orig_to->thunk) n = duplicate_thunk_for_node (orig_to, n); redirect_callee (n); @@ -270,14 +271,14 @@ cgraph_node::expand_all_artificial_thunks () { cgraph_edge *e; for (e = callers; e;) - if (e->caller->thunk.thunk_p) + if (e->caller->thunk) { cgraph_node *thunk = e->caller; e = e->next_caller; - if (thunk->expand_thunk (false, false)) + if (expand_thunk (thunk, false, false)) { - thunk->thunk.thunk_p = false; + thunk->thunk = false; thunk->analyze (); ipa_analyze_node (thunk); inline_analyze_function (thunk); @@ -812,7 +813,7 @@ cgraph_node::create_edge_including_clones (cgraph_node *callee, if (node) while (node != this) /* Thunk clones do not get updated while copying inline function body. */ - if (!node->thunk.thunk_p) + if (!node->thunk) { cgraph_edge *edge = node->get_edge (old_stmt); |