Re: CALL_EXPR_MUST_TAIL_CALL and LLVM's musttail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/13/21 12:48 PM, Avi Kivity wrote:
Perhaps you should generate one function with a huge switch instead of separate functions. Each original function translates to a case, and a tail call translates to a goto. Calling one of the functions from outside translates to using the switch to select the initial case. This should work well if only a minority of the calls are from outside.

That's how Gambit's C code has been generated for a while now.

One problem is in (Scheme) code like

(map abs list-of-numbers)

where, even if the implicit loop in map is expanded inline, each call to abs may be an intermodule call to the runtime library. With some other tricks (e.g., eta expansion https://funcall.blogspot.com/2021/04/and-tail-recursion.html) the fast path for the abs might also be inlined, in any case intermodule calls are not as infrequent as one might guess.

Brad



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux