[PATCH] D134851: [RISCV][WIP] Enable the local stack allocation pass for RISC-V.

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 21:45:45 PDT 2022


jrtc27 added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.h:77
+  bool isStackIdSafeForLocalArea(unsigned StackId) const override {
+    // We don't support putting SVE objects into the pre-allocated local
+    // frame block at the moment.
----------------
Bit too Arm-flavoured :)


================
Comment at: llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp:390-395
+  int64_t FPOffset = Offset - (Subtarget.is64Bit() ? 104 : 52);
+  // Consider FS0-FS11 if present.
+  if (Subtarget.hasStdExtD())
+    FPOffset -= 96;
+  else if (Subtarget.hasStdExtF())
+    FPOffset -= 48;
----------------
These should at least be based on XLEN and FLEN calculations rather than a bunch of hard-coded constants, but can they be calculated purely based on the ABI's callee saved register sets?

Also shouldn't the D/F checks be ABI-based rather than ISA-based? They're all caller-saved in the soft-float ABI, and similarly for the high parts of wider-than-ABI_FLEN registers.


================
Comment at: llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp:404
+  // FIXME: This is a total SWAG number. We should run some statistics
+  //        and pick a real one.
+  Offset += 128; // 128 bytes of spill slots
----------------
Maybe also fudged by XLEN?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134851/new/

https://reviews.llvm.org/D134851



More information about the llvm-commits mailing list