diff options
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib')
| -rw-r--r-- | llvm/tools/llvm-exegesis/lib/Analysis.cpp | 14 | ||||
| -rw-r--r-- | llvm/tools/llvm-exegesis/lib/Analysis.h | 7 |
2 files changed, 15 insertions, 6 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/Analysis.cpp b/llvm/tools/llvm-exegesis/lib/Analysis.cpp index 5b609257f59..a02ea29e3d1 100644 --- a/llvm/tools/llvm-exegesis/lib/Analysis.cpp +++ b/llvm/tools/llvm-exegesis/lib/Analysis.cpp @@ -91,7 +91,9 @@ Analysis::Analysis(const llvm::Target &Target, MnemonicToOpcode_.emplace(InstrInfo_->getName(I), I); } -llvm::Error Analysis::printClusters(llvm::raw_ostream &OS) const { +template <> +llvm::Error +Analysis::run<Analysis::PrintClusters>(llvm::raw_ostream &OS) const { if (Clustering_.getPoints().empty()) return llvm::Error::success(); @@ -133,8 +135,9 @@ Analysis::makePointsPerSchedClass() const { return PointsPerSchedClass; } -llvm::Error -Analysis::printSchedClassInconsistencies(llvm::raw_ostream &OS) const { +template <> +llvm::Error Analysis::run<Analysis::PrintSchedClassInconsistencies>( + llvm::raw_ostream &OS) const { // All the points in a scheduling class should be in the same cluster. // Print any scheduling class for which this is not the case. for (const auto &SchedClassAndPoints : makePointsPerSchedClass()) { @@ -167,4 +170,9 @@ Analysis::printSchedClassInconsistencies(llvm::raw_ostream &OS) const { return llvm::Error::success(); } +template llvm::Error +Analysis::run<Analysis::PrintClusters>(llvm::raw_ostream &OS) const; +template llvm::Error Analysis::run<Analysis::PrintSchedClassInconsistencies>( + llvm::raw_ostream &OS) const; + } // namespace exegesis diff --git a/llvm/tools/llvm-exegesis/lib/Analysis.h b/llvm/tools/llvm-exegesis/lib/Analysis.h index dcfaf3469dd..d8046e54a70 100644 --- a/llvm/tools/llvm-exegesis/lib/Analysis.h +++ b/llvm/tools/llvm-exegesis/lib/Analysis.h @@ -33,10 +33,11 @@ public: const InstructionBenchmarkClustering &Clustering); // Prints a csv of instructions for each cluster. - llvm::Error printClusters(llvm::raw_ostream &OS) const; - + struct PrintClusters {}; // Find potential errors in the scheduling information given measurements. - llvm::Error printSchedClassInconsistencies(llvm::raw_ostream &OS) const; + struct PrintSchedClassInconsistencies {}; + + template <typename Pass> llvm::Error run(llvm::raw_ostream &OS) const; private: void printInstructionRow(bool PrintSchedClass, size_t PointId, |

