[llvm] [DXIL] Add constraint specification and backend implementation of DXIL Ops (PR #97593)

S. Bharadwaj Yadavalli via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 14:03:23 PDT 2024


================
@@ -30,13 +31,21 @@ class DXILOpBuilder {
 public:
   DXILOpBuilder(Module &M, IRBuilderBase &B) : M(M), B(B) {}
   /// Create an instruction that calls DXIL Op with return type, specified
-  /// opcode, and call arguments. \param OpCode Opcode of the DXIL Op call
-  /// constructed \param ReturnTy Return type of the DXIL Op call constructed
+  /// opcode, and call arguments.
+  ///
+  /// \param OpCode Opcode of the DXIL Op call constructed
+  /// \param SMVer Shader Model Version of DXIL Module being constructed.
+  /// \param StageKind Shader Stage for DXIL Module being constructed.
+  /// \param ReturnTy Return type of the DXIL Op call constructed
   /// \param OverloadTy Overload type of the DXIL Op call constructed
+  /// \param Args Arguments for the DXIL Op call constructed
   /// \return DXIL Op call constructed
-  CallInst *createDXILOpCall(dxil::OpCode OpCode, Type *ReturnTy,
+  CallInst *createDXILOpCall(dxil::OpCode OpCode, VersionTuple SMVer,
+                             StringRef StageKind, Type *ReturnTy,
----------------
bharadwajy wrote:

> I saw the string is from Triple(TTStr).getEnvironmentName().str(); Could we use getEnvironment() instead of getEnvironmentName(), then we can convert the Triple::EnvironmentType to the enum we want.

I see what you mean. Actually, I think Shader Model version and Shader Kind (Environment enum) do not need to be passed to `DXILOpBuilder::createDXILOpCall(...)` since the function has access to the private `Module` instance. That was part of an NFC PR I was planning after this one - in which I want to move `lowerIntrinsic(...)` and a couple of other functions in `DXILOpLowering.cpp` as member functions of `class DXILOpBuilder`. I refrained from including those changes with an expectation to reduce the size/scope of this. I can extract just the change that avoids passing the values of SM version and stage kind.
 

https://github.com/llvm/llvm-project/pull/97593


More information about the llvm-commits mailing list