Commit 29a50dfb by Jan Hubicka Committed by Jan Hubicka

dumpfile.c (FIRST_ME_AUTO_NUMBERED_DUMP): Bump to 4.


	* dumpfile.c (FIRST_ME_AUTO_NUMBERED_DUMP): Bump to 4.
	* lto-lang.c (lto_link_dump_id, decl_merge_dump_id, partition_dump_id):
	New global vars.
	(lto_register_dumps): New hook.
	(LANG_HOOKS_REGISTER_DUMPS): New.
	* lto-partition.c: Dump into dump_file instead of symtab->dump_file.
	* lto-symtab.c: Include lto.h; dump into dump_file instead of
	symtab->dump_file.
	(lto_symtab_merge_decls): Initialize dump file.
	* lto.c (read_cgraph_and_symbols): Initialize dump file.
	(do_whole_program_analysis): Likewise.

From-SVN: r261337
parent 850078b7
2018-06-08 Jan Hubicka <hubicka@ucw.cz>
* dumpfile.c (FIRST_ME_AUTO_NUMBERED_DUMP): Bump to 4.
2018-06-08 David Edelsohn <dje.gcc@gmail.com> 2018-06-08 David Edelsohn <dje.gcc@gmail.com>
* config/rs6000/rs6000.c (rs6000_passes_ieee128): Protect with #if * config/rs6000/rs6000.c (rs6000_passes_ieee128): Protect with #if
......
...@@ -65,7 +65,7 @@ static struct dump_file_info dump_files[TDI_end] = ...@@ -65,7 +65,7 @@ static struct dump_file_info dump_files[TDI_end] =
DUMP_FILE_INFO (".gimple", "tree-gimple", DK_tree, 0), DUMP_FILE_INFO (".gimple", "tree-gimple", DK_tree, 0),
DUMP_FILE_INFO (".nested", "tree-nested", DK_tree, 0), DUMP_FILE_INFO (".nested", "tree-nested", DK_tree, 0),
#define FIRST_AUTO_NUMBERED_DUMP 1 #define FIRST_AUTO_NUMBERED_DUMP 1
#define FIRST_ME_AUTO_NUMBERED_DUMP 3 #define FIRST_ME_AUTO_NUMBERED_DUMP 4
DUMP_FILE_INFO (NULL, "lang-all", DK_lang, 0), DUMP_FILE_INFO (NULL, "lang-all", DK_lang, 0),
DUMP_FILE_INFO (NULL, "tree-all", DK_tree, 0), DUMP_FILE_INFO (NULL, "tree-all", DK_tree, 0),
......
2018-06-08 Jan Hubicka <hubicka@ucw.cz>
* lto-lang.c (lto_link_dump_id, decl_merge_dump_id, partition_dump_id):
New global vars.
(lto_register_dumps): New hook.
(LANG_HOOKS_REGISTER_DUMPS): New.
* lto-partition.c: Dump into dump_file instead of symtab->dump_file.
* lto-symtab.c: Include lto.h; dump into dump_file instead of
symtab->dump_file.
(lto_symtab_merge_decls): Initialize dump file.
* lto.c (read_cgraph_and_symbols): Initialize dump file.
(do_whole_program_analysis): Likewise.
2018-06-08 Martin Liska <mliska@suse.cz> 2018-06-08 Martin Liska <mliska@suse.cz>
* lto-partition.c (lto_balanced_map): Use cgraph_node::uid * lto-partition.c (lto_balanced_map): Use cgraph_node::uid
......
...@@ -37,6 +37,9 @@ along with GCC; see the file COPYING3. If not see ...@@ -37,6 +37,9 @@ along with GCC; see the file COPYING3. If not see
#include "stringpool.h" #include "stringpool.h"
#include "attribs.h" #include "attribs.h"
/* LTO specific dumps. */
int lto_link_dump_id, decl_merge_dump_id, partition_dump_id;
static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *); static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *);
static tree handle_leaf_attribute (tree *, tree, tree, int, bool *); static tree handle_leaf_attribute (tree *, tree, tree, int, bool *);
static tree handle_const_attribute (tree *, tree, tree, int, bool *); static tree handle_const_attribute (tree *, tree, tree, int, bool *);
...@@ -1375,6 +1378,23 @@ lto_init (void) ...@@ -1375,6 +1378,23 @@ lto_init (void)
return true; return true;
} }
/* Register c++-specific dumps. */
void
lto_register_dumps (gcc::dump_manager *dumps)
{
lto_link_dump_id = dumps->dump_register
(".lto-link", "ipa-lto-link", "ipa-lto-link",
DK_ipa, OPTGROUP_NONE, false);
decl_merge_dump_id = dumps->dump_register
(".lto-decl-merge", "ipa-lto-decl-merge", "ipa-lto-decl-merge",
DK_ipa, OPTGROUP_NONE, false);
partition_dump_id = dumps->dump_register
(".lto-partition", "ipa-lto-partition", "ipa-lto-partition",
DK_ipa, OPTGROUP_NONE, false);
}
/* Initialize tree structures required by the LTO front end. */ /* Initialize tree structures required by the LTO front end. */
static void lto_init_ts (void) static void lto_init_ts (void)
...@@ -1390,6 +1410,8 @@ static void lto_init_ts (void) ...@@ -1390,6 +1410,8 @@ static void lto_init_ts (void)
#define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lto_complain_wrong_lang_p #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lto_complain_wrong_lang_p
#undef LANG_HOOKS_INIT_OPTIONS_STRUCT #undef LANG_HOOKS_INIT_OPTIONS_STRUCT
#define LANG_HOOKS_INIT_OPTIONS_STRUCT lto_init_options_struct #define LANG_HOOKS_INIT_OPTIONS_STRUCT lto_init_options_struct
#undef LANG_HOOKS_REGISTER_DUMPS
#define LANG_HOOKS_REGISTER_DUMPS lto_register_dumps
#undef LANG_HOOKS_HANDLE_OPTION #undef LANG_HOOKS_HANDLE_OPTION
#define LANG_HOOKS_HANDLE_OPTION lto_handle_option #define LANG_HOOKS_HANDLE_OPTION lto_handle_option
#undef LANG_HOOKS_POST_OPTIONS #undef LANG_HOOKS_POST_OPTIONS
......
...@@ -160,8 +160,8 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node *node) ...@@ -160,8 +160,8 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node *node)
if (symbol_partitioned_p (node)) if (symbol_partitioned_p (node))
{ {
node->in_other_partition = 1; node->in_other_partition = 1;
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, fprintf (dump_file,
"Symbol node %s now used in multiple partitions\n", "Symbol node %s now used in multiple partitions\n",
node->name ()); node->name ());
} }
...@@ -541,13 +541,13 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) ...@@ -541,13 +541,13 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
order.qsort (node_cmp); order.qsort (node_cmp);
noreorder.qsort (node_cmp); noreorder.qsort (node_cmp);
if (symtab->dump_file) if (dump_file)
{ {
for (unsigned i = 0; i < order.length (); i++) for (unsigned i = 0; i < order.length (); i++)
fprintf (symtab->dump_file, "Balanced map symbol order:%s:%u\n", fprintf (dump_file, "Balanced map symbol order:%s:%u\n",
order[i]->name (), order[i]->tp_first_run); order[i]->name (), order[i]->tp_first_run);
for (unsigned i = 0; i < noreorder.length (); i++) for (unsigned i = 0; i < noreorder.length (); i++)
fprintf (symtab->dump_file, "Balanced map symbol no_reorder:%s:%u\n", fprintf (dump_file, "Balanced map symbol no_reorder:%s:%u\n",
noreorder[i]->name (), noreorder[i]->tp_first_run); noreorder[i]->name (), noreorder[i]->tp_first_run);
} }
...@@ -569,8 +569,8 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) ...@@ -569,8 +569,8 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
partition_size = PARAM_VALUE (MIN_PARTITION_SIZE); partition_size = PARAM_VALUE (MIN_PARTITION_SIZE);
npartitions = 1; npartitions = 1;
partition = new_partition (""); partition = new_partition ("");
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, "Total unit size: %" PRId64 ", partition size: %" PRId64 "\n", fprintf (dump_file, "Total unit size: %" PRId64 ", partition size: %" PRId64 "\n",
total_size, partition_size); total_size, partition_size);
auto_vec<symtab_node *> next_nodes; auto_vec<symtab_node *> next_nodes;
...@@ -763,8 +763,8 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) ...@@ -763,8 +763,8 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
best_n_nodes = lto_symtab_encoder_size (partition->encoder); best_n_nodes = lto_symtab_encoder_size (partition->encoder);
best_varpool_pos = varpool_pos; best_varpool_pos = varpool_pos;
} }
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, "Step %i: added %s/%i, size %i, " fprintf (dump_file, "Step %i: added %s/%i, size %i, "
"cost %" PRId64 "/%" PRId64 " " "cost %" PRId64 "/%" PRId64 " "
"best %" PRId64 "/%" PRId64", step %i\n", i, "best %" PRId64 "/%" PRId64", step %i\n", i,
order[i]->name (), order[i]->order, order[i]->name (), order[i]->order,
...@@ -777,16 +777,16 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) ...@@ -777,16 +777,16 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
{ {
if (best_i != i) if (best_i != i)
{ {
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, "Unwinding %i insertions to step %i\n", fprintf (dump_file, "Unwinding %i insertions to step %i\n",
i - best_i, best_i); i - best_i, best_i);
undo_partition (partition, best_n_nodes); undo_partition (partition, best_n_nodes);
varpool_pos = best_varpool_pos; varpool_pos = best_varpool_pos;
} }
gcc_assert (best_size == partition->insns); gcc_assert (best_size == partition->insns);
i = best_i; i = best_i;
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, fprintf (dump_file,
"Partition insns: %i (want %" PRId64 ")\n", "Partition insns: %i (want %" PRId64 ")\n",
partition->insns, partition_size); partition->insns, partition_size);
/* When we are finished, avoid creating empty partition. */ /* When we are finished, avoid creating empty partition. */
...@@ -799,8 +799,8 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) ...@@ -799,8 +799,8 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
last_visited_node = 0; last_visited_node = 0;
cost = 0; cost = 0;
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, "New partition\n"); fprintf (dump_file, "New partition\n");
best_n_nodes = 0; best_n_nodes = 0;
best_cost = -1; best_cost = -1;
...@@ -812,8 +812,8 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) ...@@ -812,8 +812,8 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
/* Watch for overflow. */ /* Watch for overflow. */
partition_size = INT_MAX / 16; partition_size = INT_MAX / 16;
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, fprintf (dump_file,
"Total size: %" PRId64 " partition_size: %" PRId64 "\n", "Total size: %" PRId64 " partition_size: %" PRId64 "\n",
total_size, partition_size); total_size, partition_size);
if (partition_size < PARAM_VALUE (MIN_PARTITION_SIZE)) if (partition_size < PARAM_VALUE (MIN_PARTITION_SIZE))
...@@ -840,21 +840,21 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size) ...@@ -840,21 +840,21 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
gcc_assert (next_nodes.length () || npartitions != 1 || !best_cost || best_cost == -1); gcc_assert (next_nodes.length () || npartitions != 1 || !best_cost || best_cost == -1);
add_sorted_nodes (next_nodes, partition); add_sorted_nodes (next_nodes, partition);
if (symtab->dump_file) if (dump_file)
{ {
fprintf (symtab->dump_file, "\nPartition sizes:\n"); fprintf (dump_file, "\nPartition sizes:\n");
unsigned partitions = ltrans_partitions.length (); unsigned partitions = ltrans_partitions.length ();
for (unsigned i = 0; i < partitions ; i++) for (unsigned i = 0; i < partitions ; i++)
{ {
ltrans_partition p = ltrans_partitions[i]; ltrans_partition p = ltrans_partitions[i];
fprintf (symtab->dump_file, "partition %d contains %d (%2.2f%%)" fprintf (dump_file, "partition %d contains %d (%2.2f%%)"
" symbols and %d (%2.2f%%) insns\n", i, p->symbols, " symbols and %d (%2.2f%%) insns\n", i, p->symbols,
100.0 * p->symbols / order.length (), p->insns, 100.0 * p->symbols / order.length (), p->insns,
100.0 * p->insns / original_total_size); 100.0 * p->insns / original_total_size);
} }
fprintf (symtab->dump_file, "\n"); fprintf (dump_file, "\n");
} }
} }
...@@ -869,8 +869,8 @@ must_not_rename (symtab_node *node, const char *name) ...@@ -869,8 +869,8 @@ must_not_rename (symtab_node *node, const char *name)
if (node->lto_file_data if (node->lto_file_data
&& lto_get_decl_name_mapping (node->lto_file_data, name) != name) && lto_get_decl_name_mapping (node->lto_file_data, name) != name)
{ {
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, fprintf (dump_file,
"Not privatizing symbol name: %s. It privatized already.\n", "Not privatizing symbol name: %s. It privatized already.\n",
name); name);
return true; return true;
...@@ -881,8 +881,8 @@ must_not_rename (symtab_node *node, const char *name) ...@@ -881,8 +881,8 @@ must_not_rename (symtab_node *node, const char *name)
that are not really clones. */ that are not really clones. */
if (node->unique_name) if (node->unique_name)
{ {
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, fprintf (dump_file,
"Not privatizing symbol name: %s. Has unique name.\n", "Not privatizing symbol name: %s. Has unique name.\n",
name); name);
return true; return true;
...@@ -972,8 +972,8 @@ privatize_symbol_name_1 (symtab_node *node, tree decl) ...@@ -972,8 +972,8 @@ privatize_symbol_name_1 (symtab_node *node, tree decl)
IDENTIFIER_POINTER IDENTIFIER_POINTER
(DECL_ASSEMBLER_NAME (decl))); (DECL_ASSEMBLER_NAME (decl)));
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, fprintf (dump_file,
"Privatizing symbol name: %s -> %s\n", "Privatizing symbol name: %s -> %s\n",
name, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))); name, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
...@@ -1018,8 +1018,8 @@ promote_symbol (symtab_node *node) ...@@ -1018,8 +1018,8 @@ promote_symbol (symtab_node *node)
TREE_PUBLIC (node->decl) = 1; TREE_PUBLIC (node->decl) = 1;
DECL_VISIBILITY (node->decl) = VISIBILITY_HIDDEN; DECL_VISIBILITY (node->decl) = VISIBILITY_HIDDEN;
DECL_VISIBILITY_SPECIFIED (node->decl) = true; DECL_VISIBILITY_SPECIFIED (node->decl) = true;
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, fprintf (dump_file,
"Promoting as hidden: %s (%s)\n", node->name (), "Promoting as hidden: %s (%s)\n", node->name (),
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl))); IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl)));
...@@ -1035,8 +1035,8 @@ promote_symbol (symtab_node *node) ...@@ -1035,8 +1035,8 @@ promote_symbol (symtab_node *node)
TREE_PUBLIC (alias->decl) = 1; TREE_PUBLIC (alias->decl) = 1;
DECL_VISIBILITY (alias->decl) = VISIBILITY_HIDDEN; DECL_VISIBILITY (alias->decl) = VISIBILITY_HIDDEN;
DECL_VISIBILITY_SPECIFIED (alias->decl) = true; DECL_VISIBILITY_SPECIFIED (alias->decl) = true;
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, fprintf (dump_file,
"Promoting alias as hidden: %s\n", "Promoting alias as hidden: %s\n",
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl))); IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl)));
} }
...@@ -1102,8 +1102,8 @@ rename_statics (lto_symtab_encoder_t encoder, symtab_node *node) ...@@ -1102,8 +1102,8 @@ rename_statics (lto_symtab_encoder_t encoder, symtab_node *node)
if (!s) if (!s)
return; return;
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, fprintf (dump_file,
"Renaming statics with asm name: %s\n", node->name ()); "Renaming statics with asm name: %s\n", node->name ());
/* Assign every symbol in the set that shares the same ASM name an unique /* Assign every symbol in the set that shares the same ASM name an unique
......
...@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-utils.h" #include "ipa-utils.h"
#include "builtins.h" #include "builtins.h"
#include "alias.h" #include "alias.h"
#include "lto.h"
#include "lto-symtab.h" #include "lto-symtab.h"
#include "stringpool.h" #include "stringpool.h"
#include "attribs.h" #include "attribs.h"
...@@ -45,9 +46,9 @@ lto_cgraph_replace_node (struct cgraph_node *node, ...@@ -45,9 +46,9 @@ lto_cgraph_replace_node (struct cgraph_node *node,
struct cgraph_edge *e, *next; struct cgraph_edge *e, *next;
bool compatible_p; bool compatible_p;
if (symtab->dump_file) if (dump_file)
{ {
fprintf (symtab->dump_file, "Replacing cgraph node %s by %s" fprintf (dump_file, "Replacing cgraph node %s by %s"
" for symbol %s\n", " for symbol %s\n",
node->dump_name (), node->dump_name (),
prevailing_node->dump_name (), prevailing_node->dump_name (),
...@@ -211,7 +212,7 @@ warn_type_compatibility_p (tree prevailing_type, tree type, ...@@ -211,7 +212,7 @@ warn_type_compatibility_p (tree prevailing_type, tree type,
if (TREE_CODE (type) != TREE_CODE (prevailing_type)) if (TREE_CODE (type) != TREE_CODE (prevailing_type))
lev |= 1; lev |= 1;
lev |= warn_type_compatibility_p (TREE_TYPE (prevailing_type), lev |= warn_type_compatibility_p (TREE_TYPE (prevailing_type),
TREE_TYPE (type), false); TREE_TYPE (type), false);
if (TREE_CODE (type) == METHOD_TYPE if (TREE_CODE (type) == METHOD_TYPE
&& TREE_CODE (prevailing_type) == METHOD_TYPE) && TREE_CODE (prevailing_type) == METHOD_TYPE)
lev |= warn_type_compatibility_p (TYPE_METHOD_BASETYPE (prevailing_type), lev |= warn_type_compatibility_p (TYPE_METHOD_BASETYPE (prevailing_type),
...@@ -271,7 +272,7 @@ warn_type_compatibility_p (tree prevailing_type, tree type, ...@@ -271,7 +272,7 @@ warn_type_compatibility_p (tree prevailing_type, tree type,
if (set1 && set2 && set1 != set2) if (set1 && set2 && set1 != set2)
{ {
tree t1 = type, t2 = prevailing_type; tree t1 = type, t2 = prevailing_type;
/* Alias sets of arrays with aliased components are the same as alias /* Alias sets of arrays with aliased components are the same as alias
sets of the inner types. */ sets of the inner types. */
...@@ -283,10 +284,10 @@ warn_type_compatibility_p (tree prevailing_type, tree type, ...@@ -283,10 +284,10 @@ warn_type_compatibility_p (tree prevailing_type, tree type,
t1 = TREE_TYPE (t1); t1 = TREE_TYPE (t1);
t2 = TREE_TYPE (t2); t2 = TREE_TYPE (t2);
} }
if ((!POINTER_TYPE_P (t1) || !POINTER_TYPE_P (t2)) if ((!POINTER_TYPE_P (t1) || !POINTER_TYPE_P (t2))
|| (set1 != TYPE_ALIAS_SET (ptr_type_node) || (set1 != TYPE_ALIAS_SET (ptr_type_node)
&& set2 != TYPE_ALIAS_SET (ptr_type_node))) && set2 != TYPE_ALIAS_SET (ptr_type_node)))
lev |= 5; lev |= 5;
} }
} }
...@@ -325,7 +326,7 @@ lto_symtab_merge (symtab_node *prevailing, symtab_node *entry) ...@@ -325,7 +326,7 @@ lto_symtab_merge (symtab_node *prevailing, symtab_node *entry)
DECL_POSSIBLY_INLINED (decl) |= DECL_POSSIBLY_INLINED (prevailing_decl); DECL_POSSIBLY_INLINED (decl) |= DECL_POSSIBLY_INLINED (prevailing_decl);
if (warn_type_compatibility_p (TREE_TYPE (prevailing_decl), if (warn_type_compatibility_p (TREE_TYPE (prevailing_decl),
TREE_TYPE (decl), TREE_TYPE (decl),
DECL_COMMON (decl) DECL_COMMON (decl)
|| DECL_EXTERNAL (decl))) || DECL_EXTERNAL (decl)))
return false; return false;
...@@ -536,8 +537,8 @@ lto_symtab_merge_p (tree prevailing, tree decl) ...@@ -536,8 +537,8 @@ lto_symtab_merge_p (tree prevailing, tree decl)
{ {
if (TREE_CODE (prevailing) != TREE_CODE (decl)) if (TREE_CODE (prevailing) != TREE_CODE (decl))
{ {
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, "Not merging decls; " fprintf (dump_file, "Not merging decls; "
"TREE_CODE mismatch\n"); "TREE_CODE mismatch\n");
return false; return false;
} }
...@@ -547,8 +548,8 @@ lto_symtab_merge_p (tree prevailing, tree decl) ...@@ -547,8 +548,8 @@ lto_symtab_merge_p (tree prevailing, tree decl)
{ {
if (DECL_BUILT_IN (prevailing) != DECL_BUILT_IN (decl)) if (DECL_BUILT_IN (prevailing) != DECL_BUILT_IN (decl))
{ {
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, "Not merging decls; " fprintf (dump_file, "Not merging decls; "
"DECL_BUILT_IN mismatch\n"); "DECL_BUILT_IN mismatch\n");
return false; return false;
} }
...@@ -556,8 +557,8 @@ lto_symtab_merge_p (tree prevailing, tree decl) ...@@ -556,8 +557,8 @@ lto_symtab_merge_p (tree prevailing, tree decl)
&& (DECL_BUILT_IN_CLASS (prevailing) != DECL_BUILT_IN_CLASS (decl) && (DECL_BUILT_IN_CLASS (prevailing) != DECL_BUILT_IN_CLASS (decl)
|| DECL_FUNCTION_CODE (prevailing) != DECL_FUNCTION_CODE (decl))) || DECL_FUNCTION_CODE (prevailing) != DECL_FUNCTION_CODE (decl)))
{ {
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, "Not merging decls; " fprintf (dump_file, "Not merging decls; "
"DECL_BUILT_IN_CLASS or CODE mismatch\n"); "DECL_BUILT_IN_CLASS or CODE mismatch\n");
return false; return false;
} }
...@@ -572,8 +573,8 @@ lto_symtab_merge_p (tree prevailing, tree decl) ...@@ -572,8 +573,8 @@ lto_symtab_merge_p (tree prevailing, tree decl)
if ((prev_attr == NULL) != (attr == NULL) if ((prev_attr == NULL) != (attr == NULL)
|| (prev_attr && !attribute_value_equal (prev_attr, attr))) || (prev_attr && !attribute_value_equal (prev_attr, attr)))
{ {
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, "Not merging decls; " fprintf (dump_file, "Not merging decls; "
"error attribute mismatch\n"); "error attribute mismatch\n");
return false; return false;
} }
...@@ -583,8 +584,8 @@ lto_symtab_merge_p (tree prevailing, tree decl) ...@@ -583,8 +584,8 @@ lto_symtab_merge_p (tree prevailing, tree decl)
if ((prev_attr == NULL) != (attr == NULL) if ((prev_attr == NULL) != (attr == NULL)
|| (prev_attr && !attribute_value_equal (prev_attr, attr))) || (prev_attr && !attribute_value_equal (prev_attr, attr)))
{ {
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, "Not merging decls; " fprintf (dump_file, "Not merging decls; "
"warning attribute mismatch\n"); "warning attribute mismatch\n");
return false; return false;
} }
...@@ -593,8 +594,8 @@ lto_symtab_merge_p (tree prevailing, tree decl) ...@@ -593,8 +594,8 @@ lto_symtab_merge_p (tree prevailing, tree decl)
attr = lookup_attribute ("noreturn", DECL_ATTRIBUTES (decl)); attr = lookup_attribute ("noreturn", DECL_ATTRIBUTES (decl));
if ((prev_attr == NULL) != (attr == NULL)) if ((prev_attr == NULL) != (attr == NULL))
{ {
if (symtab->dump_file) if (dump_file)
fprintf (symtab->dump_file, "Not merging decls; " fprintf (dump_file, "Not merging decls; "
"noreturn attribute mismatch\n"); "noreturn attribute mismatch\n");
return false; return false;
} }
...@@ -631,7 +632,7 @@ lto_symtab_merge_decls_2 (symtab_node *first, bool diagnosed_p) ...@@ -631,7 +632,7 @@ lto_symtab_merge_decls_2 (symtab_node *first, bool diagnosed_p)
visited. */ visited. */
if (lto_symtab_prevailing_decl (e->decl) != e->decl if (lto_symtab_prevailing_decl (e->decl) != e->decl
|| !lto_symtab_symbol_p (e) || !lto_symtab_symbol_p (e)
|| e->decl == prevailing->decl) || e->decl == prevailing->decl)
continue; continue;
if (!lto_symtab_merge (prevailing, e) if (!lto_symtab_merge (prevailing, e)
...@@ -683,9 +684,9 @@ lto_symtab_merge_decls_2 (symtab_node *first, bool diagnosed_p) ...@@ -683,9 +684,9 @@ lto_symtab_merge_decls_2 (symtab_node *first, bool diagnosed_p)
FOR_EACH_VEC_ELT (mismatches, i, decl) FOR_EACH_VEC_ELT (mismatches, i, decl)
{ {
/* Do not diagnose two built-in declarations, there is no useful /* Do not diagnose two built-in declarations, there is no useful
location in that case. It also happens for AVR if two built-ins location in that case. It also happens for AVR if two built-ins
use the same asm name because their libgcc assembler code is the use the same asm name because their libgcc assembler code is the
same, see PR78562. */ same, see PR78562. */
if (DECL_IS_BUILTIN (prevailing->decl) if (DECL_IS_BUILTIN (prevailing->decl)
&& DECL_IS_BUILTIN (decl)) && DECL_IS_BUILTIN (decl))
continue; continue;
...@@ -719,7 +720,7 @@ lto_symtab_merge_decls_2 (symtab_node *first, bool diagnosed_p) ...@@ -719,7 +720,7 @@ lto_symtab_merge_decls_2 (symtab_node *first, bool diagnosed_p)
diagnosed_p |= diag; diagnosed_p |= diag;
} }
else if ((DECL_USER_ALIGN (prevailing->decl) else if ((DECL_USER_ALIGN (prevailing->decl)
&& DECL_USER_ALIGN (decl)) && DECL_USER_ALIGN (decl))
&& DECL_ALIGN (prevailing->decl) < DECL_ALIGN (decl)) && DECL_ALIGN (prevailing->decl) < DECL_ALIGN (decl))
{ {
diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl), diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl),
...@@ -753,13 +754,13 @@ lto_symtab_merge_decls_1 (symtab_node *first) ...@@ -753,13 +754,13 @@ lto_symtab_merge_decls_1 (symtab_node *first)
symtab_node *prevailing; symtab_node *prevailing;
bool diagnosed_p = false; bool diagnosed_p = false;
if (symtab->dump_file) if (dump_file)
{ {
fprintf (symtab->dump_file, "Merging nodes for %s. Candidates:\n", fprintf (dump_file, "Merging nodes for %s. Candidates:\n",
first->asm_name ()); first->asm_name ());
for (e = first; e; e = e->next_sharing_asm_name) for (e = first; e; e = e->next_sharing_asm_name)
if (TREE_PUBLIC (e->decl)) if (TREE_PUBLIC (e->decl))
e->dump (symtab->dump_file); e->dump (dump_file);
} }
/* Compute the symbol resolutions. This is a no-op when using the /* Compute the symbol resolutions. This is a no-op when using the
...@@ -849,11 +850,11 @@ lto_symtab_merge_decls_1 (symtab_node *first) ...@@ -849,11 +850,11 @@ lto_symtab_merge_decls_1 (symtab_node *first)
mismatches. */ mismatches. */
lto_symtab_merge_decls_2 (prevailing, diagnosed_p); lto_symtab_merge_decls_2 (prevailing, diagnosed_p);
if (symtab->dump_file) if (dump_file)
{ {
fprintf (symtab->dump_file, "After resolution:\n"); fprintf (dump_file, "After resolution:\n");
for (e = prevailing; e; e = e->next_sharing_asm_name) for (e = prevailing; e; e = e->next_sharing_asm_name)
e->dump (symtab->dump_file); e->dump (dump_file);
} }
} }
...@@ -864,6 +865,9 @@ lto_symtab_merge_decls (void) ...@@ -864,6 +865,9 @@ lto_symtab_merge_decls (void)
{ {
symtab_node *node; symtab_node *node;
gcc_assert (!dump_file);
dump_file = dump_begin (decl_merge_dump_id, NULL);
/* Populate assembler name hash. */ /* Populate assembler name hash. */
symtab->symtab_initialize_asm_name_hash (); symtab->symtab_initialize_asm_name_hash ();
...@@ -871,6 +875,10 @@ lto_symtab_merge_decls (void) ...@@ -871,6 +875,10 @@ lto_symtab_merge_decls (void)
if (!node->previous_sharing_asm_name if (!node->previous_sharing_asm_name
&& node->next_sharing_asm_name) && node->next_sharing_asm_name)
lto_symtab_merge_decls_1 (node); lto_symtab_merge_decls_1 (node);
if (dump_file)
dump_end (decl_merge_dump_id, dump_file);
dump_file = NULL;
} }
/* Helper to process the decl chain for the symbol table entry *SLOT. */ /* Helper to process the decl chain for the symbol table entry *SLOT. */
...@@ -897,7 +905,7 @@ lto_symtab_merge_symbols_1 (symtab_node *prevailing) ...@@ -897,7 +905,7 @@ lto_symtab_merge_symbols_1 (symtab_node *prevailing)
/* No matter how we are going to deal with resolution, we will ultimately /* No matter how we are going to deal with resolution, we will ultimately
use prevailing definition. */ use prevailing definition. */
if (ce) if (ce)
ipa_merge_profiles (dyn_cast<cgraph_node *> (prevailing), ipa_merge_profiles (dyn_cast<cgraph_node *> (prevailing),
dyn_cast<cgraph_node *> (e)); dyn_cast<cgraph_node *> (e));
/* If we decided to replace the node by TO, do it. */ /* If we decided to replace the node by TO, do it. */
...@@ -919,7 +927,7 @@ lto_symtab_merge_symbols_1 (symtab_node *prevailing) ...@@ -919,7 +927,7 @@ lto_symtab_merge_symbols_1 (symtab_node *prevailing)
{ {
lto_free_function_in_decl_state_for_node (ce); lto_free_function_in_decl_state_for_node (ce);
if (!ce->weakref) if (!ce->weakref)
ce->release_body (); ce->release_body ();
ce->reset (); ce->reset ();
symtab->call_cgraph_removal_hooks (ce); symtab->call_cgraph_removal_hooks (ce);
} }
...@@ -956,7 +964,7 @@ lto_symtab_merge_symbols (void) ...@@ -956,7 +964,7 @@ lto_symtab_merge_symbols (void)
symtab->symtab_initialize_asm_name_hash (); symtab->symtab_initialize_asm_name_hash ();
/* Do the actual merging. /* Do the actual merging.
At this point we invalidate hash translating decls into symtab nodes At this point we invalidate hash translating decls into symtab nodes
because after removing one of duplicate decls the hash is not correcly because after removing one of duplicate decls the hash is not correcly
updated to the ohter dupliate. */ updated to the ohter dupliate. */
FOR_EACH_SYMBOL (node) FOR_EACH_SYMBOL (node)
......
...@@ -2972,29 +2972,43 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) ...@@ -2972,29 +2972,43 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
all_file_decl_data[i]->current_decl_state = NULL; all_file_decl_data[i]->current_decl_state = NULL;
} }
/* Finally merge the cgraph according to the decl merging decisions. */
timevar_push (TV_IPA_LTO_CGRAPH_MERGE);
if (symtab->dump_file)
{
fprintf (symtab->dump_file, "Before merging:\n");
symtab->dump (symtab->dump_file);
}
if (!flag_ltrans) if (!flag_ltrans)
{ {
/* Finally merge the cgraph according to the decl merging decisions. */
timevar_push (TV_IPA_LTO_CGRAPH_MERGE);
gcc_assert (!dump_file);
dump_file = dump_begin (lto_link_dump_id, NULL);
if (dump_file)
{
fprintf (dump_file, "Before merging:\n");
symtab->dump (dump_file);
}
lto_symtab_merge_symbols (); lto_symtab_merge_symbols ();
/* Removal of unreachable symbols is needed to make verify_symtab to pass; /* Removal of unreachable symbols is needed to make verify_symtab to pass;
we are still having duplicated comdat groups containing local statics. we are still having duplicated comdat groups containing local statics.
We could also just remove them while merging. */ We could also just remove them while merging. */
symtab->remove_unreachable_nodes (dump_file); symtab->remove_unreachable_nodes (dump_file);
ggc_collect ();
if (dump_file)
dump_end (lto_link_dump_id, dump_file);
dump_file = NULL;
timevar_pop (TV_IPA_LTO_CGRAPH_MERGE);
} }
ggc_collect ();
symtab->state = IPA_SSA; symtab->state = IPA_SSA;
/* FIXME: Technically all node removals happening here are useless, because /* All node removals happening here are useless, because
WPA should not stream them. */ WPA should not stream them. Still always perform remove_unreachable_nodes
because we may reshape clone tree, get rid of dead masters of inline
clones and remove symbol entries for read-only variables we keep around
only to be able to constant fold them. */
if (flag_ltrans) if (flag_ltrans)
symtab->remove_unreachable_nodes (dump_file); {
if (symtab->dump_file)
timevar_pop (TV_IPA_LTO_CGRAPH_MERGE); symtab->dump (symtab->dump_file);
symtab->remove_unreachable_nodes (symtab->dump_file);
}
/* Indicate that the cgraph is built and ready. */ /* Indicate that the cgraph is built and ready. */
symtab->function_flags_ready = true; symtab->function_flags_ready = true;
...@@ -3152,19 +3166,19 @@ do_whole_program_analysis (void) ...@@ -3152,19 +3166,19 @@ do_whole_program_analysis (void)
if (seen_error ()) if (seen_error ())
return; return;
if (symtab->dump_file)
{
fprintf (symtab->dump_file, "Optimized ");
symtab->dump (symtab->dump_file);
}
symtab_node::checking_verify_symtab_nodes ();
bitmap_obstack_release (NULL);
/* We are about to launch the final LTRANS phase, stop the WPA timer. */ /* We are about to launch the final LTRANS phase, stop the WPA timer. */
timevar_pop (TV_WHOPR_WPA); timevar_pop (TV_WHOPR_WPA);
timevar_push (TV_WHOPR_PARTITIONING); timevar_push (TV_WHOPR_PARTITIONING);
gcc_assert (!dump_file);
dump_file = dump_begin (partition_dump_id, NULL);
if (dump_file)
symtab->dump (dump_file);
symtab_node::checking_verify_symtab_nodes ();
bitmap_obstack_release (NULL);
if (flag_lto_partition == LTO_PARTITION_1TO1) if (flag_lto_partition == LTO_PARTITION_1TO1)
lto_1_to_1_map (); lto_1_to_1_map ();
else if (flag_lto_partition == LTO_PARTITION_MAX) else if (flag_lto_partition == LTO_PARTITION_MAX)
...@@ -3192,6 +3206,9 @@ do_whole_program_analysis (void) ...@@ -3192,6 +3206,9 @@ do_whole_program_analysis (void)
to globals with hidden visibility because they are accessed from multiple to globals with hidden visibility because they are accessed from multiple
partitions. */ partitions. */
lto_promote_cross_file_statics (); lto_promote_cross_file_statics ();
if (dump_file)
dump_end (partition_dump_id, dump_file);
dump_file = NULL;
timevar_pop (TV_WHOPR_PARTITIONING); timevar_pop (TV_WHOPR_PARTITIONING);
timevar_stop (TV_PHASE_OPT_GEN); timevar_stop (TV_PHASE_OPT_GEN);
......
...@@ -51,6 +51,8 @@ extern void lto_obj_end_section (void); ...@@ -51,6 +51,8 @@ extern void lto_obj_end_section (void);
extern lto_file *lto_set_current_out_file (lto_file *file); extern lto_file *lto_set_current_out_file (lto_file *file);
extern lto_file *lto_get_current_out_file (void); extern lto_file *lto_get_current_out_file (void);
extern int lto_link_dump_id, decl_merge_dump_id, partition_dump_id;
/* Hash table entry to hold the start offset and length of an LTO /* Hash table entry to hold the start offset and length of an LTO
section in a .o file. */ section in a .o file. */
struct lto_section_slot struct lto_section_slot
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment