• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===---------------------- FetchStage.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 Fetch stage of an instruction pipeline.  Its sole
12 /// purpose in life is to produce instructions for the rest of the pipeline.
13 ///
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_TOOLS_LLVM_MCA_FETCH_STAGE_H
17 #define LLVM_TOOLS_LLVM_MCA_FETCH_STAGE_H
18 
19 #include "InstrBuilder.h"
20 #include "SourceMgr.h"
21 #include "Stage.h"
22 #include <map>
23 
24 namespace mca {
25 
26 class FetchStage : public Stage {
27   using InstMap = std::map<unsigned, std::unique_ptr<Instruction>>;
28   InstMap Instructions;
29   InstrBuilder &IB;
30   SourceMgr &SM;
31 
32 public:
FetchStage(InstrBuilder & IB,SourceMgr & SM)33   FetchStage(InstrBuilder &IB, SourceMgr &SM) : IB(IB), SM(SM) {}
34   FetchStage(const FetchStage &Other) = delete;
35   FetchStage &operator=(const FetchStage &Other) = delete;
36 
37   bool hasWorkToComplete() const override final;
38   bool execute(InstRef &IR) override final;
39   void postExecute() override final;
40   void cycleEnd() override final;
41 };
42 
43 } // namespace mca
44 
45 #endif // LLVM_TOOLS_LLVM_MCA_FETCH_STAGE_H
46