https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82221

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Josh Poimboeuf from comment #7)
> Putting "sp" in the clobbers list is something that was suggested to me on
> the GCC mailing list a while back.  And, other than this rare bug, it seems
> to do exactly what we want, which is, force GCC to save the frame pointer
> before inserting the inline asm.  We need that to happen when we put a
> "call" instruction inside the inline asm, so that we can get a reliable
> stack trace from the called function.
> 
> I know that putting "sp" in the clobbers list is an undocumented "feature",
> so maybe it is user error.  However it would be nice to have something like
> this as a real feature.  Either with "sp", or maybe a new clobbers keyword
> like "frame". 
> 
> Would that be feasible?

Yes, if we can somehow update

static rtx
ix86_get_drap_rtx (void)
{
  /* We must use DRAP if there are outgoing arguments on stack and
     ACCUMULATE_OUTGOING_ARGS is false.  */
  if (ix86_force_drap
      || (cfun->machine->outgoing_args_on_stack
          && !ACCUMULATE_OUTGOING_ARGS))
    crtl->need_drap = true; 

to set need_drap when stack register is clobbered by asm statement.

Reply via email to