> I commented out this block at line 1312:
> 
> #    if ($StolenX86Regs <= 3 ) { # spurious uses of edi?
> #       s/^\tmovl\s+(.*),\s*\%edi\n\tjmp\s+\*%edi\n/\tmovl 
> $1,\%eax\n\tjmp
> \*\%e
> ax\n/g;
> #       s/^\tjmp\s+\*(-?\d*\(.*\%edi.*\))\n/\tmovl $1,\%eax\n\tjmp
> \*\%eax\n/g;
> #       s/^\tjmp\s+\*\%edi\n/\tmovl \%edi,\%eax\n\tjmp \*\%eax\n/g;
> #       die "$Pgm: (mangler) still have jump involving \%edi!\n$_"
> #           if /(jmp|call)\s+.*\%edi/;
> #    }
> 
> and tried again:
> 
>    ARGH! Jump uses %edi with -monly-3-regs:
>    etc
> 
> then commented out this block at 1365:
> 
>     } #elsif ($StolenX86Regs == 3 ) {
> #       die "ARGH! Jump uses \%edi with -monly-3-regs:\n$_"
> #           if /^\t(jmp|call)\s+.*\%edi/;
> #    }
> 
> and it compiled fine.  I tested (very thoroughly!) it with
> nofib/imaginary/paraffins/Main.hs which imports Array, and it got the
> right answer.

Ah no, I've changed my mind.  This is problematic.  You probably weren't hitting the 
right bit of code in your tests to show up the problem.

In -monly-3-regs,  the mangler must insert code to re-load the contents of %edi before 
doing a jump, and if the jump involves %edi itself then it tries to rearrange things 
so that it doesn't.  However in this case it couldn't find a way to rearrange the code.

The solution is going to be to have a fall-through case, to transform a jump involving 
%edi into

        movl %edi, %eax
        jmp  ... %eax ...

as long as the jump doesn't also involve %eax.

Gruesome, but it should work.

Cheers,
        Simon
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to