aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/DecoderEmitter.cpp
diff options
context:
space:
mode:
authorRahul Joshi <rjoshi@nvidia.com>2025-06-20 06:41:48 -0700
committerGitHub <noreply@github.com>2025-06-20 06:41:48 -0700
commit376b71442d03bcc8ec6e2244002e3d62916dcea4 (patch)
treeb856ae9f27c13274c17b35dc0e9c4457b5aad66f /llvm/utils/TableGen/DecoderEmitter.cpp
parentc3929fbf0ef2d0fac05c54237bd9eac4fd57b1d8 (diff)
downloadllvm-376b71442d03bcc8ec6e2244002e3d62916dcea4.zip
llvm-376b71442d03bcc8ec6e2244002e3d62916dcea4.tar.gz
llvm-376b71442d03bcc8ec6e2244002e3d62916dcea4.tar.bz2
[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`.
Diffstat (limited to 'llvm/utils/TableGen/DecoderEmitter.cpp')
-rw-r--r--llvm/utils/TableGen/DecoderEmitter.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index 3781411..2e8ff2a 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -2631,12 +2631,12 @@ namespace {
DecoderTableInfo TableInfo;
unsigned OpcodeMask = 0;
- for (const auto &Opc : OpcMap) {
+ for (const auto &[NSAndByteSize, EncodingIDs] : OpcMap) {
+ const std::string &DecoderNamespace = NSAndByteSize.first;
+ const unsigned BitWidth = 8 * NSAndByteSize.second;
// Emit the decoder for this namespace+width combination.
- ArrayRef<EncodingAndInst> NumberedEncodingsRef(NumberedEncodings.data(),
- NumberedEncodings.size());
- FilterChooser FC(NumberedEncodingsRef, Opc.second, Operands,
- IsVarLenInst ? MaxInstLen : 8 * Opc.first.second, this);
+ FilterChooser FC(NumberedEncodings, EncodingIDs, Operands,
+ IsVarLenInst ? MaxInstLen : BitWidth, this);
// The decode table is cleared for each top level decoder function. The
// predicates and decoders themselves, however, are shared across all
@@ -2657,7 +2657,7 @@ namespace {
// Print the table to the output stream.
OpcodeMask |= emitTable(OS, TableInfo.Table, indent(0), FC.getBitWidth(),
- Opc.first.first, Opc.second);
+ DecoderNamespace, EncodingIDs);
}
// For variable instruction, we emit a instruction length table