44
55# General Options
66set (LLVM_RELEASE_ENABLE_LTO THIN CACHE STRING "" )
7+ set (LLVM_RELEASE_ENABLE_PGO ON CACHE BOOL "" )
78
89set (CMAKE_BUILD_TYPE RELEASE CACHE STRING "" )
910
1011# Stage 1 Bootstrap Setup
1112set (CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "" )
12- set (CLANG_BOOTSTRAP_TARGETS
13- clang
14- check-all
15- check-llvm
16- check-clang
17- test -suite
18- stage3
19- stage3-clang
20- stage3-check-all
21- stage3-check-llvm
22- stage3-check-clang
23- stage3-install
24- stage3-test -suite CACHE STRING "" )
13+ if (LLVM_RELEASE_ENABLE_PGO)
14+ set (CLANG_BOOTSTRAP_TARGETS
15+ generate-profdata
16+ stage2
17+ stage2-clang
18+ stage2-distribution
19+ stage2-install
20+ stage2-install -distribution
21+ stage2-install -distribution-toolchain
22+ stage2-check-all
23+ stage2-check-llvm
24+ stage2-check-clang
25+ stage2-test -suite CACHE STRING "" )
26+ else ()
27+ set (CLANG_BOOTSTRAP_TARGETS
28+ clang
29+ check-all
30+ check-llvm
31+ check-clang
32+ test -suite
33+ stage3
34+ stage3-clang
35+ stage3-check-all
36+ stage3-check-llvm
37+ stage3-check-clang
38+ stage3-install
39+ stage3-test -suite CACHE STRING "" )
40+ endif ()
2541
2642# Stage 1 Options
27- set (LLVM_ENABLE_PROJECTS "clang" CACHE STRING "" )
43+ set (STAGE1_PROJECTS "clang" )
44+ set (STAGE1_RUNTIMES "" )
45+
46+ if (LLVM_RELEASE_ENABLE_PGO)
47+ list (APPEND STAGE1_PROJECTS "lld" )
48+ list (APPEND STAGE1_RUNTIMES "compiler-rt" )
49+ endif ()
50+
51+ set (LLVM_ENABLE_RUNTIMES ${STAGE1_RUNTIMES} CACHE STRING "" )
52+ set (LLVM_ENABLE_PROJECTS ${STAGE1_PROJECTS} CACHE STRING "" )
53+
2854set (LLVM_TARGETS_TO_BUILD Native CACHE STRING "" )
2955
3056# Stage 2 Bootstrap Setup
@@ -37,11 +63,26 @@ set(BOOTSTRAP_CLANG_BOOTSTRAP_TARGETS
3763
3864# Stage 2 Options
3965set (STAGE2_PROJECTS "clang" )
40- if (LLVM_RELEASE_ENABLE_LTO)
66+ set (STAGE2_RUNTIMES "" )
67+
68+ if (LLVM_RELEASE_ENABLE_LTO OR LLVM_RELEASE_ENABLE_PGO)
4169 list (APPEND STAGE2_PROJECTS "lld" )
4270endif ()
71+
72+ if (LLVM_RELEASE_ENABLE_PGO)
73+ set (BOOTSTRAP_LLVM_BUILD_INSTRUMENTED IR CACHE STRING "" )
74+ list (APPEND STAGE2_RUNTIMES "compiler-rt" )
75+ set (BOOTSTRAP_LLVM_ENABLE_LTO ${LLVM_RELEASE_ENABLE_LTO} )
76+ if (LLVM_RELEASE_ENABLE_LTO)
77+ set (BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "" )
78+ endif ()
79+ endif ()
80+
4381set (BOOTSTRAP_LLVM_ENABLE_PROJECTS ${STAGE2_PROJECTS} CACHE STRING "" )
44- set (BOOTSTRAP_LLVM_TARGETS_TO_BUILD Native CACHE STRING "" )
82+ set (BOOTSTRAP_LLVM_ENABLE_RUNTIMES ${STAGE2_RUNTIMES} CACHE STRING "" )
83+ if (NOT LLVM_RELEASE_ENABLE_PGO)
84+ set (BOOTSTRAP_LLVM_TARGETS_TO_BUILD Native CACHE STRING "" )
85+ endif ()
4586
4687# Stage 3 Options
4788set (BOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "" )
0 commit comments