[llvm] [DXIL] Add DXIL version-specific TableGen specification and implementation of DXIL Ops (PR #97593)

S. Bharadwaj Yadavalli via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 13:45:36 PDT 2024


================
@@ -170,28 +171,64 @@ 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 overload records
+  std::vector<Record *> Recs = R->getValueAsListOfDefs("overloads");
+
+  // Sort records in ascending order of DXIL version
+  AscendingSortByVersion(Recs);
+
+  for (Record *CR : Recs) {
+    OverloadRecs.push_back(CR);
+  }
+
+  // Get stage records
+  Recs = R->getValueAsListOfDefs("stages");
+
+  if (Recs.empty()) {
+    report_fatal_error(Twine("Atleast one specification of valid stage for ") +
+                           OpName + " is required",
+                       /* gen_crash_diag=*/false);
----------------
bharadwajy wrote:

> "llvm/TableGen/Error.h" has `PrintFatalError`, which is better because it can print a source location. We should use that for all of the errors in DXILEmitter.

Changed usage of `report_fatal_error()` to `PrintFatalError()`

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


More information about the llvm-commits mailing list