1 //===---------------------- EntryStage.h ------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 /// This file defines the Entry stage of an instruction pipeline. Its sole
11 /// purpose in life is to pick instructions in sequence and move them to the
12 /// next pipeline stage.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_MCA_ENTRY_STAGE_H
17 #define LLVM_MCA_ENTRY_STAGE_H
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/MCA/SourceMgr.h"
21 #include "llvm/MCA/Stages/Stage.h"
26 class EntryStage final
: public Stage
{
27 InstRef CurrentInstruction
;
28 SmallVector
<std::unique_ptr
<Instruction
>, 16> Instructions
;
32 // Updates the program counter, and sets 'CurrentInstruction'.
33 void getNextInstruction();
35 EntryStage(const EntryStage
&Other
) = delete;
36 EntryStage
&operator=(const EntryStage
&Other
) = delete;
39 EntryStage(SourceMgr
&SM
) : CurrentInstruction(), SM(SM
), NumRetired(0) { }
41 bool isAvailable(const InstRef
&IR
) const override
;
42 bool hasWorkToComplete() const override
;
43 Error
execute(InstRef
&IR
) override
;
44 Error
cycleStart() override
;
45 Error
cycleEnd() override
;
51 #endif // LLVM_MCA_FETCH_STAGE_H