Fix generation of multi-stage instruction itineraries. Patch by
authorChris Lattner <sabre@nondot.org>
Sun, 6 Apr 2008 17:38:14 +0000 (17:38 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 6 Apr 2008 17:38:14 +0000 (17:38 +0000)
giuma.cordes@gmail.com

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49276 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/SubtargetEmitter.cpp

index a0dc96787d1a0f018b19163c300d30ae51ef75d5..1f833efcaac897d44968bef1ae033a4e750c2072 100644 (file)
@@ -272,6 +272,7 @@ void SubtargetEmitter::EmitStageData(std::ostream &OS,
   OS << "static const llvm::InstrStage Stages[] = {\n"
         "  { 0, 0 }, // No itinerary\n";
         
+  unsigned StageCount = 1;
   unsigned ItinEnum = 1;
   std::map<std::string, unsigned> ItinMap;
   for (unsigned i = 0, N = ProcItinList.size(); i < N; i++) {
@@ -308,8 +309,10 @@ void SubtargetEmitter::EmitStageData(std::ostream &OS,
       if (Find == 0) {
         // Emit as { cycles, u1 | u2 | ... | un }, // index
         OS << ItinString << ", // " << ItinEnum << "\n";
-        // Record Itin class number
-        ItinMap[ItinString] = Find = ItinEnum++;
+        // Record Itin class number.
+        ItinMap[ItinString] = Find = StageCount;
+        StageCount += NStages;
+        ItinEnum++;
       }
       
       // Set up itinerary as location and location + stage count