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]

Re: trouble with porting architecture


> The architecture in question is the m6809, running in a Tandy Color
> Computer.  It works for most source, but I've come across a piece of
> source which generates the following error:
>
> ../contiki/ctk/ctk-conio.c: In function `ctk_draw_menus':
> ../contiki/ctk/ctk-conio.c:510: unable to generate reloads for:
>
> (insn 99 98 100 (set (reg:QI 0 d [32])
>          (minus:QI (reg:QI 33)
>              (reg:QI 0 d [34]))) 31 {subqi3} (nil)
>      (expr_list:REG_DEAD (reg:QI 33)
>          (expr_list:REG_DEAD (reg:QI 0 d [34])
>              (nil))))
> ../contiki/ctk/ctk-conio.c:510: Internal compiler error in
> find_reloads, at reload.c:3576
>
> Would this indicate a problem in the machine description?  Or something
> else?  The code is really rather straightforward, and doesn't generate
> any warnings.  The function in question returns nothing, and has a
> single local variable.

I think it is a consequence of the extremely low number of 8-bit registers
on the MC6809, which makes it difficult for GCC's register allocation
strategy (namely, the reload pass) to work reliably on this architecture.
I myself ran into the problem several times.

This insn shouldn't be problematic since the only transformation required to
match the constraints of the SUBA instruction is to spill (reg:QI 33) to
memory.  However the 16-bit D register, which is (partially) live before and
after the insn, consumes all 8-bit registers so this may trigger a
limitation of the reload pass.

> See function below:
>
> void
> ctk_draw_menus(struct ctk_menus *menus)
> {
>    struct ctk_menu *m;
>
>    /* Draw menus */
>    textcolor(MENUCOLOR);
>    gotoxy(0, 0);
>    revers(1);
>    cputc(' ');
>    for(m = menus->menus->next; m != NULL; m = m->next) {
>      if(m != menus->open) {
>        cputs(m->title);
>        cputc(' ');
>      } else {
>        draw_menu(m);
>      }
>    }
>
>
>    if(wherex() + strlen(menus->desktopmenu->title) + 1>= sizex) {
>      gotoxy(sizex - strlen(menus->desktopmenu->title) - 1, 0);
>    } else {
>      cclear(sizex - wherex() -
>    strlen(menus->desktopmenu->title) - 1);
>    }
>
>    /* Draw desktopmenu */
>    if(menus->desktopmenu != menus->open) {
>      cputs(menus->desktopmenu->title);
>      cputc(' ');
>    } else {
>      draw_menu(menus->desktopmenu);
>    }
>
>    revers(0);
> }

This is obviously not sufficient to reproduce the problem.  You need to
provide a preprocessed testcase, the GCC version, the options passed to the
compiler and so on (see http://gcc.gnu.org/bugs.html).  I'll try to further
help you, but not before the next week.

--
Eric Botcazou



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