From b96c434c39312a059e6a062b29993ec7d0a7da57 Mon Sep 17 00:00:00 2001 From: Marek Michalkiewicz Date: Thu, 28 Feb 2002 16:23:54 +0100 Subject: [PATCH] avr.c (avr_hard_regno_mode_ok): Do not allow r29 which may overwrite the high byte of the frame pointer. * config/avr/avr.c (avr_hard_regno_mode_ok): Do not allow r29 which may overwrite the high byte of the frame pointer. From-SVN: r50138 --- gcc/ChangeLog | 5 +++++ gcc/config/avr/avr.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 64f1d8858a3..8e896c5bc0c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-02-28 Marek Michalkiewicz + + * config/avr/avr.c (avr_hard_regno_mode_ok): Do not allow r29 + which may overwrite the high byte of the frame pointer. + 2002-02-28 Bo Thorsen * config/i386/linux64.h (LINK_SPEC): Fix 32/64 bit compilation. diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 145751993a8..8e64bcb74aa 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -5210,6 +5210,13 @@ avr_hard_regno_mode_ok (regno, mode) int regno; enum machine_mode mode; { + /* Bug workaround: recog.c (peep2_find_free_register) and probably + a few other places assume that the frame pointer is a single hard + register, so r29 may be allocated and overwrite the high byte of + the frame pointer. Do not allow any value to start in r29. */ + if (regno == REG_Y + 1) + return 0; + if (mode == QImode) return 1; /* if (regno < 24 && !AVR_ENHANCED)