summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorMatt Davis <Matthew.Davis@sony.com>2018-05-22 20:51:58 +0000
committerMatt Davis <Matthew.Davis@sony.com>2018-05-22 20:51:58 +0000
commitbd12532300dec6e307bfe10b9b0b5eca7f9655fb (patch)
tree78c0f445fc279324825ba815fffe9cd3d5295120 /llvm/tools
parenta65d39e479fd780958649be35358f7d38ea6273c (diff)
downloadbcm5719-llvm-bd12532300dec6e307bfe10b9b0b5eca7f9655fb.tar.gz
bcm5719-llvm-bd12532300dec6e307bfe10b9b0b5eca7f9655fb.zip
[llvm-mca] Move DispatchStage::cycleEvent to preExecute. NFC.
Summary: This is an intermediate change, it moves the non-notification logic from Backend::notifyCycleBegin to runCycle(). Once the scheduler becomes part of the Execution stage the explicit call to Scheduler::cycleEvent will disappear. The logic for Dispatch::cycleEvent() can be in the preExecute phase, which this patch addresses. Reviewers: andreadb, RKSimon, courbet Reviewed By: andreadb Subscribers: tschuett, gbedwell, llvm-commits Differential Revision: https://reviews.llvm.org/D47213 llvm-svn: 333029
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-mca/Backend.cpp6
-rw-r--r--llvm/tools/llvm-mca/DispatchStage.cpp6
-rw-r--r--llvm/tools/llvm-mca/DispatchStage.h8
3 files changed, 10 insertions, 10 deletions
diff --git a/llvm/tools/llvm-mca/Backend.cpp b/llvm/tools/llvm-mca/Backend.cpp
index 7c466996c2c..9077b6e6f6f 100644
--- a/llvm/tools/llvm-mca/Backend.cpp
+++ b/llvm/tools/llvm-mca/Backend.cpp
@@ -38,6 +38,9 @@ void Backend::runCycle(unsigned Cycle) {
notifyCycleBegin(Cycle);
InstRef IR;
+ Dispatch->preExecute(IR);
+ HWS->cycleEvent(); // TODO: This will eventually be stage-ified.
+
while (Fetch->execute(IR)) {
if (!Dispatch->execute(IR))
break;
@@ -51,9 +54,6 @@ void Backend::notifyCycleBegin(unsigned Cycle) {
LLVM_DEBUG(dbgs() << "[E] Cycle begin: " << Cycle << '\n');
for (HWEventListener *Listener : Listeners)
Listener->onCycleBegin();
-
- Dispatch->cycleEvent();
- HWS->cycleEvent();
}
void Backend::notifyInstructionEvent(const HWInstructionEvent &Event) {
diff --git a/llvm/tools/llvm-mca/DispatchStage.cpp b/llvm/tools/llvm-mca/DispatchStage.cpp
index 2c4eff8fea0..01bd52f793f 100644
--- a/llvm/tools/llvm-mca/DispatchStage.cpp
+++ b/llvm/tools/llvm-mca/DispatchStage.cpp
@@ -142,6 +142,12 @@ void DispatchStage::dispatch(InstRef IR) {
SC->scheduleInstruction(IR);
}
+void DispatchStage::preExecute(const InstRef &IR) {
+ RCU->cycleEvent();
+ AvailableEntries = CarryOver >= DispatchWidth ? 0 : DispatchWidth - CarryOver;
+ CarryOver = CarryOver >= DispatchWidth ? CarryOver - DispatchWidth : 0U;
+}
+
bool DispatchStage::execute(InstRef &IR) {
const InstrDesc &Desc = IR.getInstruction()->getDesc();
if (!isAvailable(Desc.NumMicroOps) || !canDispatch(IR))
diff --git a/llvm/tools/llvm-mca/DispatchStage.h b/llvm/tools/llvm-mca/DispatchStage.h
index 4620f482d8c..2e1f47d1bf2 100644
--- a/llvm/tools/llvm-mca/DispatchStage.h
+++ b/llvm/tools/llvm-mca/DispatchStage.h
@@ -98,14 +98,8 @@ public:
this)),
Owner(B), STI(Subtarget) {}
- void cycleEvent() {
- RCU->cycleEvent();
- AvailableEntries =
- CarryOver >= DispatchWidth ? 0 : DispatchWidth - CarryOver;
- CarryOver = CarryOver >= DispatchWidth ? CarryOver - DispatchWidth : 0U;
- }
-
virtual bool isReady() const override final { return isRCUEmpty(); }
+ virtual void preExecute(const InstRef &IR) override final;
virtual bool execute(InstRef &IR) override final;
void notifyInstructionRetired(const InstRef &IR);
void notifyDispatchStall(const InstRef &IR, unsigned EventType);
OpenPOWER on IntegriCloud