Enhance the InstrStage object to enable the specification of an Itinerary with overlapping stages. The default is to maintain the current behavior that the "next" stage immediately follows the previous one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78827 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/SubtargetEmitter.cpp b/utils/TableGen/SubtargetEmitter.cpp
index 919ac66..4a0bacd 100644
--- a/utils/TableGen/SubtargetEmitter.cpp
+++ b/utils/TableGen/SubtargetEmitter.cpp
@@ -215,7 +215,7 @@
     // Next stage
     const Record *Stage = StageList[i];
   
-    // Form string as ,{ cycles, u1 | u2 | ... | un }
+    // Form string as ,{ cycles, u1 | u2 | ... | un, timeinc }
     int Cycles = Stage->getValueAsInt("Cycles");
     ItinString += "  { " + itostr(Cycles) + ", ";
     
@@ -229,6 +229,9 @@
       if (++j < M) ItinString += " | ";
     }
     
+    int TimeInc = Stage->getValueAsInt("TimeInc");
+    ItinString += ", " + itostr(TimeInc);
+
     // Close off stage
     ItinString += " }";
     if (++i < N) ItinString += ", ";
@@ -252,7 +255,7 @@
 
   // Begin stages table
   OS << "static const llvm::InstrStage Stages[] = {\n"
-        "  { 0, 0 }, // No itinerary\n";
+        "  { 0, 0, 0 }, // No itinerary\n";
         
   unsigned StageCount = 1;
   unsigned ItinEnum = 1;
@@ -289,7 +292,7 @@
       
       // If new itinerary
       if (Find == 0) {
-        // Emit as { cycles, u1 | u2 | ... | un }, // index
+        // Emit as { cycles, u1 | u2 | ... | un, timeinc }, // index
         OS << ItinString << ", // " << ItinEnum << "\n";
         // Record Itin class number.
         ItinMap[ItinString] = Find = StageCount;
@@ -313,7 +316,7 @@
   }
   
   // Closing stage
-  OS << "  { 0, 0 } // End itinerary\n";
+  OS << "  { 0, 0, 0 } // End itinerary\n";
   // End stages table
   OS << "};\n";