@@ -248,9 +248,7 @@ void InstrInfoEmitter::emitOperandNameMappings(
248248 // / scan of the instructions below.
249249
250250 // 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;
254252
255253 // / The keys of this map is a map which have OpName ID values as their keys
256254 // / and instruction operand indices as their values. The values of this map
@@ -278,16 +276,13 @@ void InstrInfoEmitter::emitOperandNameMappings(
278276 }
279277
280278 const size_t NumOperandNames = OperandNameToID.size ();
281- OperandEnumToID.reserve (NumOperandNames);
282- for (const auto &Op : OperandNameToID)
283- OperandEnumToID.push_back (Op.second );
284279
285280 OS << " #ifdef GET_INSTRINFO_OPERAND_ENUM\n " ;
286281 OS << " #undef GET_INSTRINFO_OPERAND_ENUM\n " ;
287282 OS << " namespace llvm::" << Namespace << " {\n " ;
288283 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 " ;
291286 OS << " NUM_OPERAND_NAMES = " << NumOperandNames << " ,\n " ;
292287 OS << " }; // enum class OpName\n\n " ;
293288 OS << " LLVM_READONLY\n " ;
@@ -312,7 +307,7 @@ void InstrInfoEmitter::emitOperandNameMappings(
312307
313308 // Emit a row of the OperandMap table.
314309 OS << " {" ;
315- for (unsigned ID : OperandEnumToID ) {
310+ for (unsigned ID = 0 ; ID < NumOperandNames; ++ID ) {
316311 auto Iter = OpList.find (ID);
317312 OS << (Iter != OpList.end () ? (int )Iter->second : -1 ) << " , " ;
318313 }
0 commit comments