]> git.ipfire.org Git - thirdparty/gcc.git/commit
[LRA]: Check and update frame to stack pointer elimination after stack slot allocation
authorVladimir N. Makarov <vmakarov@redhat.com>
Wed, 19 Jul 2023 13:35:37 +0000 (09:35 -0400)
committerVladimir N. Makarov <vmakarov@redhat.com>
Wed, 19 Jul 2023 17:53:29 +0000 (13:53 -0400)
commit2971ff7b1d564ac04b537d907c70e6093af70832
treec5dcc85ed023eb4deb25eeacc2663779c484c540
parent029c7ebe7f4f9ea37d715dbc2da36687d8657c2c
[LRA]: Check and update frame to stack pointer elimination after stack slot allocation

Avr is an interesting target which does not use stack pointer to
address stack slots.  The elimination of stack pointer to frame pointer
is impossible if there are stack slots.  During LRA works, the
stack slots can be allocated and used and the elimination can be done
anymore.  The situation can be complicated even more if some pseudos
were allocated to the frame pointer.

gcc/ChangeLog:

* lra-int.h (lra_update_fp2sp_elimination): New prototype.
(lra_asm_insn_error): New prototype.
* lra-spills.cc (remove_pseudos): Add check for pseudo slot memory
existence.
(lra_spill): Call lra_update_fp2sp_elimination.
* lra-eliminations.cc: Remove trailing spaces.
(elimination_fp2sp_occured_p): New static flag.
(lra_eliminate_regs_1): Set the flag up.
(update_reg_eliminate): Modify the assert for stack to frame
pointer elimination.
(lra_update_fp2sp_elimination): New function.
(lra_eliminate): Clear flag elimination_fp2sp_occured_p.

gcc/testsuite/ChangeLog:

* gcc.target/avr/lra-elim.c: New test.
gcc/lra-eliminations.cc
gcc/lra-int.h
gcc/lra-spills.cc
gcc/testsuite/gcc.target/avr/lra-elim.c [new file with mode: 0644]