[llvm] [CFIInserter] Improve `CSRSavedLocation` struct. (PR #168869)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 07:30:34 PST 2025


================
@@ -88,11 +88,60 @@ class CFIInstrInserter : public MachineFunctionPass {
 #define INVALID_REG UINT_MAX
 #define INVALID_OFFSET INT_MAX
   /// contains the location where CSR register is saved.
-  struct CSRSavedLocation {
-    CSRSavedLocation(std::optional<unsigned> R, std::optional<int> O)
-        : Reg(R), Offset(O) {}
-    std::optional<unsigned> Reg;
-    std::optional<int> Offset;
+  class CSRSavedLocation {
+  public:
+    enum Kind { INVALID, REGISTER, CFA_OFFSET };
----------------
s-barannikov wrote:

enum members are constants and should be named as constants (UpperCamelCase)

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


More information about the llvm-commits mailing list