14#ifndef LLVM_MCA_INCREMENTALSOURCEMGR_H
15#define LLVM_MCA_INCREMENTALSOURCEMGR_H
31 std::deque<UniqueInst> InstStorage;
35 std::deque<Instruction *> Staging;
38 unsigned TotalCounter = 0U;
44 using InstFreedCallback = std::function<void(
Instruction *)>;
45 InstFreedCallback InstFreedCB;
61 bool hasNext()
const override {
return !Staging.empty(); }
62 bool isEnd()
const override {
return EOS; }
66 return SourceRef(TotalCounter, *Staging.front());
71 InstStorage.emplace_back(std::move(Inst));
72 Staging.push_back(InstStorage.back().get());
This file contains abstract class SourceMgr and the default implementation, CircularSourceMgr.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
An implementation of SourceMgr that allows users to add new instructions incrementally / dynamically.
void setOnInstFreedCallback(InstFreedCallback CB)
Set a callback that is invoked when a mca::Instruction is no longer needed.
void addRecycledInst(Instruction *Inst)
Add a recycled instruction.
bool isEnd() const override
Whether the instruction stream has eneded.
void printStatistic(raw_ostream &OS)
Print statistic about instruction recycling stats.
void addInst(UniqueInst &&Inst)
Add a new instruction.
ArrayRef< UniqueInst > getInstructions() const override
Provides a fixed range of UniqueInst to iterate.
SourceRef peekNext() const override
The next SourceRef.
bool hasNext() const override
Whether there is any SourceRef to inspect / peek next.
void endOfStream()
Mark the end of instruction stream.
IncrementalSourceMgr()=default
void updateNext() override
Advance to the next SourceRef.
An instruction propagated through the simulated instruction pipeline.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::pair< unsigned, const Instruction & > SourceRef
This is an optimization pass for GlobalISel generic memory operations.
Abstracting the input code sequence (a sequence of MCInst) and assigning unique identifiers to every ...
std::unique_ptr< Instruction > UniqueInst