1 //===---------------------- RetireStage.h -----------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 /// \file
10 ///
11 /// This file defines the retire stage of an instruction pipeline.
12 /// The RetireStage represents the process logic that interacts with the
13 /// simulated RetireControlUnit hardware.
14 //
15 //===----------------------------------------------------------------------===//
16 
17 #ifndef LLVM_TOOLS_LLVM_MCA_RETIRE_STAGE_H
18 #define LLVM_TOOLS_LLVM_MCA_RETIRE_STAGE_H
19 
20 #include "RegisterFile.h"
21 #include "RetireControlUnit.h"
22 #include "Stage.h"
23 
24 namespace mca {
25 
26 class RetireStage : public Stage {
27   // Owner will go away when we move listeners/eventing to the stages.
28   RetireControlUnit &RCU;
29   RegisterFile &PRF;
30 
31 public:
RetireStage(RetireControlUnit & R,RegisterFile & F)32   RetireStage(RetireControlUnit &R, RegisterFile &F)
33       : Stage(), RCU(R), PRF(F) {}
34   RetireStage(const RetireStage &Other) = delete;
35   RetireStage &operator=(const RetireStage &Other) = delete;
36 
hasWorkToComplete()37   virtual bool hasWorkToComplete() const override final {
38     return !RCU.isEmpty();
39   }
40   virtual void cycleStart() override final;
execute(InstRef & IR)41   virtual bool execute(InstRef &IR) override final { return true; }
42   void notifyInstructionRetired(const InstRef &IR);
43   void onInstructionExecuted(unsigned TokenID);
44 };
45 
46 } // namespace mca
47 
48 #endif // LLVM_TOOLS_LLVM_MCA_RETIRE_STAGE_H
49