[llvm] [Intrinsic] Unify IIT_STRUCT{2-9} into ITT_STRUCT to support upto 257 return value (PR #160434)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 26 08:53:21 PDT 2025


================
@@ -30,14 +30,12 @@ CodeGenIntrinsicContext::CodeGenIntrinsicContext(const RecordKeeper &RC) {
     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");
-  MaxNumReturn = IIT_RetNumbers->size() - 1;
+  // As the type of more than one return values is represented as an anonymous
+  // struct, which is encoded with `IIT_STRUCT` followed by a byte specifying
+  // the number of return values, starting from 2 (encoded as 0) to 257
+  // (encoded as 255). So, the maximum number of values that an intrinsic can
+  // return is 257.
+  MaxNumReturn = 257;
----------------
jurahul wrote:

nit: Make it a static constexpr and maybe move the definition in the .cpp file (i.e., outside the class and outside the header).

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


More information about the llvm-commits mailing list