[llvm] [RISCV] Add stack clash vector support (PR #119458)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 10:00:40 PST 2024


================
@@ -499,6 +499,54 @@ getPushOrLibCallsSavedInfo(const MachineFunction &MF,
   return PushOrLibCallsCSI;
 }
 
+void RISCVFrameLowering::allocateAndProbeStackForRVV(
+    MachineFunction &MF, MachineBasicBlock &MBB,
+    MachineBasicBlock::iterator MBBI, const DebugLoc &DL, int64_t Amount,
+    MachineInstr::MIFlag Flag, bool EmitCFI) const {
+  assert(Amount != 0 && "Did not need to adjust stack pointer for RVV.");
+
+  // Emit a variable-length allocation probing loop.
+
+  // Get VLEN in TargetReg
+  const RISCVInstrInfo *TII = STI.getInstrInfo();
+  Register TargetReg = RISCV::X6;
+  uint32_t NumOfVReg = Amount / 8;
----------------
topperc wrote:

Replace 8 here with `(RISCV::RVVBitsPerBlock / 8)`

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


More information about the llvm-commits mailing list