Currently BOLT enables X86 and/or AArch64, if those are targets in LLVM_TARGETS_TO_BUILD. It can support both of them concurrently because they happen to also be ELF64LE exec formats, and the way RewriteInstance is structured makes it hard to support multiple ELF formats. As more targets are added to BOLT, it will become more likely that a multi-target build would have multiple ELF formats. To allow greater control, this adds BOLT_TARGETS_TO_BUILD, which defaults to the intersection of X86;AArch64 and LLVM_TARGETS_TO_BUILD, but allows configuration to alter that -- for instance omitting one of those two targets even if llvm supports both.
If you enable bolt you have to end up with at least one BOLT_TARGETS_TO_BUILD -- unlike right now, when I think you can end up with a no-target BOLT.
It also allows some rather nice refactoring of the CMake files, by iterating over BOLT_TARGETS_TO_BUILD rather than individually check specific arches in LLVM_TARGETS_TO_BUILD.
i've tested this in a few different configs, most notably LLVM_TARGETS_TO_BUILD='X86;AArch64;PowerPC' BOLT_TARGETS_TO_BUILD=X86, where we end up with an X86 only BOLT