1 //===---------------------- EntryStage.h ------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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.
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_MCA_ENTRY_STAGE_H
18 #define LLVM_MCA_ENTRY_STAGE_H
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/MCA/SourceMgr.h"
22 #include "llvm/MCA/Stages/Stage.h"
27 class EntryStage final : public Stage {
28 InstRef CurrentInstruction;
29 SmallVector<std::unique_ptr<Instruction>, 16> Instructions;
33 // Updates the program counter, and sets 'CurrentInstruction'.
34 void getNextInstruction();
36 EntryStage(const EntryStage &Other) = delete;
37 EntryStage &operator=(const EntryStage &Other) = delete;
40 EntryStage(SourceMgr &SM) : CurrentInstruction(), SM(SM), NumRetired(0) { }
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;
52 #endif // LLVM_MCA_FETCH_STAGE_H