[llvm] [Object] Parsing and dumping of SFrame Frame Row Entries (PR #151301)

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 6 01:42:35 PDT 2025


================
@@ -68,3 +68,11 @@ ArrayRef<EnumEntry<sframe::FREOffset>> sframe::getFREOffsets() {
   };
   return ArrayRef(FREOffsets);
 }
+
+ArrayRef<EnumEntry<sframe::BaseReg>> sframe::getBaseRegisters() {
+  static constexpr EnumEntry<sframe::BaseReg> BaseRegs[] = {
+      {"FP", sframe::BaseReg::FP},
+      {"SP", sframe::BaseReg::SP},
+  };
+  return ArrayRef(BaseRegs);
+}
----------------
labath wrote:

If you mean something like:
```
// SFrame.h
extern ArrayRef<EnumEntry<sframe::BaseReg>> BaseRegisters;
// SFrame.cpp
static constexpr EnumEntry<sframe::BaseReg> BaseRegs[] = ...
ArrayRef<EnumEntry<sframe::BaseReg>> BaseRegisters = BaseRegs;
```
then I believe that should work (without creating new global constructors or anything). I did it this way because that's how this is implemented elsewhere (BinaryFormat/DXContainer.h, DebugInfo/CodeView/EnumTables.h)


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


More information about the llvm-commits mailing list