[llvm-branch-commits] [llvm] [TableGen][AsmMatcher] Support generated register coercion logic (PR #241022)

Sam Elliott via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Nov 13 13:51:09 PST 2026


================
@@ -390,6 +390,14 @@ class RegisterClass<string namespace, list<ValueType> regTypes, int alignment,
   // to message strings.
   string DiagnosticString = "";
 
+  // When registers in this class share assembly names with registers in another
+  // class returned by MatchRegisterName / parseRegister (for example, narrower
+  // or wider FP or vector group register classes), setting CoerceFromRegClass
+  // allows the assembly matcher to accept registers from CoerceFromRegClass
+  // with matching names and convert them to the corresponding register in this
+  // class instead of requiring hand-written logic in the AsmParser.
----------------
lenary wrote:

```suggestion
  // When registers in this class share assembly names with registers in another
  // class returned by MatchRegisterName / parseRegister (for example, narrower
  // or wider FP or vector group register classes), setting CoerceFromRegClass
  // allows the assembly matcher to accept registers from both this class and 
  // from CoerceFromRegClass, and will convert those from CoerceFromRegClass
  // to the corresponding register in this class using the matching names
  // instead of requiring hand-written logic in the AsmParser.
```

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


More information about the llvm-branch-commits mailing list