* 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
+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
}
}
+/* 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
/* 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);
/* 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);
/* 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
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
}
}
+/* Dump symbol table in graphviz format. */
+void dump_symtab_graphviz (void)
+{
+ symtab->dump_graphviz (stdout);
+}
+
/* Dump symbol list. */
void dump_list (void)
/* 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;
}
dump_body ();
return;
}
+ else if (flag_dump_callgraph)
+ {
+ dump_symtab_graphviz ();
+ return;
+ }
}
vnode->dump (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)
{
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)
{