> -----Original Message-----
> From: Denis Chertykov [mailto:cherty...@gmail.com]
> Sent: Sunday, May 10, 2015 12:55 PM
> To: Sivanupandi, Pitchumani
> Cc: Georg-Johann Lay; GCC Patches
> Subject: Re: [patch, avr] extend part-clobbered check to AVR_TINY
> architecture
> 
> Sorry for delay. (I was at vacation in Kazakhstan without internet.)
> 
> 
> 2015-05-08 8:32 GMT+03:00 Sivanupandi, Pitchumani
> <pitchumani.sivanupa...@atmel.com>:
> > Ping!
> >
> >> -----Original Message-----
> >> From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches-
> >> ow...@gcc.gnu.org] On Behalf Of Sivanupandi, Pitchumani
> >> Sent: Tuesday, April 21, 2015 8:21 PM
> >> To: Georg-Johann Lay; Denis Chertykov
> >> Cc: GCC Patches
> >> Subject: [patch, avr] extend part-clobbered check to AVR_TINY
> >> architecture
> >>
> >> Hi,
> >>
> >> When tried backporting AVR_TINY architecture support to 4.9, build
> >> failed in libgcc for AVR_TINY.
> >> Failure was due to ICE same as:
> >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53065
> >>
> >> Fix provided for that bug checks for if the mode crosses the callee
> >> saved register.
> >> Below patch updates that check as the AVR_TINY has different set of
> >> callee saved registers (r18 and r19).
> >>
> >> This patch is against trunk.
> >>
> >> NOTE: ICE is re-produciable only with 4.9 + tiny patch and
> >> --with-dwarf2 enabled.
> >>
> >> Is this ok for trunk?
> >>
> >> diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index
> >> 68d5ddc..2f441e5 100644
> >> --- a/gcc/config/avr/avr.c
> >> +++ b/gcc/config/avr/avr.c
> >> @@ -11333,9 +11333,10 @@ avr_hard_regno_call_part_clobbered
> (unsigned
> >> regno, machine_mode mode)
> >>      return 0;
> >>
> >>    /* Return true if any of the following boundaries is crossed:
> >> -     17/18, 27/28 and 29/30.  */
> >> +     17/18 or 19/20 (if AVR_TINY), 27/28 and 29/30.  */
> >>
> >> -  return ((regno < 18 && regno + GET_MODE_SIZE (mode) > 18)
> >> +  return ((regno <= LAST_CALLEE_SAVED_REG &&
> >> +           regno + GET_MODE_SIZE (mode) > (LAST_CALLEE_SAVED_REG +
> >> + 1))
> >>            || (regno < REG_Y && regno + GET_MODE_SIZE (mode) > REG_Y)
> >>            || (regno < REG_Z && regno + GET_MODE_SIZE (mode) >
> >> REG_Z));  }
> >>
> 
> I think it's ok.

Could you please commit? I do not have commit access.

(--patch--)
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 68d5ddc..2f441e5 
100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -11333,9 +11333,10 @@ avr_hard_regno_call_part_clobbered (unsigned regno, 
machine_mode mode)
     return 0;

   /* Return true if any of the following boundaries is crossed:
-     17/18, 27/28 and 29/30.  */
+     17/18 or 19/20 (if AVR_TINY), 27/28 and 29/30.  */

-  return ((regno < 18 && regno + GET_MODE_SIZE (mode) > 18)
+  return ((regno <= LAST_CALLEE_SAVED_REG &&
+           regno + GET_MODE_SIZE (mode) > (LAST_CALLEE_SAVED_REG + 1))
           || (regno < REG_Y && regno + GET_MODE_SIZE (mode) > REG_Y)
           || (regno < REG_Z && regno + GET_MODE_SIZE (mode) > REG_Z));  }
(--patch--)

Regards,
Pitchumani

gcc/ChangeLog
2015-05-11  Pitchumani Sivanupandi  <pitchuman...@atmel.com>

    * config/avr/avr.c (avr_hard_regno_call_part_clobbered): Use
        LAST_CALLEE_SAVED_REG instead of hard-coded register number.
        (Last callee saved reg is different for AVR_TINY architecture)

Reply via email to