[PATCH] D102611: ARM: support mandatory tail calls

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 17 04:31:56 PDT 2021


t.p.northover created this revision.
t.p.northover added reviewers: jroelofs, paquette.
Herald added subscribers: hiraditya, kristof.beyls, mcrosier, qcolombet, MatzeB.
t.p.northover requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is obviously mostly for `swifttailcc`, but it's trivial to being `tailcc` and `fastcc` along for the ride so I did those too.

The code is pretty closely modelled on how AArch64 handles this because most RISC backends will need approximately the same behaviour, so there are a few main components:

- Track how much stack space the callee is expected to restore on return (and do it).
- In the tail call case arguments might not simply be stored to `sp + N`, but to an object at a fixed offset from the stack on function entry. We use a fixed frame-index for this, which naturally reserves the space so callee-saved registers won't be placed there.
- The tail call itself needs to track how much stack space it actually needs (because different tail calls vary this).


https://reviews.llvm.org/D102611

Files:
  llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
  llvm/lib/Target/ARM/ARMCallingConv.td
  llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
  llvm/lib/Target/ARM/ARMFastISel.cpp
  llvm/lib/Target/ARM/ARMFrameLowering.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMISelLowering.h
  llvm/lib/Target/ARM/ARMInstrInfo.td
  llvm/lib/Target/ARM/ARMMachineFunctionInfo.h
  llvm/lib/Target/ARM/ARMSubtarget.cpp
  llvm/test/CodeGen/ARM/dbg-tcreturn.ll
  llvm/test/CodeGen/ARM/fastcc-tailcall.ll
  llvm/test/CodeGen/ARM/peephole-callee-save-regalloc.mir
  llvm/test/CodeGen/ARM/swifttailcc-call.ll
  llvm/test/CodeGen/ARM/swifttailcc-fastisel.ll
  llvm/test/CodeGen/ARM/tailcc-call.ll
  llvm/test/CodeGen/ARM/v8m-tail-call.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102611.345828.patch
Type: text/x-patch
Size: 51214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210517/2ca96d8f/attachment.bin>


More information about the llvm-commits mailing list