[Diffusion] rL361590: Clarify how musttail can be used to create forwarding thunks

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 24 11:25:57 PDT 2019


efriedma added subscribers: llvm-commits, efriedma.
efriedma added inline comments.

/llvm/trunk/docs/LangRef.rst:10018 This could probably be clarified.

Both "tail" and "musttail" imply that the callee doesn't access any va_list generated by a va_start call in the caller.  This is analogous to the restriction on accessing allocas, applied to the memory implicitly allocated in the stack frame.

Beyond that, for "tail", the expected behavior for varargs is obvious: each call accesses its own argument list.

It's not clear what we expect to happen for musttail calls which are varargs, but not in a function marked "thunk".  Is it legal to pass any varargs arguments?  (I guess no, because we couldn't lower it in general.)  If not, what happens if the callee calls va_start?  Does it get variadic arguments from the caller's caller?
/llvm/trunk/docs/LangRef.rst:10032 Is the "bitcasting" rule still relevant, given we now explicitly state that "thunk" functions have special rules?
/llvm/trunk/docs/LangRef.rst:10013 Maybe worth explicitly stating that this includes registers which would not normally be used to pass arguments as part of a varargs argument list?

Maybe it's also worth adding a restriction that "thunk" functions aren't allowed to call va_start, so it's clear that the functions aren't true varargs?

Users:
  rnk (Author)

https://reviews.llvm.org/rL361590





More information about the llvm-commits mailing list