[TableGen] Add `getName()` to error messages for better debugging (#149531)
Including the name helps quickly locate the corresponding Instruction
that caused the issue.
diff --git a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
index 50346c2..b07ea9e9 100644
--- a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
@@ -2114,7 +2114,8 @@
const Record *WRDef = ProcWriteResDef->getValueAsDef("WriteType");
if (!WRMap.try_emplace(WRDef, ProcWriteResDef).second)
PrintFatalError(ProcWriteResDef->getLoc(),
- "WriteType already used in another WriteRes");
+ "WriteType of " + WRDef->getName() +
+ " already used in another WriteRes");
}
// Visit ProcResourceKinds referenced by the newly discovered WriteRes.
@@ -2148,7 +2149,8 @@
const Record *RADef = ProcReadAdvanceDef->getValueAsDef("ReadType");
if (!RAMap.try_emplace(RADef, ProcReadAdvanceDef).second)
PrintFatalError(ProcReadAdvanceDef->getLoc(),
- "ReadType already used in another ReadAdvance");
+ "ReadType of " + RADef->getName() +
+ " already used in another ReadAdvance");
}
}