[clang] [llvm] [DirectX] Promote to an official target (PR #214066)
Farzon Lotfi via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 20 21:32:42 PDT 2026
https://github.com/farzonl updated https://github.com/llvm/llvm-project/pull/214066
>From 24182799237f72854e50427583d1e4a9e814a556 Mon Sep 17 00:00:00 2001
From: Farzon Lotfi <farzonlotfi at microsoft.com>
Date: Mon, 3 Aug 2026 14:25:36 -0400
Subject: [PATCH 1/2] [DirectX] Promote to an official target
This change moves the DirectX backend out of experimental
and adds the clang-dxc frontend so the community has a path
to trying out the new backend.
---
clang/CMakeLists.txt | 4 +---
clang/cmake/caches/HLSL.cmake | 6 ++----
clang/docs/ReleaseNotes.md | 6 ++++++
llvm/CMakeLists.txt | 2 +-
llvm/docs/DirectXUsage.md | 15 ++++-----------
llvm/docs/ReleaseNotes.md | 7 +++++++
6 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 89f584c5dceaa..27acc862f309c 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -527,9 +527,7 @@ option(CLANG_INCLUDE_TESTS
"Generate build targets for the Clang unit tests."
${LLVM_INCLUDE_TESTS})
-option(CLANG_ENABLE_HLSL "Include HLSL build products" Off)
-# While HLSL support is experimental this should stay hidden.
-mark_as_advanced(CLANG_ENABLE_HLSL)
+option(CLANG_ENABLE_HLSL "Include HLSL build products" On)
add_subdirectory(utils/TableGen)
diff --git a/clang/cmake/caches/HLSL.cmake b/clang/cmake/caches/HLSL.cmake
index 40e92fd37382b..1fa9a4bcc56a5 100644
--- a/clang/cmake/caches/HLSL.cmake
+++ b/clang/cmake/caches/HLSL.cmake
@@ -1,9 +1,7 @@
# Including the native target is important because some of LLVM's tests fail if
# you don't.
-set(LLVM_TARGETS_TO_BUILD "Native;SPIRV" CACHE STRING "")
-
-# Include the DirectX target for DXIL code generation.
-set(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD "DirectX" CACHE STRING "")
+# The DirectX target is included for DXIL code generation.
+set(LLVM_TARGETS_TO_BUILD "Native;SPIRV;DirectX" CACHE STRING "")
set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra" CACHE STRING "")
diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index 8c9467ca7b742..64ffd29ee6e24 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -565,6 +565,12 @@ features cannot lower the translation-unit ABI level;
- `__builtin_amdgcn_fcmp`
- `__builtin_amdgcn_fcmpf`
+#### DirectX Support
+
+- `clang-dxc` and HLSL support (`CLANG_ENABLE_HLSL`) are now enabled by
+ default, following the promotion of the DirectX backend to an official
+ LLVM target.
+
#### NVPTX Support
#### X86 Support
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index b0a40dbdfd423..d4c86946a6327 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -575,6 +575,7 @@ set(LLVM_ALL_TARGETS
ARM
AVR
BPF
+ DirectX
Hexagon
Lanai
LoongArch
@@ -595,7 +596,6 @@ set(LLVM_ALL_TARGETS
set(LLVM_ALL_EXPERIMENTAL_TARGETS
ARC
CSKY
- DirectX
M68k
Xtensa
)
diff --git a/llvm/docs/DirectXUsage.md b/llvm/docs/DirectXUsage.md
index ea9670d429e31..1141d6ef5b598 100644
--- a/llvm/docs/DirectXUsage.md
+++ b/llvm/docs/DirectXUsage.md
@@ -1,11 +1,5 @@
# User Guide for the DirectX Target
-:::{warning}
-Disclaimer: The DirectX backend is experimental and under active development.
-It is not yet feature complete or ready to be used outside of experimental or
-demonstration contexts.
-:::
-
```{toctree}
:hidden:
@@ -25,11 +19,10 @@ interfaces are documented in the [DirectX Specifications.](https://github.com/Mi
Initially the backend is aimed at supporting DirectX 12, and support for DirectX
11 is planned at a later date.
-The DirectX backend is currently experimental and is not shipped with any
-release builds of LLVM tools. To build the DirectX backend locally, add
-`DirectX` to the `LLVM_EXPERIMENTAL_TARGETS_TO_BUILD` CMake option. For more
-information on building LLVM see the {doc}`CMake` documentation.
-
+The DirectX backend is an official LLVM target and is built by default as part
+ of `LLVM_ALL_TARGETS`. For more information on building LLVM see the
+ {doc}`CMake` documentation.
+
(dx-target-triples)=
## Target Triples
diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index 9e4811067aa4d..dc3bfdbbb8bf9 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -64,6 +64,10 @@ Makes programs 10x faster by doing Special New Thing.
### Changes to building LLVM
+* The DirectX backend is now an official target and has moved from
+ `LLVM_ALL_EXPERIMENTAL_TARGETS` to `LLVM_ALL_TARGETS`. It is now built by
+ default and no longer requires `LLVM_EXPERIMENTAL_TARGETS_TO_BUILD`.
+
### Changes to TableGen
* `!cond` operator short-circuits at the first `true` condition. Subsequent
@@ -103,6 +107,9 @@ Makes programs 10x faster by doing Special New Thing.
### Changes to the DirectX Backend
+* The DirectX backend has been promoted from experimental to an official,
+ fully supported LLVM target.
+
### Changes to the Hexagon Backend
### Changes to the LoongArch Backend
>From 4bf70efe392011981b2ea6906a1b3f52d0f672fb Mon Sep 17 00:00:00 2001
From: Farzon Lotfi <hi at farzon.org>
Date: Fri, 21 Aug 2026 00:31:48 -0400
Subject: [PATCH 2/2] remove CLANG_ENABLE_HLSL since it should always be
enabled from now on
---
clang/CMakeLists.txt | 2 --
clang/cmake/caches/HLSL.cmake | 2 --
clang/docs/ReleaseNotes.md | 5 ++---
clang/lib/Headers/CMakeLists.txt | 7 -------
clang/tools/driver/CMakeLists.txt | 4 +---
5 files changed, 3 insertions(+), 17 deletions(-)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 27acc862f309c..4e27a6d7259cb 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -527,8 +527,6 @@ option(CLANG_INCLUDE_TESTS
"Generate build targets for the Clang unit tests."
${LLVM_INCLUDE_TESTS})
-option(CLANG_ENABLE_HLSL "Include HLSL build products" On)
-
add_subdirectory(utils/TableGen)
# Export CLANG_TABLEGEN_EXE for use by flang docs.
diff --git a/clang/cmake/caches/HLSL.cmake b/clang/cmake/caches/HLSL.cmake
index 1fa9a4bcc56a5..cf15125a8cad7 100644
--- a/clang/cmake/caches/HLSL.cmake
+++ b/clang/cmake/caches/HLSL.cmake
@@ -5,8 +5,6 @@ set(LLVM_TARGETS_TO_BUILD "Native;SPIRV;DirectX" CACHE STRING "")
set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra" CACHE STRING "")
-set(CLANG_ENABLE_HLSL On CACHE BOOL "")
-
if (HLSL_ENABLE_DISTRIBUTION)
set(LLVM_DISTRIBUTION_COMPONENTS
"clang;hlsl-resource-headers;clangd"
diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index 64ffd29ee6e24..1fe41205cad06 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -567,9 +567,8 @@ features cannot lower the translation-unit ABI level;
#### DirectX Support
-- `clang-dxc` and HLSL support (`CLANG_ENABLE_HLSL`) are now enabled by
- default, following the promotion of the DirectX backend to an official
- LLVM target.
+- `clang-dxc` and HLSL support are now enabled by default, following the
+ promotion of the DirectX backend to an official LLVM target.
#### NVPTX Support
diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt
index 21b6eb5e38052..3d845423759ac 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -824,26 +824,19 @@ install(
EXCLUDE_FROM_ALL
COMPONENT gpu-resource-headers)
-if(NOT CLANG_ENABLE_HLSL)
- set(EXCLUDE_HLSL EXCLUDE_FROM_ALL)
-endif()
-
install(
FILES ${hlsl_h}
DESTINATION ${header_install_dir}
- ${EXCLUDE_HLSL}
COMPONENT hlsl-resource-headers)
install(
FILES ${hlsl_subdir_files}
DESTINATION ${header_install_dir}/hlsl
- ${EXCLUDE_HLSL}
COMPONENT hlsl-resource-headers)
install(
FILES ${hlsl_generated_files}
DESTINATION ${header_install_dir}/hlsl
- ${EXCLUDE_HLSL}
COMPONENT hlsl-resource-headers)
install(
diff --git a/clang/tools/driver/CMakeLists.txt b/clang/tools/driver/CMakeLists.txt
index 002aaef005253..17dbb3ce8a27b 100644
--- a/clang/tools/driver/CMakeLists.txt
+++ b/clang/tools/driver/CMakeLists.txt
@@ -84,9 +84,7 @@ if(NOT CLANG_LINKS_TO_CREATE)
set(CLANG_LINKS_TO_CREATE clang++ clang-cl clang-cpp)
endif()
-if (CLANG_ENABLE_HLSL)
- set(HLSL_LINK clang-dxc)
-endif()
+set(HLSL_LINK clang-dxc)
foreach(link ${CLANG_LINKS_TO_CREATE} ${HLSL_LINK})
add_clang_symlink(${link} clang)
More information about the cfe-commits
mailing list