[llvm] [TableGen] Refactor Intrinsics record (PR #106986)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 4 07:21:56 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");
----------------
arsenm wrote:
Yes, but tablegen shouldn't be crashy garbage on arbitrary inputs. If it's not literally baked into the code, and is input data like the predefined .td files, it needs to be verified
https://github.com/llvm/llvm-project/pull/106986
More information about the llvm-commits
mailing list