Commit 8f940ee6 by Jan Hubicka Committed by Jan Hubicka

cgraph.c (cgraph_node_name): Remove.


	* cgraph.c (cgraph_node_name): Remove.
	(dump_cgraph_node): Use dump_symtab_base; reformat.
	* cgraph.h (symtab_node_asm_name, symtab_node_name, dump_symtab,
	debug_symtab, dump_symtab_node, debug_symtab_node, dump_symtab_base):
	Declare.
	(cgraph_node_name, varpool_node_name): Remove.
	(cgraph_node_asm_name, varpool_node_asm_name,
	cgraph_node_name, varpool_node_name): New.
	* tree-pass.h (TODO_dump_cgraph): Rename to ...
	(TODO_dump_symtab): ... this one.
	* ipa-cp (pass_ipa_cp): Update.
	* ia-reference.c (generate_summary, read_write_all_from_decl,
	propagate, ipa_reference_read_optimization_summary): Update.
	* cgraphunit.c (cgraph_analyze_functions): Update.
	(cgraph_optimize): Update.
	* ipa-ref.c (ipa_dump_references): Update.
	(ipa_dump_refering): Update.
	* ipa-inline.c (pass_ipa_inline): Update.
	* matrix-reorg.c (pass_ipa_matrix_reorg): Update.
	* ipa.c (pass_ipa_function_visibility,
	pass_ipa_whole_program_visibility): Update.
	* tree-sra.c (pass_early_ipa_sra): Update.
	* symtab.c: Include langhooks.h
	(symtab_node_asm_name): New.
	(symtab_node_name): New.
	(symtab_type_names): New static var.
	(dump_symtab_base): New.
	(dump_symtab_node, dump_symtab): New.
	(debug_symtab_node,  debug_symtab): New.
	* tree-ssa-structalias.c: Dump symbol table.
	* pases.c (execute_todo): Handle TODO_dump_symtab instead
	of TODO_dump_cgraph.
	* varpoo.c (varpool_node_name): Remove.
	(dump_varpool_node): Use dump_symtab_base; reformat.

From-SVN: r186559
parent cc8e7b1f
2012-04-18 Jan Hubicka <jh@suse.cz>
* cgraph.c (cgraph_node_name): Remove.
(dump_cgraph_node): Use dump_symtab_base; reformat.
* cgraph.h (symtab_node_asm_name, symtab_node_name, dump_symtab,
debug_symtab, dump_symtab_node, debug_symtab_node, dump_symtab_base):
Declare.
(cgraph_node_name, varpool_node_name): Remove.
(cgraph_node_asm_name, varpool_node_asm_name,
cgraph_node_name, varpool_node_name): New.
* tree-pass.h (TODO_dump_cgraph): Rename to ...
(TODO_dump_symtab): ... this one.
* ipa-cp (pass_ipa_cp): Update.
* ia-reference.c (generate_summary, read_write_all_from_decl,
propagate, ipa_reference_read_optimization_summary): Update.
* cgraphunit.c (cgraph_analyze_functions): Update.
(cgraph_optimize): Update.
* ipa-ref.c (ipa_dump_references): Update.
(ipa_dump_refering): Update.
* ipa-inline.c (pass_ipa_inline): Update.
* matrix-reorg.c (pass_ipa_matrix_reorg): Update.
* ipa.c (pass_ipa_function_visibility,
pass_ipa_whole_program_visibility): Update.
* tree-sra.c (pass_early_ipa_sra): Update.
* symtab.c: Include langhooks.h
(symtab_node_asm_name): New.
(symtab_node_name): New.
(symtab_type_names): New static var.
(dump_symtab_base): New.
(dump_symtab_node, dump_symtab): New.
(debug_symtab_node, debug_symtab): New.
* tree-ssa-structalias.c: Dump symbol table.
* pases.c (execute_todo): Handle TODO_dump_symtab instead
of TODO_dump_cgraph.
* varpoo.c (varpool_node_name): Remove.
(dump_varpool_node): Use dump_symtab_base; reformat.
2012-04-18 Manuel López-Ibáñez <manu@gcc.gnu.org> 2012-04-18 Manuel López-Ibáñez <manu@gcc.gnu.org>
* doc/invoke.texi (Language Independent Options): @item should be * doc/invoke.texi (Language Independent Options): @item should be
......
...@@ -1605,13 +1605,6 @@ cgraph_inline_failed_string (cgraph_inline_failed_t reason) ...@@ -1605,13 +1605,6 @@ cgraph_inline_failed_string (cgraph_inline_failed_t reason)
return cif_string_table[reason]; return cif_string_table[reason];
} }
/* Return name of the node used in debug output. */
const char *
cgraph_node_name (struct cgraph_node *node)
{
return lang_hooks.decl_printable_name (node->symbol.decl, 2);
}
/* Names used to print out the availability enum. */ /* Names used to print out the availability enum. */
const char * const cgraph_availability_names[] = const char * const cgraph_availability_names[] =
{"unset", "not_available", "overwritable", "available", "local"}; {"unset", "not_available", "overwritable", "available", "local"};
...@@ -1625,60 +1618,44 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node) ...@@ -1625,60 +1618,44 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
struct cgraph_edge *edge; struct cgraph_edge *edge;
int indirect_calls_count = 0; int indirect_calls_count = 0;
fprintf (f, "%s/%i", cgraph_node_name (node), node->uid); dump_symtab_base (f, (symtab_node) node);
dump_addr (f, " @", (void *)node);
if (DECL_ASSEMBLER_NAME_SET_P (node->symbol.decl))
fprintf (f, " (asm: %s)",
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->symbol.decl)));
if (node->global.inlined_to) if (node->global.inlined_to)
fprintf (f, " (inline copy in %s/%i)", fprintf (f, " Function %s/%i is inline copy in %s/%i\n",
cgraph_node_name (node),
node->symbol.order,
cgraph_node_name (node->global.inlined_to), cgraph_node_name (node->global.inlined_to),
node->global.inlined_to->uid); node->global.inlined_to->symbol.order);
if (node->symbol.same_comdat_group)
fprintf (f, " (same comdat group as %s/%i)",
cgraph_node_name (cgraph (node->symbol.same_comdat_group)),
cgraph (node->symbol.same_comdat_group)->uid);
if (node->clone_of) if (node->clone_of)
fprintf (f, " (clone of %s/%i)", fprintf (f, " Clone of %s/%i\n",
cgraph_node_name (node->clone_of), cgraph_node_asm_name (node->clone_of),
node->clone_of->uid); node->clone_of->symbol.order);
if (cgraph_function_flags_ready) if (cgraph_function_flags_ready)
fprintf (f, " availability:%s", fprintf (f, " Availability: %s\n",
cgraph_availability_names [cgraph_function_body_availability (node)]); cgraph_availability_names [cgraph_function_body_availability (node)]);
fprintf (f, " Function flags:");
if (node->analyzed) if (node->analyzed)
fprintf (f, " analyzed"); fprintf (f, " analyzed");
if (node->symbol.in_other_partition)
fprintf (f, " in_other_partition");
if (node->count) if (node->count)
fprintf (f, " executed "HOST_WIDEST_INT_PRINT_DEC"x", fprintf (f, " executed "HOST_WIDEST_INT_PRINT_DEC"x",
(HOST_WIDEST_INT)node->count); (HOST_WIDEST_INT)node->count);
if (node->origin) if (node->origin)
fprintf (f, " nested in: %s", cgraph_node_name (node->origin)); fprintf (f, " nested in: %s", cgraph_node_asm_name (node->origin));
if (node->needed) if (node->needed)
fprintf (f, " needed"); fprintf (f, " needed");
if (node->symbol.address_taken)
fprintf (f, " address_taken");
else if (node->reachable) else if (node->reachable)
fprintf (f, " reachable"); fprintf (f, " reachable");
else if (node->symbol.used_from_other_partition)
fprintf (f, " used_from_other_partition");
if (gimple_has_body_p (node->symbol.decl)) if (gimple_has_body_p (node->symbol.decl))
fprintf (f, " body"); fprintf (f, " body");
if (node->process) if (node->process)
fprintf (f, " process"); fprintf (f, " process");
if (node->local.local) if (node->local.local)
fprintf (f, " local"); fprintf (f, " local");
if (node->symbol.externally_visible)
fprintf (f, " externally_visible");
if (node->symbol.resolution != LDPR_UNKNOWN)
fprintf (f, " %s",
ld_plugin_symbol_resolution_names[(int)node->symbol.resolution]);
if (node->local.finalized) if (node->local.finalized)
fprintf (f, " finalized"); fprintf (f, " finalized");
if (node->local.redefined_extern_inline) if (node->local.redefined_extern_inline)
fprintf (f, " redefined_extern_inline"); fprintf (f, " redefined_extern_inline");
if (TREE_ASM_WRITTEN (node->symbol.decl))
fprintf (f, " asm_written");
if (node->only_called_at_startup) if (node->only_called_at_startup)
fprintf (f, " only_called_at_startup"); fprintf (f, " only_called_at_startup");
if (node->only_called_at_exit) if (node->only_called_at_exit)
...@@ -1692,7 +1669,7 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node) ...@@ -1692,7 +1669,7 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
if (node->thunk.thunk_p) if (node->thunk.thunk_p)
{ {
fprintf (f, " thunk of %s (asm: %s) fixed offset %i virtual value %i has " fprintf (f, " Thunk of %s (asm: %s) fixed offset %i virtual value %i has "
"virtual offset %i)\n", "virtual offset %i)\n",
lang_hooks.decl_printable_name (node->thunk.alias, 2), lang_hooks.decl_printable_name (node->thunk.alias, 2),
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->thunk.alias)), IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->thunk.alias)),
...@@ -1702,7 +1679,7 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node) ...@@ -1702,7 +1679,7 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
} }
if (node->alias && node->thunk.alias) if (node->alias && node->thunk.alias)
{ {
fprintf (f, " alias of %s", fprintf (f, " Alias of %s",
lang_hooks.decl_printable_name (node->thunk.alias, 2)); lang_hooks.decl_printable_name (node->thunk.alias, 2));
if (DECL_ASSEMBLER_NAME_SET_P (node->thunk.alias)) if (DECL_ASSEMBLER_NAME_SET_P (node->thunk.alias))
fprintf (f, " (asm: %s)", fprintf (f, " (asm: %s)",
...@@ -1710,12 +1687,12 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node) ...@@ -1710,12 +1687,12 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
fprintf (f, "\n"); fprintf (f, "\n");
} }
fprintf (f, " called by: "); fprintf (f, " Called by: ");
for (edge = node->callers; edge; edge = edge->next_caller) for (edge = node->callers; edge; edge = edge->next_caller)
{ {
fprintf (f, "%s/%i ", cgraph_node_name (edge->caller), fprintf (f, "%s/%i ", cgraph_node_asm_name (edge->caller),
edge->caller->uid); edge->caller->symbol.order);
if (edge->count) if (edge->count)
fprintf (f, "("HOST_WIDEST_INT_PRINT_DEC"x) ", fprintf (f, "("HOST_WIDEST_INT_PRINT_DEC"x) ",
(HOST_WIDEST_INT)edge->count); (HOST_WIDEST_INT)edge->count);
...@@ -1730,11 +1707,11 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node) ...@@ -1730,11 +1707,11 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
fprintf(f, "(can throw external) "); fprintf(f, "(can throw external) ");
} }
fprintf (f, "\n calls: "); fprintf (f, "\n Calls: ");
for (edge = node->callees; edge; edge = edge->next_callee) for (edge = node->callees; edge; edge = edge->next_callee)
{ {
fprintf (f, "%s/%i ", cgraph_node_name (edge->callee), fprintf (f, "%s/%i ", cgraph_node_asm_name (edge->callee),
edge->callee->uid); edge->callee->symbol.order);
if (!edge->inline_failed) if (!edge->inline_failed)
fprintf(f, "(inlined) "); fprintf(f, "(inlined) ");
if (edge->indirect_inlining_edge) if (edge->indirect_inlining_edge)
...@@ -1749,15 +1726,11 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node) ...@@ -1749,15 +1726,11 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
fprintf(f, "(can throw external) "); fprintf(f, "(can throw external) ");
} }
fprintf (f, "\n"); fprintf (f, "\n");
fprintf (f, " References: ");
ipa_dump_references (f, &node->symbol.ref_list);
fprintf (f, " Refering this function: ");
ipa_dump_refering (f, &node->symbol.ref_list);
for (edge = node->indirect_calls; edge; edge = edge->next_callee) for (edge = node->indirect_calls; edge; edge = edge->next_callee)
indirect_calls_count++; indirect_calls_count++;
if (indirect_calls_count) if (indirect_calls_count)
fprintf (f, " has %i outgoing edges for indirect calls.\n", fprintf (f, " Has %i outgoing edges for indirect calls.\n",
indirect_calls_count); indirect_calls_count);
} }
......
...@@ -508,7 +508,14 @@ void symtab_unregister_node (symtab_node); ...@@ -508,7 +508,14 @@ void symtab_unregister_node (symtab_node);
void symtab_remove_node (symtab_node); void symtab_remove_node (symtab_node);
symtab_node symtab_get_node (const_tree); symtab_node symtab_get_node (const_tree);
symtab_node symtab_node_for_asm (const_tree asmname); symtab_node symtab_node_for_asm (const_tree asmname);
const char * symtab_node_asm_name (symtab_node);
const char * symtab_node_name (symtab_node);
void symtab_insert_node_to_hashtable (symtab_node); void symtab_insert_node_to_hashtable (symtab_node);
void dump_symtab (FILE *);
void debug_symtab (void);
void dump_symtab_node (FILE *, symtab_node);
void debug_symtab_node (symtab_node);
void dump_symtab_base (FILE *, symtab_node);
/* In cgraph.c */ /* In cgraph.c */
void dump_cgraph (FILE *); void dump_cgraph (FILE *);
...@@ -545,7 +552,6 @@ void cgraph_update_edges_for_call_stmt (gimple, tree, gimple); ...@@ -545,7 +552,6 @@ void cgraph_update_edges_for_call_stmt (gimple, tree, gimple);
struct cgraph_local_info *cgraph_local_info (tree); struct cgraph_local_info *cgraph_local_info (tree);
struct cgraph_global_info *cgraph_global_info (tree); struct cgraph_global_info *cgraph_global_info (tree);
struct cgraph_rtl_info *cgraph_rtl_info (tree); struct cgraph_rtl_info *cgraph_rtl_info (tree);
const char * cgraph_node_name (struct cgraph_node *);
struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *, struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *,
struct cgraph_node *, gimple, struct cgraph_node *, gimple,
unsigned, gcov_type, int, bool); unsigned, gcov_type, int, bool);
...@@ -715,7 +721,6 @@ void varpool_remove_unreferenced_decls (void); ...@@ -715,7 +721,6 @@ void varpool_remove_unreferenced_decls (void);
void varpool_empty_needed_queue (void); void varpool_empty_needed_queue (void);
struct varpool_node * varpool_extra_name_alias (tree, tree); struct varpool_node * varpool_extra_name_alias (tree, tree);
struct varpool_node * varpool_create_variable_alias (tree, tree); struct varpool_node * varpool_create_variable_alias (tree, tree);
const char * varpool_node_name (struct varpool_node *node);
void varpool_reset_queue (void); void varpool_reset_queue (void);
bool const_value_known_p (tree); bool const_value_known_p (tree);
bool varpool_for_node_and_aliases (struct varpool_node *, bool varpool_for_node_and_aliases (struct varpool_node *,
...@@ -769,6 +774,34 @@ varpool_get_node (const_tree decl) ...@@ -769,6 +774,34 @@ varpool_get_node (const_tree decl)
return varpool (symtab_get_node (decl)); return varpool (symtab_get_node (decl));
} }
/* Return asm name of cgraph node. */
static inline const char *
cgraph_node_asm_name(struct cgraph_node *node)
{
return symtab_node_asm_name ((symtab_node)node);
}
/* Return asm name of varpool node. */
static inline const char *
varpool_node_asm_name(struct varpool_node *node)
{
return symtab_node_asm_name ((symtab_node)node);
}
/* Return name of cgraph node. */
static inline const char *
cgraph_node_name(struct cgraph_node *node)
{
return symtab_node_name ((symtab_node)node);
}
/* Return name of varpool node. */
static inline const char *
varpool_node_name(struct varpool_node *node)
{
return symtab_node_name ((symtab_node)node);
}
/* Walk all symbols. */ /* Walk all symbols. */
#define FOR_EACH_SYMBOL(node) \ #define FOR_EACH_SYMBOL(node) \
for ((node) = symtab_nodes; (node); (node) = (node)->symbol.next) for ((node) = symtab_nodes; (node); (node) = (node)->symbol.next)
......
...@@ -1273,8 +1273,7 @@ cgraph_analyze_functions (void) ...@@ -1273,8 +1273,7 @@ cgraph_analyze_functions (void)
if (node->needed) if (node->needed)
fprintf (cgraph_dump_file, " %s", cgraph_node_name (node)); fprintf (cgraph_dump_file, " %s", cgraph_node_name (node));
fprintf (cgraph_dump_file, "\n\nInitial "); fprintf (cgraph_dump_file, "\n\nInitial ");
dump_cgraph (cgraph_dump_file); dump_symtab (cgraph_dump_file);
dump_varpool (cgraph_dump_file);
} }
if (cgraph_dump_file) if (cgraph_dump_file)
...@@ -1310,8 +1309,7 @@ cgraph_analyze_functions (void) ...@@ -1310,8 +1309,7 @@ cgraph_analyze_functions (void)
if (cgraph_dump_file) if (cgraph_dump_file)
{ {
fprintf (cgraph_dump_file, "\n\nReclaimed "); fprintf (cgraph_dump_file, "\n\nReclaimed ");
dump_cgraph (cgraph_dump_file); dump_symtab (cgraph_dump_file);
dump_varpool (cgraph_dump_file);
} }
bitmap_obstack_release (NULL); bitmap_obstack_release (NULL);
first_analyzed = cgraph_first_function (); first_analyzed = cgraph_first_function ();
...@@ -2690,8 +2688,7 @@ cgraph_optimize (void) ...@@ -2690,8 +2688,7 @@ cgraph_optimize (void)
if (cgraph_dump_file) if (cgraph_dump_file)
{ {
fprintf (cgraph_dump_file, "Optimized "); fprintf (cgraph_dump_file, "Optimized ");
dump_cgraph (cgraph_dump_file); dump_symtab (cgraph_dump_file);
dump_varpool (cgraph_dump_file);
} }
if (post_ipa_mem_report) if (post_ipa_mem_report)
{ {
...@@ -2738,8 +2735,7 @@ cgraph_optimize (void) ...@@ -2738,8 +2735,7 @@ cgraph_optimize (void)
if (cgraph_dump_file) if (cgraph_dump_file)
{ {
fprintf (cgraph_dump_file, "\nFinal "); fprintf (cgraph_dump_file, "\nFinal ");
dump_cgraph (cgraph_dump_file); dump_symtab (cgraph_dump_file);
dump_varpool (cgraph_dump_file);
} }
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
verify_cgraph (); verify_cgraph ();
......
...@@ -2544,7 +2544,7 @@ struct ipa_opt_pass_d pass_ipa_cp = ...@@ -2544,7 +2544,7 @@ struct ipa_opt_pass_d pass_ipa_cp =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_dump_cgraph | TODO_dump_symtab |
TODO_remove_functions | TODO_ggc_collect /* todo_flags_finish */ TODO_remove_functions | TODO_ggc_collect /* todo_flags_finish */
}, },
ipcp_generate_summary, /* generate_summary */ ipcp_generate_summary, /* generate_summary */
......
...@@ -2025,7 +2025,7 @@ struct ipa_opt_pass_d pass_ipa_inline = ...@@ -2025,7 +2025,7 @@ struct ipa_opt_pass_d pass_ipa_inline =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
TODO_remove_functions, /* todo_flags_finish */ TODO_remove_functions, /* todo_flags_finish */
TODO_dump_cgraph TODO_dump_symtab
| TODO_remove_functions | TODO_ggc_collect /* todo_flags_finish */ | TODO_remove_functions | TODO_ggc_collect /* todo_flags_finish */
}, },
inline_generate_summary, /* generate_summary */ inline_generate_summary, /* generate_summary */
......
...@@ -164,13 +164,13 @@ ipa_dump_references (FILE * file, struct ipa_ref_list *list) ...@@ -164,13 +164,13 @@ ipa_dump_references (FILE * file, struct ipa_ref_list *list)
{ {
if (ref->refered_type == IPA_REF_CGRAPH) if (ref->refered_type == IPA_REF_CGRAPH)
{ {
fprintf (file, " fn:%s/%i (%s)", cgraph_node_name (ipa_ref_node (ref)), fprintf (file, " fn:%s/%i (%s)", cgraph_node_asm_name (ipa_ref_node (ref)),
ipa_ref_node (ref)->uid, ipa_ref_node (ref)->symbol.order,
ipa_ref_use_name [ref->use]); ipa_ref_use_name [ref->use]);
} }
else else
fprintf (file, " var:%s (%s)", fprintf (file, " var:%s (%s)",
varpool_node_name (ipa_ref_varpool_node (ref)), varpool_node_asm_name (ipa_ref_varpool_node (ref)),
ipa_ref_use_name [ref->use]); ipa_ref_use_name [ref->use]);
} }
fprintf (file, "\n"); fprintf (file, "\n");
...@@ -187,12 +187,12 @@ ipa_dump_refering (FILE * file, struct ipa_ref_list *list) ...@@ -187,12 +187,12 @@ ipa_dump_refering (FILE * file, struct ipa_ref_list *list)
{ {
if (ref->refering_type == IPA_REF_CGRAPH) if (ref->refering_type == IPA_REF_CGRAPH)
fprintf (file, " fn:%s/%i (%s)", fprintf (file, " fn:%s/%i (%s)",
cgraph_node_name (ipa_ref_refering_node (ref)), cgraph_node_asm_name (ipa_ref_refering_node (ref)),
ipa_ref_refering_node (ref)->uid, ipa_ref_refering_node (ref)->symbol.order,
ipa_ref_use_name [ref->use]); ipa_ref_use_name [ref->use]);
else else
fprintf (file, " var:%s (%s)", fprintf (file, " var:%s (%s)",
varpool_node_name (ipa_ref_refering_varpool_node (ref)), varpool_node_asm_name (ipa_ref_refering_varpool_node (ref)),
ipa_ref_use_name [ref->use]); ipa_ref_use_name [ref->use]);
} }
fprintf (file, "\n"); fprintf (file, "\n");
......
...@@ -553,7 +553,7 @@ generate_summary (void) ...@@ -553,7 +553,7 @@ generate_summary (void)
l = &get_reference_vars_info (node)->local; l = &get_reference_vars_info (node)->local;
fprintf (dump_file, fprintf (dump_file,
"\nFunction name:%s/%i:", "\nFunction name:%s/%i:",
cgraph_node_name (node), node->uid); cgraph_node_asm_name (node), node->symbol.order);
fprintf (dump_file, "\n locals read: "); fprintf (dump_file, "\n locals read: ");
if (l->statics_read) if (l->statics_read)
EXECUTE_IF_SET_IN_BITMAP (l->statics_read, EXECUTE_IF_SET_IN_BITMAP (l->statics_read,
...@@ -592,7 +592,7 @@ read_write_all_from_decl (struct cgraph_node *node, bool * read_all, ...@@ -592,7 +592,7 @@ read_write_all_from_decl (struct cgraph_node *node, bool * read_all,
*read_all = true; *read_all = true;
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " %s/%i -> read all\n", fprintf (dump_file, " %s/%i -> read all\n",
cgraph_node_name (node), node->uid); cgraph_node_asm_name (node), node->symbol.order);
} }
else else
{ {
...@@ -602,7 +602,7 @@ read_write_all_from_decl (struct cgraph_node *node, bool * read_all, ...@@ -602,7 +602,7 @@ read_write_all_from_decl (struct cgraph_node *node, bool * read_all,
*write_all = true; *write_all = true;
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " %s/%i -> read all, write all\n", fprintf (dump_file, " %s/%i -> read all, write all\n",
cgraph_node_name (node), node->uid); cgraph_node_asm_name (node), node->symbol.order);
} }
} }
...@@ -653,7 +653,7 @@ propagate (void) ...@@ -653,7 +653,7 @@ propagate (void)
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Starting cycle with %s/%i\n", fprintf (dump_file, "Starting cycle with %s/%i\n",
cgraph_node_name (node), node->uid); cgraph_node_asm_name (node), node->symbol.order);
node_l = &node_info->local; node_l = &node_info->local;
node_g = &node_info->global; node_g = &node_info->global;
...@@ -697,7 +697,7 @@ propagate (void) ...@@ -697,7 +697,7 @@ propagate (void)
{ {
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " Visiting %s/%i\n", fprintf (dump_file, " Visiting %s/%i\n",
cgraph_node_name (w), w->uid); cgraph_node_asm_name (w), w->symbol.order);
/* When function is overwritable, we can not assume anything. */ /* When function is overwritable, we can not assume anything. */
if (cgraph_function_body_availability (w) <= AVAIL_OVERWRITABLE) if (cgraph_function_body_availability (w) <= AVAIL_OVERWRITABLE)
read_write_all_from_decl (w, &read_all, &write_all); read_write_all_from_decl (w, &read_all, &write_all);
...@@ -811,7 +811,7 @@ propagate (void) ...@@ -811,7 +811,7 @@ propagate (void)
node_l = &node_info->local; node_l = &node_info->local;
fprintf (dump_file, fprintf (dump_file,
"\nFunction name:%s/%i:", "\nFunction name:%s/%i:",
cgraph_node_name (node), node->uid); cgraph_node_asm_name (node), node->symbol.order);
fprintf (dump_file, "\n locals read: "); fprintf (dump_file, "\n locals read: ");
if (node_l->statics_read) if (node_l->statics_read)
EXECUTE_IF_SET_IN_BITMAP (node_l->statics_read, EXECUTE_IF_SET_IN_BITMAP (node_l->statics_read,
...@@ -837,7 +837,7 @@ propagate (void) ...@@ -837,7 +837,7 @@ propagate (void)
get_reference_vars_info (w); get_reference_vars_info (w);
ipa_reference_local_vars_info_t w_l = &w_ri->local; ipa_reference_local_vars_info_t w_l = &w_ri->local;
fprintf (dump_file, "\n next cycle: %s/%i ", fprintf (dump_file, "\n next cycle: %s/%i ",
cgraph_node_name (w), w->uid); cgraph_node_asm_name (w), w->symbol.order);
fprintf (dump_file, "\n locals read: "); fprintf (dump_file, "\n locals read: ");
if (w_l->statics_read) if (w_l->statics_read)
EXECUTE_IF_SET_IN_BITMAP (w_l->statics_read, EXECUTE_IF_SET_IN_BITMAP (w_l->statics_read,
...@@ -1148,7 +1148,7 @@ ipa_reference_read_optimization_summary (void) ...@@ -1148,7 +1148,7 @@ ipa_reference_read_optimization_summary (void)
if (dump_file) if (dump_file)
fprintf (dump_file, fprintf (dump_file,
"\nFunction name:%s/%i:\n static not read:", "\nFunction name:%s/%i:\n static not read:",
cgraph_node_name (node), node->uid); cgraph_node_asm_name (node), node->symbol.order);
/* Set the statics not read. */ /* Set the statics not read. */
v_count = streamer_read_hwi (ib); v_count = streamer_read_hwi (ib);
......
...@@ -989,7 +989,7 @@ struct simple_ipa_opt_pass pass_ipa_function_and_variable_visibility = ...@@ -989,7 +989,7 @@ struct simple_ipa_opt_pass pass_ipa_function_and_variable_visibility =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_remove_functions | TODO_dump_cgraph TODO_remove_functions | TODO_dump_symtab
| TODO_ggc_collect /* todo_flags_finish */ | TODO_ggc_collect /* todo_flags_finish */
} }
}; };
...@@ -1047,7 +1047,7 @@ struct ipa_opt_pass_d pass_ipa_whole_program_visibility = ...@@ -1047,7 +1047,7 @@ struct ipa_opt_pass_d pass_ipa_whole_program_visibility =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_remove_functions | TODO_dump_cgraph TODO_remove_functions | TODO_dump_symtab
| TODO_ggc_collect /* todo_flags_finish */ | TODO_ggc_collect /* todo_flags_finish */
}, },
NULL, /* generate_summary */ NULL, /* generate_summary */
......
...@@ -2389,6 +2389,6 @@ struct simple_ipa_opt_pass pass_ipa_matrix_reorg = ...@@ -2389,6 +2389,6 @@ struct simple_ipa_opt_pass pass_ipa_matrix_reorg =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_dump_cgraph /* todo_flags_finish */ TODO_dump_symtab /* todo_flags_finish */
} }
}; };
...@@ -1862,7 +1862,7 @@ execute_todo (unsigned int flags) ...@@ -1862,7 +1862,7 @@ execute_todo (unsigned int flags)
cgraph_remove_unreachable_nodes (true, dump_file); cgraph_remove_unreachable_nodes (true, dump_file);
} }
if ((flags & TODO_dump_cgraph) && dump_file && !current_function_decl) if ((flags & TODO_dump_symtab) && dump_file && !current_function_decl)
{ {
gcc_assert (!cfun); gcc_assert (!cfun);
dump_cgraph (dump_file); dump_cgraph (dump_file);
......
...@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h" #include "tm.h"
#include "tree.h" #include "tree.h"
#include "tree-inline.h" #include "tree-inline.h"
#include "langhooks.h"
#include "hashtab.h" #include "hashtab.h"
#include "ggc.h" #include "ggc.h"
#include "cgraph.h" #include "cgraph.h"
...@@ -333,4 +334,141 @@ change_decl_assembler_name (tree decl, tree name) ...@@ -333,4 +334,141 @@ change_decl_assembler_name (tree decl, tree name)
} }
} }
/* Return printable assembler name of NODE.
This function is used only for debugging. When assembler name
is unknown go with identifier name. */
const char *
symtab_node_asm_name (symtab_node node)
{
if (!DECL_ASSEMBLER_NAME_SET_P (node->symbol.decl))
return lang_hooks.decl_printable_name (node->symbol.decl, 2);
return IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->symbol.decl));
}
/* Return printable identifier name. */
const char *
symtab_node_name (symtab_node node)
{
return lang_hooks.decl_printable_name (node->symbol.decl, 2);
}
static const char * const symtab_type_names[] = {"symbol", "function", "variable"};
/* Dump base fields of symtab nodes. Not to be used directly. */
void
dump_symtab_base (FILE *f, symtab_node node)
{
static const char * const visibility_types[] = {
"default", "protected", "hidden", "internal"
};
fprintf (f, "%s/%i (%s)",
symtab_node_asm_name (node),
node->symbol.order,
symtab_node_name (node));
dump_addr (f, " @", (void *)node);
fprintf (f, "\n Type: %s\n", symtab_type_names[node->symbol.type]);
fprintf (f, " Visibility:");
if (node->symbol.in_other_partition)
fprintf (f, " in_other_partition");
if (node->symbol.used_from_other_partition)
fprintf (f, " used_from_other_partition");
if (node->symbol.resolution != LDPR_UNKNOWN)
fprintf (f, " %s",
ld_plugin_symbol_resolution_names[(int)node->symbol.resolution]);
if (TREE_ASM_WRITTEN (node->symbol.decl))
fprintf (f, " asm_written");
if (DECL_EXTERNAL (node->symbol.decl))
fprintf (f, " external");
if (TREE_PUBLIC (node->symbol.decl))
fprintf (f, " public");
if (DECL_COMMON (node->symbol.decl))
fprintf (f, " common");
if (DECL_WEAK (node->symbol.decl))
fprintf (f, " weak");
if (DECL_DLLIMPORT_P (node->symbol.decl))
fprintf (f, " dll_import");
if (DECL_COMDAT (node->symbol.decl))
fprintf (f, " comdat");
if (DECL_COMDAT_GROUP (node->symbol.decl))
fprintf (f, " comdat_group:%s",
IDENTIFIER_POINTER (DECL_COMDAT_GROUP (node->symbol.decl)));
if (DECL_ONE_ONLY (node->symbol.decl))
fprintf (f, " one_only");
if (DECL_SECTION_NAME (node->symbol.decl))
fprintf (f, " section_name:%s",
IDENTIFIER_POINTER (DECL_SECTION_NAME (node->symbol.decl)));
if (DECL_VISIBILITY_SPECIFIED (node->symbol.decl))
fprintf (f, " visibility_specified");
if (DECL_VISIBILITY (node->symbol.decl))
fprintf (f, " visibility:%s",
visibility_types [DECL_VISIBILITY (node->symbol.decl)]);
if (DECL_VIRTUAL_P (node->symbol.decl))
fprintf (f, " virtual");
if (DECL_ARTIFICIAL (node->symbol.decl))
fprintf (f, " artificial");
fprintf (f, "\n");
if (node->symbol.same_comdat_group)
fprintf (f, " Same comdat group as: %s/%i\n",
symtab_node_asm_name (node->symbol.same_comdat_group),
node->symbol.same_comdat_group->symbol.order);
if (node->symbol.next_sharing_asm_name)
fprintf (f, " next sharing asm name: %i\n",
node->symbol.same_comdat_group->symbol.order);
if (node->symbol.previous_sharing_asm_name)
fprintf (f, " previous sharing asm name: %i\n",
node->symbol.same_comdat_group->symbol.order);
if (node->symbol.address_taken)
fprintf (f, " Address is taken.");
fprintf (f, " References: ");
ipa_dump_references (f, &node->symbol.ref_list);
fprintf (f, " Refering: ");
ipa_dump_refering (f, &node->symbol.ref_list);
}
/* Dump symtab node. */
void
dump_symtab_node (FILE *f, symtab_node node)
{
if (symtab_function_p (node))
dump_cgraph_node (f, cgraph (node));
else if (symtab_variable_p (node))
dump_varpool_node (f, varpool (node));
}
/* Dump symbol table. */
void
dump_symtab (FILE *f)
{
symtab_node node;
fprintf (f, "Symbol table:\n\n");
FOR_EACH_SYMBOL (node)
dump_symtab_node (f, node);
}
/* Dump symtab node NODE to stderr. */
DEBUG_FUNCTION void
debug_symtab_node (symtab_node node)
{
dump_symtab_node (stderr, node);
}
/* Dump symbol table to stderr. */
DEBUG_FUNCTION void
debug_symtab (void)
{
dump_symtab (stderr);
}
#include "gt-symtab.h" #include "gt-symtab.h"
...@@ -250,7 +250,7 @@ struct dump_file_info ...@@ -250,7 +250,7 @@ struct dump_file_info
#define TODO_verify_flow (1 << 3) #define TODO_verify_flow (1 << 3)
#define TODO_verify_stmts (1 << 4) #define TODO_verify_stmts (1 << 4)
#define TODO_cleanup_cfg (1 << 5) #define TODO_cleanup_cfg (1 << 5)
#define TODO_dump_cgraph (1 << 7) #define TODO_dump_symtab (1 << 7)
#define TODO_remove_functions (1 << 8) #define TODO_remove_functions (1 << 8)
#define TODO_rebuild_frequencies (1 << 9) #define TODO_rebuild_frequencies (1 << 9)
#define TODO_verify_rtl_sharing (1 << 10) #define TODO_verify_rtl_sharing (1 << 10)
......
...@@ -4865,6 +4865,6 @@ struct gimple_opt_pass pass_early_ipa_sra = ...@@ -4865,6 +4865,6 @@ struct gimple_opt_pass pass_early_ipa_sra =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_dump_cgraph /* todo_flags_finish */ TODO_dump_symtab /* todo_flags_finish */
} }
}; };
...@@ -6857,7 +6857,7 @@ ipa_pta_execute (void) ...@@ -6857,7 +6857,7 @@ ipa_pta_execute (void)
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
dump_cgraph (dump_file); dump_symtab (dump_file);
fprintf (dump_file, "\n"); fprintf (dump_file, "\n");
} }
......
...@@ -74,13 +74,6 @@ static GTY(()) symtab_node x_varpool_first_unanalyzed_node; ...@@ -74,13 +74,6 @@ static GTY(()) symtab_node x_varpool_first_unanalyzed_node;
/* Lists all assembled variables to be sent to debugger output later on. */ /* Lists all assembled variables to be sent to debugger output later on. */
static GTY(()) struct varpool_node *varpool_assembled_nodes_queue; static GTY(()) struct varpool_node *varpool_assembled_nodes_queue;
/* Return name of the node used in debug output. */
const char *
varpool_node_name (struct varpool_node *node)
{
return lang_hooks.decl_printable_name (node->symbol.decl, 2);
}
/* Return varpool node assigned to DECL. Create new one when needed. */ /* Return varpool node assigned to DECL. Create new one when needed. */
struct varpool_node * struct varpool_node *
varpool_node (tree decl) varpool_node (tree decl)
...@@ -127,17 +120,14 @@ varpool_remove_node (struct varpool_node *node) ...@@ -127,17 +120,14 @@ varpool_remove_node (struct varpool_node *node)
void void
dump_varpool_node (FILE *f, struct varpool_node *node) dump_varpool_node (FILE *f, struct varpool_node *node)
{ {
fprintf (f, "%s:", varpool_node_name (node)); dump_symtab_base (f, (symtab_node)node);
fprintf (f, " availability:%s", fprintf (f, " Availability: %s\n",
cgraph_function_flags_ready cgraph_function_flags_ready
? cgraph_availability_names[cgraph_variable_initializer_availability (node)] ? cgraph_availability_names[cgraph_variable_initializer_availability (node)]
: "not-ready"); : "not-ready");
if (DECL_ASSEMBLER_NAME_SET_P (node->symbol.decl)) fprintf (f, " Varpool flags:");
fprintf (f, " (asm: %s)", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->symbol.decl)));
if (DECL_INITIAL (node->symbol.decl)) if (DECL_INITIAL (node->symbol.decl))
fprintf (f, " initialized"); fprintf (f, " initialized");
if (TREE_ASM_WRITTEN (node->symbol.decl))
fprintf (f, " (asm written)");
if (node->needed) if (node->needed)
fprintf (f, " needed"); fprintf (f, " needed");
if (node->analyzed) if (node->analyzed)
...@@ -146,20 +136,7 @@ dump_varpool_node (FILE *f, struct varpool_node *node) ...@@ -146,20 +136,7 @@ dump_varpool_node (FILE *f, struct varpool_node *node)
fprintf (f, " finalized"); fprintf (f, " finalized");
if (node->output) if (node->output)
fprintf (f, " output"); fprintf (f, " output");
if (node->symbol.externally_visible)
fprintf (f, " externally_visible");
if (node->symbol.resolution != LDPR_UNKNOWN)
fprintf (f, " %s",
ld_plugin_symbol_resolution_names[(int)node->symbol.resolution]);
if (node->symbol.in_other_partition)
fprintf (f, " in_other_partition");
else if (node->symbol.used_from_other_partition)
fprintf (f, " used_from_other_partition");
fprintf (f, "\n"); fprintf (f, "\n");
fprintf (f, " References: ");
ipa_dump_references (f, &node->symbol.ref_list);
fprintf (f, " Refering this var: ");
ipa_dump_refering (f, &node->symbol.ref_list);
} }
/* Dump the variable pool. */ /* Dump the variable pool. */
......
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