25 if (CurrentInstruction)
30 void EntryStage::getNextInstruction() {
31 assert(!CurrentInstruction &&
"There is already an instruction to process!");
35 std::unique_ptr<Instruction> Inst = llvm::make_unique<Instruction>(SR.second);
36 CurrentInstruction =
InstRef(SR.first, Inst.get());
37 Instructions.emplace_back(std::move(Inst));
42 assert(CurrentInstruction &&
"There is no instruction to process!");
53 if (!CurrentInstruction)
60 auto Range =
make_range(&Instructions[NumRetired], Instructions.end());
61 auto It =
find_if(Range, [](
const std::unique_ptr<Instruction> &
I) {
62 return !I->isRetired();
65 NumRetired = std::distance(Instructions.begin(), It);
67 if ((NumRetired * 2) >= Instructions.size()) {
68 Instructions.erase(Instructions.begin(), It);
This class represents lattice values for constants.
bool isAvailable(const InstRef &IR) const override
Returns true if it can execute IR during this cycle.
Subclass of Error for the sole purpose of identifying the success path in the type system...
bool checkNextStage(const InstRef &IR) const
bool hasWorkToComplete() const override
Returns true if some instructions are still executing this stage.
An InstRef contains both a SourceMgr index and Instruction pair.
This file defines the Entry stage of an instruction pipeline.
void invalidate()
Invalidate this reference.
auto find_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
SourceRef peekNext() const
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Error cycleEnd() override
Called once at the end of each cycle.
Error moveToTheNextStage(InstRef &IR)
Called when an instruction is ready to move the next pipeline stage.
std::pair< unsigned, const Instruction & > SourceRef
This file defines abstractions used by the Pipeline to model register reads, register writes and inst...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
Error execute(InstRef &IR) override
The primary action that this stage performs on instruction IR.
Error cycleStart() override
Called once at the start of each cycle.