[llvm] [TableGen] Refactor Intrinsics record (PR #106986)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 4 07:18:45 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:
That I don't understand. Isn't a particular emitter tightly coupled with the corresponding TableGen record structure? For example, code in `CodeGenIntrinsic.cpp` assumes that all Intrinsic records have fields TargetPrefix and LLVMName. In the same vein, this code assumes that it has a `TypeInfo` field.
https://github.com/llvm/llvm-project/pull/106986
More information about the llvm-commits
mailing list