[clang] Add spirv-val compilation step when targeting SPIR-V (PR #188150)
Joshua Batista via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 26 15:04:05 PDT 2026
================
@@ -4779,6 +4739,18 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
}
}
+ if (C.getDefaultToolChain().getTriple().isSPIRV()) {
+ const auto &TC =
+ static_cast<const toolchains::HLSLToolChain &>(C.getDefaultToolChain());
+
+ // Call spirv-val for SPIR-V when -Vd not in Args.
+ if (TC.requiresValidation(Args)) {
+ Action *LastAction = Actions.back();
+ Actions.push_back(
+ C.MakeAction<BinaryAnalyzeJobAction>(LastAction, types::TY_Object));
----------------
bob80905 wrote:
It doesn't look like D:\llvm-project\clang\include\clang\Driver\Types.def has anything more specific than object. It seems like the closest match since SPIRV output is effectively a binary blob. Though there is a case to be made that we could add a new type. Not sure. @bogner ?
For context, Xiang did add a new type DX_CONTAINER for dxv back in early 2023: https://reviews.llvm.org/D141705.
So perhaps the right move is to make a new type.
https://github.com/llvm/llvm-project/pull/188150
More information about the cfe-commits
mailing list