summaryrefslogtreecommitdiff
path: root/gcc/print-tree.c
diff options
context:
space:
mode:
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2006-07-17 14:44:48 +0000
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2006-07-17 14:44:48 +0000
commit969239ad7a968dbd55294c9af7ca665b900942aa (patch)
treeff661fb5805de209002f680c01355880f73d6feb /gcc/print-tree.c
parent8e659d3072a90ecfd60e39b8e766f60282da3a70 (diff)
downloadgcc-969239ad7a968dbd55294c9af7ca665b900942aa.tar.gz
gcc:
PR other/28251 * tree.h (dump_addr): Declare. * print-tree.c (dump_addr): New function. (print_node_brief, print_node): Use it. * print-rtl.c (print_rtx): Likewise. * common.opt (-fdump-noaddr): New option. * doc/invoke.texi (-fdump-noaddr): Document. * loop-unroll.c (si_info_hash): Make hash independent of addresses. (ve_info_hash): Likewise. gcc/testsuite: PR other/28251 gcc.c-torture/unsorted/dump-noaddr.c: New test. gcc.c-torture/unsorted/dump-noaddr.x: New driver. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115519 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/print-tree.c')
-rw-r--r--gcc/print-tree.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index bfa3ac0a1d6..b207fe30a54 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -57,6 +57,16 @@ debug_tree (tree node)
putc ('\n', stderr);
}
+/* Print PREFIX and ADDR to FILE. */
+void
+dump_addr (FILE *file, const char *prefix, void *addr)
+{
+ if (flag_dump_noaddr || flag_dump_unnumbered)
+ fprintf (file, "%s#", prefix);
+ else
+ fprintf (file, "%s%p", prefix, addr);
+}
+
/* Print a node in brief fashion, with just the code, address and name. */
void
@@ -73,8 +83,8 @@ print_node_brief (FILE *file, const char *prefix, tree node, int indent)
name if any. */
if (indent > 0)
fprintf (file, " ");
- fprintf (file, "%s <%s %p",
- prefix, tree_code_name[(int) TREE_CODE (node)], (char *) node);
+ fprintf (file, "%s <%s", prefix, tree_code_name[(int) TREE_CODE (node)]);
+ dump_addr (file, " ", node);
if (class == tcc_declaration)
{
@@ -218,8 +228,8 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
indent_to (file, indent);
/* Print the slot this node is in, and its code, and address. */
- fprintf (file, "%s <%s %p",
- prefix, tree_code_name[(int) TREE_CODE (node)], (void *) node);
+ fprintf (file, "%s <%s", prefix, tree_code_name[(int) TREE_CODE (node)]);
+ dump_addr (file, " ", node);
/* Print the name, if any. */
if (class == tcc_declaration)
@@ -505,8 +515,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
&& DECL_STRUCT_FUNCTION (node) != 0)
{
indent_to (file, indent + 4);
- fprintf (file, "saved-insns %p",
- (void *) DECL_STRUCT_FUNCTION (node));
+ dump_addr (file, "saved-insns ", DECL_STRUCT_FUNCTION (node));
}
if ((TREE_CODE (node) == VAR_DECL || TREE_CODE (node) == PARM_DECL)
@@ -778,15 +787,16 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
break;
case STATEMENT_LIST:
- fprintf (file, " head %p tail %p stmts",
- (void *) node->stmt_list.head, (void *) node->stmt_list.tail);
+ dump_addr (file, " head ", node->stmt_list.head);
+ dump_addr (file, " tail ", node->stmt_list.tail);
+ fprintf (file, " stmts");
{
tree_stmt_iterator i;
for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i))
{
/* Not printing the addresses of the (not-a-tree)
'struct tree_stmt_list_node's. */
- fprintf (file, " %p", (void *)tsi_stmt (i));
+ dump_addr (file, " ", tsi_stmt (i));
}
fprintf (file, "\n");
for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i))
@@ -826,11 +836,9 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
{
indent_to (file, indent + 3);
if (SSA_NAME_PTR_INFO (node))
- fprintf (file, " ptr-info %p",
- (void *) SSA_NAME_PTR_INFO (node));
+ dump_addr (file, " ptr-info ", SSA_NAME_PTR_INFO (node));
if (SSA_NAME_VALUE (node))
- fprintf (file, " value %p",
- (void *) SSA_NAME_VALUE (node));
+ dump_addr (file, " value ", SSA_NAME_VALUE (node));
}
break;