From: Jeffrey A Law Date: Wed, 8 Jul 1998 22:05:40 +0000 (+0000) Subject: pa.h (LEGITIMIZE_RELOAD_ADDRESS): Handle addresses created by LEGITIMIZE_RELOAD_ADDRESS. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5f0c590d406cb69898203ec38a1c97cb7093804b;p=gcc.git pa.h (LEGITIMIZE_RELOAD_ADDRESS): Handle addresses created by LEGITIMIZE_RELOAD_ADDRESS. * pa.h (LEGITIMIZE_RELOAD_ADDRESS): Handle addresses created by LEGITIMIZE_RELOAD_ADDRESS. * tm.texi (LEGITIMIZE_RELOAD_ADDRESS): Note that this macro must be able to handle addresses created by previous invocations of the macro. From-SVN: r21014 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ced4434fdd4..964f026d0d9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ Wed Jul 8 21:43:14 1998 Jeffrey A Law (law@cygnus.com) + * pa.h (LEGITIMIZE_RELOAD_ADDRESS): Handle addresses created by + LEGITIMIZE_RELOAD_ADDRESS. + * tm.texi (LEGITIMIZE_RELOAD_ADDRESS): Note that this macro must be + able to handle addresses created by previous invocations of the macro. + * flow.c (find_auto_inc): Remove most recent change. Real bug was elsewhere. diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 21d817d483d..fb65b403fcb 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -1638,14 +1638,22 @@ extern struct rtx_def *hppa_builtin_saveregs (); #define LEGITIMIZE_RELOAD_ADDRESS(AD, MODE, OPNUM, TYPE, IND, WIN) \ do { \ int offset, newoffset, mask; \ + rtx new, temp = NULL_RTX; \ mask = GET_MODE_CLASS (MODE) == MODE_FLOAT ? 0x1f : 0x3fff; \ \ if (optimize \ - && GET_CODE (AD) == PLUS \ - && GET_CODE (XEXP (AD, 0)) == REG \ - && GET_CODE (XEXP (AD, 1)) == CONST_INT) \ + && GET_CODE (AD) == PLUS) \ + temp = simplify_binary_operation (PLUS, Pmode, \ + XEXP (AD, 0), XEXP (AD, 1)); \ + \ + new = temp ? temp : AD; \ + \ + if (optimize \ + && GET_CODE (new) == PLUS \ + && GET_CODE (XEXP (new, 0)) == REG \ + && GET_CODE (XEXP (new, 1)) == CONST_INT) \ { \ - offset = INTVAL (XEXP ((AD), 1)); \ + offset = INTVAL (XEXP ((new), 1)); \ \ /* Choose rounding direction. Round up if we are >= halfway. */ \ if ((offset & mask) >= ((mask + 1) / 2)) \ @@ -1656,11 +1664,8 @@ do { \ if (newoffset != 0 \ && VAL_14_BITS_P (newoffset)) \ { \ - rtx temp; \ \ - /* Unshare the sum as well. */ \ - AD = copy_rtx (AD); \ - temp = gen_rtx_PLUS (Pmode, XEXP (AD, 0), \ + temp = gen_rtx_PLUS (Pmode, XEXP (new, 0), \ GEN_INT (newoffset)); \ AD = gen_rtx_PLUS (Pmode, temp, GEN_INT (offset - newoffset));\ push_reload (XEXP (AD, 0), 0, &XEXP (AD, 0), 0, \ diff --git a/gcc/tm.texi b/gcc/tm.texi index cfff3a0e63c..32c5a75d053 100644 --- a/gcc/tm.texi +++ b/gcc/tm.texi @@ -4310,6 +4310,10 @@ to know something of how reload works in order to effectively use this, and it is quite easy to produce macros that build in too much knowledge of reload internals. +@emph{Note}: This macro must be able to reload an address created by a +previous invocation of this macro. If it fails to handle such addresses +then the compiler may generate incorrect code or abort. + @findex push_reload The macro definition should use @code{push_reload} to indicate parts that need reloading; @var{opnum}, @var{type} and @var{ind_levels} are usually