[llvm-mca] Register listeners with  stages; remove Pipeline dependency from Stage.

Summary:
This patch removes a few callbacks from Pipeline.  It comes at the cost of
registering Listeners with all Stages.  Not all stages need listeners or issue
callbacks, this registration is a bit redundant.  However, as we build-out the
API, this redundancy can disappear.

The main purpose here is to move callback code from the Pipeline and into the
stages that actually issue those callbacks. This removes the back-pointer to
the Pipeline that was put into a few Stage subclasses.

Reviewers: andreadb, courbet, RKSimon

Reviewed By: andreadb, courbet

Subscribers: tschuett, gbedwell, llvm-commits

Differential Revision: https://reviews.llvm.org/D48576

llvm-svn: 335748
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp
index 380cd3f..a492eb8 100644
--- a/llvm/tools/llvm-mca/llvm-mca.cpp
+++ b/llvm/tools/llvm-mca/llvm-mca.cpp
@@ -511,9 +511,9 @@
         Width, RegisterFileSize, LoadQueueSize, StoreQueueSize, AssumeNoAlias);
     P->appendStage(llvm::make_unique<mca::FetchStage>(IB, S));
     P->appendStage(llvm::make_unique<mca::DispatchStage>(
-        P.get(), *STI, *MRI, RegisterFileSize, Width, RCU, PRF, HWS));
-    P->appendStage(llvm::make_unique<mca::RetireStage>(P.get(), RCU, PRF));
-    P->appendStage(llvm::make_unique<mca::ExecuteStage>(P.get(), RCU, HWS));
+        *STI, *MRI, RegisterFileSize, Width, RCU, PRF, HWS));
+    P->appendStage(llvm::make_unique<mca::RetireStage>(RCU, PRF));
+    P->appendStage(llvm::make_unique<mca::ExecuteStage>(RCU, HWS));
     mca::PipelinePrinter Printer(*P);
 
     if (PrintSummaryView)