Go to the documentation of this file.
22 return static_cast<bool>(CurrentInstruction) || !SM.
isEnd();
26 if (CurrentInstruction)
31 Error EntryStage::getNextInstruction() {
32 assert(!CurrentInstruction &&
"There is already an instruction to process!");
35 return llvm::make_error<InstStreamPause>();
40 std::unique_ptr<Instruction> Inst = std::make_unique<Instruction>(SR.second);
41 CurrentInstruction = InstRef(SR.first, Inst.get());
42 Instructions.emplace_back(
std::move(Inst));
48 assert(CurrentInstruction &&
"There is no instruction to process!");
54 return getNextInstruction();
58 if (!CurrentInstruction)
59 return getNextInstruction();
64 assert(!CurrentInstruction);
65 return getNextInstruction();
70 auto Range =
make_range(&Instructions[NumRetired], Instructions.end());
71 auto It =
find_if(Range, [](
const std::unique_ptr<Instruction> &
I) {
72 return !
I->isRetired();
75 NumRetired = std::distance(Instructions.begin(), It);
77 if ((NumRetired * 2) >= Instructions.size()) {
78 Instructions.erase(Instructions.begin(), It);
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Error cycleStart() override
Called once at the start of each cycle.
bool isAvailable(const InstRef &IR) const override
Returns true if it can execute IR during this cycle.
Error cycleEnd() override
Called once at the end of each cycle.
bool hasWorkToComplete() const override
Returns true if some instructions are still executing this stage.
virtual SourceRef peekNext() const =0
The next SourceRef.
Error cycleResume() override
Called after the pipeline is resumed from pausing state.
virtual bool hasNext() const =0
Whether there is any SourceRef to inspect / peek next.
virtual void updateNext()=0
Advance to the next SourceRef.
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Subclass of Error for the sole purpose of identifying the success path in the type system.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
An InstRef contains both a SourceMgr index and Instruction pair.
bool checkNextStage(const InstRef &IR) const
virtual bool isEnd() const =0
Whether the instruction stream has eneded.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
Lightweight error class with error context and mandatory checking.
std::pair< unsigned, const Instruction & > SourceRef
void invalidate()
Invalidate this reference.
Error moveToTheNextStage(InstRef &IR)
Called when an instruction is ready to move the next pipeline stage.
Error execute(InstRef &IR) override
The primary action that this stage performs on instruction IR.