[PATCH] D62686: [RISCV] Add support for save/restore of callee-saved registers via libcalls

Lewis Revill via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 15 02:33:58 PST 2019


lewis-revill added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:278
   // Add CFI directives for callee-saved registers.
-  const std::vector<CalleeSavedInfo> &CSI = MFI.getCalleeSavedInfo();
-  // Iterate over list of callee-saved registers and emit .cfi_restore
-  // directives.
-  for (const auto &Entry : CSI) {
-    Register Reg = Entry.getReg();
-    unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createRestore(
-        nullptr, RI->getDwarfRegNum(Reg, true)));
-    BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
-        .addCFIIndex(CFIIndex);
+  if (!CSI.empty()) {
+    // Iterate over list of callee-saved registers and emit .cfi_restore
----------------
pzheng wrote:
> lewis-revill wrote:
> > lenary wrote:
> > > Nit: You shouldn't need this `if` statement - the for loop just won't execute if CSI is empty, surely.
> > Good catch, thanks!
> Any chance this comment from @lenary is missed?
It appears this CFI code was removed since I last rebased.
But yes, just for posterity I did miss this comment!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62686





More information about the cfe-commits mailing list