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

James Clarke via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 16 09:20:39 PST 2019


jrtc27 added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:668
+        .setMIFlag(MachineInstr::FrameSetup);
+
+    // Add registers spilled in libcall as liveins.
----------------
lewis-revill wrote:
> shiva0217 wrote:
> > GCC will generate stack adjustment and GPR callee saved CFIs for the save libcalls. Should we do the same?
> I'm not familiar with the use of the CFI offset stuff, though just to be sure, you're saying that in addition to the manually-added `.cfi_offset`s in the libcalls themselves we would want to add them in our frame too?
Yes. The CFI use is completely ignorant of any control flow. It goes to the start of the function, and walks forward, executing every `.cfi_*` directive until reaching the current point in the code. Since the libcalls (and thus their CFI directives) are not inline in the function, they are completely invisible to the CFI machinery. Thus, their side-effects must be duplicated straight after the calls to them.


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