diff options
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/common.opt | 6 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 11 | ||||
-rw-r--r-- | gcc/loop-unroll.c | 4 | ||||
-rw-r--r-- | gcc/print-rtl.c | 13 | ||||
-rw-r--r-- | gcc/print-tree.c | 34 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.c | 48 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x | 49 | ||||
-rw-r--r-- | gcc/tree.h | 1 |
10 files changed, 159 insertions, 25 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0ff6fa37143..3262d052ef8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2006-07-17 J"orn Rennecke <joern.rennecke@st.com> + + 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. + 2006-07-13 Andrew Haley <aph@redhat.com> PR tree-optimization/19505 diff --git a/gcc/common.opt b/gcc/common.opt index 3c5fc0ea544..204560f5fba 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -381,9 +381,13 @@ fdump- Common Joined RejectNegative -fdump-<type> Dump various compiler internals to a file +fdump-noaddr +Common Report Var(flag_dump_noaddr) +Suppress output of addresses in debugging dumps + fdump-unnumbered Common Report Var(flag_dump_unnumbered) VarExists -Suppress output of instruction numbers and line number notes in debugging dumps +Suppress output of instruction numbers, line number notes and addresses in debugging dumps fearly-inlining Common Report Var(flag_early_inlining) Init(1) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 0a1a917d914..32fe747b4da 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -262,7 +262,7 @@ Objective-C and Objective-C++ Dialects}. @item Debugging Options @xref{Debugging Options,,Options for Debugging Your Program or GCC}. @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol --fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol +-fdump-noaddr -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 @@ -4005,10 +4005,17 @@ with @samp{r} (@option{-fdump-rtl-expand}). Dump debugging information during parsing, to standard error. @end table +@item -fdump-noaddr +@opindex fdump-noaddr +When doing debugging dumps (see @option{-d} option above), suppress +address output. This makes it more feasible to use diff on debugging +dumps for compiler invocations with different compiler binaries and/or +different text / bss / data / heap / stack / dso start locations. + @item -fdump-unnumbered @opindex fdump-unnumbered When doing debugging dumps (see @option{-d} option above), suppress instruction -numbers and line number note output. This makes it more feasible to +numbers, line number note and address output. This makes it more feasible to use diff on debugging dumps for compiler invocations with different options, in particular with and without @option{-g}. diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 156f688651e..711b02161ab 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -1466,7 +1466,7 @@ unroll_loop_stupid (struct loops *loops, struct loop *loop) static hashval_t si_info_hash (const void *ivts) { - return htab_hash_pointer (((struct iv_to_split *) ivts)->insn); + return (hashval_t) INSN_UID (((struct iv_to_split *) ivts)->insn); } /* An equality functions for information about insns to split. */ @@ -1485,7 +1485,7 @@ si_info_eq (const void *ivts1, const void *ivts2) static hashval_t ve_info_hash (const void *ves) { - return htab_hash_pointer (((struct var_to_expand *) ves)->insn); + return (hashval_t) INSN_UID (((struct var_to_expand *) ves)->insn); } /* Return true if IVTS1 and IVTS2 (which are really both of type diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index 73e3710cea2..a9c1a932bde 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -283,12 +283,9 @@ print_rtx (rtx in_rtx) case NOTE_INSN_BLOCK_BEG: case NOTE_INSN_BLOCK_END: - fprintf (outfile, " "); - if (flag_dump_unnumbered) - fprintf (outfile, "#"); - else - fprintf (outfile, "%p", - (char *) NOTE_BLOCK (in_rtx)); +#ifndef GENERATOR_FILE + dump_addr (outfile, " ", NOTE_BLOCK (in_rtx)); +#endif sawclose = 1; break; @@ -539,7 +536,9 @@ print_rtx (rtx in_rtx) break; case 't': - fprintf (outfile, " %p", (void *) XTREE (in_rtx, i)); +#ifndef GENERATOR_FILE + dump_addr (outfile, " ", XTREE (in_rtx, i)); +#endif break; case '*': 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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9b08ae65f01..9b500c5f1d1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-07-17 J"orn Rennecke <joern.rennecke@st.com> + + PR other/28251 + gcc.c-torture/unsorted/dump-noaddr.c: New test. + gcc.c-torture/unsorted/dump-noaddr.x: New driver. + 2006-07-17 Richard Guenther <rguenther@suse.de> PR tree-optimization/28238 diff --git a/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.c b/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.c new file mode 100644 index 00000000000..11dd78b8f69 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.c @@ -0,0 +1,48 @@ +#if MASK & 1 +#define t16(x) x x x x x x x x x x x x x x x x +#define M (sizeof (t16(t16(t16(t16(t16(" ")))))) - 1) +#endif +#if MASK & 2 +#define M 1048576 +#endif + +typedef struct s { + int c; + void *vp; + struct s *s; +}s; + +typedef int (*fpt) (const char *, void *, int *); + +int M_var = M; + +extern void exit (int); + +int +f (int start, int end, int *a, int *b, int c, s *sp) +{ + int count = 0; + int i; + + for (i = start; i <= end; i++) + { + a[i] = b[i] + c; + count ++; + } + (*(fpt)sp->s->vp) ("Hello World!\n", &exit, &M_var); + return count; +} + +int +g (int i) +{ + switch (i) + { + case 1: return 42; + case 2: return 60; + case 3: return 7; + case 4: return 3; + case 5: return M; + default: return 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x b/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x new file mode 100644 index 00000000000..f0155ddb883 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x @@ -0,0 +1,49 @@ +# This checks if -fdump-noaddr dumps are done consistently. +proc dump_compare { src options } { + global srcdir subdir + global tmpdir + + exec echo $src + + global torture_with_loops + set option_list $torture_with_loops + set dumpbase dump-noaddr + # ??? passing -dumpbase to the gcc driver doesn't work, since it will pass + # another -dumpbase option to override it. + # loop through all the options + foreach option $option_list { +# c-torture-compile ${dumpbase}_1 "$option $options -DMASK=1 -x c -da -fdump-tree-all" +# c-torture-compile ${dumpbase}_2 "$option $options -DMASK=2 -x c -da -fdump-tree-all" +# c-torture-compile ${dumpbase}_3 "$option $options -DMASK=3 -x c -da -fdump-tree-all" + file delete -force dump1 + file delete -force dump2 + file mkdir dump1 + file mkdir dump2 + cd dump1 + c-torture-compile $src "$option $options -DMASK=1 -x c --param ggc-min-heapsize=1 -da -fdump-tree-all -fdump-noaddr" + cd ../dump2 + c-torture-compile $src "$option $options -DMASK=2 -x c -da -fdump-tree-all -fdump-noaddr" + cd .. + foreach dump1 [lsort [glob -nocomplain dump1/*]] { + regsub dump1/ $dump1 dump2/ dump2 + set dumptail [file tail $dump1] + #puts "$option $dump1" + set tmp [ diff "$dump1" "$dump2" ] + if { $tmp == 0 } { + untested "$option $dumptail comparison" + } elseif { $tmp == 1 } { + pass "$option $dumptail comparison" + } else { + fail "$option $dumptail comparison" + } + #exec diff $dump1 $dump2 + } + } + file delete -force dump1 + file delete -force dump2 +} + +catch {dump_compare $src $options} result +puts $result +verbose result +return 1 diff --git a/gcc/tree.h b/gcc/tree.h index 49b5be2dbf7..12e2f592b32 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4340,6 +4340,7 @@ extern void print_rtl (FILE *, rtx); /* In print-tree.c */ extern void debug_tree (tree); #ifdef BUFSIZ +extern void dump_addr (FILE*, const char *, void *); extern void print_node (FILE *, const char *, tree, int); extern void print_node_brief (FILE *, const char *, tree, int); extern void indent_to (FILE *, int); |