summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/SubtargetEmitter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/utils/TableGen/SubtargetEmitter.cpp')
-rw-r--r--llvm/utils/TableGen/SubtargetEmitter.cpp86
1 files changed, 7 insertions, 79 deletions
diff --git a/llvm/utils/TableGen/SubtargetEmitter.cpp b/llvm/utils/TableGen/SubtargetEmitter.cpp
index d1ea968590f..4ff52b3e44e 100644
--- a/llvm/utils/TableGen/SubtargetEmitter.cpp
+++ b/llvm/utils/TableGen/SubtargetEmitter.cpp
@@ -697,80 +697,12 @@ SubtargetEmitter::EmitRegisterFileTables(const CodeGenProcModel &ProcModel,
return CostTblIndex;
}
-static bool EmitPfmIssueCountersTable(const CodeGenProcModel &ProcModel,
- raw_ostream &OS) {
- unsigned NumCounterDefs = 1 + ProcModel.ProcResourceDefs.size();
- std::vector<const Record *> CounterDefs(NumCounterDefs);
- bool HasCounters = false;
- for (const Record *CounterDef : ProcModel.PfmIssueCounterDefs) {
- const Record *&CD = CounterDefs[ProcModel.getProcResourceIdx(
- CounterDef->getValueAsDef("Resource"))];
- if (CD) {
- PrintFatalError(CounterDef->getLoc(),
- "multiple issue counters for " +
- CounterDef->getValueAsDef("Resource")->getName());
- }
- CD = CounterDef;
- HasCounters = true;
- }
- if (!HasCounters) {
- return false;
- }
- OS << "\nstatic const char* " << ProcModel.ModelName
- << "PfmIssueCounters[] = {\n";
- for (unsigned i = 0; i != NumCounterDefs; ++i) {
- const Record *CounterDef = CounterDefs[i];
- if (CounterDef) {
- const auto PfmCounters = CounterDef->getValueAsListOfStrings("Counters");
- if (PfmCounters.empty())
- PrintFatalError(CounterDef->getLoc(), "empty counter list");
- OS << " \"" << PfmCounters[0];
- for (unsigned p = 1, e = PfmCounters.size(); p != e; ++p)
- OS << ",\" \"" << PfmCounters[p];
- OS << "\", // #" << i << " = ";
- OS << CounterDef->getValueAsDef("Resource")->getName() << "\n";
- } else {
- OS << " nullptr, // #" << i << "\n";
- }
- }
- OS << "};\n";
- return true;
-}
-
-static void EmitPfmCounters(const CodeGenProcModel &ProcModel,
- const bool HasPfmIssueCounters, raw_ostream &OS) {
- OS << " {\n";
- // Emit the cycle counter.
- if (ProcModel.PfmCycleCounterDef)
- OS << " \"" << ProcModel.PfmCycleCounterDef->getValueAsString("Counter")
- << "\", // Cycle counter.\n";
- else
- OS << " nullptr, // No cycle counter.\n";
-
- // Emit the uops counter.
- if (ProcModel.PfmUopsCounterDef)
- OS << " \"" << ProcModel.PfmUopsCounterDef->getValueAsString("Counter")
- << "\", // Uops counter.\n";
- else
- OS << " nullptr, // No uops counter.\n";
-
- // Emit a reference to issue counters table.
- if (HasPfmIssueCounters)
- OS << " " << ProcModel.ModelName << "PfmIssueCounters\n";
- else
- OS << " nullptr // No issue counters.\n";
- OS << " }\n";
-}
-
void SubtargetEmitter::EmitExtraProcessorInfo(const CodeGenProcModel &ProcModel,
raw_ostream &OS) {
// Generate a table of register file descriptors (one entry per each user
// defined register file), and a table of register costs.
unsigned NumCostEntries = EmitRegisterFileTables(ProcModel, OS);
- // Generate a table of ProcRes counter names.
- const bool HasPfmIssueCounters = EmitPfmIssueCountersTable(ProcModel, OS);
-
// Now generate a table for the extra processor info.
OS << "\nstatic const llvm::MCExtraProcessorInfo " << ProcModel.ModelName
<< "ExtraInfo = {\n ";
@@ -783,8 +715,6 @@ void SubtargetEmitter::EmitExtraProcessorInfo(const CodeGenProcModel &ProcModel,
EmitRegisterFileInfo(ProcModel, ProcModel.RegisterFiles.size(),
NumCostEntries, OS);
- EmitPfmCounters(ProcModel, HasPfmIssueCounters, OS);
-
OS << "};\n";
}
@@ -1410,7 +1340,7 @@ void SubtargetEmitter::EmitProcessorModels(raw_ostream &OS) {
}
//
-// EmitProcessorLookup - generate cpu name to itinerary lookup table.
+// EmitProcessorLookup - generate cpu name to sched model lookup tables.
//
void SubtargetEmitter::EmitProcessorLookup(raw_ostream &OS) {
// Gather and sort processor information
@@ -1418,12 +1348,11 @@ void SubtargetEmitter::EmitProcessorLookup(raw_ostream &OS) {
Records.getAllDerivedDefinitions("Processor");
llvm::sort(ProcessorList, LessRecordFieldName());
- // Begin processor table
+ // Begin processor->sched model table
OS << "\n";
- OS << "// Sorted (by key) array of itineraries for CPU subtype.\n"
- << "extern const llvm::SubtargetInfoKV "
- << Target << "ProcSchedKV[] = {\n";
-
+ OS << "// Sorted (by key) array of sched model for CPU subtype.\n"
+ << "extern const llvm::SubtargetInfoKV " << Target
+ << "ProcSchedKV[] = {\n";
// For each processor
for (Record *Processor : ProcessorList) {
StringRef Name = Processor->getValueAsString("Name");
@@ -1433,8 +1362,7 @@ void SubtargetEmitter::EmitProcessorLookup(raw_ostream &OS) {
// Emit as { "cpu", procinit },
OS << " { \"" << Name << "\", (const void *)&" << ProcModelName << " },\n";
}
-
- // End processor table
+ // End processor->sched model table
OS << "};\n";
}
@@ -1675,7 +1603,7 @@ void SubtargetEmitter::EmitSchedModelHelpers(const std::string &ClassName,
// Emit target predicates.
emitSchedModelHelpersImpl(OS);
-
+
OS << "} // " << ClassName << "::resolveSchedClass\n\n";
OS << "unsigned " << ClassName
OpenPOWER on IntegriCloud