This patch adds a few new convenience options used by the PGO CMake cache to setup options on bootstrap stages. The new options are:
PGO_INSTRUMENT_LTO - Builds the instrumented and final builds with LTO
PGO_BUILD_CONFIGURATION - Accepts a CMake cache script that can be used for complex configuration of the stage2-instrumented and stage2 builds.
The patch also includes a fix for bootstrap dependencies so that the instrumented LTO tools don't get used when building the final stage, and it adds distribution targets to the passthrough.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278862
91177308-0d34-0410-b5e6-
96231b3b80d8
if(LLVM_BUILD_INSTRUMENTED)
set(PGO_DEP generate-profdata)
set(PGO_OPT -DLLVM_PROFDATA_FILE=${CMAKE_CURRENT_BINARY_DIR}/utils/perf-training/clang.profdata)
- set(COMPILER_OPTIONS
- -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
- -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
- -DCMAKE_ASM_COMPILER=${CMAKE_ASM_COMPILER})
+ # Use the current tools for LTO instead of the instrumented ones
+ list(APPEND _BOOTSTRAP_DEFAULT_PASSTHROUGH
+ CMAKE_CXX_COMPILER
+ CMAKE_C_COMPILER
+ CMAKE_ASM_COMPILER
+ CMAKE_AR
+ CMAKE_RANLIB
+ DARWIN_LTO_LIBRARY
+ DYLD_LIBRARY_PATH)
+
+ set(COMPILER_OPTIONS)
+ set(LTO_LIBRARY)
set(RUNTIME_DEP) # Don't set runtime dependencies
+ set(LTO_DEP) # Don't need to depend on LTO
+ set(LTO_AR)
+ set(LTO_RANLIB)
endif()
# Find all variables that start with BOOTSTRAP_ and populate a variable with
-set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
-set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_TARGETS
+ distribution
+ install-distribution
+ check-all
+ check-llvm
+ check-clang
+ test-suite CACHE STRING "")
-set(CLANG_BOOTSTRAP_TARGETS check-all check-llvm check-clang test-suite CACHE STRING "")
+if(PGO_BUILD_CONFIGURATION)
+ include(${PGO_BUILD_CONFIGURATION})
+ set(CLANG_BOOTSTRAP_CMAKE_ARGS
+ -C ${PGO_BUILD_CONFIGURATION}
+ CACHE STRING "")
+else()
+ include(${CMAKE_CURRENT_LIST_DIR}/PGO-stage2.cmake)
-set(CLANG_BOOTSTRAP_CMAKE_ARGS
- -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2.cmake
- CACHE STRING "")
+ set(CLANG_BOOTSTRAP_CMAKE_ARGS
+ -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2.cmake
+ CACHE STRING "")
+endif()
set(CLANG_BOOTSTRAP_TARGETS
generate-profdata
stage2
+ stage2-distribution
+ stage2-install-distribution
stage2-check-all
stage2-check-llvm
stage2-check-clang
stage2-test-suite CACHE STRING "")
+if(PGO_INSTRUMENT_LTO)
+ set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
+ set(BOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
+endif()
+
+if(PGO_BUILD_CONFIGURATION)
+ set(EXTRA_ARGS -DPGO_BUILD_CONFIGURATION=${PGO_BUILD_CONFIGURATION})
+endif()
+
set(CLANG_BOOTSTRAP_CMAKE_ARGS
+ ${EXTRA_ARGS}
-C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2-instrumented.cmake
CACHE STRING "")