On 4/12/19 9:32 AM, Alexander Monakov wrote: > On Fri, 12 Apr 2019, Jeff Law wrote: >> We've been through the "who owns the argument slots, caller or callee" >> discussion a few times and I don't think we've ever reached any kind of >> conclusion in the general case. > > Callee must own the slots for tail calls to be possible. > >> I think this case side-steps the general case. >> >> We've got an argument slot for a const/pure call. Because of the >> const/pure designation the caller can assume the callee doesn't modify >> the argument slot. That may in turn allow the caller to place a >> REG_EQUIV note on the store to the slot. > > I don't think this follows. Imagine a pure foo tailcalling a pure bar. > To make the tailcall, foo may need to change some of its argument slots > to pass new arguments to bar. I'd claim that a pure/const call can't tail call another function as that would potentially modify the argument slots.
jeff