@@ -628,12 +628,23 @@ bootstrap_stage = {
compare_target=compare3 ;
bootstrap_target=bootstrap4 ; };
bootstrap_stage = {
- id=profile ; prev=1 ; };
+ id=profile ; prev=1 ; profilegen=profile ; };
bootstrap_stage = {
- id=train; prev=profile ; } ;
+ id=train; prev=profile ; lean=1 ; profilegen=train ; } ;
bootstrap_stage = {
- id=feedback ; prev=train;
+ id=feedback ; prev=train; lean=profile ; profileuse=profile ;
bootstrap_target=profiledbootstrap ; };
+bootstrap_stage = {
+ id=feedbackcompare ; prev=feedback; lean=train ; profileuse=profile ;
+ compare_target=comparefeedback ;
+ bootstrap_target=profiledbootstrapcompare ; };
+bootstrap_stage = {
+ id=feedbackfull ; prev=feedback; lean=train ; profileuse=train ;
+ bootstrap_target=profiledbootstrapfull ; };
+bootstrap_stage = {
+ id=feedbackfullcompare ; prev=feedbackfull; lean=feedback ; profileuse=train ;
+ compare_target=comparefeedbackfull ;
+ bootstrap_target=profiledbootstrapfullcompare ; };
bootstrap_stage = {
id=autoprofile ; prev=1 ;
autoprofile="$$s/gcc/config/i386/$(AUTO_PROFILE)" ; };
@@ -481,14 +481,23 @@ STAGE2_TFLAGS += -fno-checking
STAGE3_CFLAGS += -fchecking=1
STAGE3_TFLAGS += -fchecking=1
-STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
+STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-exclude-files=conftest -fprofile-generate=$$r/$(HOST_SUBDIR)/profile-stageprofile
STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
-STAGEtrain_CFLAGS = $(filter-out -fchecking=1,$(STAGE3_CFLAGS))
-STAGEtrain_TFLAGS = $(filter-out -fchecking=1,$(STAGE3_TFLAGS))
+STAGEtrain_CFLAGS = $(filter-out -fchecking=1,$(STAGE3_CFLAGS)) -fprofile-exclude-files=conftest -fprofile-generate=$$r/$(HOST_SUBDIR)/profile-stagetrain
+STAGEtrain_TFLAGS = $(filter-out -fchecking-1,$(STAGE3_TFLAGS))
-STAGEfeedback_CFLAGS = $(STAGE4_CFLAGS) -fprofile-use
-STAGEfeedback_TFLAGS = $(STAGE4_TFLAGS)
+[+ FOR bootstrap-stage +][+ IF profileuse +]
+STAGE[+id+]_CFLAGS = $(STAGE4_CFLAGS) -fprofile-use=$$r/$(HOST_SUBDIR)/profile-stage[+profileuse+]
+STAGE[+id+]_TFLAGS = $(STAGE4_TFLAGS)
+[+ ENDIF profileuse +][+ ENDFOR bootstrap-stage +]
+
+# If we are building lto, but not using it during the build it will never get profiled.
+# Force add lto flags to the generators (like in config/bootstrap-lto-lean.mk)
+ifneq (,$(filter lto,@languages@))
+STAGEtrain_GENERATOR_CFLAGS += -flto=jobserver
+STAGEfeedback_GENERATOR_CFLAGS += -flto=jobserver
+endif
STAGEautoprofile_CFLAGS = $(STAGE2_CFLAGS) -g
STAGEautoprofile_TFLAGS = $(STAGE2_TFLAGS)
@@ -498,6 +507,9 @@ STAGEautofeedback_TFLAGS = $(STAGE3_TFLAGS)
do-compare = @do_compare@
do-compare3 = $(do-compare)
+[+ FOR bootstrap-stage +][+ IF profileuse +][+ IF compare_target +]
+do-[+compare_target+] = $(do-compare3)
+[+ ENDIF compare_target +][+ ENDIF profileuse +][+ ENDFOR bootstrap-stage +]
# -----------------------------------------------
# Programs producing files for the TARGET machine
@@ -1657,6 +1669,13 @@ stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +]
fi[+ IF compare-target +]
$(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +]
+[+ IF profilegen +]
+.PHONY: clean-stage[+id+]-profile
+clean-stage[+id+]: clean-stage[+id+]-profile
+clean-stage[+id+]-profile:
+ rm -rf $(HOST_SUBDIR)/profile-stage[+id+]
+[+ ENDIF profilegen +]
+
.PHONY: all-stage[+id+] clean-stage[+id+]
do-clean: clean-stage[+id+]
@@ -1736,7 +1755,8 @@ distclean-stage[+id+]::
@: $(MAKE); $(stage)
@test "`cat stage_last`" != stage[+id+] || rm -f stage_last
rm -rf stage[+id+]-* [+
- IF compare-target +][+compare-target+] [+ ENDIF compare-target +]
+ IF compare-target +][+compare-target+] [+ ENDIF compare-target +][+
+ IF profilegen +]$(HOST_SUBDIR)/profile-stage[+id+] [+ ENDIF profilegen +]
[+ IF cleanstrap-target +]
.PHONY: [+cleanstrap-target+]
@@ -1755,19 +1775,6 @@ distclean-stage[+id+]::
[+ ENDFOR bootstrap-stage +]
-stageprofile-end::
- $(MAKE) distclean-stagefeedback
-
-stagefeedback-start::
- @r=`${PWD_COMMAND}`; export r; \
- s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
- for i in prev-*; do \
- j=`echo $$i | sed s/^prev-//`; \
- cd $$r/$$i && \
- { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL); } && \
- { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL); }; \
- done
-
@if gcc-bootstrap
do-distclean: distclean-stage1
@@ -1,10 +1,10 @@
# This option enables LTO for stage4 and LTO for generators in stage3 with profiledbootstrap.
# Otherwise, LTO is used in only stage3.
-STAGE3_CFLAGS += -flto=jobserver
+STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1
+STAGE4_CFLAGS += -flto=jobserver -frandom-seed=1
override STAGEtrain_CFLAGS := $(filter-out -flto=jobserver,$(STAGEtrain_CFLAGS))
STAGEtrain_GENERATOR_CFLAGS += -flto=jobserver
-STAGEfeedback_CFLAGS += -flto=jobserver
# assumes the host supports the linker plugin
LTO_AR = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ar$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/
@@ -15,3 +15,5 @@ LTO_EXPORTS = AR="$(LTO_AR)"; export AR; \
LTO_FLAGS_TO_PASS = AR="$(LTO_AR)" RANLIB="$(LTO_RANLIB)"
do-compare = /bin/true
+do-compare3 = $(SHELL) $(srcdir)/contrib/compare-lto $$f1 $$f2
+extra-compare = gcc/lto1$(exeext)
@@ -3,7 +3,5 @@
STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects
STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects
-STAGEprofile_CFLAGS += -flto=jobserver -frandom-seed=1
-STAGEtrain_CFLAGS += -flto=jobserver -frandom-seed=1
-STAGEfeedback_CFLAGS += -flto=jobserver -frandom-seed=1
+STAGE4_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects
do-compare = /bin/true
@@ -1,10 +1,8 @@
-# This option enables LTO for stage2 and stage3 in slim mode
+# This option enables LTO for stage2 onward in slim mode
STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1
STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1
-STAGEprofile_CFLAGS += -flto=jobserver -frandom-seed=1
-STAGEtrain_CFLAGS += -flto=jobserver -frandom-seed=1
-STAGEfeedback_CFLAGS += -flto=jobserver -frandom-seed=1
+STAGE4_CFLAGS += -flto=jobserver -frandom-seed=1
# assumes the host supports the linker plugin
LTO_AR = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ar$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/
@@ -2112,6 +2112,8 @@ Supported languages are: ${potential_languages}])
fi
AC_SUBST(stage1_languages)
+ languages=`echo "$enable_languages" | sed -e "s/,/ /g"`
+ AC_SUBST(languages)
ac_configure_args=`echo " $ac_configure_args" | sed -e "s/ '--enable-languages=[[^ ]]*'//g" -e "s/$/ '--enable-languages="$enable_languages"'/" `
fi