1. Remove ranges from itinerary data.

2. Tidy up the subtarget emittined code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24172 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/SubtargetEmitter.cpp b/utils/TableGen/SubtargetEmitter.cpp
index 0ec7803..04701fd 100644
--- a/utils/TableGen/SubtargetEmitter.cpp
+++ b/utils/TableGen/SubtargetEmitter.cpp
@@ -223,7 +223,7 @@
   
     // Form string as ,{ cycles, u1 | u2 | ... | un }
     int Cycles = Stage->getValueAsInt("Cycles");
-    ItinString += "  ,{ " + itostr(Cycles) + ", ";
+    ItinString += "  { " + itostr(Cycles) + ", ";
     
     // Get unit list
     std::vector<Record*> UnitList = Stage->getValueAsListOfDefs("Units");
@@ -260,7 +260,7 @@
 
   // Begin stages table
   OS << "static llvm::InstrStage Stages[] = {\n"
-        "  { 0, 0 } // No itinerary\n";
+        "  { 0, 0 }, // No itinerary\n";
         
   unsigned ItinEnum = 1;
   std::map<std::string, unsigned> ItinMap;
@@ -296,8 +296,9 @@
       
       // If new itinerary
       if (Find == 0) {
-        // Emit as ,{ cycles, u1 | u2 | ... | un } // index
-        OS << ItinString << " // " << ItinEnum << "\n";
+        // Emit as { cycles, u1 | u2 | ... | un }, // index
+        OS << ItinString << ", // " << ItinEnum << "\n";
+        // Record Itin class number
         ItinMap[ItinString] = Find = ItinEnum++;
       }
       
@@ -316,6 +317,8 @@
     ProcList.push_back(ItinList);
   }
   
+  // Closing stage
+  OS << "  { 0, 0 } // End itinerary\n";
   // End stages table
   OS << "};\n";
   
@@ -390,7 +393,7 @@
   // Begin processor table
   OS << "\n";
   OS << "// Sorted (by key) array of itineraries for CPU subtype.\n"
-     << "static const llvm::SubtargetInfoKV SubTypeInfoKV[] = {\n";
+     << "static const llvm::SubtargetInfoKV ProcItinKV[] = {\n";
      
   // For each processor
   for (unsigned i = 0, N = ProcessorList.size(); i < N;) {
@@ -418,7 +421,7 @@
 
   // Emit size of table
   OS<<"\nenum {\n";
-  OS<<"  SubTypeInfoKVSize = sizeof(SubTypeInfoKV)/"
+  OS<<"  ProcItinKVSize = sizeof(ProcItinKV)/"
                             "sizeof(llvm::SubtargetInfoKV)\n";
   OS<<"};\n";
 }
@@ -479,9 +482,8 @@
   if (HasItineraries) {
     OS << "\n"
        << "  InstrItinerary *Itinerary = (InstrItinerary *)"
-                        "Features.getInfo(SubTypeInfoKV, SubTypeInfoKVSize);\n"
-          "  InstrItins = InstrItineraryData(Stages, StagesSize, "
-                                             "Itinerary, ItinClassesSize);\n";
+                        "Features.getInfo(ProcItinKV, ProcItinKVSize);\n"
+          "  InstrItins = InstrItineraryData(Stages, Itinerary);\n";
   }
   
   OS << "}\n";