]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/MCA/Stages/EntryStage.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / MCA / Stages / EntryStage.h
1 //===---------------------- EntryStage.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 Entry stage of an instruction pipeline.  Its sole
12 /// purpose in life is to pick instructions in sequence and move them to the
13 /// next pipeline stage.
14 ///
15 //===----------------------------------------------------------------------===//
16
17 #ifndef LLVM_MCA_ENTRY_STAGE_H
18 #define LLVM_MCA_ENTRY_STAGE_H
19
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/MCA/SourceMgr.h"
22 #include "llvm/MCA/Stages/Stage.h"
23
24 namespace llvm {
25 namespace mca {
26
27 class EntryStage final : public Stage {
28   InstRef CurrentInstruction;
29   SmallVector<std::unique_ptr<Instruction>, 16> Instructions;
30   SourceMgr &SM;
31   unsigned NumRetired;
32
33   // Updates the program counter, and sets 'CurrentInstruction'.
34   void getNextInstruction();
35
36   EntryStage(const EntryStage &Other) = delete;
37   EntryStage &operator=(const EntryStage &Other) = delete;
38
39 public:
40   EntryStage(SourceMgr &SM) : CurrentInstruction(), SM(SM), NumRetired(0) { }
41
42   bool isAvailable(const InstRef &IR) const override;
43   bool hasWorkToComplete() const override;
44   Error execute(InstRef &IR) override;
45   Error cycleStart() override;
46   Error cycleEnd() override;
47 };
48
49 } // namespace mca
50 } // namespace llvm
51
52 #endif // LLVM_MCA_FETCH_STAGE_H