summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mca/Backend.cpp
diff options
context:
space:
mode:
authorClement Courbet <courbet@google.com>2018-03-13 13:11:01 +0000
committerClement Courbet <courbet@google.com>2018-03-13 13:11:01 +0000
commit844f22d3c3806f372c1bec258a4bc559f974081d (patch)
treeba6ab90f820ffd1d69f46206e07e9e9f49322d76 /llvm/tools/llvm-mca/Backend.cpp
parent9d7e9032f1bd3a7cd83ed1883069bcced7b52b21 (diff)
downloadbcm5719-llvm-844f22d3c3806f372c1bec258a4bc559f974081d.tar.gz
bcm5719-llvm-844f22d3c3806f372c1bec258a4bc559f974081d.zip
[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
Diffstat (limited to 'llvm/tools/llvm-mca/Backend.cpp')
-rw-r--r--llvm/tools/llvm-mca/Backend.cpp45
1 files changed, 2 insertions, 43 deletions
diff --git a/llvm/tools/llvm-mca/Backend.cpp b/llvm/tools/llvm-mca/Backend.cpp
index fab725aecf7..c17d48ca150 100644
--- a/llvm/tools/llvm-mca/Backend.cpp
+++ b/llvm/tools/llvm-mca/Backend.cpp
@@ -65,50 +65,9 @@ void Backend::notifyCycleBegin(unsigned Cycle) {
HWS->cycleEvent(Cycle);
}
-void Backend::notifyInstructionDispatched(unsigned Index) {
- DEBUG(dbgs() << "[E] Instruction Dispatched: " << Index << '\n');
+void Backend::notifyInstructionEvent(const HWInstructionEvent &Event) {
for (HWEventListener *Listener : Listeners)
- Listener->onInstructionDispatched(Index);
-}
-
-void Backend::notifyInstructionReady(unsigned Index) {
- DEBUG(dbgs() << "[E] Instruction Ready: " << Index << '\n');
- for (HWEventListener *Listener : Listeners)
- Listener->onInstructionReady(Index);
-}
-
-void Backend::notifyInstructionIssued(
- unsigned Index, const ArrayRef<std::pair<ResourceRef, unsigned>> &Used) {
- DEBUG(
- dbgs() << "[E] Instruction Issued: " << Index << '\n';
- for (const std::pair<ResourceRef, unsigned> &Resource : Used) {
- dbgs() << "[E] Resource Used: [" << Resource.first.first << '.'
- << Resource.first.second << "]\n";
- dbgs() << " cycles: " << Resource.second << '\n';
- }
- );
-
- for (HWEventListener *Listener : Listeners)
- Listener->onInstructionIssued(Index, Used);
-}
-
-void Backend::notifyInstructionExecuted(unsigned Index) {
- DEBUG(dbgs() << "[E] Instruction Executed: " << Index << '\n');
- for (HWEventListener *Listener : Listeners)
- Listener->onInstructionExecuted(Index);
-
- const Instruction &IS = *Instructions[Index];
- DU->onInstructionExecuted(IS.getRCUTokenID());
-}
-
-void Backend::notifyInstructionRetired(unsigned Index) {
- DEBUG(dbgs() << "[E] Instruction Retired: " << Index << '\n');
- for (HWEventListener *Listener : Listeners)
- Listener->onInstructionRetired(Index);
-
- const Instruction &IS = *Instructions[Index];
- DU->invalidateRegisterMappings(IS);
- Instructions.erase(Index);
+ Listener->onInstructionEvent(Event);
}
void Backend::notifyResourceAvailable(const ResourceRef &RR) {
OpenPOWER on IntegriCloud