diff options
author | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-11 11:59:08 +0000 |
---|---|---|
committer | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-11 11:59:08 +0000 |
commit | fdcf3c7bc5d050477b2e19e7cced83e809d68cdb (patch) | |
tree | 87b58c5b1052f8856f2a5927aeb8fe7a6fe0e0e3 | |
parent | d5f5031a018c1e831adf941f4175e01a8219e8e9 (diff) |
ChangeLog.vta:
* config/bootstrap-debug.mk: Add comments.
* config/bootstrap-debug-big.mk: New.
* config/bootstrap-debug-lean.mk: New.
* config/bootstrap-debug-ckovw.mk: Add comments.
* config/bootstrap-debug-lib.mk: Drop CFLAGS for stages. Use -g0
for TFLAGS in stage1. Drop -fvar-tracking-assignments-toggle.
* contrib/compare-debug: Look for .gkd files and compare them.
* Makefile.tpl (BUILD_CONFIG): Default to bootstrap-debug.
* Makefile.in: Rebuilt.
gcc/ChangeLog.vta:
* doc/invoke.texi (bootstrap-debug): More details.
(bootstrap-debug-big, bootstrap-debug-lean): Document.
(bootstrap-debug-lib): More details.
(bootstrap-debug-ckovw): Update.
* gcc.c (invoke_as): Call compare-debug-dump-opt for
-fdump-final-insns too.
(driver_self_specs): Map -fdump-final-insns to
-fdump-final-insns=..
(compare_debug_dump_opt_spec_function): Test for . argument and
compute output name. Compute temp output spec without flag name.
* doc/invoke.texi (fdump-final-insns): Document argument-less use.
* toplev.c (process_options): Don't open final insns dump file if
we're not going to write to it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/var-tracking-assignments-4_4-branch@148389 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | ChangeLog.vta | 12 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | Makefile.tpl | 2 | ||||
-rw-r--r-- | config/bootstrap-debug-big.mk | 8 | ||||
-rw-r--r-- | config/bootstrap-debug-ckovw.mk | 4 | ||||
-rw-r--r-- | config/bootstrap-debug-lean.mk | 11 | ||||
-rw-r--r-- | config/bootstrap-debug-lib.mk | 21 | ||||
-rw-r--r-- | config/bootstrap-debug.mk | 10 | ||||
-rwxr-xr-x | contrib/compare-debug | 10 | ||||
-rw-r--r-- | gcc/ChangeLog.vta | 16 | ||||
-rw-r--r-- | gcc/doc/install.texi | 52 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 9 | ||||
-rw-r--r-- | gcc/gcc.c | 32 | ||||
-rw-r--r-- | gcc/toplev.c | 2 |
14 files changed, 146 insertions, 45 deletions
diff --git a/ChangeLog.vta b/ChangeLog.vta index 9cdc35b0f12..3119e491b4c 100644 --- a/ChangeLog.vta +++ b/ChangeLog.vta @@ -1,5 +1,17 @@ 2009-06-11 Alexandre Oliva <aoliva@redhat.com> + * config/bootstrap-debug.mk: Add comments. + * config/bootstrap-debug-big.mk: New. + * config/bootstrap-debug-lean.mk: New. + * config/bootstrap-debug-ckovw.mk: Add comments. + * config/bootstrap-debug-lib.mk: Drop CFLAGS for stages. Use -g0 + for TFLAGS in stage1. Drop -fvar-tracking-assignments-toggle. + * contrib/compare-debug: Look for .gkd files and compare them. + * Makefile.tpl (BUILD_CONFIG): Default to bootstrap-debug. + * Makefile.in: Rebuilt. + +2009-06-11 Alexandre Oliva <aoliva@redhat.com> + * contrib/compare-debug: Use * rather than \? in portable regexp. 2009-03-01 Alexandre Oliva <aoliva@redhat.com> diff --git a/Makefile.in b/Makefile.in index 59937bc1ed8..bc1d2573632 100644 --- a/Makefile.in +++ b/Makefile.in @@ -735,7 +735,7 @@ EXTRA_GCC_FLAGS = \ GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) @if gcc -BUILD_CONFIG = +BUILD_CONFIG = bootstrap-debug ifneq ($(BUILD_CONFIG),) include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk) endif diff --git a/Makefile.tpl b/Makefile.tpl index 6f509d364a3..d94e01761df 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -590,7 +590,7 @@ EXTRA_GCC_FLAGS = \ GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) @if gcc -BUILD_CONFIG = +BUILD_CONFIG = bootstrap-debug ifneq ($(BUILD_CONFIG),) include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk) endif diff --git a/config/bootstrap-debug-big.mk b/config/bootstrap-debug-big.mk new file mode 100644 index 00000000000..e657735e3b3 --- /dev/null +++ b/config/bootstrap-debug-big.mk @@ -0,0 +1,8 @@ +# This BUILD_CONFIG option is a bit like bootstrap-debug-lean, but it +# trades space for speed: instead of recompiling programs during +# stage3, it generates dumps during stage2 and stage3, saving them all +# until the final compare. + +STAGE2_CFLAGS += -gtoggle -fdump-final-insns +STAGE3_CFLAGS += -fdump-final-insns +do-compare = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2 diff --git a/config/bootstrap-debug-ckovw.mk b/config/bootstrap-debug-ckovw.mk index 2e4037c6f85..909b9047fc2 100644 --- a/config/bootstrap-debug-ckovw.mk +++ b/config/bootstrap-debug-ckovw.mk @@ -1,3 +1,7 @@ +# This BUILD_CONFIG option is to be used along with +# bootstrap-debug-lean and bootstrap-debug-lib in a full bootstrap, to +# check that all host and target files are built with -fcompare-debug. + # These arrange for a simple warning to be issued if -fcompare-debug # is not given. # BOOT_CFLAGS += -fcompare-debug="-w%n-fcompare-debug not overridden" diff --git a/config/bootstrap-debug-lean.mk b/config/bootstrap-debug-lean.mk new file mode 100644 index 00000000000..5666d3f2119 --- /dev/null +++ b/config/bootstrap-debug-lean.mk @@ -0,0 +1,11 @@ +# This BUILD_CONFIG option is a bit like bootstrap-debug, but in +# addition to comparing stripped object files, it also compares +# compiler internal state during stage3. + +# This makes it slower than bootstrap-debug, for there's additional +# dumping and recompilation during stage3. bootstrap-debug-big can +# avoid the recompilation, if plenty of disk space is available. + +STAGE2_CFLAGS += -gtoggle -fcompare-debug= +STAGE3_CFLAGS += -fcompare-debug +do-compare = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2 diff --git a/config/bootstrap-debug-lib.mk b/config/bootstrap-debug-lib.mk index 6826cb2a7ca..32fdf4dd863 100644 --- a/config/bootstrap-debug-lib.mk +++ b/config/bootstrap-debug-lib.mk @@ -1,13 +1,12 @@ -# Stage1 compiler may not support this flag. -# STAGE1_CFLAGS += -fcompare-debug=-gtoggle -STAGE2_CFLAGS += -gtoggle -fcompare-debug= -STAGE3_CFLAGS += -fcompare-debug=-gtoggle -STAGE4_CFLAGS += -fcompare-debug=-fvar-tracking-assignments-toggle -# This might be enough after testing: -# TFLAGS += -fcompare-debug=-g0 -# Don't use -gtoggle for target libs, this breaks crtstuff on ppc. -STAGE1_TFLAGS += -fcompare-debug= -STAGE2_TFLAGS += -fcompare-debug=-fvar-tracking-assignments-toggle +# This BUILD_CONFIG option tests that target libraries built during +# stage3 would have generated the same executable code if they were +# compiled with -g0. + +# It uses -g0 rather than -gtoggle because -g is default on target +# library builds, and toggling it where it's supposed to be disabled +# breaks e.g. crtstuff on ppc. + +STAGE1_TFLAGS += -g0 -fcompare-debug= +STAGE2_TFLAGS += -fcompare-debug= STAGE3_TFLAGS += -fcompare-debug=-g0 -STAGE4_TFLAGS += -fcompare-debug=-fvar-tracking-assignments-toggle do-compare = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2 diff --git a/config/bootstrap-debug.mk b/config/bootstrap-debug.mk index dce80e962ba..41389241c05 100644 --- a/config/bootstrap-debug.mk +++ b/config/bootstrap-debug.mk @@ -1,2 +1,12 @@ +# This BUILD_CONFIG option builds checks that toggling debug +# information generation doesn't affect the generated object code. + +# It is very lightweight: in addition to not performing any additional +# compilation (unlike bootstrap-debug-lean), it actually speeds up +# stage2, for no debug information is generated when compiling with +# the unoptimized stage1. + +# For more thorough testing, see bootstrap-debug-lean.mk + STAGE2_CFLAGS += -gtoggle do-compare = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2 diff --git a/contrib/compare-debug b/contrib/compare-debug index f4aa731f75b..f9ce9ddec01 100755 --- a/contrib/compare-debug +++ b/contrib/compare-debug @@ -2,7 +2,7 @@ # Compare stripped copies of two given object files. -# Copyright (C) 2007, 2008 Free Software Foundation +# Copyright (C) 2007, 2008, 2009 Free Software Foundation # Originally by Alexandre Oliva <aoliva@redhat.com> # This file is part of GCC. @@ -149,4 +149,12 @@ $rm "$1.$suf1" "$2.$suf2" trap "exit $status; exit" 0 1 2 15 +if test -f "$1".gkd || test -f "$2".gkd; then + if cmp "$1".gkd "$2".gkd; then + : + else + status=$? + fi +fi + exit $status diff --git a/gcc/ChangeLog.vta b/gcc/ChangeLog.vta index 85b2a388ec2..50bbab1053e 100644 --- a/gcc/ChangeLog.vta +++ b/gcc/ChangeLog.vta @@ -1,5 +1,21 @@ 2009-06-11 Alexandre Oliva <aoliva@redhat.com> + * doc/invoke.texi (bootstrap-debug): More details. + (bootstrap-debug-big, bootstrap-debug-lean): Document. + (bootstrap-debug-lib): More details. + (bootstrap-debug-ckovw): Update. + * gcc.c (invoke_as): Call compare-debug-dump-opt for + -fdump-final-insns too. + (driver_self_specs): Map -fdump-final-insns to + -fdump-final-insns=.. + (compare_debug_dump_opt_spec_function): Test for . argument and + compute output name. Compute temp output spec without flag name. + * doc/invoke.texi (fdump-final-insns): Document argument-less use. + * toplev.c (process_options): Don't open final insns dump file if + we're not going to write to it. + +2009-06-11 Alexandre Oliva <aoliva@redhat.com> + * common.opt (fverbose-cselib): Drop. * doc/invoke.texi: Likewise. * Makefile.in (cselib.o): Depend on $(TREE_PASS_H). diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 1a7a1752036..0fc3ca372a6 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1968,28 +1968,48 @@ Removes any @option{-O}-started option from @code{BOOT_CFLAGS}, and adds Analogous to @code{bootstrap-O1}. @item @samp{bootstrap-debug} -Builds stage2 without debug information, and uses -@file{contrib/compare-debug} to compare object files. If -@code{BOOT_CFLAGS} is overridden so as to not enable debug information, -stage2 will have it, and stage3 won't. +Verifies that the compiler generates the same executable code, whether +or not it is asked to emit debug information. To this end, this option +builds stage2 host programs without debug information, and uses +@file{contrib/compare-debug} to compare them with the stripped stage3 +object files. If @code{BOOT_CFLAGS} is overridden so as to not enable +debug information, stage2 will have it, and stage3 won't. This option +is enabled by default when GCC bootstrapping is enabled: in addition to +better test coverage, it makes default bootstraps faster and leaner. + +@item @samp{bootstrap-debug-big} +In addition to the checking performed by @code{bootstrap-debug}, this +option saves internal compiler dumps during stage2 and stage3 and +compares them as well, which helps catch additional potential problems, +but at a great cost in terms of disk space. + +@item @samp{bootstrap-debug-lean} +This option saves disk space compared with @code{bootstrap-debug-big}, +but at the expense of some recompilation. Instead of saving the dumps +of stage2 and stage3 until the final compare, it uses +@option{-fcompare-debug} to generate, compare and remove the dumps +during stage3, repeating the compilation that already took place in +stage2, whose dumps were not saved. @item @samp{bootstrap-debug-lib} -Toggles debug information generation in stage2, like -@file{bootstrap-debug}, and enables internal comparison -(@option{-fcompare-debug}) with and without debug information in stage3, -and internal comparison with and without variable tracking at -assignments (VTA) on stage4. As for libraries, it toggles debug -information generation for libraries on stage1, enables internal -comparison with and without VTA on stage2, internal comparison with and -without debug information in stage3 (all libraries, unlike previous -stages that only build libgcc), and internal comparison with and without -VTA on stage4. +This option tests executable code invariance over debug information +generation on target libraries, just like @code{bootstrap-debug-lean} +tests it on host programs. It builds stage3 libraries with +@option{-fcompare-debug}, and it can be used along with any of the +@code{bootstrap-debug} options above. + +There aren't @code{-lean} or @code{-big} counterparts to this option +because most libraries are only build in stage3, so bootstrap compares +would not get significant coverage. Moreover, the few libraries built +in stage2 are used in stage3 host programs, so we wouldn't want to +compile stage2 libraries with different options for comparison purposes. @item @samp{bootstrap-debug-ckovw} Arranges for error messages to be issued if the compiler built on any stage is run without the option @option{-fcompare-debug}. This is -useful to verify the full coverage of the @code{bootstrap-debug-lib} -option. +useful to verify the full @option{-fcompare-debug} testing coverage. It +must be used along with @code{bootstrap-debug-lean} and +@code{bootstrap-debug-lib}. @item @samp{bootstrap-time} Arranges for the run time of each program started by the GCC driver, diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index d3ba952599c..37887c8903d 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -4337,9 +4337,12 @@ other options are processed, and it does so only once, no matter how many times it is given. This is mainly intended to be used with @option{-fcompare-debug}. -@item -fdump-final-insns=@var{file} -@opindex fdump-final-insns= -Dump the final internal representation (RTL) to @var{file}. +@item -fdump-final-insns@r{[}=@var{file}@r{]} +@opindex fdump-final-insns +Dump the final internal representation (RTL) to @var{file}. If the +optional argument is omitted (or if @var{file} is @code{.}), the name +of the dump file will be determined by appending @code{.gkd} to the +compilation output file name. @item -fcompare-debug@r{[}=@var{opts}@r{]} @opindex fcompare-debug diff --git a/gcc/gcc.c b/gcc/gcc.c index 3373aecfed1..dc2ccefe78d 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -869,10 +869,10 @@ static const char *asm_options = static const char *invoke_as = #ifdef AS_NEEDS_DASH_FOR_PIPED_INPUT -"%{fcompare-debug=*:%:compare-debug-dump-opt()}\ +"%{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()}\ %{!S:-o %|.s |\n as %(asm_options) %|.s %A }"; #else -"%{fcompare-debug=*:%:compare-debug-dump-opt()}\ +"%{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()}\ %{!S:-o %|.s |\n as %(asm_options) %m.s %A }"; #endif @@ -904,6 +904,7 @@ static const char *const multilib_defaults_raw[] = MULTILIB_DEFAULTS; #endif static const char *const driver_self_specs[] = { + "%{fdump-final-insns:-fdump-final-insns=.} %<fdump-final-insns", DRIVER_SELF_SPECS, GOMP_SELF_SPECS }; @@ -8518,29 +8519,38 @@ compare_debug_dump_opt_spec_function (int arg, if (arg != 0) fatal ("too many arguments to %%:compare-debug-dump-opt"); - if (!compare_debug) - return NULL; - do_spec_2 ("%{fdump-final-insns=*:%*}"); do_spec_1 (" ", 0, NULL); - if (argbuf_index > 0) + if (argbuf_index > 0 && strcmp (argv[argbuf_index - 1], ".")) { + if (!compare_debug) + return NULL; + name = xstrdup (argv[argbuf_index - 1]); ret = NULL; } else { -#define OPT "-fdump-final-insns=" - ret = "-fdump-final-insns=%g.gkd"; + const char *ext = NULL; + + if (argbuf_index > 0) + { + do_spec_2 ("%{o*:%*}%{!o:%{!S:%b%O}%{S:%b.s}}"); + ext = ".gkd"; + } + else if (!compare_debug) + return NULL; + else + do_spec_2 ("%g.gkd"); - do_spec_2 (ret + sizeof (OPT) - 1); do_spec_1 (" ", 0, NULL); -#undef OPT gcc_assert (argbuf_index > 0); - name = xstrdup (argbuf[argbuf_index - 1]); + name = concat (argbuf[argbuf_index - 1], ext, NULL); + + ret = concat ("-fdump-final-insns=", name, NULL); } which = compare_debug < 0; diff --git a/gcc/toplev.c b/gcc/toplev.c index a19894bb26a..cece3c1b03b 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1801,7 +1801,7 @@ process_options (void) debug_info_level = DINFO_LEVEL_NONE; } - if (flag_dump_final_insns) + if (flag_dump_final_insns && !flag_syntax_only && !no_backend) { FILE *final_output = fopen (flag_dump_final_insns, "w"); if (!final_output) |