[llvm] [TableGen][NFC] Refactor/deduplicate emitAction. (PR #137434)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 25 21:47:01 PDT 2025


================
@@ -125,6 +126,56 @@ void CallingConvEmitter::emitCallingConv(const Record *CC, raw_ostream &O) {
 
 void CallingConvEmitter::emitAction(const Record *Action, indent Indent,
                                     raw_ostream &O) {
+
+  auto EmitRegList = [&](const ListInit *RL, const StringRef RLName) {
+    O << Indent << "static const MCPhysReg " << RLName << "[] = {\n";
+    O << Indent << "  ";
+    ListSeparator LS;
+    for (const Init *V : RL->getValues())
+      O << LS << getQualifiedName(dyn_cast<DefInit>(V)->getDef());
----------------
topperc wrote:

`dyn_cast` -> `cast`. If the `dyn_cast` fails it's a null pointer dereference so I'm assuming it shouldn't fail?


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


More information about the llvm-commits mailing list