================
@@ -384,12 +408,20 @@ HLSLToolChain::HLSLToolChain(const Driver &D, const 
llvm::Triple &Triple,
   if (Args.hasArg(options::OPT_dxc_validator_path_EQ))
     getProgramPaths().push_back(
         Args.getLastArgValue(options::OPT_dxc_validator_path_EQ).str());
+  if (Args.hasArg(options::OPT_spirv_validator_path_EQ))
+    getProgramPaths().push_back(
+        Args.getLastArgValue(options::OPT_spirv_validator_path_EQ).str());
 }
 
 Tool *clang::driver::toolchains::HLSLToolChain::getTool(
     Action::ActionClass AC) const {
   switch (AC) {
   case Action::BinaryAnalyzeJobClass:
+    if (getTriple().isSPIRV()) {
+      if (!SPIRVValidator)
+        SPIRVValidator.reset(new tools::hlsl::SPIRV_Validator(*this));
+      return SPIRVValidator.get();
+    }
     if (!Validator)
       Validator.reset(new tools::hlsl::Validator(*this));
     return Validator.get();
----------------
bogner wrote:

We can only ever have one validator, and the spirv validator logic needs to 
look a tthe triple anyway. I wonder if it would make more sense to just have 
one `hlsl::Validator` type, and have it invoke spirv-val or dxv as appropriate 
depending on the target.

https://github.com/llvm/llvm-project/pull/188150
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to