diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-06 21:38:27 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-06 21:38:27 +0000 |
commit | 22d5a519361cdbb37368ca13a10311bc8e86050c (patch) | |
tree | 31db34d335f3bdadd76045327720c59693b2856a /gcc/config/i386 | |
parent | 275f094b185194ce00edc86f084b27fc6be2cc61 (diff) | |
download | gcc-22d5a519361cdbb37368ca13a10311bc8e86050c.tar.gz |
PR target/59644
* config/i386/i386.h (struct machine_function): Add
no_drap_save_restore field.
* config/i386/i386.c (ix86_save_reg): Use
!cfun->machine->no_drap_save_restore instead of
crtl->stack_realign_needed.
(ix86_finalize_stack_realign_flags): Don't clear drap_reg unless
this function clears frame_pointer_needed. Set
cfun->machine->no_drap_save_restore if clearing frame_pointer_needed
and DRAP reg is needed.
* gcc.target/i386/pr59644.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206375 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/i386')
-rw-r--r-- | gcc/config/i386/i386.c | 16 | ||||
-rw-r--r-- | gcc/config/i386/i386.h | 3 |
2 files changed, 6 insertions, 13 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 39891c96402..32b6418320f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -9281,7 +9281,7 @@ ix86_save_reg (unsigned int regno, bool maybe_eh_return) if (crtl->drap_reg && regno == REGNO (crtl->drap_reg) - && crtl->stack_realign_needed) + && !cfun->machine->no_drap_save_restore) return true; return (df_regs_ever_live_p (regno) @@ -10519,18 +10519,6 @@ ix86_finalize_stack_realign_flags (void) return; } - /* If drap has been set, but it actually isn't live at the start - of the function and !stack_realign, there is no reason to set it up. */ - if (crtl->drap_reg && !stack_realign) - { - basic_block bb = ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb; - if (! REGNO_REG_SET_P (DF_LR_IN (bb), REGNO (crtl->drap_reg))) - { - crtl->drap_reg = NULL_RTX; - crtl->need_drap = false; - } - } - /* If the only reason for frame_pointer_needed is that we conservatively assumed stack realignment might be needed, but in the end nothing that needed the stack alignment had been spilled, clear frame_pointer_needed @@ -10584,6 +10572,8 @@ ix86_finalize_stack_realign_flags (void) crtl->need_drap = false; } } + else + cfun->machine->no_drap_save_restore = true; frame_pointer_needed = false; stack_realign = false; diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index cdaab3684e1..ab7489a0c1b 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2419,6 +2419,9 @@ struct GTY(()) machine_function { stack below the return address. */ BOOL_BITFIELD static_chain_on_stack : 1; + /* If true, it is safe to not save/restore DRAP register. */ + BOOL_BITFIELD no_drap_save_restore : 1; + /* During prologue/epilogue generation, the current frame state. Otherwise, the frame state at the end of the prologue. */ struct machine_frame_state fs; |