32 TotalCycles =
std::max(TotalCycles, Cycles);
34 if (!DependentWrites) {
35 CyclesLeft = TotalCycles;
36 IsReady = !CyclesLeft;
47 for (
const std::pair<ReadState *, int> &
User :
Users) {
49 unsigned ReadCycles =
std::max(0, CyclesLeft -
User.second);
55 PartialWrite->writeStartEvent(CyclesLeft);
63 unsigned ReadCycles =
std::max(0, CyclesLeft - ReadAdvance);
69 return Use.first == User;
71 Users.emplace_back(User, ReadAdvance);
81 assert(!PartialWrite &&
"PartialWrite already set!");
93 if (DependentWriteCyclesLeft)
94 DependentWriteCyclesLeft--;
99 if (DependentWrites && TotalCycles) {
110 IsReady = !CyclesLeft;
116 dbgs() <<
"{ OpIdx=" << WD->OpIndex <<
", Lat=" <<
getLatency() <<
", RegID " 117 <<
getRegisterID() <<
", Cycles Left=" << getCyclesLeft() <<
" }";
121 dbgs() <<
"IID=" << getSourceIndex() <<
' ';
123 getWriteState()->dump();
131 Stage = IS_AVAILABLE;
132 RCUTokenID = RCUToken;
140 Stage = IS_EXECUTING;
146 WS.onInstructionIssued();
154 assert(
Stage == IS_READY &&
"Invalid internal state!");
160 assert(isDispatched() &&
"Unexpected instruction stage found!");
167 if (!
Def.getDependentWrite()) {
168 unsigned CyclesLeft =
Def.getDependentWriteCyclesLeft();
169 return !CyclesLeft || CyclesLeft <
getLatency();
174 if (
all_of(getDefs(), IsDefReady))
182 if (isDispatched()) {
193 assert(isExecuting() &&
"Instruction not in-flight?");
194 assert(CyclesLeft &&
"Instruction already executed?");
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
This class represents lattice values for constants.
constexpr int UNKNOWN_CYCLES
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
iv Induction Variable Users
void onInstructionIssued()
void setDependentWrite(WriteState *Other)
Tracks register operand latency in cycles.
A Use represents the edge between a Value definition and its users.
static int getLatency(LLVMDisasmContext *DC, const MCInst &Inst)
Gets latency information for Inst, based on DC information.
void writeStartEvent(unsigned Cycles)
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...
void dispatch(unsigned RCUTokenID)
void addUser(ReadState *Use, int ReadAdvance)
Tracks uses of a register definition (e.g.
void writeStartEvent(unsigned Cycles)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
This file defines abstractions used by the Pipeline to model register reads, register writes and inst...
unsigned getRegisterID() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())