diff options
author | Jim Laskey <jlaskey@mac.com> | 2005-11-01 20:06:59 +0000 |
---|---|---|
committer | Jim Laskey <jlaskey@mac.com> | 2005-11-01 20:06:59 +0000 |
commit | 6cee630070b1a7183ed56a8404e812629f5ca538 (patch) | |
tree | d5e1227dd79a99caa34d1d68b6170b9b15ddbaf8 /utils/TableGen/SubtargetEmitter.cpp | |
parent | cb366d980a389e5b9c3fc2b9aae373c0ba2903c6 (diff) | |
download | external_llvm-6cee630070b1a7183ed56a8404e812629f5ca538.zip external_llvm-6cee630070b1a7183ed56a8404e812629f5ca538.tar.gz external_llvm-6cee630070b1a7183ed56a8404e812629f5ca538.tar.bz2 |
Allow itineraries to be passed through the Target Machine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24139 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/SubtargetEmitter.cpp')
-rw-r--r-- | utils/TableGen/SubtargetEmitter.cpp | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/utils/TableGen/SubtargetEmitter.cpp b/utils/TableGen/SubtargetEmitter.cpp index 9eb1f67..0ec7803 100644 --- a/utils/TableGen/SubtargetEmitter.cpp +++ b/utils/TableGen/SubtargetEmitter.cpp @@ -178,8 +178,8 @@ void SubtargetEmitter::CPUKeyValues(std::ostream &OS) { // CollectAllItinClasses - Gathers and enumerates all the itinerary classes. // Returns itinerary class count. // -unsigned SubtargetEmitter::CollectAllItinClasses(std::map<std::string, unsigned> - &ItinClassesMap) { +unsigned SubtargetEmitter::CollectAllItinClasses(std::ostream &OS, + std::map<std::string, unsigned> &ItinClassesMap) { // Gather and sort all itinerary classes std::vector<Record*> ItinClassList = Records.getAllDerivedDefinitions("InstrItinClass"); @@ -196,6 +196,11 @@ unsigned SubtargetEmitter::CollectAllItinClasses(std::map<std::string, unsigned> ItinClassesMap[Name] = i; } + // Emit size of table + OS<<"\nenum {\n"; + OS<<" ItinClassesSize = " << N << "\n"; + OS<<"};\n"; + // Return itinerary class count return N; } @@ -313,6 +318,11 @@ void SubtargetEmitter::EmitStageData(std::ostream &OS, // End stages table OS << "};\n"; + + // Emit size of table + OS<<"\nenum {\n"; + OS<<" StagesSize = sizeof(Stages)/sizeof(llvm::InstrStage)\n"; + OS<<"};\n"; } // @@ -421,13 +431,18 @@ void SubtargetEmitter::EmitData(std::ostream &OS) { std::vector<std::vector<InstrItinerary> > ProcList; // Enumerate all the itinerary classes - unsigned NItinClasses = CollectAllItinClasses(ItinClassesMap); - // Emit the stage data - EmitStageData(OS, NItinClasses, ItinClassesMap, ProcList); - // Emit the processor itinerary data - EmitProcessorData(OS, ProcList); - // Emit the processor lookup data - EmitProcessorLookup(OS); + unsigned NItinClasses = CollectAllItinClasses(OS, ItinClassesMap); + // Make sure the rest is worth the effort + HasItineraries = NItinClasses != 0; + + if (HasItineraries) { + // Emit the stage data + EmitStageData(OS, NItinClasses, ItinClassesMap, ProcList); + // Emit the processor itinerary data + EmitProcessorData(OS, ProcList); + // Emit the processor lookup data + EmitProcessorLookup(OS); + } } // @@ -460,9 +475,15 @@ void SubtargetEmitter::ParseFeaturesFunction(std::ostream &OS) { OS << " " << Attribute << " = (Bits & " << Instance << ") != 0;\n"; } - OS << "\n" - << " InstrItinerary *Itin = (InstrItinerary *)" - "Features.getInfo(SubTypeInfoKV, SubTypeInfoKVSize);\n"; + + if (HasItineraries) { + OS << "\n" + << " InstrItinerary *Itinerary = (InstrItinerary *)" + "Features.getInfo(SubTypeInfoKV, SubTypeInfoKVSize);\n" + " InstrItins = InstrItineraryData(Stages, StagesSize, " + "Itinerary, ItinClassesSize);\n"; + } + OS << "}\n"; } |