[llvm] [NFC][RISCV] Refactor allocation of the stack space (PR #116625)

Raphael Moreira Zinsly via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 12:42:08 PST 2024


================
@@ -726,16 +745,9 @@ void RISCVFrameLowering::emitPrologue(MachineFunction &MF,
 
   if (StackSize != 0) {
     // Allocate space on the stack if necessary.
-    RI->adjustReg(MBB, MBBI, DL, SPReg, SPReg,
-                  StackOffset::getFixed(-StackSize), MachineInstr::FrameSetup,
-                  getStackAlign());
-
-    // Emit ".cfi_def_cfa_offset RealStackSize"
     unsigned CFIIndex = MF.addFrameInst(
         MCCFIInstruction::cfiDefCfaOffset(nullptr, RealStackSize));
-    BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
-        .addCFIIndex(CFIIndex)
-        .setMIFlag(MachineInstr::FrameSetup);
+    allocateStack(MBB, MBBI, StackOffset::getFixed(-StackSize), true, CFIIndex);
----------------
rzinsly wrote:

Done!

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


More information about the llvm-commits mailing list