[all-commits] [llvm/llvm-project] 667209: Config: Move LLVM_HAS_*_TARGET definitions to a ne...

Peter Collingbourne via All-commits all-commits at lists.llvm.org
Fri Apr 18 18:11:40 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 667209e45122d0cb7a4c2ac27018d31165b1be70
      https://github.com/llvm/llvm-project/commit/667209e45122d0cb7a4c2ac27018d31165b1be70
  Author: Peter Collingbourne <peter at pcc.me.uk>
  Date:   2025-04-18 (Fri, 18 Apr 2025)

  Changed paths:
    M llvm/CMakeLists.txt
    A llvm/include/llvm/Config/Targets.h.cmake
    M llvm/include/llvm/Config/llvm-config.h.cmake
    M llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
    M mlir/lib/Target/LLVM/NVVM/Target.cpp
    M mlir/unittests/Target/LLVM/SerializeNVVMTarget.cpp

  Log Message:
  -----------
  Config: Move LLVM_HAS_*_TARGET definitions to a new header.

When enabling or disabling a target we typically need to rebuild most
of LLVM because of the change to the values of the LLVM_HAS_*_TARGET
macros in llvm-config.h, which is included by most of the code, but
are unused by LLVM itself. To avoid this, move the LLVM_HAS_*_TARGET
macros to a separate header, Targets.h.

Update the only in-tree user of the macros (MLIR) to refer to the new
header. I expect that out-of-tree users will detect the change either
at compile time if they build with -Wundef, or at runtime. As far as
I can tell, the usage of these macros is rare in out-of-tree projects,
I found no out-of-tree users in projects indexed by Debian code search
[1], and one user [2] in projects indexed by GitHub code search [3]
(excluding forks of LLVM).

[1] https://codesearch.debian.net/search?q=%23.*LLVM_HAS_.*_TARGET&literal=0
[2] https://github.com/AndreyPavlenko/graph-compiler/blob/238706b12b63945dc490f9f5f33a2d20b3c58944/lib/gc/Target/LLVM/XeVM/Target.cpp#L72
[3] https://github.com/search?q=%2F%23.*LLVM_HAS_.*_TARGET%2F&type=code

Reviewers: nico, grypp, mstorsjo, MaskRay

Reviewed By: MaskRay

Pull Request: https://github.com/llvm/llvm-project/pull/136388



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list