@Josh Triplett What are your thoughts on adding the
alignstack attribute? I would name it something like
uses_stack and make it required if your asm code pushes to the stack.
How much overhead does it add? Because that seems inconsistent with the safe-default approach used elsewhere, such as assuming earlyclobber and assuming clobbers of flags.
Could we just default to alignstack, and (optionally) add a
nostack flag or similar?
It basically causes leaf functions to be treated as non-leaf functions.
Basically it adds 2 instructions to the functions for the
esp adjustment at the start & end.
And that's only on x86_64.
I'm ok with reversing it to
That seems reasonable to me. In particular, if you have a tiny leaf function that just contains inline assembly, you'll probably mark the whole function
#[inline] so that it can be inlined into its caller, which eliminates that same overhead.
And that seems like an excellent potential lint for future linting infrastructure that "understands" assembly: "it looks like this assembly could use