This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Symbol table 7/many: debug output facilities
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 18 Apr 2012 08:32:26 +0200
- Subject: Symbol table 7/many: debug output facilities
Hi,
this patch adds dump_symtab and dump_symtab_node for debugging symbol tables.
It also reorganized existing varpool and cgraph dumping code to use the same format.
I decided to switch from identifier name to assembler names. It is useless to see
all those ctor/dtor functions wihtout knowing what they are and it also makes things
look more like real symbol table.
I left mangled dumping as some places where testsuite require it and will work on
this incrementally.
Regtested/bootstrapped x86_64-linux, will commit it shortly.
Honza
* 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.
Index: cgraph.c
===================================================================
*** cgraph.c (revision 186525)
--- cgraph.c (working copy)
*************** cgraph_inline_failed_string (cgraph_inli
*** 1605,1617 ****
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. */
const char * const cgraph_availability_names[] =
{"unset", "not_available", "overwritable", "available", "local"};
--- 1605,1610 ----
*************** dump_cgraph_node (FILE *f, struct cgraph
*** 1625,1684 ****
struct cgraph_edge *edge;
int indirect_calls_count = 0;
! fprintf (f, "%s/%i", cgraph_node_name (node), node->uid);
! 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)
! fprintf (f, " (inline copy in %s/%i)",
cgraph_node_name (node->global.inlined_to),
! node->global.inlined_to->uid);
! 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)
! fprintf (f, " (clone of %s/%i)",
! cgraph_node_name (node->clone_of),
! node->clone_of->uid);
if (cgraph_function_flags_ready)
! fprintf (f, " availability:%s",
cgraph_availability_names [cgraph_function_body_availability (node)]);
if (node->analyzed)
fprintf (f, " analyzed");
- if (node->symbol.in_other_partition)
- fprintf (f, " in_other_partition");
if (node->count)
fprintf (f, " executed "HOST_WIDEST_INT_PRINT_DEC"x",
(HOST_WIDEST_INT)node->count);
if (node->origin)
! fprintf (f, " nested in: %s", cgraph_node_name (node->origin));
if (node->needed)
fprintf (f, " needed");
- if (node->symbol.address_taken)
- fprintf (f, " address_taken");
else if (node->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))
fprintf (f, " body");
if (node->process)
fprintf (f, " process");
if (node->local.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)
fprintf (f, " finalized");
if (node->local.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)
fprintf (f, " only_called_at_startup");
if (node->only_called_at_exit)
--- 1618,1661 ----
struct cgraph_edge *edge;
int indirect_calls_count = 0;
! dump_symtab_base (f, (symtab_node) node);
!
if (node->global.inlined_to)
! 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),
! node->global.inlined_to->symbol.order);
if (node->clone_of)
! fprintf (f, " Clone of %s/%i\n",
! cgraph_node_asm_name (node->clone_of),
! node->clone_of->symbol.order);
if (cgraph_function_flags_ready)
! fprintf (f, " Availability: %s\n",
cgraph_availability_names [cgraph_function_body_availability (node)]);
+
+ fprintf (f, " Function flags:");
if (node->analyzed)
fprintf (f, " analyzed");
if (node->count)
fprintf (f, " executed "HOST_WIDEST_INT_PRINT_DEC"x",
(HOST_WIDEST_INT)node->count);
if (node->origin)
! fprintf (f, " nested in: %s", cgraph_node_asm_name (node->origin));
if (node->needed)
fprintf (f, " needed");
else if (node->reachable)
fprintf (f, " reachable");
if (gimple_has_body_p (node->symbol.decl))
fprintf (f, " body");
if (node->process)
fprintf (f, " process");
if (node->local.local)
fprintf (f, " local");
if (node->local.finalized)
fprintf (f, " finalized");
if (node->local.redefined_extern_inline)
fprintf (f, " redefined_extern_inline");
if (node->only_called_at_startup)
fprintf (f, " only_called_at_startup");
if (node->only_called_at_exit)
*************** dump_cgraph_node (FILE *f, struct cgraph
*** 1692,1698 ****
if (node->thunk.thunk_p)
{
! fprintf (f, " thunk of %s (asm: %s) fixed offset %i virtual value %i has "
"virtual offset %i)\n",
lang_hooks.decl_printable_name (node->thunk.alias, 2),
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->thunk.alias)),
--- 1669,1675 ----
if (node->thunk.thunk_p)
{
! fprintf (f, " Thunk of %s (asm: %s) fixed offset %i virtual value %i has "
"virtual offset %i)\n",
lang_hooks.decl_printable_name (node->thunk.alias, 2),
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->thunk.alias)),
*************** dump_cgraph_node (FILE *f, struct cgraph
*** 1702,1708 ****
}
if (node->alias && node->thunk.alias)
{
! fprintf (f, " alias of %s",
lang_hooks.decl_printable_name (node->thunk.alias, 2));
if (DECL_ASSEMBLER_NAME_SET_P (node->thunk.alias))
fprintf (f, " (asm: %s)",
--- 1679,1685 ----
}
if (node->alias && node->thunk.alias)
{
! fprintf (f, " Alias of %s",
lang_hooks.decl_printable_name (node->thunk.alias, 2));
if (DECL_ASSEMBLER_NAME_SET_P (node->thunk.alias))
fprintf (f, " (asm: %s)",
*************** dump_cgraph_node (FILE *f, struct cgraph
*** 1710,1721 ****
fprintf (f, "\n");
}
! fprintf (f, " called by: ");
for (edge = node->callers; edge; edge = edge->next_caller)
{
! fprintf (f, "%s/%i ", cgraph_node_name (edge->caller),
! edge->caller->uid);
if (edge->count)
fprintf (f, "("HOST_WIDEST_INT_PRINT_DEC"x) ",
(HOST_WIDEST_INT)edge->count);
--- 1687,1698 ----
fprintf (f, "\n");
}
! fprintf (f, " Called by: ");
for (edge = node->callers; edge; edge = edge->next_caller)
{
! fprintf (f, "%s/%i ", cgraph_node_asm_name (edge->caller),
! edge->caller->symbol.order);
if (edge->count)
fprintf (f, "("HOST_WIDEST_INT_PRINT_DEC"x) ",
(HOST_WIDEST_INT)edge->count);
*************** dump_cgraph_node (FILE *f, struct cgraph
*** 1730,1740 ****
fprintf(f, "(can throw external) ");
}
! fprintf (f, "\n calls: ");
for (edge = node->callees; edge; edge = edge->next_callee)
{
! fprintf (f, "%s/%i ", cgraph_node_name (edge->callee),
! edge->callee->uid);
if (!edge->inline_failed)
fprintf(f, "(inlined) ");
if (edge->indirect_inlining_edge)
--- 1707,1717 ----
fprintf(f, "(can throw external) ");
}
! fprintf (f, "\n Calls: ");
for (edge = node->callees; edge; edge = edge->next_callee)
{
! fprintf (f, "%s/%i ", cgraph_node_asm_name (edge->callee),
! edge->callee->symbol.order);
if (!edge->inline_failed)
fprintf(f, "(inlined) ");
if (edge->indirect_inlining_edge)
*************** dump_cgraph_node (FILE *f, struct cgraph
*** 1749,1763 ****
fprintf(f, "(can throw external) ");
}
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)
indirect_calls_count++;
if (indirect_calls_count)
! fprintf (f, " has %i outgoing edges for indirect calls.\n",
indirect_calls_count);
}
--- 1726,1736 ----
fprintf(f, "(can throw external) ");
}
fprintf (f, "\n");
for (edge = node->indirect_calls; edge; edge = edge->next_callee)
indirect_calls_count++;
if (indirect_calls_count)
! fprintf (f, " Has %i outgoing edges for indirect calls.\n",
indirect_calls_count);
}
Index: cgraph.h
===================================================================
*** cgraph.h (revision 186525)
--- cgraph.h (working copy)
*************** void symtab_unregister_node (symtab_node
*** 508,514 ****
--- 508,521 ----
void symtab_remove_node (symtab_node);
symtab_node symtab_get_node (const_tree);
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 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 */
void dump_cgraph (FILE *);
*************** void cgraph_update_edges_for_call_stmt (
*** 545,551 ****
struct cgraph_local_info *cgraph_local_info (tree);
struct cgraph_global_info *cgraph_global_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_node *, gimple,
unsigned, gcov_type, int, bool);
--- 552,557 ----
*************** void varpool_remove_unreferenced_decls (
*** 715,721 ****
void varpool_empty_needed_queue (void);
struct varpool_node * varpool_extra_name_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);
bool const_value_known_p (tree);
bool varpool_for_node_and_aliases (struct varpool_node *,
--- 721,726 ----
*************** varpool_get_node (const_tree decl)
*** 769,774 ****
--- 774,807 ----
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. */
#define FOR_EACH_SYMBOL(node) \
for ((node) = symtab_nodes; (node); (node) = (node)->symbol.next)
Index: tree-pass.h
===================================================================
*** tree-pass.h (revision 186524)
--- tree-pass.h (working copy)
*************** struct dump_file_info
*** 250,256 ****
#define TODO_verify_flow (1 << 3)
#define TODO_verify_stmts (1 << 4)
#define TODO_cleanup_cfg (1 << 5)
! #define TODO_dump_cgraph (1 << 7)
#define TODO_remove_functions (1 << 8)
#define TODO_rebuild_frequencies (1 << 9)
#define TODO_verify_rtl_sharing (1 << 10)
--- 250,256 ----
#define TODO_verify_flow (1 << 3)
#define TODO_verify_stmts (1 << 4)
#define TODO_cleanup_cfg (1 << 5)
! #define TODO_dump_symtab (1 << 7)
#define TODO_remove_functions (1 << 8)
#define TODO_rebuild_frequencies (1 << 9)
#define TODO_verify_rtl_sharing (1 << 10)
Index: ipa-cp.c
===================================================================
*** ipa-cp.c (revision 186524)
--- ipa-cp.c (working copy)
*************** struct ipa_opt_pass_d pass_ipa_cp =
*** 2544,2550 ****
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
! TODO_dump_cgraph |
TODO_remove_functions | TODO_ggc_collect /* todo_flags_finish */
},
ipcp_generate_summary, /* generate_summary */
--- 2544,2550 ----
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
! TODO_dump_symtab |
TODO_remove_functions | TODO_ggc_collect /* todo_flags_finish */
},
ipcp_generate_summary, /* generate_summary */
Index: ipa-reference.c
===================================================================
*** ipa-reference.c (revision 186524)
--- ipa-reference.c (working copy)
*************** generate_summary (void)
*** 553,559 ****
l = &get_reference_vars_info (node)->local;
fprintf (dump_file,
"\nFunction name:%s/%i:",
! cgraph_node_name (node), node->uid);
fprintf (dump_file, "\n locals read: ");
if (l->statics_read)
EXECUTE_IF_SET_IN_BITMAP (l->statics_read,
--- 553,559 ----
l = &get_reference_vars_info (node)->local;
fprintf (dump_file,
"\nFunction name:%s/%i:",
! cgraph_node_asm_name (node), node->symbol.order);
fprintf (dump_file, "\n locals read: ");
if (l->statics_read)
EXECUTE_IF_SET_IN_BITMAP (l->statics_read,
*************** read_write_all_from_decl (struct cgraph_
*** 592,598 ****
*read_all = true;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " %s/%i -> read all\n",
! cgraph_node_name (node), node->uid);
}
else
{
--- 592,598 ----
*read_all = true;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " %s/%i -> read all\n",
! cgraph_node_asm_name (node), node->symbol.order);
}
else
{
*************** read_write_all_from_decl (struct cgraph_
*** 602,608 ****
*write_all = true;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " %s/%i -> read all, write all\n",
! cgraph_node_name (node), node->uid);
}
}
--- 602,608 ----
*write_all = true;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " %s/%i -> read all, write all\n",
! cgraph_node_asm_name (node), node->symbol.order);
}
}
*************** propagate (void)
*** 653,659 ****
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Starting cycle with %s/%i\n",
! cgraph_node_name (node), node->uid);
node_l = &node_info->local;
node_g = &node_info->global;
--- 653,659 ----
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Starting cycle with %s/%i\n",
! cgraph_node_asm_name (node), node->symbol.order);
node_l = &node_info->local;
node_g = &node_info->global;
*************** propagate (void)
*** 697,703 ****
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " Visiting %s/%i\n",
! cgraph_node_name (w), w->uid);
/* When function is overwritable, we can not assume anything. */
if (cgraph_function_body_availability (w) <= AVAIL_OVERWRITABLE)
read_write_all_from_decl (w, &read_all, &write_all);
--- 697,703 ----
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " Visiting %s/%i\n",
! cgraph_node_asm_name (w), w->symbol.order);
/* When function is overwritable, we can not assume anything. */
if (cgraph_function_body_availability (w) <= AVAIL_OVERWRITABLE)
read_write_all_from_decl (w, &read_all, &write_all);
*************** propagate (void)
*** 811,817 ****
node_l = &node_info->local;
fprintf (dump_file,
"\nFunction name:%s/%i:",
! cgraph_node_name (node), node->uid);
fprintf (dump_file, "\n locals read: ");
if (node_l->statics_read)
EXECUTE_IF_SET_IN_BITMAP (node_l->statics_read,
--- 811,817 ----
node_l = &node_info->local;
fprintf (dump_file,
"\nFunction name:%s/%i:",
! cgraph_node_asm_name (node), node->symbol.order);
fprintf (dump_file, "\n locals read: ");
if (node_l->statics_read)
EXECUTE_IF_SET_IN_BITMAP (node_l->statics_read,
*************** propagate (void)
*** 837,843 ****
get_reference_vars_info (w);
ipa_reference_local_vars_info_t w_l = &w_ri->local;
fprintf (dump_file, "\n next cycle: %s/%i ",
! cgraph_node_name (w), w->uid);
fprintf (dump_file, "\n locals read: ");
if (w_l->statics_read)
EXECUTE_IF_SET_IN_BITMAP (w_l->statics_read,
--- 837,843 ----
get_reference_vars_info (w);
ipa_reference_local_vars_info_t w_l = &w_ri->local;
fprintf (dump_file, "\n next cycle: %s/%i ",
! cgraph_node_asm_name (w), w->symbol.order);
fprintf (dump_file, "\n locals read: ");
if (w_l->statics_read)
EXECUTE_IF_SET_IN_BITMAP (w_l->statics_read,
*************** ipa_reference_read_optimization_summary
*** 1148,1154 ****
if (dump_file)
fprintf (dump_file,
"\nFunction name:%s/%i:\n static not read:",
! cgraph_node_name (node), node->uid);
/* Set the statics not read. */
v_count = streamer_read_hwi (ib);
--- 1148,1154 ----
if (dump_file)
fprintf (dump_file,
"\nFunction name:%s/%i:\n static not read:",
! cgraph_node_asm_name (node), node->symbol.order);
/* Set the statics not read. */
v_count = streamer_read_hwi (ib);
Index: cgraphunit.c
===================================================================
*** cgraphunit.c (revision 186524)
--- cgraphunit.c (working copy)
*************** cgraph_analyze_functions (void)
*** 1273,1280 ****
if (node->needed)
fprintf (cgraph_dump_file, " %s", cgraph_node_name (node));
fprintf (cgraph_dump_file, "\n\nInitial ");
! dump_cgraph (cgraph_dump_file);
! dump_varpool (cgraph_dump_file);
}
if (cgraph_dump_file)
--- 1273,1279 ----
if (node->needed)
fprintf (cgraph_dump_file, " %s", cgraph_node_name (node));
fprintf (cgraph_dump_file, "\n\nInitial ");
! dump_symtab (cgraph_dump_file);
}
if (cgraph_dump_file)
*************** cgraph_analyze_functions (void)
*** 1310,1317 ****
if (cgraph_dump_file)
{
fprintf (cgraph_dump_file, "\n\nReclaimed ");
! dump_cgraph (cgraph_dump_file);
! dump_varpool (cgraph_dump_file);
}
bitmap_obstack_release (NULL);
first_analyzed = cgraph_first_function ();
--- 1309,1315 ----
if (cgraph_dump_file)
{
fprintf (cgraph_dump_file, "\n\nReclaimed ");
! dump_symtab (cgraph_dump_file);
}
bitmap_obstack_release (NULL);
first_analyzed = cgraph_first_function ();
*************** cgraph_optimize (void)
*** 2690,2697 ****
if (cgraph_dump_file)
{
fprintf (cgraph_dump_file, "Optimized ");
! dump_cgraph (cgraph_dump_file);
! dump_varpool (cgraph_dump_file);
}
if (post_ipa_mem_report)
{
--- 2688,2694 ----
if (cgraph_dump_file)
{
fprintf (cgraph_dump_file, "Optimized ");
! dump_symtab (cgraph_dump_file);
}
if (post_ipa_mem_report)
{
*************** cgraph_optimize (void)
*** 2738,2745 ****
if (cgraph_dump_file)
{
fprintf (cgraph_dump_file, "\nFinal ");
! dump_cgraph (cgraph_dump_file);
! dump_varpool (cgraph_dump_file);
}
#ifdef ENABLE_CHECKING
verify_cgraph ();
--- 2735,2741 ----
if (cgraph_dump_file)
{
fprintf (cgraph_dump_file, "\nFinal ");
! dump_symtab (cgraph_dump_file);
}
#ifdef ENABLE_CHECKING
verify_cgraph ();
Index: ipa-ref.c
===================================================================
*** ipa-ref.c (revision 186524)
--- ipa-ref.c (working copy)
*************** ipa_dump_references (FILE * file, struct
*** 164,176 ****
{
if (ref->refered_type == IPA_REF_CGRAPH)
{
! fprintf (file, " fn:%s/%i (%s)", cgraph_node_name (ipa_ref_node (ref)),
! ipa_ref_node (ref)->uid,
ipa_ref_use_name [ref->use]);
}
else
fprintf (file, " var:%s (%s)",
! varpool_node_name (ipa_ref_varpool_node (ref)),
ipa_ref_use_name [ref->use]);
}
fprintf (file, "\n");
--- 164,176 ----
{
if (ref->refered_type == IPA_REF_CGRAPH)
{
! fprintf (file, " fn:%s/%i (%s)", cgraph_node_asm_name (ipa_ref_node (ref)),
! ipa_ref_node (ref)->symbol.order,
ipa_ref_use_name [ref->use]);
}
else
fprintf (file, " var:%s (%s)",
! varpool_node_asm_name (ipa_ref_varpool_node (ref)),
ipa_ref_use_name [ref->use]);
}
fprintf (file, "\n");
*************** ipa_dump_refering (FILE * file, struct i
*** 187,198 ****
{
if (ref->refering_type == IPA_REF_CGRAPH)
fprintf (file, " fn:%s/%i (%s)",
! cgraph_node_name (ipa_ref_refering_node (ref)),
! ipa_ref_refering_node (ref)->uid,
ipa_ref_use_name [ref->use]);
else
fprintf (file, " var:%s (%s)",
! varpool_node_name (ipa_ref_refering_varpool_node (ref)),
ipa_ref_use_name [ref->use]);
}
fprintf (file, "\n");
--- 187,198 ----
{
if (ref->refering_type == IPA_REF_CGRAPH)
fprintf (file, " fn:%s/%i (%s)",
! cgraph_node_asm_name (ipa_ref_refering_node (ref)),
! ipa_ref_refering_node (ref)->symbol.order,
ipa_ref_use_name [ref->use]);
else
fprintf (file, " var:%s (%s)",
! varpool_node_asm_name (ipa_ref_refering_varpool_node (ref)),
ipa_ref_use_name [ref->use]);
}
fprintf (file, "\n");
Index: ipa-inline.c
===================================================================
*** ipa-inline.c (revision 186524)
--- ipa-inline.c (working copy)
*************** struct ipa_opt_pass_d pass_ipa_inline =
*** 2025,2031 ****
0, /* properties_provided */
0, /* properties_destroyed */
TODO_remove_functions, /* todo_flags_finish */
! TODO_dump_cgraph
| TODO_remove_functions | TODO_ggc_collect /* todo_flags_finish */
},
inline_generate_summary, /* generate_summary */
--- 2025,2031 ----
0, /* properties_provided */
0, /* properties_destroyed */
TODO_remove_functions, /* todo_flags_finish */
! TODO_dump_symtab
| TODO_remove_functions | TODO_ggc_collect /* todo_flags_finish */
},
inline_generate_summary, /* generate_summary */
Index: matrix-reorg.c
===================================================================
*** matrix-reorg.c (revision 186524)
--- matrix-reorg.c (working copy)
*************** struct simple_ipa_opt_pass pass_ipa_matr
*** 2389,2394 ****
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
! TODO_dump_cgraph /* todo_flags_finish */
}
};
--- 2389,2394 ----
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
! TODO_dump_symtab /* todo_flags_finish */
}
};
Index: ipa.c
===================================================================
*** ipa.c (revision 186524)
--- ipa.c (working copy)
*************** struct simple_ipa_opt_pass pass_ipa_func
*** 989,995 ****
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
! TODO_remove_functions | TODO_dump_cgraph
| TODO_ggc_collect /* todo_flags_finish */
}
};
--- 989,995 ----
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
! TODO_remove_functions | TODO_dump_symtab
| TODO_ggc_collect /* todo_flags_finish */
}
};
*************** struct ipa_opt_pass_d pass_ipa_whole_pro
*** 1047,1053 ****
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
! TODO_remove_functions | TODO_dump_cgraph
| TODO_ggc_collect /* todo_flags_finish */
},
NULL, /* generate_summary */
--- 1047,1053 ----
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
! TODO_remove_functions | TODO_dump_symtab
| TODO_ggc_collect /* todo_flags_finish */
},
NULL, /* generate_summary */
Index: tree-sra.c
===================================================================
*** tree-sra.c (revision 186524)
--- tree-sra.c (working copy)
*************** struct gimple_opt_pass pass_early_ipa_sr
*** 4865,4870 ****
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
! TODO_dump_cgraph /* todo_flags_finish */
}
};
--- 4865,4870 ----
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
! TODO_dump_symtab /* todo_flags_finish */
}
};
Index: symtab.c
===================================================================
*** symtab.c (revision 186525)
--- symtab.c (working copy)
*************** along with GCC; see the file COPYING3.
*** 24,29 ****
--- 24,30 ----
#include "tm.h"
#include "tree.h"
#include "tree-inline.h"
+ #include "langhooks.h"
#include "hashtab.h"
#include "ggc.h"
#include "cgraph.h"
*************** change_decl_assembler_name (tree decl, t
*** 333,336 ****
--- 334,474 ----
}
}
+ /* 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"
Index: tree-ssa-structalias.c
===================================================================
*** tree-ssa-structalias.c (revision 186524)
--- tree-ssa-structalias.c (working copy)
*************** ipa_pta_execute (void)
*** 6857,6863 ****
if (dump_file && (dump_flags & TDF_DETAILS))
{
! dump_cgraph (dump_file);
fprintf (dump_file, "\n");
}
--- 6857,6863 ----
if (dump_file && (dump_flags & TDF_DETAILS))
{
! dump_symtab (dump_file);
fprintf (dump_file, "\n");
}
Index: passes.c
===================================================================
*** passes.c (revision 186524)
--- passes.c (working copy)
*************** execute_todo (unsigned int flags)
*** 1862,1868 ****
cgraph_remove_unreachable_nodes (true, dump_file);
}
! if ((flags & TODO_dump_cgraph) && dump_file && !current_function_decl)
{
gcc_assert (!cfun);
dump_cgraph (dump_file);
--- 1862,1868 ----
cgraph_remove_unreachable_nodes (true, dump_file);
}
! if ((flags & TODO_dump_symtab) && dump_file && !current_function_decl)
{
gcc_assert (!cfun);
dump_cgraph (dump_file);
Index: varpool.c
===================================================================
*** varpool.c (revision 186525)
--- varpool.c (working copy)
*************** static GTY(()) symtab_node x_varpool_fir
*** 74,86 ****
/* Lists all assembled variables to be sent to debugger output later on. */
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. */
struct varpool_node *
varpool_node (tree decl)
--- 74,79 ----
*************** varpool_remove_node (struct varpool_node
*** 127,143 ****
void
dump_varpool_node (FILE *f, struct varpool_node *node)
{
! fprintf (f, "%s:", varpool_node_name (node));
! fprintf (f, " availability:%s",
cgraph_function_flags_ready
? cgraph_availability_names[cgraph_variable_initializer_availability (node)]
: "not-ready");
! if (DECL_ASSEMBLER_NAME_SET_P (node->symbol.decl))
! fprintf (f, " (asm: %s)", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->symbol.decl)));
if (DECL_INITIAL (node->symbol.decl))
fprintf (f, " initialized");
- if (TREE_ASM_WRITTEN (node->symbol.decl))
- fprintf (f, " (asm written)");
if (node->needed)
fprintf (f, " needed");
if (node->analyzed)
--- 120,133 ----
void
dump_varpool_node (FILE *f, struct varpool_node *node)
{
! dump_symtab_base (f, (symtab_node)node);
! fprintf (f, " Availability: %s\n",
cgraph_function_flags_ready
? cgraph_availability_names[cgraph_variable_initializer_availability (node)]
: "not-ready");
! fprintf (f, " Varpool flags:");
if (DECL_INITIAL (node->symbol.decl))
fprintf (f, " initialized");
if (node->needed)
fprintf (f, " needed");
if (node->analyzed)
*************** dump_varpool_node (FILE *f, struct varpo
*** 146,165 ****
fprintf (f, " finalized");
if (node->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, " 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. */
--- 136,142 ----