[PATCH] D45787: [llvm-exegesis] Fix PfmIssueCountersTable creation
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 19 04:03:37 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL330317: [llvm-exegesis] Fix PfmIssueCountersTable creation (authored by RKSimon, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D45787?vs=142993&id=143066#toc
Repository:
rL LLVM
https://reviews.llvm.org/D45787
Files:
llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
Index: llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
===================================================================
--- llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
+++ llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
@@ -686,9 +686,11 @@
return CostTblIndex;
}
+
static bool EmitPfmIssueCountersTable(const CodeGenProcModel &ProcModel,
raw_ostream &OS) {
- std::vector<const Record *> CounterDefs(ProcModel.ProcResourceDefs.size());
+ 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(
@@ -706,16 +708,19 @@
}
OS << "\nstatic const char* " << ProcModel.ModelName
<< "PfmIssueCounters[] = {\n";
- for (const Record *CounterDef : CounterDefs) {
+ 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");
- for (const StringRef CounterName : PfmCounters)
- OS << " \"" << CounterName << ",\"";
- OS << ", //" << CounterDef->getValueAsDef("Resource")->getName() << "\n";
+ 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,\n";
+ OS << " nullptr, // #" << i << "\n";
}
}
OS << "};\n";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45787.143066.patch
Type: text/x-patch
Size: 1814 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180419/df9d609e/attachment.bin>
More information about the llvm-commits
mailing list