Commit 9b3e897d by Paolo Bonzini Committed by Paolo Bonzini

cgraph.h (cgraph_dump_file): Do not declare.

2004-09-10  Paolo Bonzini  <bonzini@gnu.org>

	* 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
parent c3ee0579
2004-09-10 Paolo Bonzini <bonzini@gnu.org>
* 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 <rsandifo@redhat.com> 2004-09-10 Richard Sandiford <rsandifo@redhat.com>
* doc/extend.texi: Document the FR-V built-in functions. * doc/extend.texi: Document the FR-V built-in functions.
......
...@@ -147,7 +147,6 @@ extern GTY(()) int cgraph_n_nodes; ...@@ -147,7 +147,6 @@ extern GTY(()) int cgraph_n_nodes;
extern GTY(()) int cgraph_max_uid; extern GTY(()) int cgraph_max_uid;
extern bool cgraph_global_info_ready; extern bool cgraph_global_info_ready;
extern GTY(()) struct cgraph_node *cgraph_nodes_queue; extern GTY(()) struct cgraph_node *cgraph_nodes_queue;
extern FILE *cgraph_dump_file;
extern GTY(()) int cgraph_varpool_n_nodes; extern GTY(()) int cgraph_varpool_n_nodes;
extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes_queue; extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes_queue;
...@@ -193,5 +192,6 @@ void verify_cgraph_node (struct cgraph_node *); ...@@ -193,5 +192,6 @@ void verify_cgraph_node (struct cgraph_node *);
void cgraph_mark_inline_edge (struct cgraph_edge *e); void cgraph_mark_inline_edge (struct cgraph_edge *e);
void cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate); void cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate);
void cgraph_build_static_cdtor (char which, tree body, int priority); void cgraph_build_static_cdtor (char which, tree body, int priority);
void init_cgraph (void);
#endif /* GCC_CGRAPH_H */ #endif /* GCC_CGRAPH_H */
...@@ -163,6 +163,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -163,6 +163,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
cgraph_decide_inlining implements heuristics taking whole callgraph cgraph_decide_inlining implements heuristics taking whole callgraph
into account, while cgraph_decide_inlining_incrementally considers into account, while cgraph_decide_inlining_incrementally considers
only one function at a time and is used in non-unit-at-a-time mode. */ only one function at a time and is used in non-unit-at-a-time mode. */
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
#include "coretypes.h" #include "coretypes.h"
...@@ -209,6 +210,8 @@ static int overall_insns; ...@@ -209,6 +210,8 @@ static int overall_insns;
record_calls_1. */ record_calls_1. */
static htab_t visited_nodes; static htab_t visited_nodes;
static FILE *cgraph_dump_file;
/* Determine if function DECL is needed. That is, visible to something /* Determine if function DECL is needed. That is, visible to something
either outside this translation unit, something magic in the system either outside this translation unit, something magic in the system
configury, or (if not doing unit-at-a-time) to something we havn't 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) ...@@ -1866,3 +1869,9 @@ cgraph_build_static_cdtor (char which, tree body, int priority)
fn (XEXP (DECL_RTL (decl), 0), priority); fn (XEXP (DECL_RTL (decl), 0), priority);
} }
} }
void
init_cgraph (void)
{
cgraph_dump_file = dump_begin (TDI_cgraph, NULL);
}
...@@ -249,6 +249,7 @@ Objective-C and Objective-C++ Dialects}. ...@@ -249,6 +249,7 @@ Objective-C and Objective-C++ Dialects}.
@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
-fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol -fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
-fdump-class-hierarchy@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-all @gol
-fdump-tree-original@r{[}-@var{n}@r{]} @gol -fdump-tree-original@r{[}-@var{n}@r{]} @gol
-fdump-tree-optimized@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, ...@@ -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 @var{options} controls the details of the dump as described for the
@option{-fdump-tree} options. @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)} @item -fdump-tree-@var{switch} @r{(C and C++ only)}
@itemx -fdump-tree-@var{switch}-@var{options} @r{(C and C++ only)} @itemx -fdump-tree-@var{switch}-@var{options} @r{(C and C++ only)}
@opindex fdump-tree @opindex fdump-tree
......
...@@ -418,7 +418,6 @@ int warn_return_type; ...@@ -418,7 +418,6 @@ int warn_return_type;
FILE *asm_out_file; FILE *asm_out_file;
FILE *aux_info_file; FILE *aux_info_file;
FILE *dump_file = NULL; FILE *dump_file = NULL;
FILE *cgraph_dump_file = NULL;
char *dump_file_name; char *dump_file_name;
/* The current working directory of a translation. It's generally the /* The current working directory of a translation. It's generally the
...@@ -978,6 +977,7 @@ compile_file (void) ...@@ -978,6 +977,7 @@ compile_file (void)
{ {
/* Initialize yet another pass. */ /* Initialize yet another pass. */
init_cgraph ();
init_final (main_input_filename); init_final (main_input_filename);
coverage_init (aux_base_name); coverage_init (aux_base_name);
......
...@@ -673,10 +673,11 @@ static struct dump_file_info dump_files[TDI_end] = ...@@ -673,10 +673,11 @@ static struct dump_file_info dump_files[TDI_end] =
{".nested", "tree-nested", TDF_TREE, 0, 4, 0}, {".nested", "tree-nested", TDF_TREE, 0, 4, 0},
{".inlined", "tree-inlined", TDF_TREE, 0, 5, 0}, {".inlined", "tree-inlined", TDF_TREE, 0, 5, 0},
{".vcg", "tree-vcg", TDF_TREE, 0, 6, 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, "tree-all", TDF_TREE, 0, 0, 0},
{NULL, "rtl-all", TDF_RTL, 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'}, { ".sibling", "rtl-sibling", TDF_RTL, 0, 1, 'i'},
{ ".eh", "rtl-eh", TDF_RTL, 0, 2, 'h'}, { ".eh", "rtl-eh", TDF_RTL, 0, 2, 'h'},
...@@ -803,10 +804,21 @@ get_dump_file_name (enum tree_dump_index phase) ...@@ -803,10 +804,21 @@ get_dump_file_name (enum tree_dump_index phase)
if (dfi->state == 0) if (dfi->state == 0)
return NULL; return NULL;
if (dfi->num < 0 if (dfi->num < 0)
|| snprintf (dump_id, sizeof (dump_id), ".%s%02d",
(dfi->flags & TDF_TREE) ? "t" : "", dfi->num) < 0)
dump_id[0] = '\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); return concat (dump_base_name, dump_id, dfi->suffix, NULL);
} }
......
...@@ -3714,9 +3714,11 @@ enum tree_dump_index ...@@ -3714,9 +3714,11 @@ enum tree_dump_index
within it. */ within it. */
TDI_vcg, /* create a VCG graph file for each TDI_vcg, /* create a VCG graph file for each
function's flowgraph. */ function's flowgraph. */
TDI_xml, /* dump function call graph. */
TDI_tree_all, /* enable all the GENERIC/GIMPLE dumps. */ TDI_tree_all, /* enable all the GENERIC/GIMPLE dumps. */
TDI_rtl_all, /* enable all the RTL 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_MIN, /* For now, RTL dumps are placed here. */
DFI_sibling = DFI_MIN, DFI_sibling = DFI_MIN,
...@@ -3776,6 +3778,7 @@ enum tree_dump_index ...@@ -3776,6 +3778,7 @@ enum tree_dump_index
#define TDF_TREE (1 << 9) /* is a tree dump */ #define TDF_TREE (1 << 9) /* is a tree dump */
#define TDF_RTL (1 << 10) /* is a RTL 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; typedef struct dump_info *dump_info_p;
......
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