@@ -145,8 +145,7 @@ struct EncodingIDAndOpcode {
145
145
};
146
146
147
147
using EncodingIDsVec = std::vector<EncodingIDAndOpcode>;
148
- using NamespacesHwModesMap =
149
- std::map<std::string, std::map<StringRef, unsigned >>;
148
+ using NamespacesHwModesMap = std::map<std::string, std::set<StringRef>>;
150
149
151
150
raw_ostream &operator <<(raw_ostream &OS, const EncodingAndInst &Value) {
152
151
if (Value.EncodingDef != Value.Inst ->TheDef )
@@ -2446,10 +2445,10 @@ static void collectHwModesReferencedForEncodings(
2446
2445
std::string DecoderNamespace =
2447
2446
std::string (P.second ->getValueAsString (" DecoderNamespace" ));
2448
2447
if (P.first == DefaultMode) {
2449
- NamespacesWithHwModes[DecoderNamespace][ " " ] = 1 ;
2448
+ NamespacesWithHwModes[DecoderNamespace]. insert ( " " ) ;
2450
2449
} else {
2451
- NamespacesWithHwModes[DecoderNamespace][HWM. getMode (P. first ). Name ] =
2452
- 1 ;
2450
+ NamespacesWithHwModes[DecoderNamespace]. insert (
2451
+ HWM. getMode (P. first ). Name ) ;
2453
2452
}
2454
2453
BV.set (P.first );
2455
2454
}
@@ -2478,16 +2477,14 @@ handleHwModesUnrelatedEncodings(const CodeGenInstruction *Instr,
2478
2477
case SUPPRESSION_LEVEL1: {
2479
2478
std::string DecoderNamespace =
2480
2479
std::string (InstDef->getValueAsString (" DecoderNamespace" ));
2481
- for (StringRef HwModeName : HwModeNames) {
2482
- if (NamespacesWithHwModes.count (DecoderNamespace) > 0 ) {
2483
- if (NamespacesWithHwModes[DecoderNamespace].count (HwModeName) > 0 )
2484
- GlobalEncodings.emplace_back (InstDef, Instr, HwModeName);
2485
- } else {
2486
- // Only emit the encoding once, as it's DecoderNamespace doesn't
2487
- // contain any HwModes.
2488
- GlobalEncodings.emplace_back (InstDef, Instr, " " );
2489
- break ;
2490
- }
2480
+ auto It = NamespacesWithHwModes.find (DecoderNamespace);
2481
+ if (It != NamespacesWithHwModes.end ()) {
2482
+ for (StringRef HwModeName : It->second )
2483
+ GlobalEncodings.emplace_back (InstDef, Instr, HwModeName);
2484
+ } else {
2485
+ // Only emit the encoding once, as it's DecoderNamespace doesn't
2486
+ // contain any HwModes.
2487
+ GlobalEncodings.emplace_back (InstDef, Instr, " " );
2491
2488
}
2492
2489
break ;
2493
2490
}
0 commit comments