[PATCH] D134599: [RISCV] Readjusting the framestack for Zcmp

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 17:35:17 PDT 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:229
+  default:
+    llvm_unreachable("Unexcetped Reg for Push/Pop Inst");
+  case /*s11*/ RISCV::X27:
----------------
Unexpected*


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:261
+
+  std::vector<CalleeSavedInfo> CSI = MFI.getCalleeSavedInfo();
+  // realloc stack frame for PUSH
----------------
Can this be a const reference? I think that's what getCalleedSavedInfo returns


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:298
+    Register Reg = CS.getReg();
+    const TargetRegisterClass *RC =
+        STI.getRegisterInfo()->getMinimalPhysRegClass(Reg);
----------------
Why can't we called `RISCV::PGPRRegClass.contains(Reg)`?


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:404
+      const TargetRegisterClass *RC = TRI->getMinimalPhysRegClass(Reg);
+      if (Reg == RISCV::X26 || RISCV::PGPRRegClass.hasSubClassEq(RC))
+        MaxPushPopReg = std::max(MaxPushPopReg.id(), Reg.id());
----------------
`RISCV::PGPRRegClass.contains(Reg)`?


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:602
+    std::advance(MBBI, 1);
+  else
+    // The frame pointer is callee-saved, and code has been generated for us to
----------------
Use curly braces here since there is a long comment. 


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:1372
+
+    uint64_t PoshPopRegs = CSI.size() - NonePushCSI.size();
+    if (MaxReg == RISCV::X26){
----------------
Posh -> Push


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:1372
+
+    uint64_t PoshPopRegs = CSI.size() - NonePushCSI.size();
+    if (MaxReg == RISCV::X26){
----------------
craig.topper wrote:
> Posh -> Push
`unsigned` should be sufficient here right?


================
Comment at: llvm/lib/Target/RISCV/RISCVMachineFunctionInfo.h:74
 
+  /// Size of stack frame for zcmp PUSH/POP
+  unsigned RVPushStackSize = 0;
----------------
zcmp -> Zcmp


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134599



More information about the llvm-commits mailing list