aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/X86DisassemblerTables.cpp
diff options
context:
space:
mode:
authorCoelacanthus <coelacanthus@outlook.com>2021-05-06 18:36:52 +0800
committerCoelacanthus <coelacanthus@outlook.com>2021-05-07 13:34:03 +0800
commite6cf3d64412c1ddd2fcece337fe0a5f80e386a48 (patch)
tree8182277342e1236a58e95f20aa455033c0bb4415 /llvm/utils/TableGen/X86DisassemblerTables.cpp
parente388b9399b03a78219adb3488ec8b2e2a6abcf46 (diff)
downloadllvm-e6cf3d64412c1ddd2fcece337fe0a5f80e386a48.zip
llvm-e6cf3d64412c1ddd2fcece337fe0a5f80e386a48.tar.gz
llvm-e6cf3d64412c1ddd2fcece337fe0a5f80e386a48.tar.bz2
[TableGen] Use range-based for loops (NFC)
Use range-based for loops in TableGen. Reviewed By: Paul-C-Anagnostopoulos Differential Revision: https://reviews.llvm.org/D101994
Diffstat (limited to 'llvm/utils/TableGen/X86DisassemblerTables.cpp')
-rw-r--r--llvm/utils/TableGen/X86DisassemblerTables.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/llvm/utils/TableGen/X86DisassemblerTables.cpp b/llvm/utils/TableGen/X86DisassemblerTables.cpp
index 331664f..0505c08 100644
--- a/llvm/utils/TableGen/X86DisassemblerTables.cpp
+++ b/llvm/utils/TableGen/X86DisassemblerTables.cpp
@@ -698,8 +698,8 @@ void DisassemblerTables::emitModRMDecision(raw_ostream &o1, raw_ostream &o2,
ModRMDecision.push_back(decision.instructionIDs[index]);
break;
case MODRM_FULL:
- for (unsigned index = 0; index < 256; ++index)
- ModRMDecision.push_back(decision.instructionIDs[index]);
+ for (unsigned short InstructionID : decision.instructionIDs)
+ ModRMDecision.push_back(InstructionID);
break;
}
@@ -710,10 +710,9 @@ void DisassemblerTables::emitModRMDecision(raw_ostream &o1, raw_ostream &o2,
ModRMTableNum += ModRMDecision.size();
o1 << "/*Table" << EntryNumber << "*/\n";
i1++;
- for (std::vector<unsigned>::const_iterator I = ModRMDecision.begin(),
- E = ModRMDecision.end(); I != E; ++I) {
- o1.indent(i1 * 2) << format("0x%hx", *I) << ", /*"
- << InstructionSpecifiers[*I].name << "*/\n";
+ for (unsigned I : ModRMDecision) {
+ o1.indent(i1 * 2) << format("0x%hx", I) << ", /*"
+ << InstructionSpecifiers[I].name << "*/\n";
}
i1--;
}
@@ -823,12 +822,9 @@ void DisassemblerTables::emitInstructionInfo(raw_ostream &o,
for (unsigned Index = 0; Index < NumInstructions; ++Index) {
OperandListTy OperandList;
- for (unsigned OperandIndex = 0; OperandIndex < X86_MAX_OPERANDS;
- ++OperandIndex) {
- OperandEncoding Encoding = (OperandEncoding)InstructionSpecifiers[Index]
- .operands[OperandIndex].encoding;
- OperandType Type = (OperandType)InstructionSpecifiers[Index]
- .operands[OperandIndex].type;
+ for (auto Operand : InstructionSpecifiers[Index].operands) {
+ OperandEncoding Encoding = (OperandEncoding)Operand.encoding;
+ OperandType Type = (OperandType)Operand.type;
OperandList.push_back(std::make_pair(Encoding, Type));
}
unsigned &N = OperandSets[OperandList];
@@ -856,12 +852,9 @@ void DisassemblerTables::emitInstructionInfo(raw_ostream &o,
i++;
OperandListTy OperandList;
- for (unsigned OperandIndex = 0; OperandIndex < X86_MAX_OPERANDS;
- ++OperandIndex) {
- OperandEncoding Encoding = (OperandEncoding)InstructionSpecifiers[index]
- .operands[OperandIndex].encoding;
- OperandType Type = (OperandType)InstructionSpecifiers[index]
- .operands[OperandIndex].type;
+ for (auto Operand : InstructionSpecifiers[index].operands) {
+ OperandEncoding Encoding = (OperandEncoding)Operand.encoding;
+ OperandType Type = (OperandType)Operand.type;
OperandList.push_back(std::make_pair(Encoding, Type));
}
o.indent(i * 2) << (OperandSets[OperandList] - 1) << ",\n";