Commit 34e64622 by Giuliano Belinassi Committed by Jeff Law

cgraph.c (dump_graphviz): New function.

	* cgraph.c (dump_graphviz): New function.
	* cgraph.h (dump_graphviz): New function.
	* symtab.c (dump_graphviz): New function.

	* lang.opt (flag_dump_callgraph): New flag.
	* lto-dump.c (dump_symtab_graphviz): New function.
	(dump_tool_help): New option.
	(lto_main): Handle graphviz dumping.

From-SVN: r273708
parent 2ac8e322
2019-07-02 Giuliano Belinassi <giuliano.belinassi@usp.br>
* cgraph.c (dump_graphviz): New function.
* cgraph.h (dump_graphviz): New function.
* symtab.c (dump_graphviz): New function.
2019-07-22 Sylvia Taylor <sylvia.taylor@arm.com>
* config/aarch64/aarch64-simd.md
......
......@@ -2204,6 +2204,22 @@ cgraph_node::dump (FILE *f)
}
}
/* Dump call graph node to file F in graphviz format. */
void
cgraph_node::dump_graphviz (FILE *f)
{
cgraph_edge *edge;
for (edge = callees; edge; edge = edge->next_callee)
{
cgraph_node *callee = edge->callee;
fprintf (f, "\t\"%s\" -> \"%s\"\n", name (), callee->name ());
}
}
/* Dump call graph node NODE to stderr. */
DEBUG_FUNCTION void
......
......@@ -135,6 +135,9 @@ public:
/* Dump symtab node to F. */
void dump (FILE *f);
/* Dump symtab callgraph in graphviz format. */
void dump_graphviz (FILE *f);
/* Dump symtab node to stderr. */
void DEBUG_FUNCTION debug (void);
......@@ -1106,6 +1109,9 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
/* Dump call graph node to file F. */
void dump (FILE *f);
/* Dump call graph node to file F. */
void dump_graphviz (FILE *f);
/* Dump call graph node to stderr. */
void DEBUG_FUNCTION debug (void);
......@@ -2282,6 +2288,9 @@ public:
/* Dump symbol table to F. */
void dump (FILE *f);
/* Dump symbol table to F in graphviz format. */
void dump_graphviz (FILE *f);
/* Dump symbol table to stderr. */
void DEBUG_FUNCTION debug (void);
......
2019-07-22 Giuliano Belinassi <giuliano.belinassi@usp.br>
* lang.opt (flag_dump_callgraph): New flag.
* lto-dump.c (dump_symtab_graphviz): New function.
(dump_tool_help): New option.
(lto_main): Handle graphviz dumping.
2019-07-18 Jan Hubicka <hubicka@ucw.cz>
* lto-common.c (gimple_register_canonical_type_1): Do not look for
......
......@@ -127,6 +127,9 @@ help
LTODump Var(flag_lto_dump_tool_help)
Dump the dump tool command line options.
callgraph
LTODump Var(flag_dump_callgraph)
Dump the symtab callgraph.
fresolution=
LTO Joined
......
......@@ -215,6 +215,12 @@ void dump_list_variables (void)
}
}
/* Dump symbol table in graphviz format. */
void dump_symtab_graphviz (void)
{
symtab->dump_graphviz (stdout);
}
/* Dump symbol list. */
void dump_list (void)
......@@ -269,26 +275,27 @@ void dump_body ()
/* List of command line options for dumping. */
void dump_tool_help ()
{
printf ("Usage: lto-dump [OPTION]... SUB_COMMAND [OPTION]...\n\n");
printf ("LTO dump tool command line options.\n\n");
printf (" -list [options] Dump the symbol list.\n");
printf (" -demangle Dump the demangled output.\n");
printf (" -defined-only Dump only the defined symbols.\n");
printf (" -print-value Dump initial values of the "
"variables.\n");
printf (" -name-sort Sort the symbols alphabetically.\n");
printf (" -size-sort Sort the symbols according to size.\n");
printf (" -reverse-sort Dump the symbols in reverse order.\n");
printf (" -symbol= Dump the details of specific symbol.\n");
printf (" -objects Dump the details of LTO objects.\n");
printf (" -type-stats Dump statistics of tree types.\n");
printf (" -tree-stats Dump statistics of trees.\n");
printf (" -gimple-stats Dump statistics of gimple "
"statements.\n");
printf (" -dump-body= Dump the specific gimple body.\n");
printf (" -dump-level= Deciding the optimization level "
"of body.\n");
printf (" -help Display the dump tool help.\n");
const char *msg =
"Usage: lto-dump [OPTION]... SUB_COMMAND [OPTION]...\n\n"
"LTO dump tool command line options.\n\n"
" -list [options] Dump the symbol list.\n"
" -demangle Dump the demangled output.\n"
" -defined-only Dump only the defined symbols.\n"
" -print-value Dump initial values of the variables.\n"
" -name-sort Sort the symbols alphabetically.\n"
" -size-sort Sort the symbols according to size.\n"
" -reverse-sort Dump the symbols in reverse order.\n"
" -symbol= Dump the details of specific symbol.\n"
" -objects Dump the details of LTO objects.\n"
" -callgraph Dump the callgraph in graphviz format.\n"
" -type-stats Dump statistics of tree types.\n"
" -tree-stats Dump statistics of trees.\n"
" -gimple-stats Dump statistics of gimple statements.\n"
" -dump-body= Dump the specific gimple body.\n"
" -dump-level= Deciding the optimization level of body.\n"
" -help Display the dump tool help.\n";
fputs (msg, stdout);
return;
}
......@@ -362,4 +369,9 @@ lto_main (void)
dump_body ();
return;
}
else if (flag_dump_callgraph)
{
dump_symtab_graphviz ();
return;
}
}
......@@ -956,6 +956,13 @@ symtab_node::dump (FILE *f)
}
void
symtab_node::dump_graphviz (FILE *f)
{
if (cgraph_node *cnode = dyn_cast <cgraph_node *> (this))
cnode->dump_graphviz (f);
}
void
symbol_table::dump (FILE *f)
{
symtab_node *node;
......@@ -964,6 +971,16 @@ symbol_table::dump (FILE *f)
node->dump (f);
}
void
symbol_table::dump_graphviz (FILE *f)
{
symtab_node *node;
fprintf (f, "digraph symtab {\n");
FOR_EACH_SYMBOL (node)
node->dump_graphviz (f);
fprintf (f, "}\n");
}
DEBUG_FUNCTION void
symbol_table::debug (void)
{
......
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