[PATCH] D91719: [RISCV] Add support for using -msave-restore with tailcalls

Edward Jones via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 08:34:43 PST 2020


edward-jones created this revision.
Herald added subscribers: llvm-commits, frasercrmck, NickHung, evandro, luismarques, apazos, sameer.abuasal, pzheng, simoncook, s.egerton, lenary, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, johnrusso, rbar, asb, hiraditya.
Herald added a project: LLVM.
edward-jones requested review of this revision.
Herald added a subscriber: MaskRay.

This introduces the use of a new compiler runtime library function which behaves the same as __riscv_restore_N, however instead of returning to the callee these functions do a tailcall to the function whose pointer is stored in t1. This allows the -msave-restore optimization to be applied even in a tailcall context. The new runtime library functions are called __riscv_restore_tailcall_X where X is the number of callee-saved registers which will be restored.

Original patch by Simon Cook.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91719

Files:
  llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
  llvm/lib/Target/RISCV/RISCVMachineFunctionInfo.h
  llvm/test/CodeGen/RISCV/saverestore.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91719.306127.patch
Type: text/x-patch
Size: 7358 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201118/c5520d36/attachment.bin>


More information about the llvm-commits mailing list