summaryrefslogtreecommitdiff
path: root/gcc/lto
diff options
context:
space:
mode:
authorGiuliano Belinassi <giuliano.belinassi@usp.br>2019-07-22 21:41:48 +0000
committerJeff Law <law@gcc.gnu.org>2019-07-22 15:41:48 -0600
commit34e646226fd083e18ae6e07a9ceb18e59bc20077 (patch)
treefabbe280337e8b915b1ca035a02bb3ab20bbe573 /gcc/lto
parent2ac8e32236d0fe6c07545ab0e275403af4a63710 (diff)
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
Diffstat (limited to 'gcc/lto')
-rw-r--r--gcc/lto/ChangeLog7
-rw-r--r--gcc/lto/lang.opt3
-rw-r--r--gcc/lto/lto-dump.c52
3 files changed, 42 insertions, 20 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 22e7739d3d7..c18b2c47cc1 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,10 @@
+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
diff --git a/gcc/lto/lang.opt b/gcc/lto/lang.opt
index 5bacef349e3..c62dd5aac08 100644
--- a/gcc/lto/lang.opt
+++ b/gcc/lto/lang.opt
@@ -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
diff --git a/gcc/lto/lto-dump.c b/gcc/lto/lto-dump.c
index 262f9f24d85..74d99b5f0f4 100644
--- a/gcc/lto/lto-dump.c
+++ b/gcc/lto/lto-dump.c
@@ -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;
+ }
}