invoke.text (-fdump-tree-*-verbose): New option.

2008-05-16  Kenneth Zadeck <zadeck@naturalbridge.com>

	* doc/invoke.text (-fdump-tree-*-verbose): New option.
	* tree-dump.c (dump_options): New verbose option.
	* tree-pretty-print.c (dump_phi_nodes, dump_generic_bb_buff):
	Add verbose dump.
	* tree-pass.h (TDF_VERBOSE): New dump flag.
	* print-tree.c (print_node): Added code to be able to print
	PHI_NODES.
	(tree-flow.h): Added include.
	Makefile.in (print-tree.o):  Added TREE_FLOW_H.

From-SVN: r135417
This commit is contained in:
Kenneth Zadeck 2008-05-16 13:34:34 +00:00 committed by Diego Novillo
parent 4fc4d8507e
commit 3e894af156
8 changed files with 62 additions and 22 deletions

View File

@ -1,3 +1,15 @@
2008-05-16 Kenneth Zadeck <zadeck@naturalbridge.com>
* doc/invoke.text (-fdump-tree-*-verbose): New option.
* tree-dump.c (dump_options): New verbose option.
* tree-pretty-print.c (dump_phi_nodes, dump_generic_bb_buff):
Add verbose dump.
* tree-pass.h (TDF_VERBOSE): New dump flag.
* print-tree.c (print_node): Added code to be able to print
PHI_NODES.
(tree-flow.h): Added include.
Makefile.in (print-tree.o): Added TREE_FLOW_H.
2008-05-16 Bernd Schmidt <bernd.schmidt@analog.com>
* config/bfin/bfin.c (bfin_discover_loops): Delete empty loops.

View File

@ -1986,7 +1986,7 @@ tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
debug.h $(DIAGNOSTIC_H) $(TREE_FLOW_H) tree-iterator.h tree-mudflap.h \
ipa-prop.h value-prof.h $(TARGET_H) $(INTEGRATE_H)
print-tree.o : print-tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(GGC_H) langhooks.h $(REAL_H) tree-iterator.h fixed-value.h
$(GGC_H) langhooks.h $(REAL_H) tree-iterator.h fixed-value.h $(TREE_FLOW_H)
stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(PARAMS_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) $(RTL_H) \
$(GGC_H) $(TM_P_H) $(TARGET_H) langhooks.h $(REGS_H) gt-stor-layout.h \

View File

@ -4771,8 +4771,11 @@ Enable showing virtual operands for every statement.
Enable showing line numbers for statements.
@item uid
Enable showing the unique ID (@code{DECL_UID}) for each variable.
@item verbose
Enable showing the tree dump for each statement.
@item all
Turn on all options, except @option{raw}, @option{slim} and @option{lineno}.
Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
and @option{lineno}.
@end table
The following tree dumps are possible:

View File

@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#include "langhooks.h"
#include "tree-iterator.h"
#include "tree-flow.h"
/* Define the hash table of nodes already seen.
Such nodes are not repeated; brief cross-references are used. */
@ -221,21 +222,25 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
return;
}
hash = ((unsigned long) node) % HASH_SIZE;
/* If node is in the table, just mention its address. */
for (b = table[hash]; b; b = b->next)
if (b->node == node)
{
print_node_brief (file, prefix, node, indent);
return;
}
/* Add this node to the table. */
b = XNEW (struct bucket);
b->node = node;
b->next = table[hash];
table[hash] = b;
/* Allow this function to be called if the table is not there. */
if (table)
{
hash = ((unsigned long) node) % HASH_SIZE;
/* If node is in the table, just mention its address. */
for (b = table[hash]; b; b = b->next)
if (b->node == node)
{
print_node_brief (file, prefix, node, indent);
return;
}
/* Add this node to the table. */
b = XNEW (struct bucket);
b->node = node;
b->next = table[hash];
table[hash] = b;
}
/* Indent to the specified column, since this is the long form. */
indent_to (file, indent);
@ -906,6 +911,12 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
}
break;
case PHI_NODE:
print_node (file, "result", PHI_RESULT (node), indent + 4);
for (i = 0; i < PHI_NUM_ARGS (node); i++)
print_node (file, "arg", PHI_ARG_DEF (node, i), indent + 4);
break;
case OMP_CLAUSE:
{
int i;

View File

@ -6179,12 +6179,17 @@ dump_function_to_file (tree fn, FILE *file, int flags)
print_generic_expr (file, TREE_TYPE (arg), dump_flags);
fprintf (file, " ");
print_generic_expr (file, arg, dump_flags);
if (flags & TDF_VERBOSE)
print_node (file, "", arg, 4);
if (TREE_CHAIN (arg))
fprintf (file, ", ");
arg = TREE_CHAIN (arg);
}
fprintf (file, ")\n");
if (flags & TDF_VERBOSE)
print_node (file, "", fn, 2);
dsf = DECL_STRUCT_FUNCTION (fn);
if (dsf && (flags & TDF_DETAILS))
dump_eh_tree (file, dsf);
@ -6210,6 +6215,8 @@ dump_function_to_file (tree fn, FILE *file, int flags)
var = TREE_VALUE (vars);
print_generic_decl (file, var, flags);
if (flags & TDF_VERBOSE)
print_node (file, "", var, 4);
fprintf (file, "\n");
any_var = true;

View File

@ -822,8 +822,9 @@ static const struct dump_option_value_info dump_options[] =
{"uid", TDF_UID},
{"stmtaddr", TDF_STMTADDR},
{"memsyms", TDF_MEMSYMS},
{"verbose", TDF_VERBOSE},
{"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_TREE | TDF_RTL | TDF_IPA
| TDF_STMTADDR | TDF_GRAPH | TDF_DIAGNOSTIC)},
| TDF_STMTADDR | TDF_GRAPH | TDF_DIAGNOSTIC | TDF_VERBOSE)},
{NULL, 0}
};

View File

@ -70,6 +70,8 @@ enum tree_dump_index
#define TDF_DIAGNOSTIC (1 << 15) /* A dump to be put in a diagnostic
message. */
#define TDF_VERBOSE (1 << 16) /* A dump that uses the full tree
dumper to print stmts. */
extern char *get_dump_file_name (enum tree_dump_index);
extern int dump_enabled_p (enum tree_dump_index);

View File

@ -436,10 +436,10 @@ dump_symbols (pretty_printer *buffer, bitmap syms, int flags)
}
/* Dump the node NODE on the pretty_printer BUFFER, SPC spaces of indent.
FLAGS specifies details to show in the dump (see TDF_* in tree-pass.h).
If IS_STMT is true, the object printed is considered to be a statement
and it is terminated by ';' if appropriate. */
/* Dump the node NODE on the pretty_printer BUFFER, SPC spaces of
indent. FLAGS specifies details to show in the dump (see TDF_* in
tree-pass.h). If IS_STMT is true, the object printed is considered
to be a statement and it is terminated by ';' if appropriate. */
int
dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
@ -3052,6 +3052,8 @@ dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags)
pp_string (buffer, "# ");
dump_generic_node (buffer, phi, indent, flags, false);
pp_newline (buffer);
if (flags & TDF_VERBOSE)
print_node (buffer->buffer->stream, "", phi, indent);
}
}
}
@ -3170,6 +3172,8 @@ dump_generic_bb_buff (pretty_printer *buffer, basic_block bb,
dump_generic_node (buffer, stmt, curr_indent, flags, true);
pp_newline (buffer);
dump_histograms_for_stmt (cfun, buffer->buffer->stream, stmt);
if (flags & TDF_VERBOSE)
print_node (buffer->buffer->stream, "", stmt, curr_indent);
}
dump_implicit_edges (buffer, bb, indent, flags);