aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2024-11-28 11:42:11 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2024-11-28 11:42:11 +0100
commit37c98fdeac7ae2f9649d49e0cfa2631c84a329da (patch)
tree5a2567814ecc5d4b0a72599d54e74fcc6413e6d5 /gcc/cfgexpand.cc
parentfd62fdc5e1b3c4baf5218eedbc3c6d29861f027b (diff)
downloadgcc-37c98fdeac7ae2f9649d49e0cfa2631c84a329da.zip
gcc-37c98fdeac7ae2f9649d49e0cfa2631c84a329da.tar.gz
gcc-37c98fdeac7ae2f9649d49e0cfa2631c84a329da.tar.bz2
inline-asm, i386: Add "redzone" clobber support
The following patch adds a "redzone" clobber (recognized everywhere, even on on targets which don't do anything with it), 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-28 Jakub Jelinek <jakub@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.dg/asm-redzone-1.c: New test. * gcc.target/i386/asm-redzone-1.c: New test.
Diffstat (limited to 'gcc/cfgexpand.cc')
-rw-r--r--gcc/cfgexpand.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index 2a98475..58d68ec 100644
--- a/gcc/cfgexpand.cc
+++ b/gcc/cfgexpand.cc
@@ -3209,6 +3209,12 @@ expand_asm_stmt (gasm *stmt)
rtx x = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode));
clobber_rvec.safe_push (x);
}
+ else if (j == -5)
+ {
+ if (targetm.redzone_clobber)
+ if (rtx x = targetm.redzone_clobber ())
+ clobber_rvec.safe_push (x);
+ }
else
{
/* Otherwise we should have -1 == empty string