Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions llvm/utils/TableGen/Common/CodeGenSchedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2129,13 +2129,15 @@ void CodeGenSchedModels::addWriteRes(const Record *ProcWriteResDef,
void CodeGenSchedModels::addReadAdvance(const Record *ProcReadAdvanceDef,
CodeGenProcModel &PM) {
for (const Record *ValidWrite :
ProcReadAdvanceDef->getValueAsListOfDefs("ValidWrites"))
ProcReadAdvanceDef->getValueAsListOfDefs("ValidWrites")) {
if (getSchedRWIdx(ValidWrite, /*IsRead=*/false) == 0)
PrintFatalError(
ProcReadAdvanceDef->getLoc(),
"ReadAdvance referencing a ValidWrite that is not used by "
"any instruction (" +
ValidWrite->getName() + ")");
PM.ReadOfWriteSet.insert(ValidWrite);
}

ConstRecVec &RADefs = PM.ReadAdvanceDefs;
if (is_contained(RADefs, ProcReadAdvanceDef))
Expand Down Expand Up @@ -2173,12 +2175,7 @@ bool CodeGenProcModel::isUnsupported(const CodeGenInstruction &Inst) const {
}

bool CodeGenProcModel::hasReadOfWrite(const Record *WriteDef) const {
for (auto &RADef : ReadAdvanceDefs) {
ConstRecVec ValidWrites = RADef->getValueAsListOfDefs("ValidWrites");
if (is_contained(ValidWrites, WriteDef))
return true;
}
return false;
return ReadOfWriteSet.count(WriteDef) != 0;
}

#ifndef NDEBUG
Expand Down
3 changes: 3 additions & 0 deletions llvm/utils/TableGen/Common/CodeGenSchedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ struct CodeGenProcModel {
// Map from the ReadType field to the parent ReadAdvance record.
DenseMap<const Record *, const Record *> ReadAdvanceMap;

// Set of WriteRes that are referenced by a ReadAdvance.
DenseSet<const Record *> ReadOfWriteSet;

// Per-operand machine model resources associated with this processor.
ConstRecVec ProcResourceDefs;

Expand Down
Loading