// Find the processor's resource units for this kind of resource.
Record *CodeGenSchedModels::findProcResUnits(Record *ProcResKind,
- const CodeGenProcModel &PM) const {
+ const CodeGenProcModel &PM,
+ ArrayRef<SMLoc> Loc) const {
if (ProcResKind->isSubClassOf("ProcResourceUnits"))
return ProcResKind;
if (ProcResDef->getValueAsDef("Kind") == ProcResKind
&& ProcResDef->getValueAsDef("SchedModel") == PM.ModelDef) {
if (ProcUnitDef) {
- PrintFatalError(ProcResDef->getLoc(),
+ PrintFatalError(Loc,
"Multiple ProcessorResourceUnits associated with "
+ ProcResKind->getName());
}
if (ProcResGroup == ProcResKind
&& ProcResGroup->getValueAsDef("SchedModel") == PM.ModelDef) {
if (ProcUnitDef) {
- PrintFatalError((ProcResGroup)->getLoc(),
+ PrintFatalError(Loc,
"Multiple ProcessorResourceUnits associated with "
+ ProcResKind->getName());
}
}
}
if (!ProcUnitDef) {
- PrintFatalError(ProcResKind->getLoc(),
+ PrintFatalError(Loc,
"No ProcessorResources associated with "
+ ProcResKind->getName());
}
// Iteratively add a resource and its super resources.
void CodeGenSchedModels::addProcResource(Record *ProcResKind,
- CodeGenProcModel &PM) {
+ CodeGenProcModel &PM,
+ ArrayRef<SMLoc> Loc) {
while (true) {
- Record *ProcResUnits = findProcResUnits(ProcResKind, PM);
+ Record *ProcResUnits = findProcResUnits(ProcResKind, PM, Loc);
// See if this ProcResource is already associated with this processor.
if (is_contained(PM.ProcResourceDefs, ProcResUnits))
RecVec ProcResDefs = ProcWriteResDef->getValueAsListOfDefs("ProcResources");
for (RecIter WritePRI = ProcResDefs.begin(), WritePRE = ProcResDefs.end();
WritePRI != WritePRE; ++WritePRI) {
- addProcResource(*WritePRI, ProcModels[PIdx]);
+ addProcResource(*WritePRI, ProcModels[PIdx], ProcWriteResDef->getLoc());
}
}
unsigned findSchedClassIdx(Record *ItinClassDef, ArrayRef<unsigned> Writes,
ArrayRef<unsigned> Reads) const;
- Record *findProcResUnits(Record *ProcResKind,
- const CodeGenProcModel &PM) const;
+ Record *findProcResUnits(Record *ProcResKind, const CodeGenProcModel &PM,
+ ArrayRef<SMLoc> Loc) const;
private:
void collectProcModels();
void collectRWResources(ArrayRef<unsigned> Writes, ArrayRef<unsigned> Reads,
ArrayRef<unsigned> ProcIndices);
- void addProcResource(Record *ProcResourceKind, CodeGenProcModel &PM);
+ void addProcResource(Record *ProcResourceKind, CodeGenProcModel &PM,
+ ArrayRef<SMLoc> Loc);
void addWriteRes(Record *ProcWriteResDef, unsigned PIdx);
else {
// Find the SuperIdx
if (PRDef->getValueInit("Super")->isComplete()) {
- SuperDef = SchedModels.findProcResUnits(
- PRDef->getValueAsDef("Super"), ProcModel);
+ SuperDef =
+ SchedModels.findProcResUnits(PRDef->getValueAsDef("Super"),
+ ProcModel, PRDef->getLoc());
SuperIdx = ProcModel.getProcResourceIdx(SuperDef);
}
NumUnits = PRDef->getValueAsInt("NumUnits");
SubResources = PRDef->getValueAsListOfDefs("Resources");
else {
SubResources.push_back(PRDef);
- PRDef = SchedModels.findProcResUnits(PRVec[i], PM);
+ PRDef = SchedModels.findProcResUnits(PRDef, PM, PRDef->getLoc());
for (Record *SubDef = PRDef;
SubDef->getValueInit("Super")->isComplete();) {
if (SubDef->isSubClassOf("ProcResGroup")) {
" cannot be a super resources.");
}
Record *SuperDef =
- SchedModels.findProcResUnits(SubDef->getValueAsDef("Super"), PM);
+ SchedModels.findProcResUnits(SubDef->getValueAsDef("Super"), PM,
+ SubDef->getLoc());
PRVec.push_back(SuperDef);
Cycles.push_back(Cycles[i]);
SubDef = SuperDef;