[llvm] [RISCV] Remove CalleeSavedInfo for Zcmp/save-restore-libcalls registers (PR #79535)

Visoiu Mistrih Francis via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 09:52:06 PST 2024


================
@@ -1252,6 +1252,30 @@ void RISCVFrameLowering::processFunctionBeforeFrameFinalized(
   RVFI->setCalleeSavedStackSize(Size);
 }
 
+void RISCVFrameLowering::processFunctionBeforeFrameIndicesReplaced(
+    MachineFunction &MF, RegScavenger *RS) const {
+  // Remove CalleeSavedInfo for registers saved by Zcmp or save/restore
+  // libcalls.
+  MachineFrameInfo &MFI = MF.getFrameInfo();
+  const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
+  const auto *RVFI = MF.getInfo<RISCVMachineFunctionInfo>();
+  if (!RVFI->isPushable(MF) && !RVFI->useSaveRestoreLibCalls(MF))
+    return;
+  const std::vector<CalleeSavedInfo> &CSIs = MFI.getCalleeSavedInfo();
+  std::vector<CalleeSavedInfo> NewCSIs;
+  for (const auto &CSI : CSIs) {
+    // Skip CSRs that have fake a frame index.
+    [[maybe_unused]] int ReservedFI = 0;
----------------
francisvm wrote:

Removed, thanks!

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


More information about the llvm-commits mailing list