summaryrefslogtreecommitdiffstats
path: root/llvm/utils
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/utils')
-rw-r--r--llvm/utils/TableGen/CodeGenSchedule.cpp9
-rw-r--r--llvm/utils/TableGen/CodeGenSchedule.h4
-rw-r--r--llvm/utils/TableGen/SubtargetEmitter.cpp7
3 files changed, 19 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/CodeGenSchedule.cpp b/llvm/utils/TableGen/CodeGenSchedule.cpp
index 545e8292033..625944bcfe9 100644
--- a/llvm/utils/TableGen/CodeGenSchedule.cpp
+++ b/llvm/utils/TableGen/CodeGenSchedule.cpp
@@ -1787,6 +1787,15 @@ void CodeGenSchedModels::collectPfmCounters() {
}
PM.PfmCycleCounterDef = Def;
}
+ for (Record *Def : Records.getAllDerivedDefinitions("PfmUopsCounter")) {
+ CodeGenProcModel &PM = getProcModel(Def->getValueAsDef("SchedModel"));
+ if (PM.PfmUopsCounterDef) {
+ PrintFatalError(Def->getLoc(),
+ "multiple uops counters for " +
+ Def->getValueAsDef("SchedModel")->getName());
+ }
+ PM.PfmUopsCounterDef = Def;
+ }
}
// Collect and sort WriteRes, ReadAdvance, and ProcResources.
diff --git a/llvm/utils/TableGen/CodeGenSchedule.h b/llvm/utils/TableGen/CodeGenSchedule.h
index 3ed753c8ffe..c2af28bbaa0 100644
--- a/llvm/utils/TableGen/CodeGenSchedule.h
+++ b/llvm/utils/TableGen/CodeGenSchedule.h
@@ -242,6 +242,7 @@ struct CodeGenProcModel {
// List of PfmCounters.
RecVec PfmIssueCounterDefs;
Record *PfmCycleCounterDef = nullptr;
+ Record *PfmUopsCounterDef = nullptr;
CodeGenProcModel(unsigned Idx, std::string Name, Record *MDef,
Record *IDef) :
@@ -259,7 +260,8 @@ struct CodeGenProcModel {
bool hasExtraProcessorInfo() const {
return RetireControlUnit || !RegisterFiles.empty() ||
!PfmIssueCounterDefs.empty() ||
- PfmCycleCounterDef != nullptr;
+ PfmCycleCounterDef != nullptr ||
+ PfmUopsCounterDef != nullptr;
}
unsigned getProcResourceIdx(Record *PRDef) const;
diff --git a/llvm/utils/TableGen/SubtargetEmitter.cpp b/llvm/utils/TableGen/SubtargetEmitter.cpp
index 33257b63f6e..100399f52ff 100644
--- a/llvm/utils/TableGen/SubtargetEmitter.cpp
+++ b/llvm/utils/TableGen/SubtargetEmitter.cpp
@@ -743,6 +743,13 @@ static void EmitPfmCounters(const CodeGenProcModel &ProcModel,
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";
OpenPOWER on IntegriCloud