summaryrefslogtreecommitdiff
path: root/gcc/config/i386
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-24 09:00:51 -0700
commitf0baed1fb6cd6ed7c7a3dce1f555d3f72b1575a5 (patch)
treef234dacd8a985fee4c59ebfe096e98faf4f51be9 /gcc/config/i386
parent71c83e108de7b54f604eeebefbc9e97672310ca7 (diff)
downloadgcc-f0baed1fb6cd6ed7c7a3dce1f555d3f72b1575a5.tar.gz
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. (cherry picked from commit 453a20c65722719b9e2d84339f215e7ec87692dc)
Diffstat (limited to 'gcc/config/i386')
-rw-r--r--gcc/config/i386/i386.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 6e03abf6b47..839b9929f6d 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -6965,10 +6965,12 @@ ix86_update_stack_boundary (void)
static rtx
ix86_get_drap_rtx (void)
{
- /* We must use DRAP if there are outgoing arguments on stack and
+ /* We must use DRAP if there are outgoing arguments on stack or
+ the stack pointer register is clobbered by asm statment and
ACCUMULATE_OUTGOING_ARGS is false. */
if (ix86_force_drap
- || (cfun->machine->outgoing_args_on_stack
+ || ((cfun->machine->outgoing_args_on_stack
+ || crtl->sp_is_clobbered_by_asm)
&& !ACCUMULATE_OUTGOING_ARGS))
crtl->need_drap = true;