[llvm-branch-commits] [TableGen] Slightly improve error location for a fatal error (PR #170790)

Alexander Richardson via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Dec 5 09:26:12 PST 2025


================
@@ -1316,11 +1316,18 @@ CodeGenRegBank::getOrCreateSubClass(const CodeGenRegisterClass *RC,
   return {&RegClasses.back(), true};
 }
 
-CodeGenRegisterClass *CodeGenRegBank::getRegClass(const Record *Def) const {
+CodeGenRegisterClass *CodeGenRegBank::getRegClass(const Record *Def,
+                                                  ArrayRef<SMLoc> Loc) const {
   if (CodeGenRegisterClass *RC = Def2RC.lookup(Def))
     return RC;
 
-  PrintFatalError(Def->getLoc(), "Not a known RegisterClass!");
+  ArrayRef<SMLoc> DiagLoc = Loc.empty() ? Def->getLoc() : Loc;
+  // TODO: Ideally we should update the API to allow resolving HwMode.
----------------
arichardson wrote:

In some cases (e.g. inside a `let Predicates = [...]` block), we may be able to know exactly what it resolves to but that will require a lot more refactoring. I can drop the comment if you prefer.

https://github.com/llvm/llvm-project/pull/170790


More information about the llvm-branch-commits mailing list