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 <generator> -C <path_to_clang>/cmake/caches/PGO-stage1.cmake <source dir>
After configuration the following additional targets will be generated:
stage2:
Builds a stage1 x86 compiler, runtime, and required tools (llvm-config, llvm-profdata) then uses that compiler to build an instrumented stage2 compiler.
stage2-generate-profdata:
Depends on "stage2" and will use the stage2 compiler to generate profdata based on the training files in <clang>/utils/perf-training
stage3:
Depends on "stage2-generate-profdata" and will use the stage1 compiler with the stage2 profdata to build a PGO-optimized compiler.
stage3-check-llvm:
Depends on stage3 and runs check-llvm using the stage3 compiler.
stage3-check-clang:
Depends on stage3 and runs check-clang using the stage3 compiler.
stage3-check-all:
Depends on stage3 and runs check-all using the stage3 compiler.
stage3-test-suite:
Depends on stage3 and runs the test-suite using the stage3 compiler (requires in-tree test-suite).