[llvm] [DirectX][DXIL] Distinguish return type for overload type resolution. (PR #85646)

S. Bharadwaj Yadavalli via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 07:58:59 PDT 2024


================
@@ -398,10 +398,20 @@ static void emitDXILOperationTable(std::vector<DXILOperationDesc> &Ops,
 
   OS << "  static const OpCodeProperty OpCodeProps[] = {\n";
   for (auto &Op : Ops) {
+    // Consider Op.OverloadParamIndex as the overload parameter index, by
+    // default
+    auto OLParamIdx = Op.OverloadParamIndex;
+    // If no overload parameter index is set, treat first parameter type as
+    // overload type - unless the Op has no parameters, in which case treat the
+    // return type - as overload parameter to emit the appropriate overload kind
+    // enum.
+    if (OLParamIdx < 0) {
+      OLParamIdx = (Op.OpTypes.size() > 1) ? 1 : 0;
+    }
----------------
bharadwajy wrote:

> Thanks @python3kgae! So supporting the index being arbitrary is necessary.

Looks like my [comment](https://github.com/llvm/llvm-project/pull/85646#discussion_r1530514216) and this one crossed :-)

As noted there (at the end) that support was added in an earlier merged PR and exists.
  
Any changes / improvements necessitated to support DXIL Ops addition will be done along with the DXIL Op specification, DXILEmitter, DXIL Lowering pass and corresponding tests.

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


More information about the llvm-commits mailing list