bug 419348 - build config fixes for profile-guided optimization on mac. fixes for PGO on universal builds, configure arg to disable PGO in spite of profiled build. r=bsmedberg

This commit is contained in:
ted.mielczarek@gmail.com 2008-03-06 03:57:21 -08:00
Родитель 34da15d9b4
Коммит 3d400539b6
5 изменённых файлов: 51 добавлений и 21 удалений

Просмотреть файл

@ -218,9 +218,14 @@ endif
#XXX: this is a hack, since we don't want to clobber for MSVC
# PGO support, but we can't do this test in client.mk
ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
# No point in clobbering if PGO has been explicitly disabled.
ifndef NO_PROFILE_GUIDED_OPTIMIZE
maybe_clobber_profiledbuild: clobber_all
else
maybe_clobber_profiledbuild:
endif
else
maybe_clobber_profiledbuild:
endif
.PHONY: maybe_clobber_profiledbuild

Просмотреть файл

@ -931,6 +931,30 @@ real_l10n-checkout:
else true; \
fi
####################################
# Profile-Guided Optimization
# To use this, you should set the following variables in your mozconfig
# mk_add_options PROFILE_GEN_SCRIPT=/path/to/profile-script
#
# The profile script should exercise the functionality to be included
# in the profile feedback.
#
# This is up here, outside of the MOZ_CURRENT_PROJECT logic so that this
# is usable in multi-pass builds, where you might not have a runnable
# application until all the build passes and postflight scripts have run.
ifdef MOZ_OBJDIR
PGO_OBJDIR = $(MOZ_OBJDIR)
else
PGO_OBJDIR := $(TOPSRCDIR)
endif
profiledbuild::
$(MAKE) -f $(TOPSRCDIR)/client.mk build MOZ_PROFILE_GENERATE=1
OBJDIR=${PGO_OBJDIR} $(PROFILE_GEN_SCRIPT)
$(MAKE) -f $(TOPSRCDIR)/client.mk maybe_clobber_profiledbuild
$(MAKE) -f $(TOPSRCDIR)/client.mk build MOZ_PROFILE_USE=1
#####################################################
# First Checkout
@ -958,7 +982,7 @@ endif
#####################################################
# Preflight, before building any project
build profiledbuild alldep preflight_all::
build alldep preflight_all::
ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_PREFLIGHT_ALL),,1))
# Don't run preflight_all for individual projects in multi-project builds
# (when MOZ_CURRENT_PROJECT is set.)
@ -982,7 +1006,7 @@ endif
# loop through them.
ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_BUILD_PROJECTS),,1))
configure depend build profiledbuild install export libs clean realclean distclean alldep preflight postflight::
configure depend build install export libs clean realclean distclean alldep preflight postflight maybe_clobber_profiledbuild::
set -e; \
for app in $(MOZ_BUILD_PROJECTS); do \
$(MAKE) -f $(TOPSRCDIR)/client.mk $@ MOZ_CURRENT_PROJECT=$$app; \
@ -1072,7 +1096,7 @@ depend:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
####################################
# Preflight
build profiledbuild alldep preflight::
build alldep preflight::
ifdef MOZ_PREFLIGHT
set -e; \
for mkfile in $(MOZ_PREFLIGHT); do \
@ -1086,31 +1110,17 @@ endif
build:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
$(MOZ_MAKE)
####################################
# Profile-feedback build (gcc only)
# To use this, you should set the following variables in your mozconfig
# mk_add_options PROFILE_GEN_SCRIPT=/path/to/profile-script
#
# The profile script should exercise the functionality to be included
# in the profile feedback.
profiledbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
$(MOZ_MAKE) MOZ_PROFILE_GENERATE=1
OBJDIR=${OBJDIR} $(PROFILE_GEN_SCRIPT)
$(MOZ_MAKE) maybe_clobber_profiledbuild
$(MOZ_MAKE) MOZ_PROFILE_USE=1
####################################
# Other targets
# Pass these target onto the real build system
install export libs clean realclean distclean alldep:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
install export libs clean realclean distclean alldep maybe_clobber_profiledbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
$(MOZ_MAKE) $@
####################################
# Postflight
build profiledbuild alldep postflight::
build alldep postflight::
ifdef MOZ_POSTFLIGHT
set -e; \
for mkfile in $(MOZ_POSTFLIGHT); do \
@ -1123,7 +1133,7 @@ endif # MOZ_CURRENT_PROJECT
####################################
# Postflight, after building all projects
build profiledbuild alldep postflight_all::
build alldep postflight_all::
ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_POSTFLIGHT_ALL),,1))
# Don't run postflight_all for individual projects in multi-project builds
# (when MOZ_CURRENT_PROJECT is set.)
@ -1161,4 +1171,4 @@ endif
echo-variable-%:
@echo $($*)
.PHONY: checkout real_checkout depend build profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all
.PHONY: checkout real_checkout depend build profiledbuild maybe_clobber_profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all

Просмотреть файл

@ -283,6 +283,7 @@ MOZ_OPTIMIZE_LDFLAGS = @MOZ_OPTIMIZE_LDFLAGS@
MOZ_RTTI_FLAGS_ON = @_MOZ_RTTI_FLAGS_ON@
MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE = @MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE@
PROFILE_GEN_CFLAGS = @PROFILE_GEN_CFLAGS@
PROFILE_GEN_LDFLAGS = @PROFILE_GEN_LDFLAGS@
PROFILE_USE_CFLAGS = @PROFILE_USE_CFLAGS@

Просмотреть файл

@ -351,6 +351,11 @@ DSO_PIC_CFLAGS=
endif
endif
# This comes from configure
ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE
NO_PROFILE_GUIDED_OPTIMIZE = 1
endif
# Enable profile-based feedback
ifndef NO_PROFILE_GUIDED_OPTIMIZE
ifdef MOZ_PROFILE_GENERATE

Просмотреть файл

@ -6550,6 +6550,15 @@ dnl Test for profiling options
dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
dnl Provide a switch to disable PGO even when called via profiledbuild.
MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
[ --disable-profile-guided-optimization
Don't build with PGO even if called via make profiledbuild],
MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
_SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fprofile-generate"