[llvm] [CodeGen] Refactor `determineCalleeSaves`. (PR #166763)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 7 10:15:15 PST 2025


================
@@ -390,9 +390,38 @@ class LLVM_ABI TargetFrameLowering {
   /// This method should not be called by any passes outside of PEI, because
   /// it may change state passed in by \p MF and \p RS. The preferred
   /// interface outside PEI is getCalleeSaves.
+  // LLVM_DEPRECATED("Use determinePrologCalleeSaves instead",
+  //                 "determinePrologCalleeSaves")
   virtual void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
                                     RegScavenger *RS = nullptr) const;
 
+  /// Return the list of registers which must be preserved by the function: the
+  /// value on exit must be the same as the value on entry. A register from this
+  /// list does not need to be saved / reloaded if the function did not use it.
+  const MCPhysReg *getMustPreserveRegisters(const MachineFunction &MF) const;
----------------
lenary wrote:

These, and the `MCPhysReg *CSRegs` below, i think are pointing to arrays. Can we be a bit less C-like and a bit more safe and maybe make this an ArrayRef or SmallVector?

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


More information about the llvm-commits mailing list