2009-10-03 23:10:11 +02:00
|
|
|
/* Miscellaneous utilities for GIMPLE streaming. Things that are used
|
|
|
|
in both input and output are here.
|
|
|
|
|
2017-01-01 13:07:43 +01:00
|
|
|
Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
2009-10-03 23:10:11 +02:00
|
|
|
Contributed by Doug Kwan <dougkwan@google.com>
|
|
|
|
|
|
|
|
This file is part of GCC.
|
|
|
|
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free
|
|
|
|
Software Foundation; either version 3, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GCC; see the file COPYING3. If not see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "coretypes.h"
|
2015-07-08 02:53:03 +02:00
|
|
|
#include "backend.h"
|
|
|
|
#include "tree.h"
|
|
|
|
#include "gimple.h"
|
2015-10-29 14:57:32 +01:00
|
|
|
#include "tree-streamer.h"
|
|
|
|
#include "cgraph.h"
|
|
|
|
#include "lto-streamer.h"
|
2009-10-03 23:10:11 +02:00
|
|
|
#include "toplev.h"
|
2014-05-22 18:21:18 +02:00
|
|
|
#include "lto-section-names.h"
|
2009-10-03 23:10:11 +02:00
|
|
|
|
|
|
|
/* Statistics gathered during LTO, WPA and LTRANS. */
|
|
|
|
struct lto_stats_d lto_stats;
|
|
|
|
|
2012-05-29 16:14:06 +02:00
|
|
|
/* LTO uses bitmaps with different life-times. So use a separate
|
2009-10-03 23:10:11 +02:00
|
|
|
obstack for all LTO bitmaps. */
|
|
|
|
static bitmap_obstack lto_obstack;
|
|
|
|
static bool lto_obstack_initialized;
|
|
|
|
|
2014-11-13 14:37:38 +01:00
|
|
|
const char *section_name_prefix = LTO_SECTION_NAME_PREFIX;
|
2015-01-09 22:38:00 +01:00
|
|
|
/* Set when streaming LTO for offloading compiler. */
|
|
|
|
bool lto_stream_offload_p;
|
2009-10-03 23:10:11 +02:00
|
|
|
|
|
|
|
/* Return a string representing LTO tag TAG. */
|
|
|
|
|
|
|
|
const char *
|
|
|
|
lto_tag_name (enum LTO_tags tag)
|
|
|
|
{
|
|
|
|
if (lto_tag_is_tree_code_p (tag))
|
|
|
|
{
|
|
|
|
/* For tags representing tree nodes, return the name of the
|
|
|
|
associated tree code. */
|
tree-core.h (tree_code_name): Remove.
gcc/
* tree-core.h (tree_code_name): Remove.
* tree.h (get_tree_code_name): New prototype.
* tree.c (tree_code_name): Make static.
(get_tree_code_name): New function.
(dump_tree_statistics, tree_check_failed, tree_not_check_failed,
tree_class_check_failed, tree_range_check_failed,
tree_not_class_check_failed, omp_clause_check_failed,
tree_contains_struct_check_failed, tree_operand_check_failed): Use new
wrapper get_tree_code_name instead of calling tree_code_name directly.
* tree-vrp.c (dump_asserts_for): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-pretty-print.c (do_niy, dump_generic_node): Likewise.
* tree-pretty-print.h (pp_unsupported_tree): Likewise.
* lto-streamer-out.c (lto_write_tree, DFS_write_tree): Likewise.
* tree-ssa-dom.c (print_expr_hash_elt): Likewise.
* gimple-pretty-print.c (dump_unary_rhs, dump_binary_rhs,
dump_ternary_rhs, dump_gimple_assign, dump_gimple_cond,
dump_gimple_omp_for): Likewise.
* tree-vect-data-refs.c (vect_create_data_ref_ptr): Likewise.
* tree-ssa-pre.c (print_pre_expr): Likewise.
* ipa-prop.c (ipa_print_node_jump_functions_for_edge): Likewise.
* print-tree.c (print_node_brief, print_node): Likewise.
* gimple.c (gimple_check_failed): Likewise.
* lto-streamer.c (lto_tag_name, print_lto_report): Likewise.
* config/frv/frv.c (frv_init_cumulative_args): Likewise.
* config/mep/mep.c (mep_validate_vliw): Likewise.
* config/iq2000/iq2000.c (init_cumulative_args): Likewise.
* config/rs6000/rs6000.c (init_cumulative_args): Likewise.
gcc/cp/
* error.c (code_to_string): Use new wrapper get_tree_code_name.
* cxx-pretty-print.c (pp_cxx_assignment_operator): Likewise.
* pt.c (tsubst): Likewise.
* semantics.c (cxx_eval_constant_expression,
potential_constant_expression_1): Likewise.
* mangle.c (MANGLE_TRACE_TREE, dump_substitution_candidates,
add_substitution, find_substitution): Likewise.
From-SVN: r203695
2013-10-16 12:09:17 +02:00
|
|
|
return get_tree_code_name (lto_tag_to_tree_code (tag));
|
2009-10-03 23:10:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (lto_tag_is_gimple_code_p (tag))
|
|
|
|
{
|
|
|
|
/* For tags representing gimple statements, return the name of
|
|
|
|
the associated gimple code. */
|
|
|
|
return gimple_code_name[lto_tag_to_gimple_code (tag)];
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (tag)
|
|
|
|
{
|
|
|
|
case LTO_null:
|
|
|
|
return "LTO_null";
|
|
|
|
case LTO_bb0:
|
|
|
|
return "LTO_bb0";
|
|
|
|
case LTO_bb1:
|
|
|
|
return "LTO_bb1";
|
|
|
|
case LTO_eh_region:
|
|
|
|
return "LTO_eh_region";
|
|
|
|
case LTO_function:
|
|
|
|
return "LTO_function";
|
|
|
|
case LTO_eh_table:
|
|
|
|
return "LTO_eh_table";
|
|
|
|
case LTO_ert_cleanup:
|
|
|
|
return "LTO_ert_cleanup";
|
|
|
|
case LTO_ert_try:
|
|
|
|
return "LTO_ert_try";
|
|
|
|
case LTO_ert_allowed_exceptions:
|
|
|
|
return "LTO_ert_allowed_exceptions";
|
|
|
|
case LTO_ert_must_not_throw:
|
|
|
|
return "LTO_ert_must_not_throw";
|
|
|
|
case LTO_tree_pickle_reference:
|
|
|
|
return "LTO_tree_pickle_reference";
|
|
|
|
case LTO_field_decl_ref:
|
|
|
|
return "LTO_field_decl_ref";
|
|
|
|
case LTO_function_decl_ref:
|
|
|
|
return "LTO_function_decl_ref";
|
|
|
|
case LTO_label_decl_ref:
|
|
|
|
return "LTO_label_decl_ref";
|
|
|
|
case LTO_namespace_decl_ref:
|
|
|
|
return "LTO_namespace_decl_ref";
|
|
|
|
case LTO_result_decl_ref:
|
|
|
|
return "LTO_result_decl_ref";
|
|
|
|
case LTO_ssa_name_ref:
|
|
|
|
return "LTO_ssa_name_ref";
|
|
|
|
case LTO_type_decl_ref:
|
|
|
|
return "LTO_type_decl_ref";
|
|
|
|
case LTO_type_ref:
|
|
|
|
return "LTO_type_ref";
|
|
|
|
case LTO_global_decl_ref:
|
|
|
|
return "LTO_global_decl_ref";
|
|
|
|
default:
|
|
|
|
return "LTO_UNKNOWN";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Allocate a bitmap from heap. Initializes the LTO obstack if necessary. */
|
|
|
|
|
|
|
|
bitmap
|
|
|
|
lto_bitmap_alloc (void)
|
|
|
|
{
|
|
|
|
if (!lto_obstack_initialized)
|
|
|
|
{
|
|
|
|
bitmap_obstack_initialize (<o_obstack);
|
|
|
|
lto_obstack_initialized = true;
|
|
|
|
}
|
|
|
|
return BITMAP_ALLOC (<o_obstack);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free bitmap B. */
|
|
|
|
|
|
|
|
void
|
|
|
|
lto_bitmap_free (bitmap b)
|
|
|
|
{
|
|
|
|
BITMAP_FREE (b);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Get a section name for a particular type or name. The NAME field
|
2010-07-23 07:33:51 +02:00
|
|
|
is only used if SECTION_TYPE is LTO_section_function_body. For all
|
|
|
|
others it is ignored. The callee of this function is responsible
|
|
|
|
to free the returned name. */
|
2009-10-03 23:10:11 +02:00
|
|
|
|
|
|
|
char *
|
2010-07-23 07:33:51 +02:00
|
|
|
lto_get_section_name (int section_type, const char *name, struct lto_file_decl_data *f)
|
2009-10-03 23:10:11 +02:00
|
|
|
{
|
2010-07-23 07:33:51 +02:00
|
|
|
const char *add;
|
|
|
|
char post[32];
|
|
|
|
const char *sep;
|
|
|
|
|
|
|
|
if (section_type == LTO_section_function_body)
|
2009-10-03 23:10:11 +02:00
|
|
|
{
|
2010-01-01 17:49:15 +01:00
|
|
|
gcc_assert (name != NULL);
|
|
|
|
if (name[0] == '*')
|
|
|
|
name++;
|
2010-07-23 07:33:51 +02:00
|
|
|
add = name;
|
|
|
|
sep = "";
|
|
|
|
}
|
|
|
|
else if (section_type < LTO_N_SECTION_TYPES)
|
|
|
|
{
|
|
|
|
add = lto_section_name[section_type];
|
|
|
|
sep = ".";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
internal_error ("bytecode stream: unexpected LTO section %s", name);
|
2009-10-03 23:10:11 +02:00
|
|
|
|
2010-07-23 07:33:51 +02:00
|
|
|
/* Make the section name unique so that ld -r combining sections
|
|
|
|
doesn't confuse the reader with merged sections.
|
2009-10-03 23:10:11 +02:00
|
|
|
|
2010-07-23 07:33:51 +02:00
|
|
|
For options don't add a ID, the option reader cannot deal with them
|
2011-09-29 15:14:51 +02:00
|
|
|
and merging should be ok here. */
|
2010-07-23 07:33:51 +02:00
|
|
|
if (section_type == LTO_section_opts)
|
|
|
|
strcpy (post, "");
|
2011-09-29 15:14:51 +02:00
|
|
|
else if (f != NULL)
|
|
|
|
sprintf (post, "." HOST_WIDE_INT_PRINT_HEX_PURE, f->id);
|
2010-07-23 07:33:51 +02:00
|
|
|
else
|
2011-09-29 15:14:51 +02:00
|
|
|
sprintf (post, "." HOST_WIDE_INT_PRINT_HEX_PURE, get_random_seed (false));
|
2014-11-13 14:37:38 +01:00
|
|
|
return concat (section_name_prefix, sep, add, post, NULL);
|
2009-10-03 23:10:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Show various memory usage statistics related to LTO. */
|
|
|
|
|
|
|
|
void
|
gimple.h (gimple_register_type): Remove.
2012-09-11 Richard Guenther <rguenther@suse.de>
* gimple.h (gimple_register_type): Remove.
(print_gimple_types_stats): Adjust prototype.
* lto-streamer.h (print_lto_report): Likewise.
* lto-streamer.c (print_lto_report): Adjust.
* gimple.c (gimple_types, type_hash_cache, enum gtc_mode,
struct type_pair_d, lookup_type_pair, struct sccs,
next_dfs_num, gtc_next_dfs_num, struct gimple_type_leader_entry_s,
gimple_type_leader, gimple_lookup_type_leader, compare_type_names_p,
gtc_visit, gimple_types_compatible_p_1, gimple_types_compatible_p,
visit, iterative_hash_name, struct type_hash_pair,
type_hash_pair_compare, iterative_hash_gimple_type, gimple_type_hash,
gimple_type_eq, gimple_register_type_1, gimple_register_type):
Move to lto/lto.c.
(print_gimple_types_stats): Adjust.
(free_gimple_type_tables): Likewise.
lto/
* lto.c (gimple_types, type_hash_cache, enum gtc_mode,
struct type_pair_d, lookup_type_pair, struct sccs,
next_dfs_num, gtc_next_dfs_num, struct gimple_type_leader_entry_s,
gimple_type_leader, gimple_lookup_type_leader, compare_type_names_p,
gtc_visit, gimple_types_compatible_p_1, gimple_types_compatible_p,
visit, iterative_hash_name, struct type_hash_pair,
type_hash_pair_compare, iterative_hash_gimple_type, gimple_type_hash,
gimple_type_eq, gimple_register_type_1, gimple_register_type):
Move here from gimple.c
(read_cgraph_and_symbols): Free hash tables here.
(print_lto_report_1): New function wrapping print_lto_report.
(do_whole_program_analysis): Call it.
(lto_main): Likewise.
From-SVN: r191177
2012-09-11 13:39:27 +02:00
|
|
|
print_lto_report (const char *s)
|
2009-10-03 23:10:11 +02:00
|
|
|
{
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
fprintf (stderr, "[%s] # of input files: "
|
|
|
|
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s, lto_stats.num_input_files);
|
|
|
|
|
2009-11-25 11:55:54 +01:00
|
|
|
fprintf (stderr, "[%s] # of input cgraph nodes: "
|
2009-10-03 23:10:11 +02:00
|
|
|
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
|
|
|
|
lto_stats.num_input_cgraph_nodes);
|
|
|
|
|
|
|
|
fprintf (stderr, "[%s] # of function bodies: "
|
|
|
|
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
|
|
|
|
lto_stats.num_function_bodies);
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_TREE_CODES; i++)
|
|
|
|
if (lto_stats.num_trees[i])
|
|
|
|
fprintf (stderr, "[%s] # of '%s' objects read: "
|
|
|
|
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
|
tree-core.h (tree_code_name): Remove.
gcc/
* tree-core.h (tree_code_name): Remove.
* tree.h (get_tree_code_name): New prototype.
* tree.c (tree_code_name): Make static.
(get_tree_code_name): New function.
(dump_tree_statistics, tree_check_failed, tree_not_check_failed,
tree_class_check_failed, tree_range_check_failed,
tree_not_class_check_failed, omp_clause_check_failed,
tree_contains_struct_check_failed, tree_operand_check_failed): Use new
wrapper get_tree_code_name instead of calling tree_code_name directly.
* tree-vrp.c (dump_asserts_for): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-pretty-print.c (do_niy, dump_generic_node): Likewise.
* tree-pretty-print.h (pp_unsupported_tree): Likewise.
* lto-streamer-out.c (lto_write_tree, DFS_write_tree): Likewise.
* tree-ssa-dom.c (print_expr_hash_elt): Likewise.
* gimple-pretty-print.c (dump_unary_rhs, dump_binary_rhs,
dump_ternary_rhs, dump_gimple_assign, dump_gimple_cond,
dump_gimple_omp_for): Likewise.
* tree-vect-data-refs.c (vect_create_data_ref_ptr): Likewise.
* tree-ssa-pre.c (print_pre_expr): Likewise.
* ipa-prop.c (ipa_print_node_jump_functions_for_edge): Likewise.
* print-tree.c (print_node_brief, print_node): Likewise.
* gimple.c (gimple_check_failed): Likewise.
* lto-streamer.c (lto_tag_name, print_lto_report): Likewise.
* config/frv/frv.c (frv_init_cumulative_args): Likewise.
* config/mep/mep.c (mep_validate_vliw): Likewise.
* config/iq2000/iq2000.c (init_cumulative_args): Likewise.
* config/rs6000/rs6000.c (init_cumulative_args): Likewise.
gcc/cp/
* error.c (code_to_string): Use new wrapper get_tree_code_name.
* cxx-pretty-print.c (pp_cxx_assignment_operator): Likewise.
* pt.c (tsubst): Likewise.
* semantics.c (cxx_eval_constant_expression,
potential_constant_expression_1): Likewise.
* mangle.c (MANGLE_TRACE_TREE, dump_substitution_candidates,
add_substitution, find_substitution): Likewise.
From-SVN: r203695
2013-10-16 12:09:17 +02:00
|
|
|
get_tree_code_name ((enum tree_code) i), lto_stats.num_trees[i]);
|
2009-10-03 23:10:11 +02:00
|
|
|
|
|
|
|
if (flag_lto)
|
|
|
|
{
|
|
|
|
fprintf (stderr, "[%s] Compression: "
|
|
|
|
HOST_WIDE_INT_PRINT_UNSIGNED " output bytes, "
|
|
|
|
HOST_WIDE_INT_PRINT_UNSIGNED " compressed bytes", s,
|
|
|
|
lto_stats.num_output_il_bytes,
|
|
|
|
lto_stats.num_compressed_il_bytes);
|
|
|
|
if (lto_stats.num_output_il_bytes > 0)
|
|
|
|
{
|
|
|
|
const float dividend = (float) lto_stats.num_compressed_il_bytes;
|
|
|
|
const float divisor = (float) lto_stats.num_output_il_bytes;
|
|
|
|
fprintf (stderr, " (ratio: %f)", dividend / divisor);
|
|
|
|
}
|
|
|
|
fprintf (stderr, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag_wpa)
|
|
|
|
{
|
|
|
|
fprintf (stderr, "[%s] # of output files: "
|
|
|
|
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
|
|
|
|
lto_stats.num_output_files);
|
|
|
|
|
Replace cgraph_node_set and varpool_node_set by symtab_node_encoder in partitioning.
Replace cgraph_node_set and varpool_node_set by symtab_node_encoder
in partitioning.
* tree-pass.h (cgraph_node_set_def, varpool_node_set_def): Remove
forward declaration.
(lto_symtab_encoder_d): Forward declare.
(ipa_write_optimization_summaries): Update.
* lto-cgraph.c (lto_symtab_encoder_new): Do not initialize
body, initializer and in_partition.
(lto_symtab_encoder_delete): Update.
(lto_symtab_encoder_encode): Update.
(lto_symtab_encoder_lookup): Move inline.
(lto_symtab_encoder_delete_node): New function.
(lto_symtab_encoder_encode_body_p, lto_set_symtab_encoder_encode_body,
lto_symtab_encoder_encode_initializer_p,
lto_set_symtab_encoder_encode_initializer, lto_symtab_encoder_in_partition_p,
lto_symtab_encoder_in_partition_p): Update.
(compute_ltrans_boundary): Take encoder as an input.
* passes.c (ipa_write_summaries_1): Update.
(ipa_write_summaries_1): Update.
(ipa_write_summaries): Update.
(ipa_write_optimization_summaries): Update.
* lto-streamer.c (print_lto_report): Report number of cgraph nodes.
* lto-streamer.h (lto_stats_d): Replace num_output_cgraph_nodes by
num_output_symtab_nodes.
(lto_encoder_entry): New structure.
(struct lto_symtab_encoder_d): Reorg.
(lto_symtab_encoder_delete_node): Declare.
(lto_symtab_encoder_lookup): Bring inline.
(compute_ltrans_boundary): Update.
(lto_symtab_encoder_size): Update.
(lsei_node, lsei_cgraph_node, lsei_varpool_node): Update.
(lto_symtab_encoder_deref): Update.
Replace cgraph_node_set and varpool_node_set by symtab_node_encoder
in partitioning.
* lto-partition.h (ltrans_partition_def): Replace cgraph_set and varpool_set
by encoder.
* lto-partition.c (new_partition): Update.
* lto.c (cmp_partitions_order): Update.
(lto_wpa_write_files): Update.
(free_ltrans_partitions): Update.
(add_references_to_partition): Update.
(add_cgraph_node_to_partition_1): Update.
(add_cgraph_node_to_partition): Update.
(add_varpool_node_to_partition): Update.
(undo_partition): Update.
(lto_balanced_map): Update.
(set_referenced_from_other_partition_p, set_reachable_from_other_partition_p,
set_referenced_from_this_partition_p): Update.
(lto_promote_cross_file_statics): Update.
From-SVN: r191107
2012-09-09 14:31:32 +02:00
|
|
|
fprintf (stderr, "[%s] # of output symtab nodes: "
|
2009-10-03 23:10:11 +02:00
|
|
|
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
|
Replace cgraph_node_set and varpool_node_set by symtab_node_encoder in partitioning.
Replace cgraph_node_set and varpool_node_set by symtab_node_encoder
in partitioning.
* tree-pass.h (cgraph_node_set_def, varpool_node_set_def): Remove
forward declaration.
(lto_symtab_encoder_d): Forward declare.
(ipa_write_optimization_summaries): Update.
* lto-cgraph.c (lto_symtab_encoder_new): Do not initialize
body, initializer and in_partition.
(lto_symtab_encoder_delete): Update.
(lto_symtab_encoder_encode): Update.
(lto_symtab_encoder_lookup): Move inline.
(lto_symtab_encoder_delete_node): New function.
(lto_symtab_encoder_encode_body_p, lto_set_symtab_encoder_encode_body,
lto_symtab_encoder_encode_initializer_p,
lto_set_symtab_encoder_encode_initializer, lto_symtab_encoder_in_partition_p,
lto_symtab_encoder_in_partition_p): Update.
(compute_ltrans_boundary): Take encoder as an input.
* passes.c (ipa_write_summaries_1): Update.
(ipa_write_summaries_1): Update.
(ipa_write_summaries): Update.
(ipa_write_optimization_summaries): Update.
* lto-streamer.c (print_lto_report): Report number of cgraph nodes.
* lto-streamer.h (lto_stats_d): Replace num_output_cgraph_nodes by
num_output_symtab_nodes.
(lto_encoder_entry): New structure.
(struct lto_symtab_encoder_d): Reorg.
(lto_symtab_encoder_delete_node): Declare.
(lto_symtab_encoder_lookup): Bring inline.
(compute_ltrans_boundary): Update.
(lto_symtab_encoder_size): Update.
(lsei_node, lsei_cgraph_node, lsei_varpool_node): Update.
(lto_symtab_encoder_deref): Update.
Replace cgraph_node_set and varpool_node_set by symtab_node_encoder
in partitioning.
* lto-partition.h (ltrans_partition_def): Replace cgraph_set and varpool_set
by encoder.
* lto-partition.c (new_partition): Update.
* lto.c (cmp_partitions_order): Update.
(lto_wpa_write_files): Update.
(free_ltrans_partitions): Update.
(add_references_to_partition): Update.
(add_cgraph_node_to_partition_1): Update.
(add_cgraph_node_to_partition): Update.
(add_varpool_node_to_partition): Update.
(undo_partition): Update.
(lto_balanced_map): Update.
(set_referenced_from_other_partition_p, set_reachable_from_other_partition_p,
set_referenced_from_this_partition_p): Update.
(lto_promote_cross_file_statics): Update.
From-SVN: r191107
2012-09-09 14:31:32 +02:00
|
|
|
lto_stats.num_output_symtab_nodes);
|
2009-10-03 23:10:11 +02:00
|
|
|
|
lto-streamer.h (enum LTO_tags): Add LTO_tree_scc.
2013-06-17 Richard Biener <rguenther@suse.de>
* lto-streamer.h (enum LTO_tags): Add LTO_tree_scc.
(lto_input_scc): Declare.
(lto_input_tree_1): Likewise.
(struct lto_stats_d): Add num_tree_bodies_output and
num_pickle_refs_output.
* lto-streamer-in.c (lto_read_body): Use streamer_tree_cache_get_tree.
(lto_read_tree_1): Split out from ...
(lto_read_tree): ... this.
(lto_input_scc): New function.
(lto_input_tree_1): Split out from ...
(lto_input_tree): ... this. Handle LTO_tree_scc.
(lto_data_in_create): Create the streamer cache without hashes.
* lto-streamer-out.c (create_output_block): Create the streamer
cache with hashes when not doing WPA.
(lto_write_tree_1): Split out from ...
(lto_write_tree): ... this.
(get_symbol_initial_value): New function.
(lto_output_tree_1): Split out from ...
(lto_output_tree): ... this. Write trees as series of SCCs
using a DFS walk via DFS_write_tree.
(struct sccs, struct scc_entry): New types.
(next_dfs_num, sccstack, sccstate, sccstate_obstack): New globals.
(DFS_write_tree_body): New function.
(DFS_write_tree): Likewise.
(hash_tree): Likewise.
(scc_entry_compare): Likewise.
(hash_scc): Likewise.
(tree_is_indexable): DEBUG_EXPR_DECLs are local entities.
* tree-streamer-in.c (lto_input_ts_list_tree_pointers): Stream
TREE_CHAIN as regular reference.
(streamer_read_integer_cst): Remove.
(streamer_get_pickled_tree): Adjust.
* tree-streamer-out.c (streamer_write_chain): Disable streaming
of DECL_EXTERNALs in BLOCK_VARS for now.
(write_ts_list_tree_pointers): Stream TREE_CHAIN as regular
reference.
* tree-streamer.c (streamer_tree_cache_add_to_node_array):
Add hash value argument and record that if hashes are recorded
in the cache.
(streamer_tree_cache_insert_1): Adjust.
(streamer_tree_cache_insert): Likewise.
(streamer_tree_cache_insert_at): Rename to ...
(streamer_tree_cache_replace_tree): ... this and adjust.
(streamer_tree_cache_append): Adjust.
(record_common_node): Likewise.
(streamer_tree_cache_create): Add argument whether to
record hash values together with trees.
(streamer_tree_cache_delete): Adjust.
* tree-streamer.h (struct streamer_tree_cache_d): Add
vector of hashes.
(streamer_read_integer_cst): Remove.
(streamer_tree_cache_insert): Adjust.
(streamer_tree_cache_append): Likewise.
(streamer_tree_cache_insert_at): Rename to ...
(streamer_tree_cache_replace_tree): ... this and adjust.
(streamer_tree_cache_create): Add argument whether to record hashes.
(streamer_tree_cache_get): Rename to ...
(streamer_tree_cache_get_tree): ... this.
(streamer_tree_cache_get_hash): New function.
* tree.c (cache_integer_cst): New function.
* tree.h (cache_integer_cst): Declare.
(ANON_AGGRNAME_FORMAT, ANON_AGGRNAME_P): Move here from cp/cp-tree.h.
* lto-symtab.c (lto_varpool_replace_node): Only release
DECL_INITIAL of non-prevailing decls.
* varpool.c (varpool_remove_initializer): Do not release
DECL_INITIAL when we are still in CGRAPH_LTO_STREAMING.
cp/
* cp-tree.h (ANON_AGGRNAME_FORMAT, ANON_AGGRNAME_P): Move to tree.h.
lto/
* Make-lang.in (lto.o): Add $(DATA_STREAMER_H) dependency.
* lto.c: Include data-streamer.h.
(lto_read_in_decl_state): Use streamer_tree_cache_get_tree.
(gimple_type_leader_entry_s, gimple_type_leader,
gimple_lookup_type_leader): Remove.
(gtc_visit): Simplify.
(gimple_types_compatible_p): Likewise.
(gimple_register_type_1): Likewise. Merge into ...
(gimple_register_type): ... this. Keep it as legacy for
statistics purposes for now.
(fixup_integer_cst): Remove.
(LTO_FIXUP_TREE, lto_fixup_types, lto_ft_*): Simplify and
rename to ...
(MAYBE_REMEMBER_WITH_VARS, maybe_remember_with_vars,
maybe_remember_with_vars_*): ... these.
(uniquify_nodes): Remove.
(lto_fixup_prevailing_type): New function.
(struct tree_scc, struct tree_scc_hasher): New type and hasher.
(tree_scc_hash, tree_scc_hash_obstack): New globals.
(num_merged_types, num_prevailing_types, num_not_merged_types,
num_not_merged_types_in_same_scc, total_scc_size, num_sccs_read,
total_scc_size_merged, num_sccs_merged, num_scc_compares,
num_scc_compare_collisions): New global counters.
(compare_tree_sccs_1): New function.
(compare_tree_sccs): Likewise.
(unify_scc): Likewise.
(lto_read_decls): Stream in tree SCCs and unify them on the
way in. Finalize prevailing SCC tree members.
(read_cgraph_and_symbols): Do not initialize or free gimple_type_leader.
Allocate and free tree_scc_hash_obstack and tree_scc_hash, do not bother
to ggc-collect during merging.
(print_lto_report_1): Adjust for new merging code.
From-SVN: r200151
2013-06-17 17:08:24 +02:00
|
|
|
fprintf (stderr, "[%s] # of output tree pickle references: "
|
|
|
|
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
|
|
|
|
lto_stats.num_pickle_refs_output);
|
|
|
|
fprintf (stderr, "[%s] # of output tree bodies: "
|
|
|
|
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
|
|
|
|
lto_stats.num_tree_bodies_output);
|
|
|
|
|
2009-10-03 23:10:11 +02:00
|
|
|
fprintf (stderr, "[%s] # callgraph partitions: "
|
|
|
|
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
|
|
|
|
lto_stats.num_cgraph_partitions);
|
|
|
|
|
|
|
|
fprintf (stderr, "[%s] Compression: "
|
|
|
|
HOST_WIDE_INT_PRINT_UNSIGNED " input bytes, "
|
|
|
|
HOST_WIDE_INT_PRINT_UNSIGNED " uncompressed bytes", s,
|
|
|
|
lto_stats.num_input_il_bytes,
|
|
|
|
lto_stats.num_uncompressed_il_bytes);
|
|
|
|
if (lto_stats.num_input_il_bytes > 0)
|
|
|
|
{
|
|
|
|
const float dividend = (float) lto_stats.num_uncompressed_il_bytes;
|
|
|
|
const float divisor = (float) lto_stats.num_input_il_bytes;
|
|
|
|
fprintf (stderr, " (ratio: %f)", dividend / divisor);
|
|
|
|
}
|
|
|
|
fprintf (stderr, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < LTO_N_SECTION_TYPES; i++)
|
|
|
|
fprintf (stderr, "[%s] Size of mmap'd section %s: "
|
|
|
|
HOST_WIDE_INT_PRINT_UNSIGNED " bytes\n", s,
|
|
|
|
lto_section_name[i], lto_stats.section_size[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-28 21:01:00 +02:00
|
|
|
#ifdef LTO_STREAMER_DEBUG
|
|
|
|
struct tree_hash_entry
|
|
|
|
{
|
|
|
|
tree key;
|
|
|
|
intptr_t value;
|
|
|
|
};
|
|
|
|
|
2015-06-25 19:06:13 +02:00
|
|
|
struct tree_entry_hasher : nofree_ptr_hash <tree_hash_entry>
|
2013-04-26 02:28:35 +02:00
|
|
|
{
|
2016-10-12 15:18:36 +02:00
|
|
|
static inline hashval_t hash (const tree_hash_entry *);
|
|
|
|
static inline bool equal (const tree_hash_entry *, const tree_hash_entry *);
|
2013-04-26 02:28:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
inline hashval_t
|
2016-10-12 15:18:36 +02:00
|
|
|
tree_entry_hasher::hash (const tree_hash_entry *e)
|
2010-04-28 21:01:00 +02:00
|
|
|
{
|
|
|
|
return htab_hash_pointer (e->key);
|
|
|
|
}
|
|
|
|
|
2013-04-26 02:28:35 +02:00
|
|
|
inline bool
|
2016-10-12 15:18:36 +02:00
|
|
|
tree_entry_hasher::equal (const tree_hash_entry *e1, const tree_hash_entry *e2)
|
2010-04-28 21:01:00 +02:00
|
|
|
{
|
|
|
|
return (e1->key == e2->key);
|
|
|
|
}
|
2013-04-26 02:28:35 +02:00
|
|
|
|
2016-10-12 15:18:36 +02:00
|
|
|
static hash_table<tree_entry_hasher> *tree_htab;
|
2010-04-28 21:01:00 +02:00
|
|
|
#endif
|
|
|
|
|
2009-10-03 23:10:11 +02:00
|
|
|
/* Initialization common to the LTO reader and writer. */
|
|
|
|
|
|
|
|
void
|
|
|
|
lto_streamer_init (void)
|
|
|
|
{
|
|
|
|
/* Check that all the TS_* handled by the reader and writer routines
|
|
|
|
match exactly the structures defined in treestruct.def. When a
|
|
|
|
new TS_* astructure is added, the streamer should be updated to
|
|
|
|
handle it. */
|
[PATCH 7/9] ENABLE_CHECKING refactoring: middle-end, LTO FE
[PATCH 7/9] ENABLE_CHECKING refactoring: middle-end, LTO FE
gcc/lto/ChangeLog:
2015-10-27 Mikhail Maltsev <maltsevm@gmail.com>
* lto.c (unify_scc): Use flag_checking and remove ENABLE_CHECKING
conditionals.
(lto_fixup_state): Likewise.
(do_whole_program_analysis): Use
symtab_node::checking_verify_symtab_nodes and remove ENABLE_CHECKING
conditionals.
gcc/ChangeLog:
2015-10-27 Mikhail Maltsev <maltsevm@gmail.com>
* attribs.c (check_attribute_tables): New function, broken out from...
(init_attributes): Use it.
* cfgcleanup.c (try_optimize_cfg): Use flag_checking, CHECKING_P
gcc_checking_assert and checking_* functions to eliminate
ENABLE_CHECKING conditionals.
* cfgexpand.c (expand_goto, expand_debug_expr): Likewise.
(pass_expand::execute): Likewise.
* cgraphclones.c (symbol_table::materialize_all_clones): Likewise.
* cgraphunit.c (mark_functions_to_output): Likewise.
(cgraph_node::expand_thunk): Likewise.
(symbol_table::compile): Likewise.
* ddg.c (add_cross_iteration_register_deps): Likewise.
(create_ddg_all_sccs): Likewise.
* df-core.c (df_finish_pass, df_analyze): Likewise.
* diagnostic-core.h: Likewise.
* diagnostic.c (diagnostic_report_diagnostic): Likewise.
* dominance.c (calculate_dominance_info): Likewise.
* dwarf2out.c (add_AT_die_ref): Likewise.
(const_ok_for_output_1, mem_loc_descriptor): Likewise.
(loc_list_from_tree, gen_lexical_block_die): Likewise.
gen_type_die_with_usage, gen_type_die): Likewise.
(dwarf2out_decl): Likewise.
* emit-rtl.c (verify_rtx_sharing, reorder_insns_nobb): Likewise.
* except.c (duplicate_eh_regions): Likewise.
* fwprop.c (register_active_defs, update_df_init): Likewise.
(fwprop_init, fwprop_done): Likewise.
(update_uses): Likewise.
* ggc-page.c (ggc_grow): Likewise.
* gimplify.c (gimplify_body): Likewise.
(gimplify_hasher::equal): Likewise.
* graphite-isl-ast-to-gimple.c (graphite_verify): Likewise.
* graphite-scop-detection.c (canonicalize_loop_closed_ssa_form):
Likewise.
* graphite-sese-to-poly.c (rewrite_reductions_out_of_ssa): Likewise.
(rewrite_cross_bb_scalar_deps_out_of_ssa): Likwise.
* hash-table.h (::find_empty_slot_for_expand): Likewise.
* ifcvt.c (if_convert): Likewise.
* ipa-cp.c (ipcp_propagate_stage): Likewise.
* ipa-devirt.c (type_in_anonymous_namespace_p): Likewise.
(odr_type_p, odr_types_equivalent_p): Likewise.
(add_type_duplicate, get_odr_type): Likewise.
* ipa-icf.c (sem_item_optimizer::execute): Likewise.
(sem_item_optimizer::subdivide_classes_by_equality): Likewise.
(sem_item_optimizer::verify_classes): Likewise.
(sem_item_optimizer::traverse_congruence_split): Likewise.
(sem_item_optimizer::checking_verify_classes): New.
* ipa-icf.h (sem_item_optimizer::checking_verify_classes): Add new
method.
* cfgrtl.c (commit_edge_insertions): Likewise.
(fixup_reorder_chain, cfg_layout_finalize): Likewise.
(rtl_flow_call_edges_add): Likewise.
* cgraph.c (symbol_table::create_edge): Likewise.
(cgraph_edge::redirect_call_stmt_to_callee): Likewise.
* cgraph.h (symtab_node): Likewise.
(symtab_node::checking_verify_symtab_nodes): Define.
(cgraph_node::checking_verify_cgraph_nodes): Define.
* cfghooks.h (checking_verify_flow_info): Define.
* cfgloop.h (checking_verify_loop_structure): Define.
* dominance.h (checking_verify_dominators): Define.
* et-forest.c: Fix comment.
* ipa-inline-analysis.c (compute_inline_parameters): Use flag_checking,
CHECKING_P gcc_checking_assert and checking_* functions to eliminate
ENABLE_CHECKING conditionals.
* ipa-inline-transform.c (save_inline_function_body): Likewise.
* ipa-inline.c (inline_small_functions): Likewise.
(early_inliner): Likewise.
* ipa-inline.h (estimate_edge_growth): Likewise.
* ipa-visibility.c (function_and_variable_visibility): Likewise.
* ipa.c (symbol_table::remove_unreachable_nodes): Likewise.
(ipa_single_use): Likewise.
* ira-int.h: Likewise.
* ira.c (ira): Likewise.
* loop-doloop.c (doloop_optimize_loops): Likewise.
* loop-init.c (loop_optimizer_init, fix_loop_structure): Likewise.
* loop-invariant.c (move_loop_invariants): Likewise.
* lra-assigns.c (lra_assign): Likewise.
* lra-constraints.c (lra_constraints): Likewise.
* lra-eliminations.c (lra_eliminate): Likewise.
* lra-int.h (struct lra_reg): Likewise.
* lra-lives.c (check_pseudos_live_through_calls): Likewise.
(lra_create_live_ranges_1): Likewise.
* lra-remat.c (create_remat_bb_data): Likewise.
* lra.c (lra_update_insn_recog_data, restore_scratches): Likewise.
(lra): Likewise.
(check_rtl): Always define. Remove incorrect guard around
extract_constrain_insn call.
* lto-cgraph.c (input_cgraph_1: Use flag_checking,
CHECKING_P gcc_checking_assert and checking_* functions to eliminate
ENABLE_CHECKING conditionals.
* lto-streamer-out.c (DFS::DFS): Likewise.
(lto_output): Likewise.
* lto-streamer.c (lto_streamer_init): Likewise.
* omp-low.c (scan_omp_target, expand_omp_taskreg): Likewise.
expand_omp_target, execute_expand_omp): Likewise.
(lower_omp_target): Likewise.
* passes.c (execute_function_todo): Likewise.
(execute_todo, execute_one_pass): Likewise.
(verify_curr_properties): Always define.
* predict.c (tree_estimate_probability: Use flag_checking,
CHECKING_P gcc_checking_assert and checking_* functions to eliminate
ENABLE_CHECKING conditionals.
(propagate_freq): Likewise.
* pretty-print.c (pp_format): Likewise.
* real.c (real_to_decimal_for_mode): Likewise.
* recog.c (split_all_insns): Likewise.
* regcprop.c (kill_value_one_regno): Likewise.
(copy_value): Likewise.
(validate_value_data): Define unconditionally.
* reload.c: Fix comment.
* timevar.c: Include options.h
* tree-ssa.h (checking_verify_ssa): Define.
* tree-ssa-loop-manip.h (checking_verify_loop_closed_ssa): Define.
* sched-deps.c (CHECK): Remove unused macro.
(add_or_update_dep_1, sd_add_dep: Use flag_checking, CHECKING_P
gcc_checking_assert and checking_* functions to eliminate
ENABLE_CHECKING conditionals.
* sel-sched-ir.c (free_regset_pool, tidy_control_flow): Likewise.
* sel-sched.c (struct moveop_static_params): Likewise.
(find_best_reg_for_expr, move_cond_jump): Likewise.
(move_op_orig_expr_not_found): Likewise.
(code_motion_process_successors, move_op): Likewise.
* ssa-iterators.h (first_readonly_imm_use): Likewise.
(next_readonly_imm_use): Likewise.
* store-motion.c (compute_store_table): Likewise.
* symbol-summary.h (function_summary::function_summary): Likewise.
* target.h (cumulative_args_t): Likewise.
(get_cumulative_args, pack_cumulative_args): Likewise.
* timevar.c: (timer::print): Likewise.
* trans-mem.c (ipa_tm_execute): Likewise.
* tree-cfg.c (move_stmt_op): Likewise.
(move_sese_region_to_fn): Likewise.
(gimple_flow_call_edges_add): Likewise.
* tree-cfgcleanup.c (cleanup_tree_cfg_noloop, repair_loop_structures):
Likewise.
* tree-eh.c (remove_unreachable_handlers): Likewise.
* tree-if-conv.c (pass_if_conversion::execute): Likewise.
* tree-inline.c (expand_call_inline, optimize_inline_calls): Likewise.
* tree-into-ssa.c (update_ssa): Likewise.
* tree-loop-distribution.c (pass_loop_distribution::execute): Likewise.
* tree-outof-ssa.c (eliminate_useless_phis, rewrite_trees): Likewise.
* tree-parloops.c (pass_parallelize_loops::execute): Likewise.
* tree-predcom.c (suitable_component_p): Likewise.
* tree-profile.c (gimple_gen_const_delta_profiler): Likewise.
* tree-ssa-alias.c (refs_may_alias_p_1): Likewise.
* tree-ssa-live.c (verify_live_on_entry): Likewise.
* tree-ssa-live.h (register_ssa_partition): Likewise.
* tree-ssa-loop-ivcanon.c (tree_unroll_loops_completely): Likewise.
* tree-ssa-loop-manip.c (add_exit_phi): Likewise.
(tree_transform_and_unroll_loop): Likewise.
* tree-ssa-math-opts.c (pass_cse_reciprocals::execute): Likewise.
* tree-ssa-operands.c (get_expr_operands): Likewise.
* tree-ssa-propagate.c (replace_exp_1): Likewise.
* tree-ssa-structalias.c (rewrite_constraints): Likewise.
* tree-ssa-ter.c (free_temp_expr_table): Likewise.
* tree-ssa-threadupdate.c (duplicate_thread_path): Likewise.
* tree-ssanames.c (release_ssa_name_fn): Likewise.
* tree-stdarg.c (expand_ifn_va_arg): Likewise.
* tree-vect-loop-manip.c
(slpeel_tree_duplicate_loop_to_edge_cfg): Likewise.
(slpeel_checking_verify_cfg_after_peeling): Likewise.
(vect_do_peeling_for_loop_bound): Likewise.
(vect_do_peeling_for_alignment): Likewise.
* tree-vrp.c (supports_overflow_infinity): Likewise.
(set_value_range): Likewise.
* tree.c (free_lang_data_in_cgraph): Likewise.
* value-prof.c (gimple_remove_histogram_value): Likewise.
(free_hist): Likewise.
* var-tracking.c (canonicalize_values_star): Likewise.
(compute_bb_dataflow, vt_find_locations, vt_emit_notes): Likewise.
From-SVN: r229470
2015-10-28 02:05:53 +01:00
|
|
|
if (flag_checking)
|
|
|
|
streamer_check_handled_ts_structures ();
|
2010-04-28 21:01:00 +02:00
|
|
|
|
|
|
|
#ifdef LTO_STREAMER_DEBUG
|
2016-10-12 15:18:36 +02:00
|
|
|
tree_htab = new hash_table<tree_entry_hasher> (31);
|
2010-04-28 21:01:00 +02:00
|
|
|
#endif
|
2009-10-03 23:10:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Gate function for all LTO streaming passes. */
|
|
|
|
|
|
|
|
bool
|
|
|
|
gate_lto_out (void)
|
|
|
|
{
|
2014-11-28 13:23:55 +01:00
|
|
|
return ((flag_generate_lto || flag_generate_offload || in_lto_p)
|
2009-10-03 23:10:11 +02:00
|
|
|
/* Don't bother doing anything if the program has errors. */
|
diagnostic-core.h: New.
* diagnostic-core.h: New. Contents moved from diagnostic.h and
toplev.h.
* diagnostic.c: Don't include toplev.h.
(progname): Define. Moved from toplev.c.
(seen_error): New function.
* diagnostic.h: Include diagnostic-core.h.
(diagnostic_t, emit_diagnostic): Don't declare here.
* toplev.c (progname): Move to toplev.c.
(emit_debug_global_declarations, compile_file, finalize,
do_compile, toplev_main): Use seen_error.
* toplev.h: Include diagnostic-core.h.
(trim_filename, GCC_DIAG_STYLE, ATTRIBUTE_GCC_DIAG,
internal_error, warning, warning_at, error, error_n, error_at,
fatal_error, pedwarn, permerror, sorry, inform, inform_n,
verbatim, fnotice, progname): Move to diagnostic-core.h.
* builtins.c: Include diagnostic-core.h instead of diagnostic.h.
(expand_builtin_expect): Use seen_error.
* c-decl.c: Include diagnostic-core.h instead of diagnostic.h.
(c_make_fname_decl, c_write_global_declarations): Use seen_error.
* c-format.c: Include diagnostic-core.h instead of diagnostic.h.
* c-gimplify.c: Include diagnostic-core.h instead of diagnostic.h.
* c-lang.c: Include diagnostic-core.h instead of diagnostic.h.
* c-lex.c (c_lex_with_flags, interpret_float): Don't increment
errorcount for errors.
* c-opts.c (c_common_finish): Use seen_error.
* cgraph.c: Include diagnostic-core.h instead of diagnostic.h.
* cgraphunit.c (verify_cgraph_node, verify_cgraph,
cgraph_output_pending_asms, cgraph_optimize): Use seen_error.
* coverage.c: Include diagnostic-core.h instead of diagnostic.h.
(get_coverage_counts): Use seen_error.
* dwarf2out.c (dwarf2out_finish): Use seen_error.
* gimplify.c (gimplify_var_or_parm_decl, gimple_push_cleanup,
gimplify_body): Use seen_error.
* ipa-inline.c (cgraph_early_inlining): Use seen_error.
* ipa-pure-const.c (gate_pure_const): Use seen_error.
* ipa-reference.c (gate_reference): Use seen_error.
* jump.c: Include diagnostic-core.h instead of diagnostic.h.
* lambda-code.c: Include diagnostic-core.h instead of
diagnostic.h.
* lto-cgraph.c: Include diagnostic-core.h instead of diagnostic.h.
* lto-compress.c: Include diagnostic-core.h instead of
diagnostic.h.
* lto-section-in.c: Include diagnostic-core.h instead of
diagnostic.h.
* lto-streamer-out.c: Include diagnostic-core.h instead of
diagnostic.h.
* lto-streamer.c: Include diagnostic-core.h instead of
diagnostic.h.
(gate_lto_out): Use seen_error.
* matrix-reorg.c: Include diagnostic-core.h instead of
diagnostic.h.
* omega.c: Include diagnostic-core.h instead of diagnostic.h.
* omp-low.c: Include diagnostic-core.h instead of diagnostic.h.
(gate_expand_omp, lower_omp_1): Use seen_error.
* passes.c: Include diagnostic-core.h instead of diagnostic.h.
(rest_of_decl_compilation, rest_of_type_compilation,
gate_rest_of_compilation, ipa_write_summaries): Use seen_error.
* tree-cfg.c (label_to_block_fn): Use seen_error.
* tree-inline.c (optimize_inline_calls): Use seen_error.
* tree-mudflap.c (mudflap_finish_file): Use
seen_error.
* tree-optimize.c (gate_all_optimizations,
gate_all_early_local_passes, gate_all_early_optimizations): Use
seen_error.
* tree-ssa-structalias.c (gate_ipa_pta): Use seen_error.
* varpool.c: Include diagnostic-core.h instead of diagnostic.h.
(varpool_remove_unreferenced_decls,
varpool_assemble_pending_decls): Use seen_error.
* Makefile.in (DIAGNOSTIC_CORE_H): Define.
(TOPLEV_H, DIAGNOSTIC_H): Update.
(c-decl.o, c-lang.o, c-format.o, lto-compress.o, lto-cgraph.o,
lto-streamer-out.o, lto-section-in.o, lto-streamer.o,
c-gimplify.o, omp-low.o, omega.o, diagnostic.o, passes.o,
builtins.o, jump.o, cgraph.o, varpool.o, matrix-reorg.o,
coverage.o, lambda-code.o): Update dependencies.
cp:
* call.c: Include diagnostic-core.h instead of diagnostic.h.
* cp-lang.c: Don't include diagnostic.h
* name-lookup.c: Include diagnostic-core.h instead of
diagnostic.h.
(cp_emit_debug_info_for_using): Use seen_error.
* optimize.c: Include diagnostic-core.h instead of diagnostic.h.
* parser.c: Include diagnostic-core.h instead of diagnostic.h.
* pt.c (iterative_hash_template_arg): Use seen_error.
* repo.c: Include diagnostic-core.h instead of diagnostic.h.
* typeck2.c: Include diagnostic-core.h instead of diagnostic.h.
* Make-lang.in (cp/cp-lang.o, cp/typeck2.o, cp/call.o, cp/repo.o,
cp/optimize.o, cp/parser.o, cp/name-lookup.o): Update
dependencies.
lto:
* lto.c: Include diagnostic-core.h instead of diagnostic.h.
(read_cgraph_and_symbols, lto_main): Use seen_error.
* Make-lang.in (lto/lto.o): Update dependencies.
objc:
* objc-act.c: Include diagnostic-core.h instead of diagnostic.h.
* Make-lang.in (objc/objc-act.o): Update dependencies.
From-SVN: r159947
2010-05-27 22:16:07 +02:00
|
|
|
&& !seen_error ());
|
2009-10-03 23:10:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef LTO_STREAMER_DEBUG
|
|
|
|
/* Add a mapping between T and ORIG_T, which is the numeric value of
|
|
|
|
the original address of T as it was seen by the LTO writer. This
|
|
|
|
mapping is useful when debugging streaming problems. A debugging
|
|
|
|
session can be started on both reader and writer using ORIG_T
|
|
|
|
as a breakpoint value in both sessions.
|
|
|
|
|
2009-11-25 11:55:54 +01:00
|
|
|
Note that this mapping is transient and only valid while T is
|
2009-10-03 23:10:11 +02:00
|
|
|
being reconstructed. Once T is fully built, the mapping is
|
|
|
|
removed. */
|
|
|
|
|
|
|
|
void
|
|
|
|
lto_orig_address_map (tree t, intptr_t orig_t)
|
|
|
|
{
|
2010-04-28 21:01:00 +02:00
|
|
|
struct tree_hash_entry ent;
|
|
|
|
struct tree_hash_entry **slot;
|
|
|
|
|
|
|
|
ent.key = t;
|
|
|
|
ent.value = orig_t;
|
Remove a layer of indirection from hash_table
gcc/
* hash-table.h: Remove a layer of indirection from hash_table so that
it contains the hash table's data instead of a pointer to the data.
* alloc-pool.c, asan.c, attribs.c, bitmap.c, cfg.c,
config/arm/arm.c, config/i386/winnt.c, config/ia64/ia64.c,
config/mips/mips.c, config/sol2.c, coverage.c, cselib.c,
data-streamer-out.c, dse.c, dwarf2cfi.c, dwarf2out.c, except.c,
fold-const.c, gcse.c, ggc-common.c,
gimple-ssa-strength-reduction.c, gimplify.c,
graphite-clast-to-gimple.c, graphite-dependences.c,
graphite-htab.h, graphite.c, haifa-sched.c, ipa-devirt.c,
ipa-profile.c, ira-color.c, ira-costs.c, loop-invariant.c,
loop-iv.c, loop-unroll.c, lto-streamer-in.c, lto-streamer-out.c,
lto-streamer.c, lto-streamer.h, passes.c, plugin.c,
postreload-gcse.c, sese.c, statistics.c, store-motion.c,
trans-mem.c, tree-browser.c, tree-cfg.c, tree-complex.c,
tree-eh.c, tree-into-ssa.c, tree-parloops.c, tree-sra.c,
tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-dom.c,
tree-ssa-live.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivopts.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sccvn.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-tail-merge.c,
tree-ssa-threadupdate.c, tree-ssa-uncprop.c,
tree-vect-data-refs.c, tree-vect-loop.c, tree-vectorizer.c,
tree-vectorizer.h, valtrack.c, valtrack.h, var-tracking.c,
vtable-verify.c, vtable-verify.h: Adjust.
gcc/c/
* c-decl.c: Adjust.
gcc/cp/
* class.c, semantics.c, tree.c, vtable-class-hierarchy.c:
Adjust.
gcc/java/
* jcf-io.c: Adjust.
gcc/lto/
* lto.c: Adjust.
gcc/objc/
* objc-act.c: Adjust.
From-SVN: r211936
2014-06-24 15:21:35 +02:00
|
|
|
slot = tree_htab->find_slot (&ent, INSERT);
|
2010-04-28 21:01:00 +02:00
|
|
|
gcc_assert (!*slot);
|
|
|
|
*slot = XNEW (struct tree_hash_entry);
|
|
|
|
**slot = ent;
|
2009-10-03 23:10:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Get the original address of T as it was seen by the writer. This
|
|
|
|
is only valid while T is being reconstructed. */
|
|
|
|
|
|
|
|
intptr_t
|
|
|
|
lto_orig_address_get (tree t)
|
|
|
|
{
|
2010-04-28 21:01:00 +02:00
|
|
|
struct tree_hash_entry ent;
|
|
|
|
struct tree_hash_entry **slot;
|
|
|
|
|
|
|
|
ent.key = t;
|
Remove a layer of indirection from hash_table
gcc/
* hash-table.h: Remove a layer of indirection from hash_table so that
it contains the hash table's data instead of a pointer to the data.
* alloc-pool.c, asan.c, attribs.c, bitmap.c, cfg.c,
config/arm/arm.c, config/i386/winnt.c, config/ia64/ia64.c,
config/mips/mips.c, config/sol2.c, coverage.c, cselib.c,
data-streamer-out.c, dse.c, dwarf2cfi.c, dwarf2out.c, except.c,
fold-const.c, gcse.c, ggc-common.c,
gimple-ssa-strength-reduction.c, gimplify.c,
graphite-clast-to-gimple.c, graphite-dependences.c,
graphite-htab.h, graphite.c, haifa-sched.c, ipa-devirt.c,
ipa-profile.c, ira-color.c, ira-costs.c, loop-invariant.c,
loop-iv.c, loop-unroll.c, lto-streamer-in.c, lto-streamer-out.c,
lto-streamer.c, lto-streamer.h, passes.c, plugin.c,
postreload-gcse.c, sese.c, statistics.c, store-motion.c,
trans-mem.c, tree-browser.c, tree-cfg.c, tree-complex.c,
tree-eh.c, tree-into-ssa.c, tree-parloops.c, tree-sra.c,
tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-dom.c,
tree-ssa-live.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivopts.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sccvn.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-tail-merge.c,
tree-ssa-threadupdate.c, tree-ssa-uncprop.c,
tree-vect-data-refs.c, tree-vect-loop.c, tree-vectorizer.c,
tree-vectorizer.h, valtrack.c, valtrack.h, var-tracking.c,
vtable-verify.c, vtable-verify.h: Adjust.
gcc/c/
* c-decl.c: Adjust.
gcc/cp/
* class.c, semantics.c, tree.c, vtable-class-hierarchy.c:
Adjust.
gcc/java/
* jcf-io.c: Adjust.
gcc/lto/
* lto.c: Adjust.
gcc/objc/
* objc-act.c: Adjust.
From-SVN: r211936
2014-06-24 15:21:35 +02:00
|
|
|
slot = tree_htab->find_slot (&ent, NO_INSERT);
|
2010-04-28 21:01:00 +02:00
|
|
|
return (slot ? (*slot)->value : 0);
|
2009-10-03 23:10:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Clear the mapping of T to its original address. */
|
|
|
|
|
|
|
|
void
|
|
|
|
lto_orig_address_remove (tree t)
|
|
|
|
{
|
2010-04-28 21:01:00 +02:00
|
|
|
struct tree_hash_entry ent;
|
|
|
|
struct tree_hash_entry **slot;
|
|
|
|
|
|
|
|
ent.key = t;
|
Remove a layer of indirection from hash_table
gcc/
* hash-table.h: Remove a layer of indirection from hash_table so that
it contains the hash table's data instead of a pointer to the data.
* alloc-pool.c, asan.c, attribs.c, bitmap.c, cfg.c,
config/arm/arm.c, config/i386/winnt.c, config/ia64/ia64.c,
config/mips/mips.c, config/sol2.c, coverage.c, cselib.c,
data-streamer-out.c, dse.c, dwarf2cfi.c, dwarf2out.c, except.c,
fold-const.c, gcse.c, ggc-common.c,
gimple-ssa-strength-reduction.c, gimplify.c,
graphite-clast-to-gimple.c, graphite-dependences.c,
graphite-htab.h, graphite.c, haifa-sched.c, ipa-devirt.c,
ipa-profile.c, ira-color.c, ira-costs.c, loop-invariant.c,
loop-iv.c, loop-unroll.c, lto-streamer-in.c, lto-streamer-out.c,
lto-streamer.c, lto-streamer.h, passes.c, plugin.c,
postreload-gcse.c, sese.c, statistics.c, store-motion.c,
trans-mem.c, tree-browser.c, tree-cfg.c, tree-complex.c,
tree-eh.c, tree-into-ssa.c, tree-parloops.c, tree-sra.c,
tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-dom.c,
tree-ssa-live.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivopts.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sccvn.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-tail-merge.c,
tree-ssa-threadupdate.c, tree-ssa-uncprop.c,
tree-vect-data-refs.c, tree-vect-loop.c, tree-vectorizer.c,
tree-vectorizer.h, valtrack.c, valtrack.h, var-tracking.c,
vtable-verify.c, vtable-verify.h: Adjust.
gcc/c/
* c-decl.c: Adjust.
gcc/cp/
* class.c, semantics.c, tree.c, vtable-class-hierarchy.c:
Adjust.
gcc/java/
* jcf-io.c: Adjust.
gcc/lto/
* lto.c: Adjust.
gcc/objc/
* objc-act.c: Adjust.
From-SVN: r211936
2014-06-24 15:21:35 +02:00
|
|
|
slot = tree_htab->find_slot (&ent, NO_INSERT);
|
2010-04-28 21:01:00 +02:00
|
|
|
gcc_assert (slot);
|
|
|
|
free (*slot);
|
Remove a layer of indirection from hash_table
gcc/
* hash-table.h: Remove a layer of indirection from hash_table so that
it contains the hash table's data instead of a pointer to the data.
* alloc-pool.c, asan.c, attribs.c, bitmap.c, cfg.c,
config/arm/arm.c, config/i386/winnt.c, config/ia64/ia64.c,
config/mips/mips.c, config/sol2.c, coverage.c, cselib.c,
data-streamer-out.c, dse.c, dwarf2cfi.c, dwarf2out.c, except.c,
fold-const.c, gcse.c, ggc-common.c,
gimple-ssa-strength-reduction.c, gimplify.c,
graphite-clast-to-gimple.c, graphite-dependences.c,
graphite-htab.h, graphite.c, haifa-sched.c, ipa-devirt.c,
ipa-profile.c, ira-color.c, ira-costs.c, loop-invariant.c,
loop-iv.c, loop-unroll.c, lto-streamer-in.c, lto-streamer-out.c,
lto-streamer.c, lto-streamer.h, passes.c, plugin.c,
postreload-gcse.c, sese.c, statistics.c, store-motion.c,
trans-mem.c, tree-browser.c, tree-cfg.c, tree-complex.c,
tree-eh.c, tree-into-ssa.c, tree-parloops.c, tree-sra.c,
tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-dom.c,
tree-ssa-live.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivopts.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sccvn.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-tail-merge.c,
tree-ssa-threadupdate.c, tree-ssa-uncprop.c,
tree-vect-data-refs.c, tree-vect-loop.c, tree-vectorizer.c,
tree-vectorizer.h, valtrack.c, valtrack.h, var-tracking.c,
vtable-verify.c, vtable-verify.h: Adjust.
gcc/c/
* c-decl.c: Adjust.
gcc/cp/
* class.c, semantics.c, tree.c, vtable-class-hierarchy.c:
Adjust.
gcc/java/
* jcf-io.c: Adjust.
gcc/lto/
* lto.c: Adjust.
gcc/objc/
* objc-act.c: Adjust.
From-SVN: r211936
2014-06-24 15:21:35 +02:00
|
|
|
tree_htab->clear_slot (slot);
|
2009-10-03 23:10:11 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Check that the version MAJOR.MINOR is the correct version number. */
|
|
|
|
|
|
|
|
void
|
2016-05-19 17:02:30 +02:00
|
|
|
lto_check_version (int major, int minor, const char *file_name)
|
2009-10-03 23:10:11 +02:00
|
|
|
{
|
|
|
|
if (major != LTO_major_version || minor != LTO_minor_version)
|
Always pass explicit location to fatal_error.
The patch <https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00698.html>
adding an overload for fatal_error that passes an explicit location
broke gcc.pot regeneration because xgettext cannot handle function
overloads with the diagnostic string argument in different positions.
As the desired direction is for all diagnostics to have explicit
locations, this patch addresses the regression by removing the version
of fatal_error that does not pass a location, passing explicit
input_location everywhere (in the hope that those will incrementally
be changed to other locations, much as with the addition of a location
argument to pedwarn some time ago - a lot of cases aren't meaningfully
associated with a source file so UNKNOWN_LOCATION may be better).
Note that this patch does not attempt to fix any existing issues with
these diagnostics (such as wrongly starting with capital letters or
ending with '.' or '\n'); it just adds the input_location argument.
Bootstrapped with no regressions for x86_64-unknown-linux-gnu (Go
excluded).
gcc:
* diagnostic.c (fatal_error (const char *, ...)): Remove function.
* diagnostic-core.h (fatal_error (const char *, ...)): Remove
prototype.
* toplev.h (init_asm_output): Update comment on use of
UNKNOWN_LOCATION with fatal_error.
* cgraph.c, collect-utils.c, collect2.c, config/arc/arc.c,
config/arc/arc.md, config/avr/avr.c, config/c6x/c6x.h,
config/darwin.c, config/host-darwin.c, config/i386/host-cygwin.c,
config/i386/intelmic-mkoffload.c, config/nios2/nios2.c,
config/nvptx/mkoffload.c, config/nvptx/nvptx.h,
config/rs6000/host-darwin.c, config/rs6000/rs6000.c,
config/s390/s390.c, gcc.c, gcov-io.h, gcov-tool.c, ggc-common.c,
ggc-page.c, graph.c, ipa-inline-analysis.c, ipa-reference.c,
lto-cgraph.c, lto-section-in.c, lto-streamer-in.c, lto-streamer.c,
lto-wrapper.c, objc/objc-act.c, opts.c, passes.c, plugin.c,
tlink.c, toplev.c, tree-streamer-in.c, varpool.c: All callers of
fatal_error changed to pass input_location as first argument.
gcc/c-family:
* c-opts.c, c-pch.c, cppspec.c: All callers of fatal_error changed
to pass input_location as first argument.
gcc/cp:
* class.c, except.c, parser.c, pt.c: All callers of fatal_error
changed to pass input_location as first argument.
gcc/fortran:
* f95-lang.c, gfortranspec.c, trans-const.c, trans-expr.c: All
callers of fatal_error changed to pass input_location as first
argument.
gcc/java:
* class.c, expr.c, jcf-parse.c, jvspec.c: All callers of
fatal_error changed to pass input_location as first argument.
gcc/lto:
* lto-object.c, lto-symtab.c, lto.c: All callers of fatal_error
changed to pass input_location as first argument.
libcc1:
* plugin.cc: All callers of fatal_error changed to pass
input_location as first argument.
From-SVN: r220293
2015-01-30 17:15:00 +01:00
|
|
|
fatal_error (input_location,
|
2017-03-06 09:54:57 +01:00
|
|
|
"bytecode stream in file %qs generated with LTO version "
|
2016-05-19 17:02:30 +02:00
|
|
|
"%d.%d instead of the expected %d.%d",
|
|
|
|
file_name,
|
2009-10-03 23:10:11 +02:00
|
|
|
major, minor,
|
|
|
|
LTO_major_version, LTO_minor_version);
|
|
|
|
}
|
2011-06-06 18:49:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* Initialize all the streamer hooks used for streaming GIMPLE. */
|
|
|
|
|
|
|
|
void
|
|
|
|
lto_streamer_hooks_init (void)
|
|
|
|
{
|
|
|
|
streamer_hooks_init ();
|
2011-08-11 14:02:34 +02:00
|
|
|
streamer_hooks.write_tree = lto_output_tree;
|
|
|
|
streamer_hooks.read_tree = lto_input_tree;
|
2012-10-10 16:27:59 +02:00
|
|
|
streamer_hooks.input_location = lto_input_location;
|
|
|
|
streamer_hooks.output_location = lto_output_location;
|
2011-06-06 18:49:11 +02:00
|
|
|
}
|