From 5be480417d1fbecc89d5759551e32e448134a94c Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Tue, 5 Jan 2016 23:51:42 +0000 Subject: [CMake] Support a simple case for bootstrap builds to generate PGO data Summary: This patch adds support for the clang multi-stage bootstrapping to support PGO profdata generation, and can build a 2 or 3 stage compiler. With this patch applied you can configure your build directory with the following invocation of CMake: cmake -G -C /cmake/caches/PGO.cmake After configuration the following additional targets will be generated: stage2-instrumented: Builds a stage1 x86 compiler, runtime, and required tools (llvm-config, llvm-profdata) then uses that compiler to build an instrumented stage2 compiler. stage2-instrumented-generate-profdata: Depends on "stage2-instrumented" and will use the instrumented compiler to generate profdata based on the training files in /utils/perf-training stage2: Depends on "stage2-instrumented-generate-profdata" and will use the stage1 compiler with the stage2 profdata to build a PGO-optimized compiler. stage2-check-llvm: Depends on stage2 and runs check-llvm using the stage3 compiler. stage2-check-clang: Depends on stage2 and runs check-clang using the stage3 compiler. stage2-check-all: Depends on stage2 and runs check-all using the stage3 compiler. stage2-test-suite: Depends on stage2 and runs the test-suite using the stage3 compiler (requires in-tree test-suite). Reviewers: bogner, silvas, chandlerc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15584 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256873 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/caches/PGO-stage2-instrumented.cmake | 9 +++++++++ cmake/caches/PGO-stage2.cmake | 2 ++ cmake/caches/PGO.cmake | 17 +++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 cmake/caches/PGO-stage2-instrumented.cmake create mode 100644 cmake/caches/PGO-stage2.cmake create mode 100644 cmake/caches/PGO.cmake (limited to 'cmake') diff --git a/cmake/caches/PGO-stage2-instrumented.cmake b/cmake/caches/PGO-stage2-instrumented.cmake new file mode 100644 index 0000000000..fe5e83d28a --- /dev/null +++ b/cmake/caches/PGO-stage2-instrumented.cmake @@ -0,0 +1,9 @@ +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 check-all check-llvm check-clang test-suite CACHE STRING "") + +set(CLANG_BOOTSTRAP_CMAKE_ARGS + -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2.cmake + CACHE STRING "") diff --git a/cmake/caches/PGO-stage2.cmake b/cmake/caches/PGO-stage2.cmake new file mode 100644 index 0000000000..2080cd405f --- /dev/null +++ b/cmake/caches/PGO-stage2.cmake @@ -0,0 +1,2 @@ +set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "") +set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "") diff --git a/cmake/caches/PGO.cmake b/cmake/caches/PGO.cmake new file mode 100644 index 0000000000..dc11173fae --- /dev/null +++ b/cmake/caches/PGO.cmake @@ -0,0 +1,17 @@ +set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "") +set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "") +set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "") + +set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "") +set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "") +set(CLANG_BOOTSTRAP_TARGETS + generate-profdata + stage2 + stage2-check-all + stage2-check-llvm + stage2-check-clang + stage2-test-suite CACHE STRING "") + +set(CLANG_BOOTSTRAP_CMAKE_ARGS + -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2-instrumented.cmake + CACHE STRING "") -- cgit v1.2.3