[tree-ssa-branch] improved dumping options
Ben Elliston
bje@redhat.com
Wed Jul 17 15:02:00 GMT 2002
The following patch adds a new -fdump-tree-all-ssa option and improves
the dump output to make it easier to diff trees between phases. Sorry
for the "jumbo" patch; I will do a better job of compartmentalising
patches in future. Okay to commit?
Ben
2002-07-17 Ben Elliston <bje@redhat.com>
* c-decl.c (c_decode_option): Handle -fdump-tree-all-ssa.
* tree.h (dump_enable_all_ssa): Declare.
* tree-dump.c (dump_enable_all_ssa): New function.
* doc/invoke.texi (Option Summary): Document -fdump-tree-ssa-all
and -fdump-tree-ssapre options.
* c-simplify.c (c_simplify_function_tree): Dump the original tree
only if a TDI_original dump is requested, rather than TDI_simple.
* tree-dump.c (dump_begin): Include phase number in dump filename.
2002-07-16 Ben Elliston <bje@redhat.com>
* tree-dump.c (dump_files): Rename "unparse" to "raw".
* tree.h (TDF_UNPARSE): Rename from this ..
(TDF_RAW): .. to this.
* tree-ssa-pre.c (tree_perform_ssapre): Use TDF_RAW and invert the
logical sense of this flag.
* tree-ssa-ccp.c (tree_ssa_ccp): Likewise.
* c-simplify.c (c_simplify_function_tree): Likewise.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.334.2.3
diff -u -p -r1.334.2.3 c-decl.c
--- c-decl.c 8 Jul 2002 01:44:45 -0000 1.334.2.3
+++ c-decl.c 17 Jul 2002 21:32:02 -0000
@@ -642,6 +642,8 @@ c_decode_option (argc, argv)
flag_no_builtin = 1;
else if (!strncmp (p, "-fno-builtin-", strlen ("-fno-builtin-")))
disable_builtin_function (p + strlen ("-fno-builtin-"));
+ else if (!strcmp (p, "-fdump-tree-all-ssa"))
+ dump_enable_all_ssa ();
else if (p[0] == '-' && p[1] == 'f' && dump_switch_p (p + 2))
;
else if (!strcmp (p, "-ansi"))
Index: c-simplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/c-simplify.c,v
retrieving revision 1.1.4.5
diff -u -p -r1.1.4.5 c-simplify.c
--- c-simplify.c 17 Jul 2002 15:46:28 -0000 1.1.4.5
+++ c-simplify.c 17 Jul 2002 21:32:03 -0000
@@ -130,16 +130,18 @@ c_simplify_function_tree (fndecl)
return 1;
/* Debugging dumps. */
- dump_file = dump_begin (TDI_simple, &dump_flags);
+ dump_file = dump_begin (TDI_original, &dump_flags);
if (dump_file)
{
- fprintf (dump_file, "\n%s() (ORIGINAL)\n",
+ fprintf (dump_file, "%s()\n",
IDENTIFIER_POINTER (DECL_NAME (fndecl)));
- if (dump_flags & TDF_UNPARSE)
- print_c_tree (dump_file, fnbody);
- else
+ if (dump_flags & TDF_RAW)
dump_node (fnbody, TDF_SLIM | dump_flags, dump_file);
+ else
+ print_c_tree (dump_file, fnbody);
+
+ dump_end (TDI_original, dump_file);
}
/* Create a new binding level for the temporaries created by the
@@ -156,15 +158,16 @@ c_simplify_function_tree (fndecl)
poplevel (1, 1, 0);
/* Debugging dump after simplification. */
+ dump_file = dump_begin (TDI_simple, &dump_flags);
if (dump_file)
{
- fprintf (dump_file, "\n%s() (SIMPLIFIED)\n",
+ fprintf (dump_file, "%s()\n",
IDENTIFIER_POINTER (DECL_NAME (fndecl)));
- if (dump_flags & TDF_UNPARSE)
- print_c_tree (dump_file, fnbody);
- else
+ if (dump_flags & TDF_RAW)
dump_node (fnbody, TDF_SLIM | dump_flags, dump_file);
+ else
+ print_c_tree (dump_file, fnbody);
dump_end (TDI_simple, dump_file);
}
Index: tree-dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-dump.c,v
retrieving revision 1.6.2.2
diff -u -p -r1.6.2.2 tree-dump.c
--- tree-dump.c 10 Jul 2002 22:05:14 -0000 1.6.2.2
+++ tree-dump.c 17 Jul 2002 21:32:04 -0000
@@ -829,7 +829,7 @@ static const struct dump_option_value_in
{
{"address", TDF_ADDRESS},
{"slim", TDF_SLIM},
- {"unparse", TDF_UNPARSE},
+ {"raw", TDF_RAW},
{"details", TDF_DETAILS},
{"refs", TDF_REFS},
{"rdefs", TDF_RDEFS},
@@ -849,11 +849,15 @@ dump_begin (phase, flag_ptr)
{
FILE *stream;
char *name;
+ char dump_id[10];
if (!dump_files[phase].state)
return NULL;
- name = concat (dump_base_name, dump_files[phase].suffix, NULL);
+ if (snprintf (dump_id, sizeof (dump_id), ".t%02d", phase) < 0)
+ dump_id[0] = '\0';
+
+ name = concat (dump_base_name, dump_id, dump_files[phase].suffix, NULL);
stream = fopen (name, dump_files[phase].state < 0 ? "w" : "a");
if (!stream)
error ("could not open dump file `%s'", name);
@@ -893,6 +897,21 @@ dump_end (phase, stream)
FILE *stream;
{
fclose (stream);
+}
+
+/* Enable all SSA-related tree dumps. */
+
+void
+dump_enable_all_ssa ()
+{
+ dump_files[TDI_original].state = -1;
+ dump_files[TDI_optimized].state = -1;
+ dump_files[TDI_cfg].state = -1;
+ dump_files[TDI_dot].state = -1;
+ dump_files[TDI_ssa_pre].state = -1;
+ dump_files[TDI_ccp].state = -1;
+ dump_files[TDI_ssa].state = -1;
+ dump_files[TDI_simple].state = -1;
}
/* Parse ARG as a dump switch. Return non-zero if it is, and store the
Index: tree-ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-ccp.c,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 tree-ssa-ccp.c
--- tree-ssa-ccp.c 10 Jul 2002 22:05:14 -0000 1.1.2.1
+++ tree-ssa-ccp.c 17 Jul 2002 21:32:04 -0000
@@ -153,10 +153,10 @@ tree_ssa_ccp (fndecl)
fprintf (dump_file, "\n%s() (ORIGINAL)\n",
IDENTIFIER_POINTER (DECL_NAME (fndecl)));
- if (dump_flags & TDF_UNPARSE)
- print_c_tree (dump_file, fnbody);
- else
+ if (dump_flags & TDF_RAW)
dump_node (fnbody, TDF_SLIM | dump_flags, dump_file);
+ else
+ print_c_tree (dump_file, fnbody);
}
VARRAY_TREE_INIT (decl_map, next_decl_uid, "Decl map");
@@ -234,10 +234,10 @@ tree_ssa_ccp (fndecl)
fprintf (dump_file, "\n%s() (OPTIMIZED)\n",
IDENTIFIER_POINTER (DECL_NAME (fndecl)));
- if (dump_flags & TDF_UNPARSE)
- print_c_tree (dump_file, fnbody);
- else
+ if (dump_flags & TDF_RAW)
dump_node (fnbody, TDF_SLIM | dump_flags, dump_file);
+ else
+ print_c_tree (dump_file, fnbody);
}
free (values);
Index: tree-ssa-pre.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-pre.c,v
retrieving revision 1.1.4.4
diff -u -p -r1.1.4.4 tree-ssa-pre.c
--- tree-ssa-pre.c 10 Jul 2002 00:04:41 -0000 1.1.4.4
+++ tree-ssa-pre.c 17 Jul 2002 21:32:04 -0000
@@ -1748,10 +1748,10 @@ tree_perform_ssapre ()
fprintf (dump_file, "\n%s() (ORIGINAL)\n",
IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
- if (dump_flags & TDF_UNPARSE)
- print_c_tree (dump_file, fn);
- else
+ if (dump_flags & TDF_RAW)
dump_node (fn, TDF_SLIM | dump_flags, dump_file);
+ else
+ print_c_tree (dump_file, fn);
}
/* Compute immediate dominators. */
@@ -1847,10 +1847,10 @@ tree_perform_ssapre ()
fprintf (dump_file, "\n%s() (OPTIMIZED)\n",
IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
- if (dump_flags & TDF_UNPARSE)
- print_c_tree (dump_file, fn);
- else
+ if (dump_flags & TDF_RAW)
dump_node (fn, TDF_SLIM | dump_flags, dump_file);
+ else
+ print_c_tree (dump_file, fn);
dump_end (TDI_ssa_pre, dump_file);
}
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.342.2.4
diff -u -p -r1.342.2.4 tree.h
--- tree.h 10 Jul 2002 22:05:14 -0000 1.342.2.4
+++ tree.h 17 Jul 2002 21:32:06 -0000
@@ -3094,7 +3094,7 @@ enum tree_dump_index
values, extend the DUMP_OPTIONS array in tree-dump.c */
#define TDF_ADDRESS (1 << 0) /* dump node addresses */
#define TDF_SLIM (1 << 1) /* don't go wild following links */
-#define TDF_UNPARSE (1 << 2) /* unparse the function */
+#define TDF_RAW (1 << 2) /* unparse the function */
#define TDF_DETAILS (1 << 3) /* show how each statement is simplified */
#define TDF_REFS (1 << 0) /* dump ssa variable refs */
#define TDF_RDEFS (1 << 1) /* dump reaching definitions */
@@ -3107,6 +3107,7 @@ extern FILE *dump_begin PARAMS ((enum
extern void dump_end PARAMS ((enum tree_dump_index, FILE *));
extern void dump_node PARAMS ((tree, int, FILE *));
extern int dump_switch_p PARAMS ((const char *));
+extern void dump_enable_all_ssa PARAMS (());
extern const char *dump_flag_name PARAMS ((enum tree_dump_index));
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.152.2.3
diff -u -p -r1.152.2.3 invoke.texi
--- doc/invoke.texi 10 Jul 2002 22:05:15 -0000 1.152.2.3
+++ doc/invoke.texi 17 Jul 2002 21:32:13 -0000
@@ -245,9 +245,11 @@ in the following sections.
-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-tree-all-ssa @gol
-fdump-tree-original@r{[}-@var{n}@r{]} -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
--fdump-tree-cfg -fdump-tree-dot -fdump-tree-ssa@r{[}-@var{n}@r{]} @gol
+-fdump-tree-cfg -fdump-tree-dot @gol
+-fdump-tree-ssa{[}-@var{n}@r{]} -fdump-tree-ssapre@r{[}-@var{n}@r{]} @gol
-fdump-tree-simple@r{[}-unparse@r{]} @gol
-fmem-report @gol
-fprofile-arcs -ftest-coverage -ftime-report @gol
More information about the Gcc-patches
mailing list