[clang] [llvm] [RISCV] Support frame pointers in SiFive CLIC preemptible handlers (PR #221318)
Sam Elliott via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 19 00:00:54 PDT 2026
================
@@ -1456,15 +1433,12 @@ void RISCVFrameLowering::emitEpilogue(MachineFunction &MF,
if (NeedsDwarfCFI && hasFP(MF))
CFIBuilder.buildDefCFA(SPReg, RealStackSize);
- // With a frame pointer, restore the SiFive CLIC CSRs through X5.
- if (hasFP(MF))
- emitSiFiveCLICPreemptibleRestores(MF, MBB, FirstScalarCSRRestoreInsn, DL);
-
// Skip to after the restores of scalar callee-saved registers
// FIXME: assumes exactly one instruction is used to restore each
// callee-saved register.
MBBI = std::next(FirstScalarCSRRestoreInsn,
- getUnmanagedCSI(MF, CSI, PreferAscendingLS).size());
+ getScalarSpillCSI(MF, CSI, PreferAscendingLS).size());
+ emitSiFiveCLICPreemptibleRestores(MF, MBB, MBBI, DL);
CFIBuilder.setInsertPoint(MBBI);
----------------
lenary wrote:
I don't think I understand why we're moving MBBI but not the CFIBuilder's insert point. I sort of think of those two as atomically representing each other -- can we move the `setInsertPoint` one line earlier, and then pass the `CFIBuilder` into `emitSiFiveCLICPreemptibleRestores` so we don't have to create a new one?
https://github.com/llvm/llvm-project/pull/221318
More information about the cfe-commits
mailing list