[PATCH] Fix fastcc/tailcallopt for ARM64

Jiangning Liu liujiangning1 at gmail.com
Tue May 6 20:34:43 PDT 2014


Hi t.p.northover,

ARM64 only supports sibling call, and it doesn't really support aggressive tail call optimization as AArch64 is able to do right now. This patch is to support aggressive tail call optimization for ARM64. There is a tracker at http://llvm.org/bugs/show_bug.cgi?id=19426 describing the issue, and this is blocking the merge from AArch64 to ARM64.

Originally ARM64 is using IsTailCall to represent sibling call. With this patch, IsTailCall is changed to be the original tail call eligibility meaning, and IsSibCall is added to describe the real sibling call.

Both sibling call and tail call optimizations use branch instruction to replace the call, and remove the return instruction after calling the callee, but the difference is sibling call doesn't break traditional ABI, i.e. not pop argument stack, while tail call does.

IsTailCall, TailCallOpt and IsSibCall have the following relationships,

* IsTailCall and TailCallOpt are orthogonal.
1) IsTailCall means a callee isEligibleForTailCallOptimization().
2) TailCallOpt means command line option switch Options.GuaranteedTailCallOpt only.
* IsSibCall = (!TailCallOpt && IsTailCall)

For Darwin, I'm not sure if we still need to guarantee 16-byte alignment, so the tests don't really cover arm64-darwin yet. 

Thanks,
-Jiangning

http://reviews.llvm.org/D3633

Files:
  lib/Target/ARM64/ARM64FrameLowering.cpp
  lib/Target/ARM64/ARM64ISelLowering.cpp
  lib/Target/ARM64/ARM64ISelLowering.h
  lib/Target/ARM64/ARM64InstrInfo.td
  lib/Target/ARM64/ARM64MachineFunctionInfo.h
  test/CodeGen/AArch64/fastcc-reserved.ll
  test/CodeGen/AArch64/fastcc.ll
  test/CodeGen/AArch64/tail-call.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3633.9138.patch
Type: text/x-patch
Size: 41001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140507/e00676ee/attachment.bin>


More information about the llvm-commits mailing list