From ae7a23a3fab74ebd45203d48fa09681c9945ee7a Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 31 Oct 2020 10:18:06 +0100 Subject: Move clone_info to summary * Makefile.in: (OBJS): Add symtab-clones.o (GTFILES): Add symtab-clones.h * cgraph.c: Include symtab-clones.h. (cgraph_edge::resolve_speculation): Fix formating (cgraph_edge::redirect_call_stmt_to_callee): Update. (cgraph_update_edges_for_call_stmt): Update (release_function_body): Fix formating. (cgraph_node::remove): Fix formating. (cgraph_node::dump): Fix formating. (cgraph_node::get_availability): Fix formating. (cgraph_node::call_for_symbol_thunks_and_aliases): Fix formating. (set_const_flag_1): Fix formating. (set_pure_flag_1): Fix formating. (cgraph_node::can_remove_if_no_direct_calls_p): Fix formating. (collect_callers_of_node_1): Fix formating. (clone_of_p): Update. (cgraph_node::verify_node): Update. (cgraph_c_finalize): Call clone_info::release (). * cgraph.h (struct cgraph_clone_info): Move to symtab-clones.h. (cgraph_node): Remove clone_info. (symbol_table): Add m_clones. * cgraphclones.c: Include symtab-clone.h. (duplicate_thunk_for_node): Update. (cgraph_node::create_clone): Update. (cgraph_node::create_virtual_clone): Update. (cgraph_node::find_replacement): Update. (cgraph_node::materialize_clone): Update. * gengtype.c (open_base_files): Include symtab-clones.h. * ipa-cp.c: Include symtab-clones.h. (initialize_node_lattices): Update. (want_remove_some_param_p): Update. (create_specialized_node): Update. * ipa-fnsummary.c: Include symtab-clones.h. (ipa_fn_summary_t::duplicate): Update. * ipa-modref.c: Include symtab-clones.h. (update_signature): Update. * ipa-param-manipulation.c: Include symtab-clones.h. (ipa_param_body_adjustments::common_initialization): Update. * ipa-prop.c: Include symtab-clones.h. (adjust_agg_replacement_values): Update. (ipcp_get_parm_bits): Update. (ipcp_update_bits): Update. (ipcp_update_vr): Update. * ipa-sra.c: Include symtab-clones.h. (process_isra_node_results): Update. (disable_unavailable_parameters): Update. * lto-cgraph.c: Include symtab-clone.h. (output_cgraph_opt_summary_p): Update. (output_node_opt_summary): Update. (input_node_opt_summary): Update. * symtab-clones.cc: New file. * symtab-clones.h: New file. * tree-inline.c (expand_call_inline): Update. (update_clone_info): Update. (tree_function_versioning): Update. --- gcc/lto-cgraph.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'gcc/lto-cgraph.c') diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 91900a1..8718678 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see #include "alloc-pool.h" #include "symbol-summary.h" #include "symtab-thunks.h" +#include "symtab-clones.h" /* True when asm nodes has been output. */ bool asm_nodes_output = false; @@ -1823,9 +1824,10 @@ input_offload_tables (bool do_force_output) static int output_cgraph_opt_summary_p (struct cgraph_node *node) { - return ((node->clone_of || node->former_clone_of) - && (node->clone.tree_map - || node->clone.param_adjustments)); + if (node->clone_of || node->former_clone_of) + return true; + clone_info *info = clone_info::get (node); + return info && (info->tree_map || info->param_adjustments); } /* Output optimization summary for EDGE to OB. */ @@ -1849,9 +1851,12 @@ output_node_opt_summary (struct output_block *ob, /* TODO: Should this code be moved to ipa-param-manipulation? */ struct bitpack_d bp; bp = bitpack_create (ob->main_stream); - bp_pack_value (&bp, (node->clone.param_adjustments != NULL), 1); + clone_info *info = clone_info::get (node); + + bp_pack_value (&bp, (info && info->param_adjustments != NULL), 1); streamer_write_bitpack (&bp); - if (ipa_param_adjustments *adjustments = node->clone.param_adjustments) + if (ipa_param_adjustments *adjustments + = info ? info->param_adjustments : NULL) { streamer_write_uhwi (ob, vec_safe_length (adjustments->m_adj_params)); ipa_adjusted_param *adj; @@ -1879,17 +1884,18 @@ output_node_opt_summary (struct output_block *ob, } streamer_write_hwi (ob, adjustments->m_always_copy_start); bp = bitpack_create (ob->main_stream); - bp_pack_value (&bp, node->clone.param_adjustments->m_skip_return, 1); + bp_pack_value (&bp, info->param_adjustments->m_skip_return, 1); streamer_write_bitpack (&bp); } - streamer_write_uhwi (ob, vec_safe_length (node->clone.tree_map)); - FOR_EACH_VEC_SAFE_ELT (node->clone.tree_map, i, map) - { - streamer_write_uhwi (ob, map->parm_num); - gcc_assert (EXPR_LOCATION (map->new_tree) == UNKNOWN_LOCATION); - stream_write_tree (ob, map->new_tree, true); - } + streamer_write_uhwi (ob, info ? vec_safe_length (info->tree_map) : 0); + if (info) + FOR_EACH_VEC_SAFE_ELT (info->tree_map, i, map) + { + streamer_write_uhwi (ob, map->parm_num); + gcc_assert (EXPR_LOCATION (map->new_tree) == UNKNOWN_LOCATION); + stream_write_tree (ob, map->new_tree, true); + } if (lto_symtab_encoder_in_partition_p (encoder, node)) { @@ -1959,6 +1965,8 @@ input_node_opt_summary (struct cgraph_node *node, struct bitpack_d bp; bp = streamer_read_bitpack (ib_main); bool have_adjustments = bp_unpack_value (&bp, 1); + clone_info *info = clone_info::get_create (node); + if (have_adjustments) { count = streamer_read_uhwi (ib_main); @@ -1991,7 +1999,7 @@ input_node_opt_summary (struct cgraph_node *node, int always_copy_start = streamer_read_hwi (ib_main); bp = streamer_read_bitpack (ib_main); bool skip_return = bp_unpack_value (&bp, 1); - node->clone.param_adjustments + info->param_adjustments = (new (ggc_alloc ()) ipa_param_adjustments (new_params, always_copy_start, skip_return)); } @@ -2001,7 +2009,7 @@ input_node_opt_summary (struct cgraph_node *node, { struct ipa_replace_map *map = ggc_alloc (); - vec_safe_push (node->clone.tree_map, map); + vec_safe_push (info->tree_map, map); map->parm_num = streamer_read_uhwi (ib_main); map->new_tree = stream_read_tree (ib_main, data_in); } -- cgit v1.1