Tail calls and portability

I have been working on adding proper tail (via become) to rustc. I was able to make them work (some parts of the type checker aren’t implemented yet). However, I ran into an LLVM-related problem.

LLVM claims to support proper tail calls when fastcc is used — but only on i386, x86-64 and PowerPC. Is this accurate? Will proper tail calls be supported on WebAssembly? Are they supported on ARM? AArch64? Other backends?

As a general “good practice", you should answer to your own thread you started this morning instead of starting a new one with little difference: http://lists.llvm.org/pipermail/llvm-dev/2017-January/108678.html

+CC WebAssembly folks to make sure they don’t miss this question.

The current version of the WebAssembly ISA doesn’t support tail calls. It is likely that support will be added in future versions.


Note that tail calls on PowerPC can run into the TOC-restoration issue
for non-PIC calls.


There is some support for tail calls for MIPS, but it is not enabled by default yet.


Hexagon uses tail calls in the right circumstances, but it ignores musttail.