aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-09-14 08:52:27 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-09-16 05:26:19 -0700
commit453a20c65722719b9e2d84339f215e7ec87692dc (patch)
tree8daea27aac33fe804d008a44c3286bd5e13fcbc0 /gcc/cfgexpand.c
parentf419a0158950034ed9996ae860b0c8df03731119 (diff)
downloadgcc-453a20c65722719b9e2d84339f215e7ec87692dc.zip
gcc-453a20c65722719b9e2d84339f215e7ec87692dc.tar.gz
gcc-453a20c65722719b9e2d84339f215e7ec87692dc.tar.bz2
rtl_data: Add sp_is_clobbered_by_asm
Add sp_is_clobbered_by_asm to rtl_data to inform backends that the stack pointer is clobbered by asm statement. gcc/ PR target/97032 * cfgexpand.c (asm_clobber_reg_kind): Set sp_is_clobbered_by_asm to true if the stack pointer is clobbered by asm statement. * emit-rtl.h (rtl_data): Add sp_is_clobbered_by_asm. * config/i386/i386.c (ix86_get_drap_rtx): Set need_drap to true if the stack pointer is clobbered by asm statement. gcc/testsuite/ PR target/97032 * gcc.target/i386/pr97032.c: New test.
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index b334ea0..1eaa1da 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2868,11 +2868,15 @@ asm_clobber_reg_is_valid (int regno, int nregs, const char *regname)
as it was before, so no asm can validly clobber the stack pointer in
the usual sense. Adding the stack pointer to the clobber list has
traditionally had some undocumented and somewhat obscure side-effects. */
- if (overlaps_hard_reg_set_p (regset, Pmode, STACK_POINTER_REGNUM)
- && warning (OPT_Wdeprecated, "listing the stack pointer register"
- " %qs in a clobber list is deprecated", regname))
- inform (input_location, "the value of the stack pointer after an %<asm%>"
- " statement must be the same as it was before the statement");
+ if (overlaps_hard_reg_set_p (regset, Pmode, STACK_POINTER_REGNUM))
+ {
+ crtl->sp_is_clobbered_by_asm = true;
+ if (warning (OPT_Wdeprecated, "listing the stack pointer register"
+ " %qs in a clobber list is deprecated", regname))
+ inform (input_location, "the value of the stack pointer after"
+ " an %<asm%> statement must be the same as it was before"
+ " the statement");
+ }
return is_valid;
}