m68k bootstrap problem

Kenneth Zadeck zadeck@naturalbridge.com
Tue Jun 19 20:35:00 GMT 2007


Roman Zippel wrote:
> Hi,
>
> m68k currently doesn't bootstrap, which I think is dataflow related, the 
> whole precompiled file is at http://www.xs4all.nl/~zippel/expmed.i.gz, but 
> the small test below should be enough to demonstrate the problem 
> (although it doesn't crash):
>
> int fi1(int);
> int fi2(int);
> void *fp1(int, void *);
> void *fp2(int, int);
>
> void *f(int x, int a, int b)
> {
>         if (x) {
>                 int y = fi1(1);
>                 void *p;
>                 y += fi2(3);
>                 p = fp1(2, 0);
>                 return fp1(y, p);
>         } else {
>                 int z = fi2(2);
>                 z += fi1(z);
>                 return fp2(z, 3);
>         }
> }
>
> The function is exited here via a sibcall, one important thing is that 
> current_function_return_rtx is set to:
>
> (parallel/i:SI [
>         (expr_list:REG_DEP_TRUE (reg:SI 8 %a0 [ <result> ])
>             (const_int 0 [0x0]))
>         (expr_list:REG_DEP_TRUE (reg:SI 0 %d0 [ <result> ])
>             (const_int 0 [0x0]))
>     ])
>
> This means the return value is returned in both %d0/%a0.
>
> The problem is now that this seems to produce incorrect REG_DEAD notes for 
> %d0, they are missing at the last use before the sibcall. This now seems 
> to confuse reload in the full test case, where it calls 
> save_call_clobbered_regs(), which can't quite decide whether to save %d0 
> across a function call or not.
> setup_save_areas() doesn't create a stack slot for %d0 because it's not 
> associated with a pseudo which lives across a function call, but later in 
> save_call_clobbered_regs() %d0 is still live at a function call and it
> attempts to save the register, which fails due to the missing stack slot.
>
> AFAICT this behaviour is correct, the question is now how do I get 
> correct REG_DEAD notes? It seems to be related to the unusual return 
> expression above, but at this point I need some help to fix this.
>
> bye, Roman
>   
a particularly useful kind of debugging is available for these kinds of
problems.
if you change the 0 to a 1 at df-problems.c:49, it will turn on a
verbose trace of the process that it goes thru to decide to build
reg_dead notes.  This process includes listing all of the info for each
of the insn's uses and defs. 

The reason that there is no reg_dead not in the last use (insn 45)
before the sib_call (insn 46)  is that there is no def for r0 in the
sibcall (insn 46) and r0 is live at the end of the block.

This of course changes the question to not why there no note to why is
there no def.

Kenny


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.c.171r.lreg
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20070619/ecc12bcf/attachment.ksh>


More information about the Gcc mailing list