[PATCH] D51206: [Sparc] Add tail call support
Daniel Cederman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 24 00:14:01 PDT 2018
dcederman created this revision.
dcederman added reviewers: jyknight, venkatra.
Herald added subscribers: llvm-commits, jrtc27, fedor.sergeev.
This patch adds tail call support to the 32-bit Sparc backend.
Two new instructions are defined, TAIL_CALL and TAIL_CALLrr. They are encoded the same as CALL and BINDrr, but are marked with isReturn so that the epilogue gets emitted. In contrast to CALL, TAIL_CALL is not marked with isCall. This makes it possible to use the leaf function optimization when the only call a function makes is a tail call.
TAIL_CALL modifies the return address in %o7, so for leaf functions the value in %o7 needs to be restored after the call. For normal functions which uses the restore instruction this is not necessary.
Repository:
rL LLVM
https://reviews.llvm.org/D51206
Files:
lib/Target/Sparc/DelaySlotFiller.cpp
lib/Target/Sparc/SparcCallingConv.td
lib/Target/Sparc/SparcFrameLowering.cpp
lib/Target/Sparc/SparcISelLowering.cpp
lib/Target/Sparc/SparcISelLowering.h
lib/Target/Sparc/SparcInstrInfo.td
test/CodeGen/SPARC/2011-01-11-Call.ll
test/CodeGen/SPARC/2011-01-19-DelaySlot.ll
test/CodeGen/SPARC/tailcall.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51206.162326.patch
Type: text/x-patch
Size: 16509 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180824/aac77246/attachment.bin>
More information about the llvm-commits
mailing list