[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
This commit is contained in:
Matt Davis 2018-05-22 20:51:58 +00:00
parent a65d39e479
commit bd12532300
3 changed files with 10 additions and 10 deletions

View File

@ -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) {

View File

@ -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))

View File

@ -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);