From: Paolo Bonzini Date: Fri, 10 Sep 2004 08:20:37 +0000 (+0000) Subject: cgraph.h (cgraph_dump_file): Do not declare. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9b3e897d2b6f2c5fdd211a729b37d565865328d9;p=gcc.git cgraph.h (cgraph_dump_file): Do not declare. 2004-09-10 Paolo Bonzini * cgraph.h (cgraph_dump_file): Do not declare. * cgraphunit.c (cgraph_dump_file): Declare as static. (init_cgraph): New. * toplev.c (cgraph_dump_file): Do not declare. (compile_file): Call init_cgraph. * tree-dump.c (dump_files): Add IPA dump file, remove XML dump of call graph. (get_dump_file_name): Support IPA dump file naming scheme. * tree.h (enum tree_dump_index): Add IPA dump file, remove XML dump of call graph. * doc/invoke.texi (Debugging Options): Document the new options. From-SVN: r87281 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4304f42b0ef..e9f8cdfdd66 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2004-09-10 Paolo Bonzini + + * cgraph.h (cgraph_dump_file): Do not declare. + * cgraphunit.c (cgraph_dump_file): Declare as static. + (init_cgraph): New. + * toplev.c (cgraph_dump_file): Do not declare. + (compile_file): Call init_cgraph. + * tree-dump.c (dump_files): Add IPA dump file, remove + XML dump of call graph. + (get_dump_file_name): Support IPA dump file naming scheme. + * tree.h (enum tree_dump_index): Add IPA dump file, remove + XML dump of call graph. + * doc/invoke.texi (Debugging Options): Document the new options. + 2004-09-10 Richard Sandiford * doc/extend.texi: Document the FR-V built-in functions. diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 0c86b76962f..a6e9cd75880 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -147,7 +147,6 @@ extern GTY(()) int cgraph_n_nodes; extern GTY(()) int cgraph_max_uid; extern bool cgraph_global_info_ready; extern GTY(()) struct cgraph_node *cgraph_nodes_queue; -extern FILE *cgraph_dump_file; extern GTY(()) int cgraph_varpool_n_nodes; extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes_queue; @@ -193,5 +192,6 @@ void verify_cgraph_node (struct cgraph_node *); void cgraph_mark_inline_edge (struct cgraph_edge *e); void cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate); void cgraph_build_static_cdtor (char which, tree body, int priority); +void init_cgraph (void); #endif /* GCC_CGRAPH_H */ diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index d0048a83731..bc14983b56e 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -163,6 +163,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA cgraph_decide_inlining implements heuristics taking whole callgraph into account, while cgraph_decide_inlining_incrementally considers only one function at a time and is used in non-unit-at-a-time mode. */ + #include "config.h" #include "system.h" #include "coretypes.h" @@ -209,6 +210,8 @@ static int overall_insns; record_calls_1. */ static htab_t visited_nodes; +static FILE *cgraph_dump_file; + /* Determine if function DECL is needed. That is, visible to something either outside this translation unit, something magic in the system configury, or (if not doing unit-at-a-time) to something we havn't @@ -1866,3 +1869,9 @@ cgraph_build_static_cdtor (char which, tree body, int priority) fn (XEXP (DECL_RTL (decl), 0), priority); } } + +void +init_cgraph (void) +{ + cgraph_dump_file = dump_begin (TDI_cgraph, NULL); +} diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index bee642c8323..6bf49e46567 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -249,6 +249,7 @@ Objective-C and Objective-C++ Dialects}. @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol -fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol +-fdump-ipa-all -fdump-ipa-cgraph @gol -fdump-tree-all @gol -fdump-tree-original@r{[}-@var{n}@r{]} @gol -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol @@ -3655,6 +3656,22 @@ to the source file name. If the @samp{-@var{options}} form is used, @var{options} controls the details of the dump as described for the @option{-fdump-tree} options. +@item -fdump-ipa-@var{switch} +@opindex fdump-ipa +Control the dumping at various stages of inter-procedural analyisis +language tree to a file. The file name is generated by appending a switch +specific suffix to the source file name. The following dumps are possible: + +@table @samp +@item all +Enables all inter-procedural analysis dumps; currently the only produced +dump is the @samp{cgraph} dump. + +@item cgraph +Dumps information about call-graph optimization, unused function removal, +and inlining decisions. +@end table + @item -fdump-tree-@var{switch} @r{(C and C++ only)} @itemx -fdump-tree-@var{switch}-@var{options} @r{(C and C++ only)} @opindex fdump-tree diff --git a/gcc/toplev.c b/gcc/toplev.c index eeb111df3c5..c3cae64b296 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -418,7 +418,6 @@ int warn_return_type; FILE *asm_out_file; FILE *aux_info_file; FILE *dump_file = NULL; -FILE *cgraph_dump_file = NULL; char *dump_file_name; /* The current working directory of a translation. It's generally the @@ -978,6 +977,7 @@ compile_file (void) { /* Initialize yet another pass. */ + init_cgraph (); init_final (main_input_filename); coverage_init (aux_base_name); diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c index c09fc531a55..5c08132bfb1 100644 --- a/gcc/tree-dump.c +++ b/gcc/tree-dump.c @@ -673,10 +673,11 @@ static struct dump_file_info dump_files[TDI_end] = {".nested", "tree-nested", TDF_TREE, 0, 4, 0}, {".inlined", "tree-inlined", TDF_TREE, 0, 5, 0}, {".vcg", "tree-vcg", TDF_TREE, 0, 6, 0}, - /* FIXME -fdump-call-graph is broken. Set TDF_TREE when it is fixed. */ - {".xml", "call-graph", 0, 0, 7, 0}, {NULL, "tree-all", TDF_TREE, 0, 0, 0}, {NULL, "rtl-all", TDF_RTL, 0, 0, 0}, + {NULL, "ipa-all", TDF_IPA, 0, 0, 0}, + + { ".cgraph", "ipa-cgraph", TDF_IPA, 0, 1, 0}, { ".sibling", "rtl-sibling", TDF_RTL, 0, 1, 'i'}, { ".eh", "rtl-eh", TDF_RTL, 0, 2, 'h'}, @@ -803,10 +804,21 @@ get_dump_file_name (enum tree_dump_index phase) if (dfi->state == 0) return NULL; - if (dfi->num < 0 - || snprintf (dump_id, sizeof (dump_id), ".%s%02d", - (dfi->flags & TDF_TREE) ? "t" : "", dfi->num) < 0) + if (dfi->num < 0) dump_id[0] = '\0'; + else + { + const char *template; + if (dfi->flags & TDF_TREE) + template = ".t%02d"; + else if (dfi->flags & TDF_IPA) + template = ".i%02d"; + else + template = ".%02d"; + + if (snprintf (dump_id, sizeof (dump_id), template, dfi->num) < 0) + dump_id[0] = '\0'; + } return concat (dump_base_name, dump_id, dfi->suffix, NULL); } diff --git a/gcc/tree.h b/gcc/tree.h index 432a170b6de..20adc7ffd4e 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -3714,9 +3714,11 @@ enum tree_dump_index within it. */ TDI_vcg, /* create a VCG graph file for each function's flowgraph. */ - TDI_xml, /* dump function call graph. */ TDI_tree_all, /* enable all the GENERIC/GIMPLE dumps. */ TDI_rtl_all, /* enable all the RTL dumps. */ + TDI_ipa_all, /* enable all the IPA dumps. */ + + TDI_cgraph, /* dump function call graph. */ DFI_MIN, /* For now, RTL dumps are placed here. */ DFI_sibling = DFI_MIN, @@ -3776,6 +3778,7 @@ enum tree_dump_index #define TDF_TREE (1 << 9) /* is a tree dump */ #define TDF_RTL (1 << 10) /* is a RTL dump */ +#define TDF_IPA (1 << 11) /* is an IPA dump */ typedef struct dump_info *dump_info_p;