[llvm] [TableGen] Add check for number of intrinsic return values (PR #107326)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 08:21:40 PDT 2024


================
@@ -29,6 +29,15 @@ CodeGenIntrinsicContext::CodeGenIntrinsicContext(const RecordKeeper &RC) {
   for (const Record *Rec : RC.getAllDerivedDefinitions("IntrinsicProperty"))
     if (Rec->getValueAsBit("IsDefault"))
       DefaultProperties.push_back(Rec);
+
+  // The maximum number of values that an intrinsic can return is the size of
+  // of `IIT_RetNumbers` list - 1 (since we index into this list using the
+  // number of return values as the index).
+  const auto *IIT_RetNumbers =
+      dyn_cast_or_null<ListInit>(RC.getGlobal("IIT_RetNumbers"));
+  if (!IIT_RetNumbers)
+    PrintFatalError("Unable to find 'IIT_RetNumbers' list");
----------------
jurahul wrote:

Done. I changed the 2 errors that I am adding to use lowercase. 

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


More information about the llvm-commits mailing list