summaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/CodeEmitterGen.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@sifive.com>2021-02-11 21:02:50 -0800
committerCraig Topper <craig.topper@sifive.com>2021-02-11 21:16:10 -0800
commit56277e3e10d204e26e7884c4d978b82fd1620f02 (patch)
treeb29b748d718d29181a5dcf3ab4fffb20152edae7 /llvm/utils/TableGen/CodeEmitterGen.cpp
parent9b123cde6340449669b88afc540d560080b4113b (diff)
[TableGen] Make the map in InfoByHwMode protected. NFCI
Switch some for loops to just use the begin()/end() implementations in the InfoByHwMode struct. Add a method to insert into the map for the one case that was modifying the map directly.
Diffstat (limited to 'llvm/utils/TableGen/CodeEmitterGen.cpp')
-rw-r--r--llvm/utils/TableGen/CodeEmitterGen.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/CodeEmitterGen.cpp b/llvm/utils/TableGen/CodeEmitterGen.cpp
index 3b77f09d9b79..24cb485c032f 100644
--- a/llvm/utils/TableGen/CodeEmitterGen.cpp
+++ b/llvm/utils/TableGen/CodeEmitterGen.cpp
@@ -272,7 +272,7 @@ std::string CodeEmitterGen::getInstructionCase(Record *R,
EncodingInfoByHwMode EBM(DI->getDef(), HWM);
Case += " switch (HwMode) {\n";
Case += " default: llvm_unreachable(\"Unhandled HwMode\");\n";
- for (auto &KV : EBM.Map) {
+ for (auto &KV : EBM) {
Case += " case " + itostr(KV.first) + ": {\n";
Case += getInstructionCaseForEncoding(R, KV.second, Target);
Case += " break;\n";
@@ -409,7 +409,7 @@ void CodeEmitterGen::run(raw_ostream &o) {
if (const RecordVal *RV = R->getValue("EncodingInfos")) {
if (DefInit *DI = dyn_cast_or_null<DefInit>(RV->getValue())) {
EncodingInfoByHwMode EBM(DI->getDef(), HWM);
- for (auto &KV : EBM.Map) {
+ for (auto &KV : EBM) {
BitsInit *BI = KV.second->getValueAsBitsInit("Inst");
BitWidth = std::max(BitWidth, BI->getNumBits());
HwModes.insert(KV.first);