This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Add BOLT_TARGETS_TO_BUILD
ClosedPublic

Authored by urnathan on Apr 20 2023, 3:10 PM.

Details

Summary

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

Diff Detail

Event Timeline

urnathan created this revision.Apr 20 2023, 3:10 PM
urnathan requested review of this revision.Apr 20 2023, 3:10 PM
This revision is now accepted and ready to land.Apr 20 2023, 7:45 PM
This revision was landed with ongoing or failed builds.Apr 21 2023, 10:07 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2023, 10:07 AM