[llvm] r260499 - [TableGen] Simplify code slightly. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 10 23:39:23 PST 2016


Author: ctopper
Date: Thu Feb 11 01:39:22 2016
New Revision: 260499

URL: http://llvm.org/viewvc/llvm-project?rev=260499&view=rev
Log:
[TableGen] Simplify code slightly. NFC

Modified:
    llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp

Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=260499&r1=260498&r2=260499&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Thu Feb 11 01:39:22 2016
@@ -577,22 +577,19 @@ void InstrInfoEmitter::emitEnums(raw_ost
   if (Namespace.empty())
     PrintFatalError("No instructions defined!");
 
-  ArrayRef<const CodeGenInstruction*> NumberedInstructions =
-    Target.getInstructionsByEnumValue();
-
   OS << "namespace " << Namespace << " {\n";
   OS << "  enum {\n";
   unsigned Num = 0;
-  for (const CodeGenInstruction *Inst : NumberedInstructions)
+  for (const CodeGenInstruction *Inst : Target.getInstructionsByEnumValue())
     OS << "    " << Inst->TheDef->getName() << "\t= " << Num++ << ",\n";
-  OS << "    INSTRUCTION_LIST_END = " << NumberedInstructions.size() << "\n";
+  OS << "    INSTRUCTION_LIST_END = " << Num << "\n";
   OS << "  };\n\n";
   OS << "namespace Sched {\n";
   OS << "  enum {\n";
   Num = 0;
   for (const auto &Class : SchedModels.explicit_classes())
     OS << "    " << Class.Name << "\t= " << Num++ << ",\n";
-  OS << "    SCHED_LIST_END = " << SchedModels.numInstrSchedClasses() << "\n";
+  OS << "    SCHED_LIST_END = " << Num << "\n";
   OS << "  };\n";
   OS << "} // end Sched namespace\n";
   OS << "} // end " << Namespace << " namespace\n";




More information about the llvm-commits mailing list