[llvm] [DXIL] Model DXIL Class specification of DXIL Ops in DXIL.td (PR #87803)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Fri May 31 13:08:59 PDT 2024


================
@@ -170,11 +149,20 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) {
   // Set the index of the overload parameter, if any.
   OverloadParamIndex = -1; // default; indicating none
   if (!OverloadParamIndices.empty()) {
-    if (OverloadParamIndices.size() > 1)
-      report_fatal_error("Multiple overload type specification not supported",
-                         false);
+    assert(OverloadParamIndices.size() == 1 &&
+           "Multiple overload type specification not supported");
     OverloadParamIndex = OverloadParamIndices[0];
   }
+
+  // Get valid overload types of the Operation
+  std::vector<Record *> OverloadTypeRecs =
+      R->getValueAsListOfDefs("OpOverloadTypes");
+  unsigned OverloadTypeRecsSize = OverloadTypeRecs.size();
+  // Populate OpOverloads with
+  for (unsigned I = 0; I < OverloadTypeRecsSize; I++) {
+    OpOverloads.emplace_back(OverloadTypeRecs[I]);
+  }
----------------
bogner wrote:

Why copy the vector out of `R->getValueAsListOfDefs` at all? Isn't this just:
```c++
for (Record *R : R->getValueAsListOfDefs("OpOverloadTypes"))
  OpOverloads.push_back(R);
```

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


More information about the llvm-commits mailing list