[llvm] dc7a624 - [tblgen] Compress CompositeSequences to 1/8th of its size. NFCI.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 24 10:39:07 PST 2022
Author: Benjamin Kramer
Date: 2022-02-24T19:31:33+01:00
New Revision: dc7a624e3839b44fbf78149a044460919bdbfaed
URL: https://github.com/llvm/llvm-project/commit/dc7a624e3839b44fbf78149a044460919bdbfaed
DIFF: https://github.com/llvm/llvm-project/commit/dc7a624e3839b44fbf78149a044460919bdbfaed.diff
LOG: [tblgen] Compress CompositeSequences to 1/8th of its size. NFCI.
Added:
Modified:
llvm/utils/TableGen/RegisterInfoEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/RegisterInfoEmitter.cpp b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
index eb4b7b20a5c4d..8a9ce15c3508b 100644
--- a/llvm/utils/TableGen/RegisterInfoEmitter.cpp
+++ b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
@@ -814,12 +814,14 @@ RegisterInfoEmitter::emitComposeSubRegIndexLaneMask(raw_ostream &OS,
OS << " // Sequence " << Idx << "\n";
Idx += Sequence.size() + 1;
}
+ auto *IntType = getMinimalTypeForRange(*std::max_element(
+ SubReg2SequenceIndexMap.begin(), SubReg2SequenceIndexMap.end()));
OS << " };\n"
- " static const MaskRolOp *const CompositeSequences[] = {\n";
+ " static const "
+ << IntType << " CompositeSequences[] = {\n";
for (size_t i = 0, e = SubRegIndices.size(); i != e; ++i) {
OS << " ";
- unsigned Idx = SubReg2SequenceIndexMap[i];
- OS << format("&LaneMaskComposeSequences[%u]", Idx);
+ OS << SubReg2SequenceIndexMap[i];
if (i+1 != e)
OS << ",";
OS << " // to " << SubRegIndices[i].getName() << "\n";
@@ -832,7 +834,9 @@ RegisterInfoEmitter::emitComposeSubRegIndexLaneMask(raw_ostream &OS,
" --IdxA; assert(IdxA < " << SubRegIndices.size()
<< " && \"Subregister index out of bounds\");\n"
" LaneBitmask Result;\n"
- " for (const MaskRolOp *Ops = CompositeSequences[IdxA]; Ops->Mask.any(); ++Ops) {\n"
+ " for (const MaskRolOp *Ops =\n"
+ " &LaneMaskComposeSequences[CompositeSequences[IdxA]];\n"
+ " Ops->Mask.any(); ++Ops) {\n"
" LaneBitmask::Type M = LaneMask.getAsInteger() & Ops->Mask.getAsInteger();\n"
" if (unsigned S = Ops->RotateLeft)\n"
" Result |= LaneBitmask((M << S) | (M >> (LaneBitmask::BitWidth - S)));\n"
@@ -849,7 +853,9 @@ RegisterInfoEmitter::emitComposeSubRegIndexLaneMask(raw_ostream &OS,
" --IdxA; assert(IdxA < " << SubRegIndices.size()
<< " && \"Subregister index out of bounds\");\n"
" LaneBitmask Result;\n"
- " for (const MaskRolOp *Ops = CompositeSequences[IdxA]; Ops->Mask.any(); ++Ops) {\n"
+ " for (const MaskRolOp *Ops =\n"
+ " &LaneMaskComposeSequences[CompositeSequences[IdxA]];\n"
+ " Ops->Mask.any(); ++Ops) {\n"
" LaneBitmask::Type M = LaneMask.getAsInteger();\n"
" if (unsigned S = Ops->RotateLeft)\n"
" Result |= LaneBitmask((M >> S) | (M << (LaneBitmask::BitWidth - S)));\n"
More information about the llvm-commits
mailing list