From: simonmar Date: Fri, 30 Jul 1999 14:20:22 +0000 (+0000) Subject: [project @ 1999-07-30 14:20:22 by simonmar] X-Git-Tag: Approximately_9120_patches~5926 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=28afcb2772c191aa7a9450df12ec38865b5913cb [project @ 1999-07-30 14:20:22 by simonmar] Fix -monly-3-regs problem. --- diff --git a/ghc/driver/ghc-asm.lprl b/ghc/driver/ghc-asm.lprl index 2b297ef..73554ae 100644 --- a/ghc/driver/ghc-asm.lprl +++ b/ghc/driver/ghc-asm.lprl @@ -147,7 +147,7 @@ sub init_TARGET_STUFF { $T_X86_PRE_LLBL = '.L'; $T_X86_BADJMP = '^\tjmp [^\.\*]'; - $T_MOVE_DIRVS = '^(\s*(\.(p2)?align\s+\d+(,0x90)?|\.globl\s+\S+|\.text|\.data|\.section\s+.*|\.type\s+.*|\.Lfe.*\n\t\.size\s+.*|\.size\s+.*|\.ident.*)\n)'; + $T_MOVE_DIRVS = '^(\s*(\.(p2)?align\s+\d+(,0x90)?|\.globl\s+\S+|\.text|\.data|\.section\s+.*|\.size\s+.*|\.type\s+.*|\.Lfe.*\n\t\.size\s+.*|\.ident.*)\n)'; $T_COPY_DIRVS = '\.(globl)'; if ( $TargetPlatform =~ /freebsd3/ ) { @@ -684,7 +684,7 @@ sub mangle_asm { } die "Prologue junk?: $p\n" if $p =~ /^\t[^\.]/ - && $TargetPlatform !~ /^powerpc-/; #ToDo: remove test + && $TargetPlatform !~ /^(powerpc-|i386-)/; #ToDo: remove test # glue together what's left $c = $p . $r; @@ -704,6 +704,7 @@ sub mangle_asm { $e =~ s/^\tret\n//; $e =~ s/^\tpopl \%edi\n//; $e =~ s/^\tpopl \%esi\n//; + $e =~ s/^\tpopl \%ebx\n//; $e =~ s/^\tpopl \%ecx\n//; $e =~ s/^\taddl \$\d+,\%esp\n//; } elsif ($TargetPlatform =~ /^m68k-/) { @@ -744,7 +745,7 @@ sub mangle_asm { # On Alphas, the prologue mangling is done a little later (below) # toss all calls to __DISCARD__ - $c =~ s/^\t(call|jbsr|jal)\s+$TUS[@]?__DISCARD__\n//go; + $c =~ s/^\t(call|jbsr|jal)\s+$TUS[@]?__DISCARD__(\@PLT)?\n//go; # MIPS: that may leave some gratuitous asm macros around # (no harm done; but we get rid of them to be tidier) @@ -970,7 +971,9 @@ sub mangle_asm { $chk[$infochk{$symb}] =~ s/\.long ([A-Za-z]\S+_upd)/\.long \.\1/; print OUTASM $chk[$infochk{$symb}]; } else { - print OUTASM &rev_tbl($symb, $chk[$infochk{$symb}], 1); +# for shared libs --SDM + print OUTASM $chk[$infochk{$symb}]; +# print OUTASM &rev_tbl($symb, $chk[$infochk{$symb}], 1); } # entry code will be put here! @@ -1009,6 +1012,10 @@ sub mangle_asm { # The next two only apply if we're not stealing %esi or %edi. $c =~ s/^\tmovl \$${T_US}${symb}_fast\d*,\%esi\n\tjmp \*\%esi\n// if ($StolenX86Regs < 3); $c =~ s/^\tmovl \$${T_US}${symb}_fast\d*,\%edi\n\tjmp \*\%edi\n// if ($StolenX86Regs < 4); + # for PIC code + $c =~ s/^\tleal ${T_US}${symb}_fast\d*\@GOTOFF\(\%ebx\),\%eax\n\tjmp \*\%eax\n//; + $c =~ s/^\tjmp \*${T_US}${symb}_fast\d*\@GOT\(\%ebx\)\n//; + $c =~ s/^\.LPR\d+\:\n\tmovl \(\%esp\),\%ebx\n\tret\n//; } elsif ( $TargetPlatform =~ /^mips-/ ) { $c =~ s/^\tjmp \$31,\(\$27\),0\n\t\.align 4\n\t\.end/\t.align 4\n\t.end/; } elsif ( $TargetPlatform =~ /^m68k-/ ) { @@ -1081,7 +1088,9 @@ sub mangle_asm { print OUTASM ".${symb}_vtbl:\n"; print OUTASM $chk[$vectorchk{$symb}]; } else { - print OUTASM &rev_tbl($symb, $chk[$vectorchk{$symb}], 0); +# for shared libs --SDM print OUTASM $chk[$vectorchk{$symb}]; + print OUTASM $chk[$vectorchk{$symb}]; +# print OUTASM &rev_tbl($symb, $chk[$vectorchk{$symb}], 0); } # direct return code will be put here! $chkcat[$vectorchk{$symb}] = 'DONE ALREADY'; @@ -1217,7 +1226,7 @@ sub print_doctored { } if ($StolenX86Regs <= 3 ) { # spurious uses of edi? s/^\tmovl (.*),\%edi\n\tjmp \*%edi\n/\tmovl $1,\%eax\n\tjmp \*\%eax\n/g; - s/^\tjmp \*(-?\d*)\((.*\%edi.*)\)\n/\tmovl $2,\%eax\n\tjmp \*$1\(\%eax\)\n/g; + s/^\tjmp \*(-?\d*\(.*\%edi.*\))\n/\tmovl $1,\%eax\n\tjmp \*\%eax\n/g; s/^\tjmp \*\%edi\n/\tmovl \%edi,\%eax\n\tjmp \*\%eax\n/g; die "$Pgm: (mangler) still have jump involving \%edi!\n$_" if /(jmp|call) .*\%edi/;