> Hi!
> 
> The following patch adds a "redzone" clobber (recognized just
> on targets which choose to recognize it, right now just x86),
> with which one can mark the rare case where inline asm pushes
> something on the stack or uses call instruction without taking
> red zone into account (i.e. addq $-128, %rsp; and addq $128, %rsp
> around that).
> 
> 2024-11-06  Jakub Jelinek  <ja...@redhat.com>
> 
> gcc/
>       * target.def (redzone_clobber): New target hook.
>       * varasm.cc (decode_reg_name_and_count): Return -5 for
>       "redzone".
>       * cfgexpand.cc (expand_asm_stmt): Handle redzone clobber.
>       * config/i386/i386.h (struct machine_function): Add
>       asm_redzone_clobber_seen member.
>       * config/i386/i386.cc (ix86_compute_frame_layout): Don't
>       use red zone if cfun->machine->asm_redzone_clobber_seen.
>       (ix86_redzone_clobber): New function.
>       (TARGET_REDZONE_CLOBBER): Redefine.
>       * doc/extend.texi (Clobbers and Scratch Registers): Document
>       the "redzone" clobber.
>       * doc/tm.texi.in: Add @hook TARGET_REDZONE_CLOBBER.
>       * doc/tm.texi: Regenerate.
> gcc/testsuite/
>       * gcc.target/i386/asm-redzone-1.c: New test.

LGTM, though if asm needs temporary memory it can ask for it explicitly.
I guess this can be practical to hide actual call in the asm statement
(which will break unwinding I guess).
Honza

Reply via email to