[clang] [llvm] [HLSL][SPIR-V] Add Vulkan to target triple (PR #76749)
Nathan Gauër via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 3 05:16:55 PST 2024
================
@@ -4236,20 +4236,35 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
// TODO: Revisit restricting SPIR-V to logical once we've figured out how to
// handle PhysicalStorageBuffer64 memory model
if (T.isDXIL() || T.isSPIRVLogical()) {
- enum { ShaderModel, ShaderStage };
+ enum { ShaderModel, VulkanEnv, ShaderStage };
+ enum { OS, Environment };
+
+ int ExpectedOS = T.isSPIRVLogical() ? VulkanEnv : ShaderModel;
+
if (T.getOSName().empty()) {
Diags.Report(diag::err_drv_hlsl_bad_shader_required_in_target)
- << ShaderModel << T.str();
- } else if (!T.isShaderModelOS() || T.getOSVersion() == VersionTuple(0)) {
- Diags.Report(diag::err_drv_hlsl_bad_shader_unsupported)
- << ShaderModel << T.getOSName() << T.str();
+ << ExpectedOS << OS << T.str();
} else if (T.getEnvironmentName().empty()) {
Diags.Report(diag::err_drv_hlsl_bad_shader_required_in_target)
- << ShaderStage << T.str();
+ << ShaderStage << Environment << T.str();
} else if (!T.isShaderStageEnvironment()) {
Diags.Report(diag::err_drv_hlsl_bad_shader_unsupported)
<< ShaderStage << T.getEnvironmentName() << T.str();
}
+
+ if (T.isDXIL()) {
----------------
Keenuts wrote:
Shall this be an:
```cpp
if (T.isDXIL()) {
else if (T.isSPIRVLogical()) {
} else {
llvm_unreachable();
}
```
(In case the condition line 4239 gets changed but not this)
https://github.com/llvm/llvm-project/pull/76749
More information about the cfe-commits
mailing list