[llvm] [TableGen] Refactor Intrinsics record (PR #106986)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 07:03:17 PDT 2024


================
@@ -273,11 +273,12 @@ using TypeSigTy = SmallVector<unsigned char>;
 /// Computes type signature of the intrinsic \p Int.
 static TypeSigTy ComputeTypeSignature(const CodeGenIntrinsic &Int) {
   TypeSigTy TypeSig;
-  if (const auto *R = Int.TheDef->getValue("TypeSig")) {
-    for (const auto *a : cast<ListInit>(R->getValue())->getValues()) {
-      for (const auto *b : cast<ListInit>(a)->getValues())
-        TypeSig.emplace_back(cast<IntInit>(b)->getValue());
-    }
+  const Record *TypeInfo = Int.TheDef->getValueAsDef("TypeInfo");
+  const ListInit *OuterList = TypeInfo->getValueAsListInit("TypeSig");
----------------
jurahul wrote:

Yeah, the null check is not necessary anymore. It was needed to for unit test that had they own Intrinsic class definition, but now all of them have moved to use the Intrinsics.td file, so we can assume the Intrinsic class will have that field.

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


More information about the llvm-commits mailing list