This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Xtensa: change rtl pattern to indicate a side effect
- From: Bob Wilson <bwilson at tensilica dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 11 Feb 2003 13:49:51 -0800
- Subject: Xtensa: change rtl pattern to indicate a side effect
- Organization: Tensilica, Inc.
This patch fixes a bug for Xtensa targets where register renaming missed a
place where a value in register a7 was killed. The problem (yet again) is
related to the wierd way that gcc has to handle the conflict between an
incoming argument in register a7 and the frame pointer allocated to a7. The
machine description includes a "set_frame_ptr" pattern containing an
unspec_volatile operation to indicate where the frame pointer is assigned.
Previously this operation did not set a7, so various optimizations, including
register renaming, might not have been aware that a7 was potentially killed
at that point.
Tested with the xtensa-elf target and committed on mainline and also
backported to the 3.2 and 3.3 branches.
2003-02-11 Bob Wilson <bob.wilson@acm.org>
* config/xtensa/xtensa.md (set_frame_ptr): Change rtl to set reg a7.
* config/xtensa/xtensa.c (xtensa_reorg): Search for UNSPECV_SET_FP
as a SET pattern.
Index: xtensa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/xtensa/xtensa.c,v
retrieving revision 1.26
diff -c -3 -r1.26 xtensa.c
*** xtensa.c 3 Feb 2003 20:23:24 -0000 1.26
--- xtensa.c 10 Feb 2003 22:37:35 -0000
***************
*** 2241,2248 ****
continue;
pat = PATTERN (insn);
! if (GET_CODE (pat) == UNSPEC_VOLATILE
! && (XINT (pat, 1) == UNSPECV_SET_FP))
{
set_frame_ptr_insn = insn;
break;
--- 2241,2249 ----
continue;
pat = PATTERN (insn);
! if (GET_CODE (pat) == SET
! && GET_CODE (SET_SRC (pat)) == UNSPEC_VOLATILE
! && (XINT (SET_SRC (pat), 1) == UNSPECV_SET_FP))
{
set_frame_ptr_insn = insn;
break;
Index: xtensa.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/xtensa/xtensa.md,v
retrieving revision 1.7
diff -c -3 -r1.7 xtensa.md
*** xtensa.md 22 Nov 2002 00:23:31 -0000 1.7
--- xtensa.md 10 Feb 2003 22:37:35 -0000
***************
*** 2387,2393 ****
;; to set up the frame pointer.
(define_insn "set_frame_ptr"
! [(unspec_volatile [(const_int 0)] UNSPECV_SET_FP)]
""
"*
{
--- 2387,2393 ----
;; to set up the frame pointer.
(define_insn "set_frame_ptr"
! [(set (reg:SI A7_REG) (unspec_volatile [(const_int 0)] UNSPECV_SET_FP))]
""
"*
{
***************
*** 2401,2407 ****
;; Post-reload splitter to remove fp assignment when it's not needed.
(define_split
! [(unspec_volatile [(const_int 0)] UNSPECV_SET_FP)]
"reload_completed && !frame_pointer_needed"
[(unspec [(const_int 0)] UNSPEC_NOP)]
"")
--- 2401,2407 ----
;; Post-reload splitter to remove fp assignment when it's not needed.
(define_split
! [(set (reg:SI A7_REG) (unspec_volatile [(const_int 0)] UNSPECV_SET_FP))]
"reload_completed && !frame_pointer_needed"
[(unspec [(const_int 0)] UNSPEC_NOP)]
"")