[llvm-mca] Refactor event listeners to make the backend agnostic to event types.
Summary: This is a first step towards making the pipeline configurable.
Subscribers: llvm-commits, andreadb
Differential Revision: https://reviews.llvm.org/D44309
llvm-svn: 327389
diff --git a/llvm/tools/llvm-mca/BackendStatistics.cpp b/llvm/tools/llvm-mca/BackendStatistics.cpp
index d310a7b..3bdbdd3 100644
--- a/llvm/tools/llvm-mca/BackendStatistics.cpp
+++ b/llvm/tools/llvm-mca/BackendStatistics.cpp
@@ -20,6 +20,22 @@
namespace mca {
+void BackendStatistics::onInstructionEvent(const HWInstructionEvent &Event) {
+ switch (Event.Type) {
+ case HWInstructionEvent::Retired:
+ ++NumRetired;
+ break;
+ case HWInstructionEvent::Issued:
+ ++NumIssued;
+ break;
+ case HWInstructionEvent::Dispatched:
+ ++NumDispatched;
+ break;
+ default:
+ break;
+ }
+}
+
void BackendStatistics::printRetireUnitStatistics(llvm::raw_ostream &OS) const {
std::string Buffer;
raw_string_ostream TempStream(Buffer);