This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to fix stupid_life_analysis REG_UNUSED notes
- To: egcs-patches at egcs dot cygnus dot com
- Subject: Patch to fix stupid_life_analysis REG_UNUSED notes
- From: John Wehle <john at feith dot com>
- Date: Wed, 21 Apr 1999 02:15:24 -0400 (EDT)
- Cc: law at cygnus dot com
Currently reload will turn:
(insn 109 108 112 (parallel[
(set (reg/v:DI 48)
(fix:DI (fix:DF (reg:DF 63))))
(clobber (reg:DF 63))
(clobber (mem:SI (plus:SI (reg:SI 6 %ebp)
(const_int -4 [0xfffffffc])) 0))
(clobber (mem:DI (plus:SI (reg:SI 6 %ebp)
(const_int -12 [0xfffffff4])) 0))
(clobber (scratch:SI))
] ) 148 {fix_truncsfdi2+2} (nil)
(expr_list:REG_EQUAL (fix:DI (reg/v:DF 39))
(nil)))
into:
(insn 109 353 356 (parallel[
(set (reg/v:DI 1 %edx)
(fix:DI (fix:DF (reg:DF 15 %st(7)))))
(clobber (reg:DF 15 %st(7)))
(clobber (mem:SI (plus:SI (reg:SI 6 %ebp)
(const_int -4 [0xfffffffc])) 0))
(clobber (mem:DI (plus:SI (reg:SI 6 %ebp)
(const_int -12 [0xfffffff4])) 0))
(clobber (reg:SI 0 %eax))
] ) 148 {fix_truncsfdi2+2} (nil)
(expr_list:REG_EQUAL (fix:DI (reg/v:DF 14 %st(6)))
(nil)))
(insn 356 109 112 (set (mem:DF (plus:SI (reg:SI 6 %ebp)
(const_int -88 [0xffffffa8])) 0)
(reg:DF 15 %st(7))) 69 {movdf+1} (nil)
(nil))
which causes problems when running reg-stack for the x86. This
problem only occurs when flow doesn't run since otherwise there's
a REG_UNUSED note which causes reload to avoid generating the
unnecessary output reload. The problem is stupid_life_analysis
doesn't generate a REG_UNUSED note for a register which is clobbered
if it is used in an earlier instruction. This patch has been
successfully bootstrapped and passes make check on FreeBSD 3.1
configured for aout.
ChangeLog:
Wed Apr 21 00:24:15 EDT 1999 John Wehle (john@feith.com)
* stupid.c (stupid_mark_refs): Generate a REG_UNUSED note
for a register which is clobbered even if the register
was used by an earlier instruction.
Enjoy!
-- John Wehle
------------------8<------------------------8<------------------------
*** gcc/stupid.c.ORIGINAL Wed Mar 31 22:22:33 1999
--- gcc/stupid.c Wed Apr 21 00:19:14 1999
*************** stupid_mark_refs (x, chain)
*** 682,697 ****
if (last_setjmp_suid < reg_where_dead[regno])
regs_crosses_setjmp[regno] = 1;
! /* If this register is only used in this insn and is only
! set, mark it unused. We have to do this even when not
! optimizing so that MD patterns which count on this
! behavior (e.g., it not causing an output reload on
! an insn setting CC) will operate correctly. */
if (GET_CODE (SET_DEST (x)) == REG
! && REGNO_FIRST_UID (regno) == INSN_UID (insn)
! && REGNO_LAST_UID (regno) == INSN_UID (insn)
! && (code == CLOBBER || ! reg_mentioned_p (SET_DEST (x),
! SET_SRC (x))))
REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_UNUSED,
SET_DEST (x),
REG_NOTES (insn));
--- 682,699 ----
if (last_setjmp_suid < reg_where_dead[regno])
regs_crosses_setjmp[regno] = 1;
! /* If this register is clobbered or it is only used in
! this insn and is only set, mark it unused. We have
! to do this even when not optimizing so that MD patterns
! which count on this behavior (e.g., it not causing an
! output reload on an insn setting CC) will operate
! correctly. */
if (GET_CODE (SET_DEST (x)) == REG
! && (code == CLOBBER
! || (REGNO_FIRST_UID (regno) == INSN_UID (insn)
! && REGNO_LAST_UID (regno) == INSN_UID (insn)
! && ! reg_mentioned_p (SET_DEST (x),
! SET_SRC (x)))))
REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_UNUSED,
SET_DEST (x),
REG_NOTES (insn));
-------------------------------------------------------------------------
| Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com |
| John Wehle | Fax: 1-215-540-5495 | |
-------------------------------------------------------------------------