IBM zSystems: Make stack_tie to work with hard frame pointer
authorAndreas Krebbel <krebbel@linux.ibm.com>
Wed, 1 Feb 2023 07:59:42 +0000 (08:59 +0100)
committerAndreas Krebbel <krebbel@linux.ibm.com>
Wed, 1 Feb 2023 07:59:42 +0000 (08:59 +0100)
commit36ffb2e0293d1bbef30e3553a431679de00549b9
tree3cffb24ac71493f13e4d2844d676a9a5d474d6b6
parentef5f7b89bbc352255595069eb870d6f30f1f9134
IBM zSystems: Make stack_tie to work with hard frame pointer

With this patch a scheduling barrier is created to prevent the insn
setting up the frame-pointer and instructions which save GPRs to the
stack to be swapped.  Otherwise broken CFI information would be
generated since the stack save insns would use a base register which
is not currently declared as holding the CFA.

Without -mpreserve-args this did not happen because the store multiple
we used for saving the GPRs would also cover the frame-pointer
register and therefore creates a dependency on the frame-pointer
hardreg. However, with this patch the stack_tie is emitted regardless
of -mpreserve-args since this in general appears to be the safer
approach.

* config/s390/s390.cc (save_gprs): Use gen_frame_mem.
(restore_gprs): Likewise.
(s390_emit_stack_tie): Make the stack_tie to be dependent on the
frame pointer if a frame-pointer is used.
(s390_emit_prologue): Emit stack_tie when frame-pointer is needed.
* config/s390/s390.md (stack_tie): Add a register operand and
rename to ...
(@stack_tie<mode>): ... this.
gcc/config/s390/s390.cc
gcc/config/s390/s390.md