Skip to content

Commit 376b714

Browse files
authored
[NFC][TableGen][DecoderEmitter] Use structured binding in range for loop (#144890)
Also assign variable names to different elements of `OpMap` for better readibility, and eliminate `NumberedEncodingsRef` as `std::vector` will automatically get converted to an `ArrayRef`.
1 parent c3929fb commit 376b714

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/utils/TableGen/DecoderEmitter.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2631,12 +2631,12 @@ namespace {
26312631

26322632
DecoderTableInfo TableInfo;
26332633
unsigned OpcodeMask = 0;
2634-
for (const auto &Opc : OpcMap) {
2634+
for (const auto &[NSAndByteSize, EncodingIDs] : OpcMap) {
2635+
const std::string &DecoderNamespace = NSAndByteSize.first;
2636+
const unsigned BitWidth = 8 * NSAndByteSize.second;
26352637
// Emit the decoder for this namespace+width combination.
2636-
ArrayRef<EncodingAndInst> NumberedEncodingsRef(NumberedEncodings.data(),
2637-
NumberedEncodings.size());
2638-
FilterChooser FC(NumberedEncodingsRef, Opc.second, Operands,
2639-
IsVarLenInst ? MaxInstLen : 8 * Opc.first.second, this);
2638+
FilterChooser FC(NumberedEncodings, EncodingIDs, Operands,
2639+
IsVarLenInst ? MaxInstLen : BitWidth, this);
26402640

26412641
// The decode table is cleared for each top level decoder function. The
26422642
// predicates and decoders themselves, however, are shared across all
@@ -2657,7 +2657,7 @@ namespace {
26572657

26582658
// Print the table to the output stream.
26592659
OpcodeMask |= emitTable(OS, TableInfo.Table, indent(0), FC.getBitWidth(),
2660-
Opc.first.first, Opc.second);
2660+
DecoderNamespace, EncodingIDs);
26612661
}
26622662

26632663
// For variable instruction, we emit a instruction length table

0 commit comments

Comments
 (0)