[HLSL][clang][Driver] Support validator version command line option.
authorpython3kgae <python3kgae@outlook.com>
Fri, 15 Apr 2022 23:22:54 +0000 (16:22 -0700)
committerpython3kgae <python3kgae@outlook.com>
Fri, 29 Apr 2022 23:48:08 +0000 (16:48 -0700)
commit73417c517644db5c419c85c0b3cb6750172fcab5
treef9722eb93aac9bab6419b82f0ec42ed61758d5bb
parent6918a15f431541136f85e2dd8d41c23d78d1124b
[HLSL][clang][Driver] Support validator version command line option.

The DXIL validator version option(/validator-version) decide the validator version when compile hlsl.
The format is major.minor like 1.0.

In normal case, the value of validator version should be got from DXIL validator. Before we got DXIL validator ready for llvm/main, DXIL validator version option is added first to set validator version.

It will affect code generation for DXIL, so it is treated as a code gen option.

A new member std::string DxilValidatorVersion is added to clang::CodeGenOptions.

Then CGHLSLRuntime is added to clang::CodeGenModule.
It is used to translate clang::CodeGenOptions::DxilValidatorVersion into a ModuleFlag under key "dx.valver" at end of clang code generation.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D123884
13 files changed:
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Basic/TargetOptions.h
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CGHLSLRuntime.cpp [new file with mode: 0644]
clang/lib/CodeGen/CGHLSLRuntime.h [new file with mode: 0644]
clang/lib/CodeGen/CMakeLists.txt
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/HLSL.cpp
clang/lib/Driver/ToolChains/HLSL.h
clang/test/CodeGenHLSL/validator_version.hlsl [new file with mode: 0644]
clang/unittests/Driver/ToolChainTest.cpp