This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch: rs6000: fix setting LR with invalid base register
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: 13 Dec 2001 14:07:50 -0800
- Subject: patch: rs6000: fix setting LR with invalid base register
hi guys!
the splitter below is creating:
(mem (plus XXX constant))
however, the patterns that generate the scratch XXX (eh_set_lr_*) are
returning r0 which is an invalid base register. this causes an invalid
memory reference to be generated.
i stumbled into this while debugging some other problem and compiling
unwind-dw2.c with -O0.
(define_split
[(unspec_volatile [(match_operand 0 "register_operand" "")] 9)
(clobber (match_scratch 1 ""))]
"reload_completed"
[(const_int 0)]
"
{
rs6000_stack_t *info = rs6000_stack_info ();
-snip-
if (frame_pointer_needed
|| current_function_calls_alloca
|| info->total_size > 32767)
{
emit_move_insn (operands[1], gen_rtx_MEM (Pmode, frame_rtx));
frame_rtx = operands[1];
}
-snip-
tmp = plus_constant (frame_rtx, info->lr_save_offset + sp_offset);
tmp = gen_rtx_MEM (Pmode, tmp);
testing on ppc linux. ok to install provided no regressions?
--
Aldy Hernandez E-mail: aldyh@redhat.com
Professional Gypsy
Red Hat, Inc.
2001-12-13 Aldy Hernandez <aldyh@redhat.com>
* rs6000.md (eh_set_lr_di): Change scratch constraint to base
register.
(eh_set_lr_si): Same.
Index: config/rs6000/rs6000.md
===================================================================
RCS file: /cvs/uberbaum/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.146
diff -c -p -r1.146 rs6000.md
*** rs6000.md 2001/12/10 22:46:15 1.146
--- rs6000.md 2001/12/13 21:50:57
***************
*** 13824,13836 ****
; We can't expand this before we know where the link register is stored.
(define_insn "eh_set_lr_si"
[(unspec_volatile [(match_operand:SI 0 "register_operand" "r")] 9)
! (clobber (match_scratch:SI 1 "=&r"))]
"TARGET_32BIT"
"#")
(define_insn "eh_set_lr_di"
[(unspec_volatile [(match_operand:DI 0 "register_operand" "r")] 9)
! (clobber (match_scratch:DI 1 "=&r"))]
"TARGET_64BIT"
"#")
--- 13824,13836 ----
; We can't expand this before we know where the link register is stored.
(define_insn "eh_set_lr_si"
[(unspec_volatile [(match_operand:SI 0 "register_operand" "r")] 9)
! (clobber (match_scratch:SI 1 "=&b"))]
"TARGET_32BIT"
"#")
(define_insn "eh_set_lr_di"
[(unspec_volatile [(match_operand:DI 0 "register_operand" "r")] 9)
! (clobber (match_scratch:DI 1 "=&b"))]
"TARGET_64BIT"
"#")