summaryrefslogtreecommitdiff
path: root/Makefile.tpl
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2016-06-23 14:34:16 +0000
committerAndi Kleen <ak@gcc.gnu.org>2016-06-23 14:34:16 +0000
commit277d7ee0c95456a21ef371aa025791cbef883169 (patch)
treea64cadd18e82bbd81f52a690484f43fc66291fdc /Makefile.tpl
parent7f586d904de25044a08f99669df5bc1ed2fa9f26 (diff)
Add make autoprofiledbootstrap
Add support for profiledbootstrap with autofdo. Will be useful to get better testing coverage of autofdo. This requires Linux perf and autofdo to be installed, only really for x86_64 linux on Intel so far. Profile the whole build process with perf, then convert the file, and pass it back to the compiler in the feedback stage. The conversion has to be done per language, as only that knows the name of the binary. Currently we only do it for C and C++, as the other languages don't have enough coverage during a normal bootstrap. For lto1 it is also disabled, because it would only be useful during a LTO bootstrap, but right now autofdo and LTO are not working together due to PR66229 For common backend files always the profile output of the C++ compiler is used. In theory multiple inputs could be merged here, but so far that is not implemented. The method is not friendly to partial rebuilds, as only the profile information from the current rebuild is used. So if an error occurs it is best to clean and restart, otherwise the code quality may be worse. This patch is fairly large, but most of it is auto generated from autogen in Makefile.in. for the new stage targets. Passes profiledbootstrap and normal bootstrap on x86_64-linux. autoprofiledbootstrap is currently not working due to PR70427 (but it finishes with that worked around) The autofdo'ed compiler is ~7% faster on insn-recog.i (vs ~11% for profiledfeedback), and ~4% faster for tramp3d-v4 (vs 10% for profiledfeedback) on a Sandy Bridge system. gcc/lto/: 2016-06-23 Andi Kleen <ak@linux.intel.com> * Make-lang.in: Add support for autofdo (disabled for now) gcc/cp/: 2016-06-23 Andi Kleen <ak@linux.intel.com> * Make-lang.in: Add support for autofdo. gcc/: 2016-06-23 Andi Kleen <ak@linux.intel.com> * Makefile.in: Regenerate. * doc/install.texi: Document autoprofiledbootstrap. /: 2016-06-23 Andi Kleen <ak@linux.intel.com> * Makefile.def: Add autoprofiledbootstrap. * Makefile.tpl: Dito. * Makefile.in: Regenerate. gcc/c/: 2016-06-23 Andi Kleen <ak@linux.intel.com> * Make-lang.in: Add support for autofdo. From-SVN: r237733
Diffstat (limited to 'Makefile.tpl')
-rw-r--r--Makefile.tpl16
1 files changed, 14 insertions, 2 deletions
diff --git a/Makefile.tpl b/Makefile.tpl
index a05c4bc084b..94a4f79f68e 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -382,6 +382,8 @@ MAKEINFO = @MAKEINFO@
EXPECT = @EXPECT@
RUNTEST = @RUNTEST@
+AUTO_PROFILE = gcc-auto-profile -c 1000000
+
# This just becomes part of the MAKEINFO definition passed down to
# sub-makes. It lets flags be given on the command line while still
# using the makeinfo from the object tree.
@@ -418,6 +420,8 @@ CXXFLAGS = @CXXFLAGS@
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
GOCFLAGS = $(CFLAGS)
+CREATE_GCOV = create_gcov
+
TFLAGS =
# Defaults for all stages; some are overridden below.
@@ -462,6 +466,12 @@ STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
STAGEfeedback_CFLAGS = $(STAGE3_CFLAGS) -fprofile-use
STAGEfeedback_TFLAGS = $(STAGE3_TFLAGS)
+STAGEautoprofile_CFLAGS = $(STAGE2_CFLAGS) -g
+STAGEautoprofile_TFLAGS = $(STAGE2_TFLAGS)
+
+STAGEautofeedback_CFLAGS = $(STAGE3_CFLAGS)
+STAGEautofeedback_TFLAGS = $(STAGE3_TFLAGS)
+
do-compare = @do_compare@
do-compare3 = $(do-compare)
@@ -617,7 +627,8 @@ EXTRA_HOST_FLAGS = \
'READELF=$(READELF)' \
'STRIP=$(STRIP)' \
'WINDRES=$(WINDRES)' \
- 'WINDMC=$(WINDMC)'
+ 'WINDMC=$(WINDMC)' \
+ 'CREATE_GCOV=$(CREATE_GCOV)'
FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
@@ -1147,6 +1158,7 @@ all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
[+exports+][+ IF prev +] \
[+poststage1_exports+][+ ENDIF prev +] [+extra_exports+] \
cd [+subdir+]/[+module+] && \
+ [+autoprofile+] \
$(MAKE) $(BASE_FLAGS_TO_PASS)[+ IF prefix +] \
CFLAGS="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
@@ -1160,7 +1172,7 @@ all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
[+args+] [+IF prev +][+poststage1_args+][+ ELSE prev +] \
[+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] \
- TFLAGS="$(STAGE[+id+]_TFLAGS)" \
+ TFLAGS="$(STAGE[+id+]_TFLAGS)" [+profile_data+] \
$(TARGET-stage[+id+]-[+prefix+][+module+])
maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+]