@@ -248,9 +248,7 @@ void InstrInfoEmitter::emitOperandNameMappings(
248
248
// / scan of the instructions below.
249
249
250
250
// Map of operand names to their ID.
251
- std::map<StringRef, unsigned > OperandNameToID;
252
- // Map from operand name enum value -> ID.
253
- std::vector<unsigned > OperandEnumToID;
251
+ MapVector<StringRef, unsigned > OperandNameToID;
254
252
255
253
// / The keys of this map is a map which have OpName ID values as their keys
256
254
// / and instruction operand indices as their values. The values of this map
@@ -278,16 +276,13 @@ void InstrInfoEmitter::emitOperandNameMappings(
278
276
}
279
277
280
278
const size_t NumOperandNames = OperandNameToID.size ();
281
- OperandEnumToID.reserve (NumOperandNames);
282
- for (const auto &Op : OperandNameToID)
283
- OperandEnumToID.push_back (Op.second );
284
279
285
280
OS << " #ifdef GET_INSTRINFO_OPERAND_ENUM\n " ;
286
281
OS << " #undef GET_INSTRINFO_OPERAND_ENUM\n " ;
287
282
OS << " namespace llvm::" << Namespace << " {\n " ;
288
283
OS << " enum class OpName {\n " ;
289
- for (const auto &[I, Op ] : enumerate( OperandNameToID) )
290
- OS << " " << Op. first << " = " << I << " ,\n " ;
284
+ for (const auto &[Op, I ] : OperandNameToID)
285
+ OS << " " << Op << " = " << I << " ,\n " ;
291
286
OS << " NUM_OPERAND_NAMES = " << NumOperandNames << " ,\n " ;
292
287
OS << " }; // enum class OpName\n\n " ;
293
288
OS << " LLVM_READONLY\n " ;
@@ -312,7 +307,7 @@ void InstrInfoEmitter::emitOperandNameMappings(
312
307
313
308
// Emit a row of the OperandMap table.
314
309
OS << " {" ;
315
- for (unsigned ID : OperandEnumToID ) {
310
+ for (unsigned ID = 0 ; ID < NumOperandNames; ++ID ) {
316
311
auto Iter = OpList.find (ID);
317
312
OS << (Iter != OpList.end () ? (int )Iter->second : -1 ) << " , " ;
318
313
}
0 commit comments