[RISCV] Tail calls don't need to save return address
authorSameer AbuAsal <sabuasal@codeaurora.org>
Thu, 21 Jun 2018 14:37:09 +0000 (14:37 +0000)
committerSameer AbuAsal <sabuasal@codeaurora.org>
Thu, 21 Jun 2018 14:37:09 +0000 (14:37 +0000)
commite01e711c64fb743a659552eff30252e822fe9eb8
treea7f0aaf2ada27a4869457f7cd871f0664474fd30
parent22c82af5c85e33508fee35d1785e801bc8136acc
[RISCV] Tail calls don't need to save return address

Summary:
 When expanding the PseudoTail in expandFunctionCall() we were using X6
 to save the return address. Since this is a tail call the return
 address is not needed, this patch replaces it with X0 to be ignored.

 This matches the behaviour listed in the ISA V2.2 document page 110.
 tail offset -----> jalr x0, x6, offset

 GCC exhibits the same behavior.

Reviewers: apazos, asb, mgrang

Reviewed By: asb

Subscribers: rbar, johnrusso, simoncook, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01

Differential Revision: https://reviews.llvm.org/D48343

llvm-svn: 335239
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
llvm/test/MC/RISCV/tail-call.s