This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Frame pointer using more than one register


Hello,

I've just read a bug report for the AVR port - the problem is
that the frame pointer consists of two 8-bit registers (r29:r28)
and some parts of GCC are not prepared for it.  One of such
places was fixed long time ago:

Sat May 19 09:40:45 2001  Denis Chertykov  <denisc@overta.ru>

        * regrename.c (regrename_optimize): frame pointer register can
        use a few hardregs.

But I've just found another one - recog.c (peep2_find_free_register):

      /* And we don't clobber traceback for noreturn functions.  */
      if ((regno == FRAME_POINTER_REGNUM || regno == HARD_FRAME_POINTER_REGNUM)
          && (! reload_completed || frame_pointer_needed))
        continue;

This means GCC avoids r28, but happily allocates r29 for a QImode
peephole2 scratch register, which is wrong if the frame pointer
is used.  I think this code should check if regno is within a range
of register numbers: FRAME_POINTER_REGNUM to (FRAME_POINTER_REGNUM
 + number_of_hard_registers_used_by_frame_pointer - 1) inclusive.

My question is - are there any other places like this, where GCC
assumes (which is correct for most other targets, but wrong for AVR)
that the frame pointer is a single hard register?  If yes, it may be
safer to change avr_hard_regno_mode_ok() to disallow QImode in r29
for now, to avoid similar bugs in the future...

Thanks,
Marek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]