From f0baed1fb6cd6ed7c7a3dce1f555d3f72b1575a5 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 14 Sep 2020 08:52:27 -0700 Subject: 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) --- gcc/config/i386/i386.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/config/i386') 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; -- cgit v1.2.1